wangzhe 10 miesięcy temu
rodzic
commit
0636ffe88b

+ 51 - 19
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZdszBigscreenServiceImpl.java

@@ -52,7 +52,7 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
     public void setConstructionProgress(){
         ZdszBigscreenBo zdszBigscreenBo = new ZdszBigscreenBo();
         String time = getPreviousDay();
-        time = "2024-05-21";
+//        time = "2024-05-21";
         zdszBigscreenBo.setTime(time);
         String[] times = time.split("-");
         zdszBigscreenBo.setMaterial("z_engineering_material_" + times[0] + "_" + times[1]); // z_engineering_material_2024_08
@@ -267,7 +267,8 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
         zdszBigscreenBo.setNode("z_engineering_node_" + times[0] + "_" + times[1]); // z_engineering_node_2024_03
         Map map = new HashMap();
         map.put("time", time); // 创建时间
-        List<Map> civiMaps = bigscreenMapper.civiNumNew(zdszBigscreenBo); // 民用工程
+        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); // 碰口工程
@@ -278,38 +279,69 @@ public class ZdszBigscreenServiceImpl implements IZdszBigscreenService {
         civiMaps = mapMergeMap(civiMaps, touchMaps);
         civiMaps = mapMergeMap(civiMaps, infrastructureMaps);
         civiMaps = mapMergeMap(civiMaps, pipeMaps);
+        civiMaps = mapMergeMap(civiMaps, civiOldMaps);
         map.put("json", mapToJson(civiMaps)); // JSON数据
-        bigscreenMapper.setConstructionNew(map);
+        bigscreenMapper.setConstructionMap(map);
     }
     @Override
     public Map getConstructionMap(ZdszBigscreenBo zdszBigscreenBo){
         clearTime(zdszBigscreenBo);
-        setProjectStatus();
+        setConstructionMap();
+        Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
+        List<SysDictData> dictDataList = sysDictMap.get("district");
         List<Map> list = bigscreenMapper.getConstructionMap(zdszBigscreenBo);
         int size = list.size();
         switch (size){
             case 0:{
+                List names = new ArrayList();
+                List values = new ArrayList();
+                for (SysDictData dictData: dictDataList) {
+                    names.add(dictData.getDictLabel());
+                    values.add(0);
+                }
                 Map map = new LinkedHashMap();
-                map.put("civi", 0); // 民用工程
-                map.put("gy", 0); // 工业工程
-                map.put("industry", 0); // 市政工程
-                map.put("touch", 0); // 碰口工程
-                map.put("infrastructure", 0); // 基建工程
-                map.put("pipe", 0); // 顶管工程
+                map.put("name", names); // 名称
+                map.put("value", values); // 数量
                 return map;
             }
             case 1:{
-                return list.get(0);
+                List names = new ArrayList();
+                List values = new ArrayList();
+                Map map = list.get(0);
+                String jsonStr = map.get("json").toString();
+                JsonValue jsonValue = Json.parse(jsonStr);
+                JsonObject jsonObject = jsonValue.asObject();
+                for (SysDictData dictData: dictDataList) {
+                    names.add(dictData.getDictLabel());
+                    Object value = jsonObject.get(dictData.getDictValue());
+                    values.add(value == null ? 0 : value);
+                }
+                Map linkedHashMap = new LinkedHashMap();
+                linkedHashMap.put("name", names); // 名称
+                linkedHashMap.put("value", values); // 数量
+                return linkedHashMap;
             }
             default:{
-                Map map = new LinkedHashMap();
-                map.put("civi", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("civi")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 民用工程
-                map.put("gy", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("gy")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 工业工程
-                map.put("industry", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("industry")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 市政工程
-                map.put("touch", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("touch")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 碰口工程
-                map.put("infrastructure", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("infrastructure")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 基建工程
-                map.put("pipe", list.stream().map(x -> new BigDecimal(String.valueOf(x.get("pipe")))).reduce(BigDecimal.ZERO, BigDecimal::add)); // 顶管工程
-                return map;
+                List names = new ArrayList();
+                List values = new ArrayList();
+                for (SysDictData dictData: dictDataList) {
+                    names.add(dictData.getDictLabel());
+                    Long longValue = 0L;
+                    for (int i = 0; i < list.size(); i++) {
+                        Map map = list.get(i);
+                        String jsonStr = map.get("json").toString();
+                        JsonValue jsonValue = Json.parse(jsonStr);
+                        JsonObject jsonObject = jsonValue.asObject();
+                        Object valueObj = jsonObject.get(dictData.getDictValue());
+                        Long value = valueObj == null ? 0L : Long.valueOf(valueObj.toString());
+                        longValue += value;
+                    }
+                    values.add(longValue);
+                }
+                Map linkedHashMap = new LinkedHashMap();
+                linkedHashMap.put("name", names); // 名称
+                linkedHashMap.put("value", values); // 数量
+                return linkedHashMap;
             }
         }
     }

+ 27 - 22
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZdszBigscreenMapper.xml

@@ -99,22 +99,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         values (#{time}, #{civi}, #{gy}, #{industry}, #{touch}, #{infrastructure}, #{pipe})
     </insert>
     <select id="civiNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_civil eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_civil eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="gyNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_gy eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_gy eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="industryNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_industry eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_industry eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="touchNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_touch_operation_engineering eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_touch_operation_engineering eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="infrastructureNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_infrastructure eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_infrastructure eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="pipeNumEng" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_pipe_jacking eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_pipe_jacking eng on eng.id = node.civli_id where info.del_flag = 0 and date_format(info.update_time, '%Y-%m-%d') = #{time}
     </select>
     <select id="getCountEngineering" resultType="java.util.LinkedHashMap">
         <if test="time != null and time != ''">
@@ -181,8 +181,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <insert id="setConstructionMap">
         delete from z_bigscreen_construction_map where time = #{time};
-        insert into z_bigscreen_construction_map (time, civi, gy, industry, touch, infrastructure, pipe)
-        values (#{time}, #{civi}, #{gy}, #{industry}, #{touch}, #{infrastructure}, #{pipe})
+        insert into z_bigscreen_construction_map (time, json)
+        values (#{time}, #{json})
     </insert>
     <select id="getConstructionMap" resultType="java.util.LinkedHashMap">
         <if test="time != null and time != ''">
@@ -207,19 +207,19 @@ 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.dict_value) `value` from sys_dict_data dict
-         left join z_engineering_civil civi on dict.dict_value = civi.district
+        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.create_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        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>
     <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.create_time, '%Y-%m-%d') = #{time}
+        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>
     <select id="industryNumNew" resultType="java.util.Map">
@@ -227,7 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                                          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.create_time, '%Y-%m-%d') = #{time}
+        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>
     <select id="touchNumNew" resultType="java.util.Map">
@@ -235,7 +235,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                                          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.create_time, '%Y-%m-%d') = #{time}
+        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>
     <select id="infrastructureNumNew" resultType="java.util.Map">
@@ -243,7 +243,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                                          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.create_time, '%Y-%m-%d') = #{time}
+        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>
     <select id="pipeNumNew" resultType="java.util.Map">
@@ -251,7 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                                          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.create_time, '%Y-%m-%d') = #{time}
+        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>
     <select id="getConstructionNew" resultType="java.util.LinkedHashMap">
@@ -277,15 +277,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         values (#{time}, #{json})
     </insert>
     <select id="civiNumOld" 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
+        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 = 'old_renovation' and date_format(info.create_time, '%Y-%m-%d') = #{time}
-        group by dict.dict_value
+        where dict_type = 'district' and info.del_flag = 0 and civi.engin_type = 'old_renovation' and date_format(info.update_time, '%Y-%m-%d') = #{time}
+        group by civi.house_id) houses
+        group by houses.dict_value
     </select>
     <select id="gyNumOld" resultType="java.lang.Long">
-        select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_gy eng on eng.id = node.civli_id where date_format(info.create_time, '%Y-%m-%d') = #{time}
+        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 = 'old_renovation' and date_format(info.create_time, '%Y-%m-%d') = #{time}
+        group by dict.dict_value
     </select>
     <select id="industryNumOld" resultType="java.lang.Long">
         select count(eng.id) from ${info} info left join ${node} node on info.eng_info_id = node.id left join z_engineering_industry eng on eng.id = node.civli_id where date_format(info.create_time, '%Y-%m-%d') = #{time}