Переглянути джерело

Merge branch 'onemap' of http://114.244.114.158:8802/siwei/onemap-implementationSupervision-system-back into onemap

wanger 2 місяців тому
батько
коміт
cad1feb0cd

+ 3 - 0
onemap-common/onemap-common-core/src/main/java/com/onemap/common/core/utils/GHSSHelper.java

@@ -43,6 +43,9 @@ public class GHSSHelper {
             case ">=":
                 s = (xzz >= ghz ? "正常" : "预警");
                 break;
+            case "<":
+                s = (xzz < ghz ? "正常" : "预警");
+                break;
             case "-":
                 s = (xzz - ghz > 0 ? "增加" : (xzz - ghz == 0 ? "无变化" : "降低"));
                 break;

+ 10 - 1
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/task/CtfxSchedule.java

@@ -34,6 +34,8 @@ public class CtfxSchedule {
     //冲突分析python方法名标识
     @Value("${Fxpj.Xmydsyx.functionId}")
     private String xmydsyxFunctionId;
+    @Value("${Fxpj.jsyd.functionId}")
+    private String jsydFunctionId;
     private static final Logger log = LoggerFactory.getLogger(CtfxSchedule.class);
 
     @Async("taskExecutor")
@@ -46,8 +48,10 @@ public class CtfxSchedule {
             wrapper.orderByAsc("cjsj");
             //每次只操作一条记录
             List<TCtfxMainDTO> ress = ctfxMapper.selectList(wrapper);
+            log.info(ress.toString());
             if (ress.size() > 0) {
                 TCtfxMainDTO ctfxMainDTO = ress.get(0);
+                log.info(ctfxMainDTO.toString());
                 String id = ctfxMainDTO.getId();
                 ctfxMainDTO.setRwzt("1");
                 ctfxMainDTO.setRwkssj(new Date());
@@ -87,13 +91,18 @@ public class CtfxSchedule {
                         Map<String, String> params = new HashMap<>();
                         params.put("bsm", id);
                         result = PythonExecute.Run(xmydsyxFunctionId, params);
+                    } else if ("7".equals(ctfxMainDTO.getSsmk())) {//建设用地完成情况分析
+                        //执行python
+                        Map<String, String> params = new HashMap<>();
+                        params.put("bsm", id);
+                        result = PythonExecute.Run(jsydFunctionId, params);
                     } else {
                         //执行python
                         Map<String, String> params = new HashMap<>();
                         params.put("bsm", id);
                         result = PythonExecute.Run(functionId, params);
                     }
-                    System.out.println("冲突分析:BSM:" + ctfxMainDTO.getId() + ",结果:" + result);
+                    log.info("冲突分析:BSM:" + ctfxMainDTO.getId() + ",结果:" + result);
                 });
             }
         } catch (Exception e) {

+ 7 - 7
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/task/PythonExecute.java

@@ -8,19 +8,19 @@ import org.python.core.PyObject;
 import org.python.core.PyString;
 import org.python.core.PyType;
 import org.python.util.PythonInterpreter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Component
 public class PythonExecute {
-
+    private static final Logger log = LoggerFactory.getLogger(PythonExecute.class);
     /**
      * python.exe位置
      */
@@ -69,11 +69,11 @@ public class PythonExecute {
 //        } catch (Exception e) {
 //            e.printStackTrace();
 //        }
-        //Runtime方式
         JSONObject json = new JSONObject(params);
         System.out.println(String.format("%s %s %s %s", pythonexe, pythonfile, functionName, Base64Utils.base64Encode(json.toJSONString())));
         String[] arguments = new String[]{pythonexe, pythonfile, functionName, Base64Utils.base64Encode(json.toJSONString())};
         try {
+            log.info("python执行参数:{}", arguments[3]);
             Process process = Runtime.getRuntime().exec(arguments);
             BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
             String line = null;
@@ -250,4 +250,4 @@ public class PythonExecute {
             this.value = value;
         }
     }
-}
+}

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/fxpj/CtfxController.java

@@ -16,7 +16,7 @@ import static com.onemap.common.core.utils.PageUtils.startRecordPage;
 
 /**
  * 冲突分析
- * 所属模块(1:生态保护,2:农业生产,3:城镇建设,4:村庄用地)
+ * 所属模块(1:生态保护,2:农业生产,3:城镇建设,4:村庄用地,7:建设用地
  */
 @RestController
 @RequestMapping("/fxpj/ctfx")

+ 7 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/fxpj/CtfxServiceImpl.java

@@ -85,8 +85,10 @@ public class CtfxServiceImpl implements CtfxService {
         wrapper.like("id", bsm);
         TCtfxYzDTO tCtfxYzDTO = tCtfxYzMapper.selectOne(wrapper);
         if (tCtfxYzDTO != null) {
-            String sjlx = tCtfxYzDTO.getSjlx();
-            sjlx += "_" + StringUtils.completionXzqdm(xzqdm) + "_";
+//            String sjlx = tCtfxYzDTO.getSjlx();
+//            sjlx += "_" + StringUtils.completionXzqdm(xzqdm) + "_";
+            // 目前查看数据库,每个市的数在一个库里,暂时改为下面的方式
+            String sjlx = String.format("%s_%s00_", tCtfxYzDTO.getSjlx(), xzqdm.substring(0, 4));
             List<String> yearlist = tCtfxYzMapper.getFxyzYear(sjlx);
             if (yearlist.size() > 0) {
                 List<Map<String, String>> data = new ArrayList<>();
@@ -127,6 +129,9 @@ public class CtfxServiceImpl implements CtfxService {
             mainDto.setFxtable("SDE." + mainDto.getFxtable());
             mainDto.setSjy(sjy.getTablename());
         }
+        if ("7".equals(mainDto.getSsmk())) {
+            mainDto.setFxtable("SDE." + mainDto.getFxtable());
+        }
         tCtfxMainMapper.insert(mainDto);
         if ("6".equals(mainDto.getSsmk())) {
             String fxyz = mainDto.getFxyz();

+ 11 - 5
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/ghss/ZbmxJcpgyjServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class ZbmxJcpgyjServiceImpl implements IZbmxJcpgyjService {
@@ -129,7 +130,7 @@ public class ZbmxJcpgyjServiceImpl implements IZbmxJcpgyjService {
             ZbmxZbjczDTO hbfx = zbmxJcpgyjMapper.SelectHBFX(page.getXzqdm(), page.getZbbh(), jcsj);
             //监测值(目标对比)
             String timejczmbdb = "";
-            if (page.getYear() == null || page.getYear() == "") {
+            if (page.getYear() == null || Objects.equals(page.getYear(), "")) {
                 Calendar cal = Calendar.getInstance();
                 timejczmbdb = Integer.toString(cal.get(Calendar.YEAR));
             } else {
@@ -240,7 +241,8 @@ public class ZbmxJcpgyjServiceImpl implements IZbmxJcpgyjService {
             List<ZbmxJcpgyjDTO> jcz = zbmxJcpgyjMapper.SelectJCZ(newidsList, page.getXzqdm(), page.getYear());
             //规划值
             List<ZbmxJcpgyjDTO> ghz = zbmxJcpgyjMapper.SelectGHZ(newidsList, page.getXzqdm());
-
+            // 城市监测用地特殊处理, 101006 城市监测用地bsm
+            String symbol = "101006".equals(page.getTxbsm())  ? "<" : ">=";
             for (ZbmxJcpgyjViewDTO item : dataZB) {
 
                 ZbmxJcpgyjDTO b = GetJcpgyjClass(jcz, item.getZbbh());
@@ -257,9 +259,13 @@ public class ZbmxJcpgyjServiceImpl implements IZbmxJcpgyjService {
                 if (c != null) {
                     item.setGhmbz(new KeyValuePair().init(c.key, c.value != null ? c.value.toString() + c.dw : null));
                 }
-
-                item.setStatus(GHSSHelper.RarlyWarning(b.value == null ? 0 : b.value, c.value == null ? 0 : c.value, ">="));
-
+                String status = GHSSHelper.RarlyWarning(b.value == null ? 0 : b.value, c.value == null ? 0 : c.value, symbol);
+                item.setStatus(status);
+            }
+            String status = page.getStatus();
+            if (status != null && !(status = status.trim()).isEmpty()) {
+                String flag = "0".equals(status) ? "预警" : "正常";
+                return   dataZB.stream().filter(item -> flag.equals(item.getStatus())).collect(Collectors.toList());
             }
             return dataZB;
         } catch (Exception e) {