Browse Source

各个区今日施工数 新建

wangzhe 11 months ago
parent
commit
79fa521743

+ 60 - 27
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZdszBigscreenServiceImpl.java

@@ -74,7 +74,7 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
             spiral_welded_pipe += numbers.get(3);
             seamless_steel_tube += numbers.get(4);
             galvanized_steel_pipe += numbers.get(5);
-            iron += numbers.get(6);
+            polyethylene_pipe += numbers.get(6);
         }
         Map map = new HashMap();
         map.put("time", time); // 创建时间
@@ -214,12 +214,25 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
             String[] times = month.split("-");
             zdszBigscreenBo.setInfo("z_engineering_info_" + times[0] + "_" + times[1]); // z_engineering_info_2024_03
             zdszBigscreenBo.setNode("z_engineering_node_" + times[0] + "_" + times[1]); // z_engineering_node_2024_03
-            civi.add(bigscreenMapper.civiNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
-            gy.add(bigscreenMapper.gyNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
-            industry.add(bigscreenMapper.industryNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
-            touch.add(bigscreenMapper.touchNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
-            infrastructure.add(bigscreenMapper.infrastructureNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
-            civi.add(bigscreenMapper.pipeNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+            setMergeList(civi, bigscreenMapper.civiNumEng(zdszBigscreenBo));
+            setMergeList(gy, bigscreenMapper.gyNumEng(zdszBigscreenBo));
+            setMergeList(industry, bigscreenMapper.industryNumEng(zdszBigscreenBo));
+            setMergeList(touch, bigscreenMapper.touchNumEng(zdszBigscreenBo));
+            setMergeList(infrastructure, bigscreenMapper.infrastructureNumEng(zdszBigscreenBo));
+            setMergeList(pipe, bigscreenMapper.pipeNumEng(zdszBigscreenBo));
+//            civi.add(bigscreenMapper.civiNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            gy.add(bigscreenMapper.gyNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            industry.add(bigscreenMapper.industryNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            touch.add(bigscreenMapper.touchNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            infrastructure.add(bigscreenMapper.infrastructureNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            pipe.add(bigscreenMapper.pipeNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+
+//            civi.add(bigscreenMapper.civiNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            gy.add(bigscreenMapper.gyNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            industry.add(bigscreenMapper.industryNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            touch.add(bigscreenMapper.touchNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            infrastructure.add(bigscreenMapper.infrastructureNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
+//            pipe.add(bigscreenMapper.pipeNumEng(zdszBigscreenBo).stream().collect(Collectors.toSet()));
 //            pipe += bigscreenMapper.gyNumEng(zdszBigscreenBo);
 //            industry += bigscreenMapper.industryNumEng(zdszBigscreenBo);
 //            touch += bigscreenMapper.touchNumEng(zdszBigscreenBo);
@@ -234,6 +247,13 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
         map.put("pipe", pipe.size()); // 顶管工程
         bigscreenMapper.setCountEngineering(map);
     }
+    private void setMergeList(Set set, List<String> list){
+        for (String string: list) {
+            if(string != null){
+                set.add(string);
+            }
+        }
+    }
     @Override
     public Map getCountEngineering(ZdszBigscreenBo zdszBigscreenBo){
         clearTime(zdszBigscreenBo);
@@ -341,25 +361,30 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
         }
 //        time = "2024-03-10";
         zdszBigscreenBo.setTime(time);
-        String[] times = time.split("-");
-        zdszBigscreenBo.setInfo("z_engineering_info_" + times[0] + "_" + times[1]); // z_engineering_info_2024_03
-        zdszBigscreenBo.setNode("z_engineering_node_" + times[0] + "_" + times[1]); // z_engineering_node_2024_03
         Map map = new HashMap();
         map.put("time", time); // 创建时间
-        List<Map> civiOldMaps = bigscreenMapper.civiNumNew(zdszBigscreenBo); // 民用工程 旧改
-        List<Map> civiMaps = bigscreenMapper.civiNumNew(zdszBigscreenBo); // 民用工程 新建
-        List<Map> gyMaps = bigscreenMapper.gyNumNew(zdszBigscreenBo); // 工业工程
-        List<Map> industryMaps = bigscreenMapper.industryNumNew(zdszBigscreenBo); // 市政工程
-        List<Map> touchMaps = bigscreenMapper.touchNumNew(zdszBigscreenBo); // 碰口工程
-        List<Map> infrastructureMaps = bigscreenMapper.infrastructureNumNew(zdszBigscreenBo); // 基建工程
-        List<Map> pipeMaps = bigscreenMapper.pipeNumNew(zdszBigscreenBo); // 顶管工程
-        civiMaps = mapMergeMap(civiMaps, gyMaps);
-        civiMaps = mapMergeMap(civiMaps, industryMaps);
-        civiMaps = mapMergeMap(civiMaps, touchMaps);
-        civiMaps = mapMergeMap(civiMaps, infrastructureMaps);
-        civiMaps = mapMergeMap(civiMaps, pipeMaps);
-        civiMaps = mapMergeMap(civiMaps, civiOldMaps);
-        map.put("json", mapToJson(civiMaps)); // JSON数据
+        List<Map> initMaps = new ArrayList<>();
+        List<String> monthList = batchInitMonthList(null);
+        for (String month: monthList) {
+            String[] times = month.split("-");
+            zdszBigscreenBo.setInfo("z_engineering_info_" + times[0] + "_" + times[1]); // z_engineering_info_2024_03
+            zdszBigscreenBo.setNode("z_engineering_node_" + times[0] + "_" + times[1]); // z_engineering_node_2024_03
+            List<Map> civiOldMaps = bigscreenMapper.civiNumNew(zdszBigscreenBo); // 民用工程 旧改
+            List<Map> civiMaps = bigscreenMapper.civiNumNew(zdszBigscreenBo); // 民用工程 新建
+            List<Map> gyMaps = bigscreenMapper.gyNumNew(zdszBigscreenBo); // 工业工程
+            List<Map> industryMaps = bigscreenMapper.industryNumNew(zdszBigscreenBo); // 市政工程
+            List<Map> touchMaps = bigscreenMapper.touchNumNew(zdszBigscreenBo); // 碰口工程
+            List<Map> infrastructureMaps = bigscreenMapper.infrastructureNumNew(zdszBigscreenBo); // 基建工程
+            List<Map> pipeMaps = bigscreenMapper.pipeNumNew(zdszBigscreenBo); // 顶管工程
+            initMaps = mapMergeMap(initMaps, civiMaps);
+            initMaps = mapMergeMap(initMaps, gyMaps);
+            initMaps = mapMergeMap(initMaps, industryMaps);
+            initMaps = mapMergeMap(initMaps, touchMaps);
+            initMaps = mapMergeMap(initMaps, infrastructureMaps);
+            initMaps = mapMergeMap(initMaps, pipeMaps);
+            initMaps = mapMergeMap(initMaps, civiOldMaps);
+        }
+        map.put("json", mapToJson(initMaps)); // JSON数据
         bigscreenMapper.setConstructionMap(map);
     }
     @Override
@@ -652,11 +677,15 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
         String start = "{";
         for (int i = 0; i < maps.size(); i++) {
             Map data = maps.get(i);
-            String key = data.get("key").toString();
+            Object keyObj = data.get("key");
+            if(keyObj == null){
+                continue;
+            }
+            String key = keyObj.toString();
             Long value = Long.valueOf(data.get("value").toString());
             start = start + "\"" + key + "\":"+value+",";
         }
-        if(maps.size() > 0){
+        if(maps.size() > 0 && start.length() > 1){
             start = start.substring(0, start.length() - 1);
         }
         String end= "}";
@@ -669,7 +698,11 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
             for (int j = 0; j < destinations.size(); j++) {
                 Map destination = destinations.get(j);
                 Map map = maps.get(i);
-                if(map.get("key").equals(destination.get("key"))){
+                Object keyObj = map.get("key");
+                if(keyObj == null){
+                    continue;
+                }
+                if(keyObj.equals(destination.get("key"))){
                     isExist = true;
                     Long value = Long.valueOf(destination.get("value").toString()) + Long.valueOf(map.get("value").toString());
                     destination.put("value", value);

+ 36 - 37
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZdszBigscreenMapper.xml

@@ -201,52 +201,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         values (#{time}, #{json})
     </insert>
     <select id="civiNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict_value) `value` from (select dict_value from sys_dict_data dict left join z_engineering_civil civi on dict.dict_value = civi.district
-         left join ${node} node on node.civli_id = civi.id
-         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by civi.area_id) areas
-        group by areas.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+         left join ${node} node on info.eng_info_id = node.id
+         left join z_engineering_civil civi on node.civli_id = civi.id
+         left join sys_dict_data dict on dict.dict_value = civi.district
+        where info.del_flag = 0 and dict_type = 'district' and civi.engin_type = 'new_built' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by civi.area_id
     </select>
     <select id="gyNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict.dict_value) `value` from sys_dict_data dict
-         left join z_engineering_civil civi on dict.dict_value = civi.district
-         left join ${node} node on node.civli_id = civi.id
-         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+            left join ${node} node on info.eng_info_id = node.id
+            left join z_engineering_gy eng on node.civli_id = eng.id
+            left join sys_dict_data dict on dict.dict_value = eng.district
+        where info.del_flag = 0 and dict_type = 'district' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by dict_value
     </select>
     <select id="industryNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict.dict_value) `value` from sys_dict_data dict
-                                                                         left join z_engineering_civil civi on dict.dict_value = civi.district
-                                                                         left join ${node} node on node.civli_id = civi.id
-                                                                         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+            left join ${node} node on info.eng_info_id = node.id
+            left join z_engineering_industry eng on node.civli_id = eng.id
+            left join sys_dict_data dict on dict.dict_value = eng.district
+        where info.del_flag = 0 and dict_type = 'district' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by dict_value
     </select>
     <select id="touchNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict.dict_value) `value` from sys_dict_data dict
-                                                                         left join z_engineering_civil civi on dict.dict_value = civi.district
-                                                                         left join ${node} node on node.civli_id = civi.id
-                                                                         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+            left join ${node} node on info.eng_info_id = node.id
+            left join z_touch_operation_engineering eng on node.civli_id = eng.id
+            left join sys_dict_data dict on dict.dict_value = eng.district
+        where info.del_flag = 0 and dict_type = 'district' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by dict_value
     </select>
     <select id="infrastructureNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict.dict_value) `value` from sys_dict_data dict
-                                                                         left join z_engineering_civil civi on dict.dict_value = civi.district
-                                                                         left join ${node} node on node.civli_id = civi.id
-                                                                         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+            left join ${node} node on info.eng_info_id = node.id
+            left join z_engineering_infrastructure eng on node.civli_id = eng.id
+            left join sys_dict_data dict on dict.dict_value = eng.district
+        where info.del_flag = 0 and dict_type = 'district' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by dict_value
     </select>
     <select id="pipeNumNew" resultType="java.util.Map">
-        select dict_value `key`, count(dict.dict_value) `value` from sys_dict_data dict
-                                                                         left join z_engineering_civil civi on dict.dict_value = civi.district
-                                                                         left join ${node} node on node.civli_id = civi.id
-                                                                         left join  ${info} info on info.eng_info_id = node.id
-        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'new_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        select dict_value `key`, count(dict_value) `value` from ${info} info
+            left join ${node} node on info.eng_info_id = node.id
+            left join z_engineering_pipe_jacking eng on node.civli_id = eng.id
+            left join sys_dict_data dict on dict.dict_value = eng.district
+        where info.del_flag = 0 and dict_type = 'district' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by dict_value
     </select>
     <select id="getConstructionNew" resultType="java.util.LinkedHashMap">
         <if test="time != null and time != ''">
@@ -277,7 +277,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           left join sys_dict_data dict on dict.dict_value = civi.district
         where info.del_flag = 0 and dict_type = 'district' and civi.engin_type = 'old_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
         group by civi.house_id
-
     </select>
     <select id="civiNumOldOld" resultType="java.util.Map">
         select dict_value `key`, count(dict_value) `value` from (select dict_value from sys_dict_data dict left join z_engineering_civil civi on dict.dict_value = civi.district