wang_xy 10 months ago
parent
commit
c590a89ebc
21 changed files with 804 additions and 231 deletions
  1. 18 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringCivilController.java
  2. BIN
      ruoyi-admin/src/main/resources/excel/bottomLegExcel.xlsx
  3. BIN
      ruoyi-admin/src/main/resources/excel/civilExcel.xlsx
  4. BIN
      ruoyi-admin/src/main/resources/excel/civilExcelColor.xlsx
  5. BIN
      ruoyi-admin/src/main/resources/excel/obtainQualifiedRoomExcel.xlsx
  6. 1 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  7. 3 2
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEnginNotInstalledVo.java
  8. 26 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilBottomLegExport.java
  9. 10 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilExportVos.java
  10. 24 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilObtainQualifiedRoom.java
  11. 1 1
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/roomStatusVo.java
  12. 4 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/mapper/ZEngineeringCivilMapper.java
  13. 3 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringCivilService.java
  14. 1 0
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringNodeService.java
  15. 93 5
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java
  16. 0 2
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringIndustryServiceImpl.java
  17. 116 19
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringNodeServiceImpl.java
  18. 1 1
      ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringReviewServiceImpl.java
  19. 2 2
      ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEnginMaterialQualityMapper.xml
  20. 476 182
      ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringCivilMapper.xml
  21. 25 15
      ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringNodeMapper.xml

+ 18 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringCivilController.java

@@ -46,6 +46,22 @@ public class ZEngineeringCivilController extends BaseController {
     private IZEngineeringReviewService izEngineeringReviewService;
 
 
+    @PostMapping("/exportBottomLeg")
+    public void exportBottomLeg(ZEngineeringCivilBo bo, PageQuery pageQuery, HttpServletResponse response) {
+        List<ZEngineeringCivilBottomLegExport> zEngineeringCivilExportVos = iZEngineeringCivilService.exportBottomLeg(bo);
+        ExcelUtil.exportTemplate(Collections.singletonList(zEngineeringCivilExportVos), "民用工程-底腿", "excel/bottomLegExcel.xlsx", response);
+    }
+
+
+
+    @PostMapping("/exportObtainQualifiedRoom")
+    public void exportObtainQualifiedRoom(ZEngineeringCivilBo bo, PageQuery pageQuery, HttpServletResponse response) {
+        List<ZEngineeringCivilObtainQualifiedRoom> zEngineeringCivilExportVos = iZEngineeringCivilService.exportObtainQualifiedRoom(bo);
+        ExcelUtil.exportTemplate(Collections.singletonList(zEngineeringCivilExportVos), "民用工程-底腿", "excel/obtainQualifiedRoomExcel.xlsx", response);
+    }
+
+
+
     /**
      * 根据某个行政区下所有小区进行施工统计(柱状图)
      */
@@ -95,8 +111,8 @@ public class ZEngineeringCivilController extends BaseController {
     @Log(title = "民用工程导出带进度颜色", businessType = BusinessType.EXPORT)
     @PostMapping("/exportColor")
     public void exportColor(ZEngineeringCivilBo bo, PageQuery pageQuery, HttpServletResponse response) {
-//            List<ZEngineeringCivilExportVos> zEngineeringCivilExportVos = iZEngineeringCivilService.exportList(bo);
-            List<ZEngineeringCivilVo> zEngineeringCivilExportVos = iZEngineeringCivilService.queryAllList(bo);
+            List<ZEngineeringCivilExportVos> zEngineeringCivilExportVos = iZEngineeringCivilService.exportListColor(bo);
+//            List<ZEngineeringCivilVo> zEngineeringCivilExportVos = iZEngineeringCivilService.queryAllList(bo);
             ExcelUtil.exportTemplate(Collections.singletonList(zEngineeringCivilExportVos), "民用工程-室内", "excel/civilExcelColor.xlsx", response);
     }
 

BIN
ruoyi-admin/src/main/resources/excel/bottomLegExcel.xlsx


BIN
ruoyi-admin/src/main/resources/excel/civilExcel.xlsx


BIN
ruoyi-admin/src/main/resources/excel/civilExcelColor.xlsx


BIN
ruoyi-admin/src/main/resources/excel/obtainQualifiedRoomExcel.xlsx


+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -85,6 +85,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
         wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
             .eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId())
             .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
+            .like(StringUtils.isNotBlank(user.getNickName()), "u.nick_name", user.getNickName())
             .eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
             .like(StringUtils.isNotBlank(user.getPhonenumber()), "u.phonenumber", user.getPhonenumber())
             .between(params.get("beginTime") != null && params.get("endTime") != null,

+ 3 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEnginNotInstalledVo.java

@@ -26,7 +26,8 @@ public class ZEnginNotInstalledVo implements Serializable {
      *
      */
     private String id;
-    @ExcelProperty(value = "行政区")
+    @ExcelProperty(value = "行政区" ,converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "district")
     private String district;
 
     private String areaId;
@@ -44,7 +45,7 @@ public class ZEnginNotInstalledVo implements Serializable {
     private String unitName;
     @ExcelProperty(value = "房间")
     private String houseName;
-    @ExcelProperty(value = "未安装类型")
+    @ExcelProperty(value = "未安装类型" ,converter = ExcelDictConvert.class)
     @ExcelDictFormat(dictType = "not_installed_type")
     private String type;
     /**

+ 26 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilBottomLegExport.java

@@ -0,0 +1,26 @@
+package com.ruoyi.zdsz.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 民用工程视图对象 z_engineering_civil
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class ZEngineeringCivilBottomLegExport extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String ardds;
+    private String bottomLeg;
+    private String acceptanceNumber;
+    private String disqualificationNumber;
+
+}

+ 10 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilExportVos.java

@@ -82,5 +82,15 @@ public class ZEngineeringCivilExportVos extends BaseEntity implements Serializab
     private String sgwz;
     private String jtwz;
 
+    //导出专用 其他没用
+    private String gx1;
+    private String gx2;
+    private String gx3;
+    private String gx4;
+    private String gx5;
+    private String gx6;
+    private String gx7;
+
+
 
 }

+ 24 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringCivilObtainQualifiedRoom.java

@@ -0,0 +1,24 @@
+package com.ruoyi.zdsz.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 民用工程视图对象 z_engineering_civil
+ *
+ * @author ruoyi
+ * @date 2023-12-27
+ */
+@Data
+@ExcelIgnoreUnannotated
+public class ZEngineeringCivilObtainQualifiedRoom extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String ardds;
+    private String type;
+
+}

+ 1 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/roomStatusVo.java

@@ -40,5 +40,5 @@ public class roomStatusVo extends BaseEntity {
     /**
      * 统计排序字段
      */
-    private  Integer unitOrder;
+    private  String unitOrder;
 }

+ 4 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/mapper/ZEngineeringCivilMapper.java

@@ -34,6 +34,8 @@ public interface ZEngineeringCivilMapper extends BaseMapperPlus<ZEngineeringCivi
     List<areaWillDoneVo> getAreaCompletionInformationList(@Param("idList") List idList,@Param("enginCycle")String enginCycle,@Param("enginType")String enginType);
     List<areaWillDoneVo> getAreaCompletionInformationList2(@Param("enginCycle")String enginCycle,@Param("enginType")String enginType);
     Map<String,Number> getsumStatus(String district);
+    List<ZEngineeringCivilBottomLegExport> exportBottomLeg(@Param("p") ZEngineeringCivilBo bo,@Param("tableNames") List<String> list);
+    List<ZEngineeringCivilObtainQualifiedRoom> exportObtainQualifiedRoom(@Param("p") ZEngineeringCivilBo bo,@Param("tableNames") List<String> list);
 
     areaMessageVo getHouseMessage(String Id);
     areaMessageVo getAreaMessage(String Id);
@@ -41,7 +43,9 @@ public interface ZEngineeringCivilMapper extends BaseMapperPlus<ZEngineeringCivi
     LinkedList<String> getTableNames(String tableName);
     List<ZEngineeringInfoBo> getsumId(@Param("tableNames") List tableNames, @Param("createTime")List createTime, @Param("UserName") String UserName);
     List<ZEngineeringCivilExportVo> getexportList(@Param("tableNames") List tableNames,@Param("createTime") String createTime,@Param("p") ZEngineeringCivilBo bo);
+    List<ZEngineeringCivilExportVo> getexportListColor(@Param("tableNames") List tableNames,@Param("createTime") String createTime,@Param("p") ZEngineeringCivilBo bo);
     Long getTypeNumber( @Param("tableNames") List tableNames,@Param("p")ZEngineeringCivilBo bo);
+    List<ZEngineeringCivilExportVo> getexportNotInstalled(ZEngineeringCivilBo bo);
 
 
 }

+ 3 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringCivilService.java

@@ -36,6 +36,9 @@ public interface IZEngineeringCivilService {
     TableDataInfo<ZEngineeringCivilVo> queryPageList(ZEngineeringCivilBo bo, PageQuery pageQuery);
     List<ZEngineeringCivilVo> queryAllList(ZEngineeringCivilBo bo);
     List<ZEngineeringCivilExportVos> exportList(ZEngineeringCivilBo bo);
+    List<ZEngineeringCivilBottomLegExport> exportBottomLeg(ZEngineeringCivilBo bo);
+    List<ZEngineeringCivilObtainQualifiedRoom> exportObtainQualifiedRoom(ZEngineeringCivilBo bo);
+    List<ZEngineeringCivilExportVos> exportListColor(ZEngineeringCivilBo bo);
     List<ZEngineeringCivilExportVos> exportCcourtyardList(ZEngineeringCivilBo bo);
     List<ZEngineeringCivilExportVos> exportOverheadList(ZEngineeringCivilBo bo);
     List<ZEngineeringCivilExportVos> exportBottomLegList(ZEngineeringCivilBo bo);

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringNodeService.java

@@ -85,6 +85,7 @@ public interface IZEngineeringNodeService {
     Boolean delete(ZEngineeringNodeBo bo);
     List<String> nodeTypeList(List<ZEngineeringCivil> zEngineeringCivilList,String type,String state,ZEngineeringCivilBo bo);
     Map<String,Object> ReViewList(List<ZEngineeringCivilVo> zEngineeringCivilList);
+    Map<String,Object> ReViewListColor(List<ZEngineeringCivilVo> zEngineeringCivilList);
     Map<String,Object> ReViewPipeJackingList(List<ZEngineeringPipeJackingVo> list);
     Map<String,Object> ReViewInfrastructureList(List<ZEngineeringInfrastructureVo> list);
     Map<String,Object> ReViewSZList(List<ZEngineeringIndustryVo> list);

+ 93 - 5
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java

@@ -82,6 +82,22 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
     private IZEngineeringInfoService izEngineeringInfoService;
 
     @Override
+    public List<ZEngineeringCivilObtainQualifiedRoom> exportObtainQualifiedRoom(ZEngineeringCivilBo bo) {
+        LocalDate startDate = LocalDate.of(2024, 3, 1); // 指定开始日期
+        LocalDate endDate = LocalDate.now(); // 当前日期
+        List<String> monthsBetween = getMonthsBetween(startDate, endDate);
+        return baseMapper.exportObtainQualifiedRoom(bo,monthsBetween);
+    }
+
+    @Override
+    public List<ZEngineeringCivilBottomLegExport> exportBottomLeg(ZEngineeringCivilBo bo) {
+        LocalDate startDate = LocalDate.of(2024, 3, 1); // 指定开始日期
+        LocalDate endDate = LocalDate.now(); // 当前日期
+        List<String> monthsBetween = getMonthsBetween(startDate, endDate);
+        return baseMapper.exportBottomLeg(bo,monthsBetween);
+    }
+
+    @Override
     public Map<String, List<?>> selectByDistrictStatistics(String district) {
         List<String> name = new ArrayList<>();
         List<Integer> wsg = new ArrayList<>();
@@ -399,7 +415,7 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
                 if ("表后管".equals(zEngineeringCivilExportVo.getType())) {
                     zEngineeringCivilExportVos.setBHGmaterialQuality(zEngineeringCivilExportVo.getMaterialQuality());
                     zEngineeringCivilExportVos.setBHGspecifications(zEngineeringCivilExportVo.getSpecifications());
-                    zEngineeringCivilExportVos.setBHGnumber(zEngineeringCivilExportVo.getNumber().toString());
+                    zEngineeringCivilExportVos.setBHGnumber(ObjectUtils.isEmpty(zEngineeringCivilExportVo.getNumber())?"":zEngineeringCivilExportVo.getNumber().toString());
                 }
                 if (ObjectUtils.isEmpty(zEngineeringCivilExportVos.getBJQmaterialQuality())) {
                     zEngineeringCivilExportVos.setBJQmaterialQuality("");
@@ -429,6 +445,74 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
 
         return arrayList;
     }
+    @Override
+    public List<ZEngineeringCivilExportVos> exportListColor(ZEngineeringCivilBo bo) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy_MM");
+        LinkedList<String> list = baseMapper.getTableNames("z_engineering_info");
+        list.removeLast();
+        List DateList = new ArrayList();
+        list.stream().forEach(item -> {
+            DateList.add(item.substring(item.indexOf("2")));
+        });
+        List<ZEngineeringCivilExportVo> zEngineeringCivilExportVoList = baseMapper.getexportListColor(DateList, format.format(new Date()), bo);
+
+        LinkedHashMap<String, List<ZEngineeringCivilExportVo>> hashMap = new LinkedHashMap<>();
+
+        for (int i = 0; i < zEngineeringCivilExportVoList.size(); i++) {
+            if (hashMap.containsKey(zEngineeringCivilExportVoList.get(i).getId())) {
+                List<ZEngineeringCivilExportVo> zEngineeringCivilExportVos = hashMap.get(zEngineeringCivilExportVoList.get(i).getId());
+                zEngineeringCivilExportVos.add(zEngineeringCivilExportVoList.get(i));
+            } else {
+                List<ZEngineeringCivilExportVo> zEngineeringCivilExportVos = new ArrayList<>();
+                zEngineeringCivilExportVos.add(zEngineeringCivilExportVoList.get(i));
+                hashMap.put(zEngineeringCivilExportVoList.get(i).getId(), zEngineeringCivilExportVos);
+            }
+        }
+        ArrayList<ZEngineeringCivilExportVos> arrayList = new ArrayList<>();
+        List<String> strings = new ArrayList<>();
+        for (Map.Entry<String, List<ZEngineeringCivilExportVo>> stringListEntry : hashMap.entrySet()) {
+            strings.add(stringListEntry.getKey());
+        }
+        for (String string : strings) {
+            ZEngineeringCivilExportVos zEngineeringCivilExportVos = new ZEngineeringCivilExportVos();
+            for (ZEngineeringCivilExportVo zEngineeringCivilExportVo : hashMap.get(string)) {
+                zEngineeringCivilExportVos.setDistrict(zEngineeringCivilExportVo.getDistrict());
+                zEngineeringCivilExportVos.setAreaId(zEngineeringCivilExportVo.getAreaId());
+                zEngineeringCivilExportVos.setBuildingId(zEngineeringCivilExportVo.getBuildingId());
+                zEngineeringCivilExportVos.setUnitId(zEngineeringCivilExportVo.getUnitId());
+                zEngineeringCivilExportVos.setHouseId(zEngineeringCivilExportVo.getHouseId());
+                zEngineeringCivilExportVos.setSource(zEngineeringCivilExportVo.getSource());
+                zEngineeringCivilExportVos.setEnginType(zEngineeringCivilExportVo.getEnginType());
+                zEngineeringCivilExportVos.setEnginClassification(zEngineeringCivilExportVo.getEnginClassification());
+                zEngineeringCivilExportVos.setCompletionStatus(zEngineeringCivilExportVo.getCompletionStatus());
+                if ("拆旧管".equals(zEngineeringCivilExportVo.getType())||"打孔".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx1(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("立杠".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx2(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("挂表".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx3(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("表后管".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx4(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("报警器".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx5(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("切断阀".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx6(zEngineeringCivilExportVo.getReviewStatus());
+                }
+                if ("阀管".equals(zEngineeringCivilExportVo.getType())){
+                    zEngineeringCivilExportVos.setGx7(zEngineeringCivilExportVo.getReviewStatus());
+                }
+            }
+            arrayList.add(zEngineeringCivilExportVos);
+        }
+
+
+        return arrayList;
+    }
 
     @Override
     public List<ZEngineeringCivilExportVos> exportBottomLegList(ZEngineeringCivilBo bo) {
@@ -964,7 +1048,8 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
             List done = value.stream().filter(item -> item.getRoomStatus().equals("竣工")).collect(Collectors.toList());
             List notInstall = value.stream().filter(item -> item.getRoomStatus().equals("未安装")).collect(Collectors.toList());
             List<List<roomStatusVo>> roomStatusVoList = new ArrayList<>();
-            Map<String, List<roomStatusVo>> sortMap = roomMap.entrySet().stream().sorted(Comparator.comparingInt(entry -> Integer.parseInt(entry.getKey()))).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldVal, newVal) -> oldVal, LinkedHashMap::new));
+            Map<String, List<roomStatusVo>> sortMap = roomMap.entrySet().stream().sorted(
+                Comparator.comparingInt(entry -> Integer.parseInt(entry.getKey()))).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldVal, newVal) -> oldVal, LinkedHashMap::new));
             sortMap.forEach((key1, value1) -> {
                 roomStatusVoList.add(value1);
             });
@@ -1380,8 +1465,9 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
         } else if (zEngineeringCivilBo.getEnginType().equals("new_built")) {
             zEngineeringCivilBo.setEnginType("新建");
         }
-
-        izEngiineeringPhotoService.write(zEngineeringCivilBo);
+        if(zEngineeringReviewBo.getReviewStatus().equals("1")){
+            izEngiineeringPhotoService.write(zEngineeringCivilBo);
+        }
         return 0;
     }
 
@@ -1397,7 +1483,9 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
                 MonthTableNameHandler.setData(format.format(item.getCreateTime()));
                 zEngineeringInfoMapper.update(lqw);
                 MonthTableNameHandler.removeData();
-                izEngiineeringPhotoService.writeImg(infoIdList.getInfoIdList(), item,zEngineeringReviewBo.getEngInfoName());
+                if(zEngineeringReviewBo.getReviewStatus().equals("1")){
+                    izEngiineeringPhotoService.writeImg(infoIdList.getInfoIdList(), item,zEngineeringReviewBo.getEngInfoName());
+                }
             });
             izEngineeringReviewService.insert(zEngineeringReviewBo);
         } catch (Exception e) {

+ 0 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringIndustryServiceImpl.java

@@ -325,8 +325,6 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
 //                    dists = "the_steel_pipe_sealed_with_gas";
 //                }
                 String date = new SimpleDateFormat("yyyy_MM").format(Date.from(((LocalDateTime) item.get("createTime")).atZone(ZoneId.systemDefault()).toInstant()));
-                ;
-                ;
                 MonthTableNameHandler.setData(date);
                 List<Map<String, String>> mapList = baseMapper.getReviewStatusByNodeId(item.get("id").toString());
                 Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");

+ 116 - 19
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringNodeServiceImpl.java

@@ -66,6 +66,8 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
     @Autowired
     private IZEngiineeringPhotoService izEngiineeringPhotoService;
     @Autowired
+    private ZEngiineeringPhotoMapper izEngiineeringPhotoMapper;
+    @Autowired
     private ZEngineeringCivilMapper zEngineeringCivilMapper;
     @Autowired
     private ZEngineeringReviewMapper zEngineeringReviewMapper;
@@ -706,7 +708,12 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
         List<String> monthsBetween = getMonthsBetween(startDate, endDate);
         if(!ObjectUtils.isEmpty(civilIds)){
             if (StringUtils.isNotBlank(state)) {
-                nodeTypeList.addAll(baseMapper.selectNodeListByMonth(monthsBetween,type,state,civilIds));
+                if("99".equals(state)){
+                    List<String> nodeList = baseMapper.selectNodeListByMonth(monthsBetween,type,state,civilIds).stream().map(ZEngineeringNode::getCivliId).collect(Collectors.toList());
+                    return minus(civilIds,nodeList);
+                }else{
+                    nodeTypeList.addAll(baseMapper.selectNodeListByMonth(monthsBetween,type,state,civilIds));
+                }
             }else{
                 for (String date:monthsBetween) {
                     MonthTableNameHandler.setData(date);
@@ -726,7 +733,7 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
                 MonthTableNameHandler.setData(date);
                 LambdaQueryWrapper<ZEngineeringInfo> lqw = Wrappers.lambdaQuery();
                 lqw.eq(StringUtils.isNotBlank(item.getId()), ZEngineeringInfo::getEngInfoId, item.getId());
-                lqw.like(ZEngineeringInfo::getCreateBy, bo.getCreateBy());
+                lqw.like(StringUtils.isNotEmpty(bo.getCreateBy()),ZEngineeringInfo::getCreateBy, bo.getCreateBy());
                 if (!"".equals(bo.getBeginTime()) && !ObjectUtils.isEmpty(bo.getBeginTime())) {
                     lqw.between(ZEngineeringInfo::getUpdateInfoTime, bo.getBeginTime().get(0), bo.getBeginTime().get(1));
                 }
@@ -742,6 +749,10 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
         return IDList;
     }
 
+    private static List<String> minus(List<String> list1, List<String> list2) {
+        List<String> minus = list1.stream().filter(item -> !list2.contains(item)).collect(Collectors.toList());
+        return minus;
+    }
     @Override
     public Map<String, Object> ReViewInfrastructureList(List<ZEngineeringInfrastructureVo> list) {
         Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
@@ -1035,6 +1046,9 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
             if (item.getEnginClassification().equals("每日施工日志")){
                 flag = "gy_log_every_day";
             }
+            if (item.getEnginClassification().equals("调压柜")){
+                flag = "gy_tyg";
+            }
             List stateList=new ArrayList();
             sysDictMap.get(flag).stream().forEach(item3 -> {
                 Map<String,Object> map=new HashMap<>();
@@ -1151,20 +1165,31 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
                 List<ZEngineeringReview> ReviewList = zEngineeringReviewMapper.selectList(lqw2);
                 LambdaQueryWrapper<ZEngineeringInfo> lqw3 = Wrappers.lambdaQuery();
                 lqw3.eq(StringUtils.isNotBlank(item2.getId()), ZEngineeringInfo::getEngInfoId, item2.getId());
-                List<String> infoList = zEngineeringInfoMapper.selectList(lqw3).stream().map(ZEngineeringInfo::getState).collect(Collectors.toList());
-//                if("底腿".equals(item2.getType())){
-                    if(infoList.size()>0&&!(infoList.contains(null)||infoList.contains("0")||infoList.contains(""))){
+                lqw3.orderByDesc(ZEngineeringInfo::getUpdateInfoTime);
+                List<ZEngineeringInfo> infoList = zEngineeringInfoMapper.selectList(lqw3);
+                List<String> infostateList = infoList.stream().map(ZEngineeringInfo::getState).collect(Collectors.toList());
+                if("底腿".equals(item2.getType())){
+                    if(infostateList.size()>0&&!infostateList.contains(null)&&!infostateList.contains("")){
                         if (ReviewList.size() > 0) {
                             nodeTypeList.add(ReviewList.get(0));
                         }
+                    }else{
+                        LambdaQueryWrapper<ZEngiineeringPhoto> lqw4 = Wrappers.lambdaQuery();
+                        lqw4.eq(!ObjectUtils.isEmpty(infoList),ZEngiineeringPhoto::getParentId, infoList.get(0).getId());
+                        List<String> photoList = izEngiineeringPhotoMapper.selectList(lqw4).stream().map(ZEngiineeringPhoto::getType).collect(Collectors.toList());
+                        if (photoList.size()>0 && (!photoList.contains("onTheDitch")||!photoList.contains("beforeBottom")||!photoList.contains("inferiorSulcus")||!photoList.contains("legBackfilling"))) {
+                            ZEngineeringReview ifhave = new ZEngineeringReview();
+                            ifhave.setEngInfoId(item2.getId());
+                            ifhave.setReviewStatus("99");
+                            ifhave.setReviewContent("有暂存");
+                            nodeTypeList.add(ifhave);
+                        }
                     }
-//                }else{
-//                    if(if(!(infoList.contains(null)||infoList.size()>0||infoList.contains(""))){
-//                        if (ReviewList.size() > 0) {
-//                            nodeTypeList.add(ReviewList.get(0));
-//                        }
-//                    }
-//                }
+                }else{
+                    if (ReviewList.size() > 0) {
+                        nodeTypeList.add(ReviewList.get(0));
+                    }
+                }
             });
             List stateList = new ArrayList();
             List<SysDictData> list = Collections.EMPTY_LIST;
@@ -1176,18 +1201,37 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
             if (list != null && !list.isEmpty()) {
                 list.stream().forEach(item3 -> {
                     Map<String, Object> map = new HashMap<>();
-                    if (nodeList.size() > 0 && nodeList.stream().anyMatch(x -> x.getType().equals(item3.getDictValue()))) {
-                        map.put("Type", item3.getDictValue());
-                        map.put("state", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewStatus() : "0");
-                        map.put("content", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewContent() : "暂未审核");
+//                    if (nodeList.size() > 0 && nodeList.stream().anyMatch(x -> x.getType().equals(item3.getDictValue()))) {
+//                        map.put("Type", item3.getDictValue());
+//                        map.put("state", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewStatus() : "0");
+//                        map.put("content", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewContent() : "暂未审核");
+//                    } else {
+//                        map.put("Type", item3.getDictValue());
+//                        map.put("state", "0");
+//                        map.put("content", "暂未审核");
+//                    }
+                    if (nodeList.size()>0&&nodeList.stream().anyMatch(x->x.getType().equals(item3.getDictValue()))){
+                        map.put("Type",item3.getDictValue());
+                        map.put("state",nodeTypeList.stream().anyMatch(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId()))?nodeTypeList.stream().filter(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewStatus():"0");
+                        map.put("content",nodeTypeList.stream().anyMatch(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId()))?nodeTypeList.stream().filter(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewContent():"暂未审核");
+                        String enginfoid = nodeTypeList.stream().anyMatch(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId()))?nodeTypeList.stream().filter(y->y.getEngInfoId().equals(nodeList.stream().filter(x->x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getEngInfoId():null;
+                        if(StringUtils.isNotBlank(enginfoid)&&!"2".equals(map.get("state").toString())){
+                            LambdaQueryWrapper<ZEngineeringInfo> lqw3 = Wrappers.lambdaQuery();
+                            lqw3.eq(ZEngineeringInfo::getEngInfoId, enginfoid);
+                            List<ZEngineeringInfo> info= zEngineeringInfoMapper.selectList(lqw3);
+                            if(ObjectUtils.isEmpty(info)){
+                                map.put("Type",item3.getDictValue());
+                                map.put("state","-1");
+                                map.put("content","无数据");
+                            }
+                        }
                     }else {
                         map.put("Type",item3.getDictValue());
-                        map.put("state","0");
-                        map.put("content","暂未审核");
+                        map.put("state","-1");
+                        map.put("content","无数据");
                     }
                     stateList.add(map);
                     ReViewStateMap.set(stateList);
-                    ;
                 });
             }
             if (item.getEnginClassification().contains("indoor_engin")) {
@@ -1204,6 +1248,59 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
         return statemap;
     }
 
+    @Override
+    public Map<String, Object> ReViewListColor(List<ZEngineeringCivilVo> zEngineeringCivilList) {
+        Map<String, List<SysDictData>> sysDictMap = RedisUtils.getCacheMap("sys_dict");
+        List<ZEngineeringReview> nodeTypeList = new ArrayList<>();
+        Map<String, Object> statemap = new HashMap<>();
+        List<Map<String, Object>> ReViewMap = new ArrayList<>();
+        AtomicReference<List<Map<String, Object>>> ReViewStateMap = new AtomicReference<>(new ArrayList<>());
+        zEngineeringCivilList.stream().forEach(item -> {
+            String date = new SimpleDateFormat("yyyy_MM").format(item.getCreateTime());
+            MonthTableNameHandler.setData(date);
+            LambdaQueryWrapper<ZEngineeringNode> lqw = Wrappers.lambdaQuery();
+            lqw.eq(StringUtils.isNotBlank(item.getId()), ZEngineeringNode::getCivliId, item.getId());
+            List<ZEngineeringNode> nodeList = baseMapper.selectList(lqw);
+            nodeList.stream().forEach(item2 -> {
+                LambdaQueryWrapper<ZEngineeringReview> lqw2 = Wrappers.lambdaQuery();
+                lqw2.eq(StringUtils.isNotBlank(item2.getId()), ZEngineeringReview::getEngInfoId, item2.getId()).orderByDesc(ZEngineeringReview::getReviewTime);
+                List<ZEngineeringReview> ReviewList = zEngineeringReviewMapper.selectList(lqw2);
+                    if (ReviewList.size() > 0) {
+                        nodeTypeList.add(ReviewList.get(0));
+                    }
+            });
+            List stateList = new ArrayList();
+            List<SysDictData> list = Collections.EMPTY_LIST;
+            if (item.getEnginClassification().equals("pressure_regulating")) {
+                list = sysDictMap.get("gy_tyg");
+            } else {
+                list = sysDictMap.get(item.getEnginType() + "_" + item.getEnginClassification());
+            }
+            if (list != null && !list.isEmpty()) {
+                list.stream().forEach(item3 -> {
+                    Map<String, Object> map = new HashMap<>();
+                    if (nodeList.size() > 0 && nodeList.stream().anyMatch(x -> x.getType().equals(item3.getDictValue()))) {
+                        map.put("Type", item3.getDictValue());
+                        map.put("state", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewStatus() : "0");
+                        map.put("content", nodeTypeList.stream().anyMatch(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())) ? nodeTypeList.stream().filter(y -> y.getEngInfoId().equals(nodeList.stream().filter(x -> x.getType().equals(item3.getDictValue())).collect(Collectors.toList()).get(0).getId())).collect(Collectors.toList()).get(0).getReviewContent() : "暂未审核");
+                    } else {
+                        map.put("Type", item3.getDictValue());
+                        map.put("state", "0");
+                        map.put("content", "暂未审核");
+                    }
+                    stateList.add(map);
+                    ReViewStateMap.set(stateList);
+                    ;
+                });
+            }
+            statemap.put(item.getId(), ReViewStateMap.get());
+
+            MonthTableNameHandler.removeData();
+        });
+
+        return statemap;
+    }
+
 
     /**
      * 保存前的数据校验

+ 1 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringReviewServiceImpl.java

@@ -77,10 +77,10 @@ public class ZEngineeringReviewServiceImpl implements IZEngineeringReviewService
     @DynamicName(spel = "#bo.createTime")
     public ZEngineeringReviewBo query(ZEngineeringNodeBo bo) {
         LambdaQueryWrapper<ZEngineeringReview> lqw = Wrappers.lambdaQuery();
-//        lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringReview::getEngInfoId, bo.getId()).orderByDesc(ZEngineeringReview::getUpdateInfoTime);
         lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringReview::getEngInfoId, bo.getId());
         lqw.eq(StringUtils.isNotBlank(bo.getReviewStatus()), ZEngineeringReview::getReviewStatus, bo.getReviewStatus());
         lqw.orderByDesc(ZEngineeringReview::getUpdateInfoTime);
+//        lqw.eq(StringUtils.isNotBlank(bo.getId()), ZEngineeringReview::getEngInfoId, bo.getId()).orderByDesc(ZEngineeringReview::getUpdateInfoTime);
         List<ZEngineeringReview> zEngineeringReviewList=baseMapper.selectList(lqw);
         if (zEngineeringReviewList.size()==0)
         {

+ 2 - 2
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEnginMaterialQualityMapper.xml

@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SET @nodeType = (select
             CASE
                 #{tableName}
-                WHEN 'z_engineering_gy' THEN (SELECT CASE engin_classification WHEN '室内管线' THEN '焊接' WHEN '室外管线' THEN '下管' END FROM z_engineering_gy  WHERE id = #{id} )
+                WHEN 'z_engineering_gy' THEN (SELECT CASE engin_classification WHEN '室内管线' THEN '焊接' WHEN '庭院' THEN '下管' END FROM z_engineering_gy  WHERE id = #{id} )
                 WHEN 'z_engineering_industry' THEN '下管'
                 WHEN 'z_engineering_pipe_jacking' THEN '回拖'
             END
@@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SET @nodeType = (select
             CASE
                 #{tableName}
-                WHEN 'z_engineering_gy' THEN (SELECT CASE engin_classification WHEN '室内管线' THEN 'gy_inner' WHEN '室外管线' THEN 'gy_out' WHEN '调压柜' THEN 'gy_tyg' END FROM z_engineering_gy  WHERE id = #{id})
+                WHEN 'z_engineering_gy' THEN (SELECT CASE engin_classification WHEN '室内管线' THEN 'gy_inner' WHEN '庭院' THEN 'gy_out' WHEN '调压柜' THEN 'gy_tyg' END FROM z_engineering_gy  WHERE id = #{id})
                 WHEN 'z_engineering_industry' THEN 'municipal_node_types'
                 WHEN 'z_engineering_pipe_jacking' THEN 'pipe_jack'
                 WHEN 'z_touch_operation_engineering' THEN (SELECT b.dict_type FROM z_touch_operation_engineering a JOIN sys_dict_type b ON a.mode_operation = b.dict_name WHERE id = #{id})

+ 476 - 182
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringCivilMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.zdsz.mapper.ZEngineeringCivilMapper">
 
     <resultMap type="com.ruoyi.zdsz.domain.ZEngineeringCivil" id="ZEngineeringCivilResult">
@@ -24,19 +24,133 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
     </resultMap>
+    <select id="exportObtainQualifiedRoom" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilObtainQualifiedRoom">
+        SELECT
+        concat( IFNULL( area, '' ), IFNULL( building, '' ), IFNULL( unit, '' ), IFNULL( house, '' ) ) ardds,
+        GROUP_CONCAT( type ) type
+        FROM
+        (
+        <foreach collection="tableNames" item="name" separator=" union all ">
+            select
+            e.dict_label,
+            e.dict_value,
+            ( SELECT NAME FROM z_area WHERE id = a.area_id ) area,
+            a.area_id area_id,
+            ( SELECT NAME FROM z_building WHERE id = a.building_id ) building,
+            ( SELECT IF(NAME='无',null,NAME) FROM z_unit WHERE id = a.unit_id ) unit,
+            ( SELECT NAME FROM z_house WHERE id = a.house_id ) house,
+            concat(b.type,'合格') type,
+            c.update_info_time time
+            FROM
+            z_engineering_civil a
+            LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
+            LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
+            LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
+            LEFT JOIN sys_dict_data e ON e.dict_value = a.district
+            WHERE
+            a.engin_type = 'old_renovation'
+            AND engin_classification = 'indoor_engin'
+            AND a.del_flag = 0
+            AND b.del_flag = 0
+            AND c.del_flag = 0
+            AND d.del_flag = 0
+            AND c.state = '1'
+            <if test="p.beginTime != null and p.beginTime != ''">
+                AND c.update_info_time BETWEEN concat( #{p.beginTime[0]}, ' 00:00:00' ) AND concat( #{p.beginTime[1]}, ' 23:59:59' )
+            </if>
+        </foreach>
+        ) z
+        where 1=1
+        <if test="p.district != null and p.district != ''">
+            AND z.dict_value = #{p.district}
+        </if>
+        <if test="p.areaId != null and p.areaId != ''">
+            AND z.area_id = #{p.areaId}
+        </if>
+        GROUP BY
+        z.area,
+        z.building,
+        z.unit,
+        z.house
+        HAVING
+        type LIKE '%拆旧管%'
+        AND type LIKE '%立杠%'
+        AND type LIKE '%表后管%'
+        AND type LIKE '%挂表%'
+        AND type LIKE '%阀管%'
+        ORDER BY
+        z.area,
+        z.building,
+        z.unit,
+        z.house
+    </select>
+    <select id="exportBottomLeg" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilBottomLegExport">
+        SELECT
+        concat( IFNULL( area, '' ), IFNULL( building, '' ), IFNULL( unit, '' ) ) 'ardds',
+        GROUP_CONCAT( concat( construct_addre, '第', number, '根',state ) ORDER BY number ) 'bottom_leg',
+        GROUP_CONCAT( time ORDER BY number ) '日期',
+        sum( if(state='合格',1,0) ) 'acceptance_number',
+        sum( if(state='不合格',1,0) ) 'disqualification_number'
+
+        FROM
+        (
+        <foreach collection="tableNames" item="name"  separator=" union all ">
+            SELECT
+            e.dict_label,
+            e.dict_value,
+            ( SELECT NAME FROM z_area WHERE id = a.area_id ) area,
+            a.area_id AS area_id,
+            ( SELECT NAME FROM z_building WHERE id = a.building_id ) building,
+            ( SELECT IF(NAME='无',null,NAME) FROM z_unit WHERE id = a.unit_id ) unit,
+            DATE_FORMAT( d.update_info_time, '%Y年%m月%d日 %H:%i:%S' ) time,
+            d.update_info_time AS update_info_time,
+            c.construct_addre,
+            d.number,
+            IF( c.state = '0', '不合格', '合格' ) state
+            FROM
+            z_engineering_civil a
+            LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
+            LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
+            LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
+            LEFT JOIN sys_dict_data e ON e.dict_value = a.district
+            WHERE
+            a.engin_type = 'old_renovation'
+            AND engin_classification = 'bottom_leg'
+            AND b.type = '底腿'
+            AND a.del_flag = 0
+            AND b.del_flag = 0
+            AND c.del_flag = 0
+            AND d.del_flag = 0
+            AND ( c.state = '0' OR c.state = '1' )
+        </foreach>
+        ) z
+        where 1=1
+        <if test="p.district != null and p.district != ''">
+            AND z.dict_value = #{p.district}
+        </if>
+        <if test="p.areaId != null and p.areaId != ''">
+            AND z.area_id = #{p.areaId}
+        </if>
+        GROUP BY
+        z.area,
+        z.building,
+        z.unit
+    </select>
 
     <select id="selectByDistrictStatistics" resultType="java.util.Map">
-        select aas.name AS name,
-               MAX(CASE aas.statu WHEN '未施工' THEN aas.num ELSE 0 END ) weishigong,
-               MAX(CASE aas.statu WHEN '施工中' THEN aas.num ELSE 0 END ) shigongzhong ,
-               MAX(CASE aas.statu WHEN '竣工' THEN aas.num ELSE 0 END ) jungong
-        FROM (SELECT
-                      (SELECT name FROM z_area WHERE id = al.zarea) AS name,
-                      IF(ISNULL(al.completion_status),'未施工',al.completion_status) AS statu,
-                      COUNT(ISNULL(al.completion_status)) AS num
-              FROM (SELECT zh.id zid, zh.area_id zarea,zec.* FROM z_house zh
-                                                                      LEFT JOIN z_engineering_civil zec on zec.house_id = zh.id
-                    WHERE zh.area_id in (SELECT id FROM z_area WHERE district = #{district} AND del_flag = '0')) al GROUP BY al.zarea,al.completion_status) aas group by aas.name
+        select aas.name AS                                               name,
+               MAX(CASE aas.statu WHEN '未施工' THEN aas.num ELSE 0 END) weishigong,
+               MAX(CASE aas.statu WHEN '施工中' THEN aas.num ELSE 0 END) shigongzhong,
+               MAX(CASE aas.statu WHEN '竣工' THEN aas.num ELSE 0 END)   jungong
+        FROM (SELECT (SELECT name FROM z_area WHERE id = al.zarea)                    AS name,
+                     IF(ISNULL(al.completion_status), '未施工', al.completion_status) AS statu,
+                     COUNT(ISNULL(al.completion_status))                              AS num
+              FROM (SELECT zh.id zid, zh.area_id zarea, zec.*
+                    FROM z_house zh
+                             LEFT JOIN z_engineering_civil zec on zec.house_id = zh.id
+                    WHERE zh.area_id in (SELECT id FROM z_area WHERE district = #{district} AND del_flag = '0')) al
+              GROUP BY al.zarea, al.completion_status) aas
+        group by aas.name
     </select>
 
     <select id="queryPageList" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilVo">
@@ -107,10 +221,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="p.enginCycle != null and p.enginCycle != ''">
             and engin_cycle = 0
         </if>
-        order by a.update_info_time desc
-            LIMIT #{page},#{size}
+        order by a.update_info_time asc
+        LIMIT #{page},#{size}
         ) AS at)
-        order by a.update_info_time desc
+        order by a.update_info_time asc
     </select>
     <select id="queryAllList" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilVo">
         select
@@ -164,8 +278,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         CONVERT ( REPLACE ( e.name, '号', '' ), UNSIGNED ) ASC
     </select>
     <select id="queryPageIdList" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilVo">
-       select
-       #{total} as total,
+        select
+        #{total} as total,
         a.*,
         if(b.name is null , '未知' ,b.NAME) AS areaName,
         if(c.name is null , '未知' ,c.NAME) AS buildingName,
@@ -178,10 +292,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join z_unit d on d.id = a.unit_id
         left join z_house e on e.id = a.house_id
         left join sys_dict_data f on f.dict_type = a.engin_type and f.dict_value = a.engin_classification
-        where a.id in  <foreach collection="idList" item="name" open="(" separator="," close=")">
-        #{name}
-    </foreach>
-        order by a.update_info_time desc
+        where a.id in
+        <foreach collection="idList" item="name" open="(" separator="," close=")">
+            #{name}
+        </foreach>
+        order by a.update_info_time asc
     </select>
 <select id="getObtainRoomcCompletionInformationList" resultType="com.ruoyi.zdsz.domain.vo.roomStatusVo">
     select
@@ -200,7 +315,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </if>
     LIMIT 1),'未施工')) AS roomStatus,
     b.create_time,
-    CAST(CONCAT( REPLACE ( bd.NAME, '栋', '' ),REPLACE ( c.NAME, '单元', '' )) AS SIGNED) AS unitOrder
+    CONCAT( REPLACE ( bd.NAME, '栋', '' ),REPLACE ( c.NAME, '单元', '' )) AS unitOrder
     FROM
     z_house a
     LEFT JOIN z_engineering_civil b ON a.id = b.house_id
@@ -224,7 +339,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and a.unit_id = #{unitId}
     </if>
     order by
-    unitOrder,
+    CAST(unitOrder AS SIGNED),
+    unitName,
     REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(a.`name`,')',''),'(',''),')',''),'(',''),'号','') ASC
 </select>
 
@@ -363,13 +479,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         WHERE
         zh.del_flag = 0
-          AND zh.area_id in
+        AND zh.area_id in
         <foreach collection="idList" item="name" open="(" separator="," close=")">
             #{name}
         </foreach>
         ORDER BY za.id ASC
     </select>
-    <select id="getAreaCompletionInformationList2"  resultType="com.ruoyi.zdsz.domain.vo.areaWillDoneVo">
+    <select id="getAreaCompletionInformationList2" resultType="com.ruoyi.zdsz.domain.vo.areaWillDoneVo">
         SELECT
         za.id as areaId,
         za.NAME,
@@ -393,68 +509,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY za.id ASC
     </select>
     <select id="getsumStatus" resultType="java.util.Map">
-        select
-            MAX(CASE aas.statu WHEN '未施工' THEN aas.num ELSE 0 END ) weishigong,
-            MAX(CASE aas.statu WHEN '施工中' THEN aas.num ELSE 0 END ) shigongzhong ,
-            MAX(CASE aas.statu WHEN '竣工' THEN aas.num ELSE 0 END ) jungong
-        FROM (
-                 SELECT
-
-                     al.completion_status AS statu,
+        select MAX(CASE aas.statu WHEN '未施工' THEN aas.num ELSE 0 END) weishigong,
+               MAX(CASE aas.statu WHEN '施工中' THEN aas.num ELSE 0 END) shigongzhong,
+               MAX(CASE aas.statu WHEN '竣工' THEN aas.num ELSE 0 END)   jungong
+        FROM (SELECT al.completion_status                AS statu,
                      COUNT(ISNULL(al.completion_status)) AS num
-                 FROM (
-                          SELECT
-                              IF(ISNULL(zec.completion_status),'未施工',zec.completion_status) completion_status
-                          FROM z_house zh
-                                   LEFT JOIN z_engineering_civil zec on zec.house_id = zh.id and zec.del_flag = '0'
-                          WHERE zh.area_id IN (SELECT id FROM z_area za WHERE za.district = #{district} and za.del_flag = '0')
-                      ) al GROUP BY al.completion_status) aas
+              FROM (SELECT IF(ISNULL(zec.completion_status), '未施工', zec.completion_status) completion_status
+                    FROM z_house zh
+                             LEFT JOIN z_engineering_civil zec on zec.house_id = zh.id and zec.del_flag = '0'
+                    WHERE zh.area_id IN
+                          (SELECT id FROM z_area za WHERE za.district = #{district} and za.del_flag = '0')) al
+              GROUP BY al.completion_status) aas
     </select>
     <select id="getHouseMessage" resultType="com.ruoyi.zdsz.domain.vo.areaMessageVo">
-        SELECT
-            a.`name` AS houseId,
-            b.`name` AS unitId,
-            c.`name` AS buildingId,
-            d.name AS areaId,
-            e.dict_label AS district
-        FROM
-            z_house a
-                LEFT JOIN z_unit b ON a.unit_id=b.id
-                LEFT JOIN z_building c ON a.building_id=c.id
-                LEFT JOIN z_area d ON a.area_id=d.id
-                LEFT JOIN sys_dict_data e ON e.dict_value=d.district
-        WHERE
-            a.id = #{id}
- </select>
+        SELECT a.`name`     AS houseId,
+               b.`name`     AS unitId,
+               c.`name`     AS buildingId,
+               d.name       AS areaId,
+               e.dict_label AS district
+        FROM z_house a
+                 LEFT JOIN z_unit b ON a.unit_id = b.id
+                 LEFT JOIN z_building c ON a.building_id = c.id
+                 LEFT JOIN z_area d ON a.area_id = d.id
+                 LEFT JOIN sys_dict_data e ON e.dict_value = d.district
+        WHERE a.id = #{id}
+    </select>
     <select id="getAreaMessage" resultType="com.ruoyi.zdsz.domain.vo.areaMessageVo">
-        SELECT
-            a.`name` AS buildingId,
-            d.name AS areaId,
-            e.dict_label AS district
-        FROM
-            z_building a
-                LEFT JOIN z_area d ON a.area_id=d.id
-                LEFT JOIN sys_dict_data e ON e.dict_value=d.district
-        WHERE
-            a.id = #{id}
+        SELECT a.`name`     AS buildingId,
+               d.name       AS areaId,
+               e.dict_label AS district
+        FROM z_building a
+                 LEFT JOIN z_area d ON a.area_id = d.id
+                 LEFT JOIN sys_dict_data e ON e.dict_value = d.district
+        WHERE a.id = #{id}
     </select>
     <select id="getAreaName" resultType="com.ruoyi.zdsz.domain.vo.areaMessageVo">
-        SELECT
-            a.`name` AS areaId,
-            e.dict_label AS district
-        FROM
-            z_area a
-                LEFT JOIN sys_dict_data e ON e.dict_value = a.district
-        WHERE
-            a.id = #{id}
+        SELECT a.`name`     AS areaId,
+               e.dict_label AS district
+        FROM z_area a
+                 LEFT JOIN sys_dict_data e ON e.dict_value = a.district
+        WHERE a.id = #{id}
     </select>
     <select id="getTableNames" resultType="String">
-        SELECT
-            table_name as tableName
-        FROM
-            information_schema.TABLES
-        WHERE
-            table_name like CONCAT(#{tableName},'%') GROUP BY table_name
+        SELECT table_name as tableName
+        FROM information_schema.TABLES
+        WHERE table_name like CONCAT(#{tableName}, '%')
+        GROUP BY table_name
     </select>
     <select id="getsumId" resultType="com.ruoyi.zdsz.domain.bo.ZEngineeringInfoBo">
         SELECT
@@ -462,12 +562,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         z_engineering_info
         WHERE
-            1=1
+        1=1
         <if test="createTime != null and createTime != ''">
             and update_info_time between #{createTime[0]} and #{createTime[1]}
         </if>
         <if test="UserName != null and UserName != ''">
-        and create_by like CONCAT('%',#{UserName},'%')
+            and create_by like CONCAT('%',#{UserName},'%')
         </if>
         <foreach collection="tableNames" item="name">
             union
@@ -478,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             WHERE
             1=1
             <if test="createTime != null and createTime != ''">
-              and  update_info_time between #{createTime[0]} and #{createTime[1]}
+                and update_info_time between #{createTime[0]} and #{createTime[1]}
             </if>
             <if test="UserName != null and UserName != ''">
                 and create_by like CONCAT('%',#{UserName},'%')
@@ -488,14 +588,99 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     <select id="getexportList" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilExportVo">
         select * from (
+        SELECT
+        a.id,
+        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
+        g.`name` AS area_id,
+        h.`name` AS building_id,
+        i.`name` AS unit_id,
+        j.`name` AS house_id,
+        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS
+        source,
+        k.dict_label AS engin_classification,
+        CASE
+        a.engin_type
+        WHEN 'new_built' THEN
+        '新建' ELSE '旧改'
+        END AS engin_type,
+        a.completion_status,
+        b.type,
+        c.construct_addre,
+        c.construct_according_drawings,
+        c.segmented_compression_qualified,
+        c.backfill_time,
+        c.construct_phone,
+        c.construct_time,
+        c.head_name,
+        c.head_phone,
+        d.visit_type,
+        d.corrosion_level AS corrosion_level,
+        n.name as self_closing_valve_type,
+        m.name as brand,
+        e.`name` AS material_quality,
+        f.`name` AS specifications,
+        d.number,
+        c.update_info_time as updateInfoTime,
+        c.create_by as createBy,
+        c.remark,
+        d.remark as remarkd
+        FROM
+        z_engineering_civil a
+        LEFT JOIN z_engineering_node b ON a.id = b.civli_id
+        LEFT JOIN z_engineering_info c ON b.id = c.eng_info_id
+        LEFT JOIN z_engineering_material d ON c.id = d.details_id
+        LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
+        LEFT JOIN z_engin_specifications f ON f.id = d.specifications
+        LEFT JOIN z_area g ON g.id = a.area_id
+        LEFT JOIN z_building h ON h.id = a.building_id
+        LEFT JOIN z_unit i ON i.id = a.unit_id
+        LEFT JOIN z_house j ON j.id = a.house_id
+        LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
+        AND k.dict_value = a.engin_classification
+        LEFT JOIN z_engin_material_quality l ON l.id = d.corrosion_level
+        LEFT JOIN z_engin_material_quality m ON m.id = d.brand
+        LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
+        WHERE
+        a.create_time LIKE CONCAT(REPLACE(#{createTime}, '_', '-'),'%')
+        <if test="p.district != null and p.district != ''">
+            and a.district = #{p.district}
+        </if>
+        <if test="p.areaId != null and p.areaId != ''">
+            and a.area_id = #{p.areaId}
+        </if>
+        <if test="p.buildingId != null and p.buildingId != ''">
+            and a.building_id = #{p.buildingId}
+        </if>
+        <if test="p.unitId != null and p.unitId != ''">
+            and a.unit_id = #{p.unitId}
+        </if>
+        <if test="p.enginType != null and p.enginType != ''">
+            and a.engin_type = #{p.enginType}
+        </if>
+        <if test="p.enginClassification != null and p.enginClassification != ''">
+            and a.engin_classification = #{p.enginClassification}
+        </if>
+        <if test="p.enginCycle != null and p.enginCycle != ''">
+            and a.engin_cycle = 0
+        </if>
+        <if test="p.beginTime != null and p.beginTime != ''">
+            and c.update_info_time between #{p.beginTime[0]} and #{p.beginTime[1]}
+        </if>
+        <if test="p.createBy != null and p.createBy != ''">
+            and c.create_by like CONCAT(#{p.createBy},'%')
+        </if>
+        <foreach collection="tableNames" item="name">
+            union
             SELECT
             a.id,
-            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
+            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS
+            district,
             g.`name` AS area_id,
             h.`name` AS building_id,
             i.`name` AS unit_id,
             j.`name` AS house_id,
-            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS source,
+            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS
+            source,
             k.dict_label AS engin_classification,
             CASE
             a.engin_type
@@ -524,10 +709,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             c.remark,
             d.remark as remarkd
             FROM
-                z_engineering_civil a
-            LEFT JOIN z_engineering_node b ON a.id = b.civli_id
-            LEFT JOIN z_engineering_info c ON b.id = c.eng_info_id
-            LEFT JOIN z_engineering_material d ON c.id = d.details_id
+            z_engineering_civil a
+            LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
+            LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
+            LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
             LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
             LEFT JOIN z_engin_specifications f ON f.id = d.specifications
             LEFT JOIN z_area g ON g.id = a.area_id
@@ -536,11 +721,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN z_house j ON j.id = a.house_id
             LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
             AND k.dict_value = a.engin_classification
-            LEFT JOIN z_engin_material_quality l ON l.id = d.corrosion_level
+            LEFT JOIN z_engin_specifications l ON l.id = d.corrosion_level
             LEFT JOIN z_engin_material_quality m ON m.id = d.brand
             LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
             WHERE
-             a.create_time LIKE CONCAT(REPLACE(#{createTime}, '_', '-'),'%')
+            a.create_time LIKE CONCAT(REPLACE(#{name}, '_', '-'),'%')
             <if test="p.district != null and p.district != ''">
                 and a.district = #{p.district}
             </if>
@@ -563,94 +748,200 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and a.engin_cycle = 0
             </if>
             <if test="p.beginTime != null and p.beginTime != ''">
-                and  c.update_info_time between #{beginTime[0]} and #{beginTime[1]}
+                and c.update_info_time between #{p.beginTime[0]} and #{p.beginTime[1]}
+            </if>
+            <if test="p.createBy != null and p.createBy != ''">
+                and c.create_by like CONCAT(#{p.createBy},'%')
+            </if>
+        </foreach>
+        union SELECT
+        a.id,
+        b.dict_label as district,
+        a.area_name as area_id,
+        a.building_name as building_id,
+        a.unit_name as unit_id,
+        a.house_name as house_id,
+        e.dict_label as source,
+        '室内' AS engin_classification,
+        CASE
+        a.engin_type
+        WHEN 'new_built' THEN
+        '新建' ELSE '旧改'
+        END as engin_type,
+        concat(c.dict_label,'——',a.remark) as completion_status,
+        null AS type,
+        null AS construct_addre,
+        null AS construct_according_drawings,
+        null AS segmented_compression_qualified,
+        null AS backfill_time,
+        null AS construct_phone,
+        null AS construct_time,
+        null AS head_name,
+        null AS head_phone,
+        null AS visit_type,
+        null AS corrosion_level,
+        null AS self_closing_valve_type,
+        null AS brand,
+        null AS material_quality,
+        null AS specifications,
+        null AS number,
+        null AS updateInfoTime,
+        null AS createBy,
+        null AS remark,
+        null AS remarkd
+        FROM
+        z_engin_not_installed a
+        LEFT JOIN sys_dict_data b ON a.district = b.dict_value AND b.dict_type = 'district'
+        LEFT JOIN sys_dict_data c ON a.type = c.dict_value and c.dict_type = 'not_installed_type'
+        left join z_house d on a.house_id=d.id
+        LEFT JOIN sys_dict_data e ON d.source = e.dict_value and e.dict_type = 'community_source'
+        where a.del_flag = 0
+        and d.del_flag = 0
+        <if test="p.district != null and p.district != ''">
+            and a.district = #{p.district}
+        </if>
+        <if test="p.areaId != null and p.areaId != ''">
+            and a.area_id = #{p.areaId}
+        </if>
+        <if test="p.buildingId != null and p.buildingId != ''">
+            and a.building_id = #{p.buildingId}
+        </if>
+        <if test="p.unitId != null and p.unitId != ''">
+            and a.unit_id = #{p.unitId}
+        </if>
+        <if test="p.houseId != null and p.houseId != ''">
+            and a.unit_id = #{p.houseId}
+        </if>
+        <if test="p.enginType != null and p.enginType != ''">
+            and a.engin_type = #{p.enginType}
+        </if>
+        <if test="p.beginTime != null and p.beginTime != ''">
+            and a.create_time between #{p.beginTime[0]} and #{p.beginTime[1]}
+        </if>
+        <if test="p.createBy != null and p.createBy != ''">
+            and a.create_by like CONCAT(#{p.createBy},'%')
+        </if>
+        ) z
+        ORDER BY
+        z.area_id,
+        CONVERT ( REPLACE ( z.building_id, '栋', '' ), UNSIGNED ),
+        CONVERT ( REPLACE ( z.unit_id, '单元', '' ), UNSIGNED ),
+        CONVERT ( REPLACE ( z.house_id, '号', '' ), UNSIGNED ) ASC
+    </select>
+    <select id="getexportListColor" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilExportVo">
+        select * from (
+        SELECT
+        a.id,
+        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
+        g.`name` AS area_id,
+        h.`name` AS building_id,
+        i.`name` AS unit_id,
+        j.`name` AS house_id,
+        (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS
+        source,
+        k.dict_label AS engin_classification,
+        CASE
+        a.engin_type
+        WHEN 'new_built' THEN
+        '新建' ELSE '旧改'
+        END AS engin_type,
+        a.completion_status,
+        b.type,
+        (select r.review_status from z_engineering_review r where b.id=r.eng_info_id ORDER BY r.review_time desc LIMIT 1
+        ) AS reviewStatus
+        FROM
+        z_engineering_civil a
+        LEFT JOIN z_engineering_node b ON a.id = b.civli_id
+        LEFT JOIN z_area g ON g.id = a.area_id
+        LEFT JOIN z_building h ON h.id = a.building_id
+        LEFT JOIN z_unit i ON i.id = a.unit_id
+        LEFT JOIN z_house j ON j.id = a.house_id
+        LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
+        AND k.dict_value = a.engin_classification
+        WHERE
+        a.create_time LIKE CONCAT(REPLACE(#{createTime}, '_', '-'),'%')
+        <if test="p.district != null and p.district != ''">
+            and a.district = #{p.district}
+        </if>
+        <if test="p.areaId != null and p.areaId != ''">
+            and a.area_id = #{p.areaId}
+        </if>
+        <if test="p.buildingId != null and p.buildingId != ''">
+            and a.building_id = #{p.buildingId}
+        </if>
+        <if test="p.unitId != null and p.unitId != ''">
+            and a.unit_id = #{p.unitId}
+        </if>
+        <if test="p.enginType != null and p.enginType != ''">
+            and a.engin_type = #{p.enginType}
+        </if>
+        <if test="p.enginClassification != null and p.enginClassification != ''">
+            and a.engin_classification = #{p.enginClassification}
+        </if>
+        <if test="p.enginCycle != null and p.enginCycle != ''">
+            and a.engin_cycle = 0
+        </if>
+        <if test="p.createBy != null and p.createBy != ''">
+            and c.create_by like CONCAT(#{p.createBy},'%')
+        </if>
+        <foreach collection="tableNames" item="name">
+            union
+            SELECT
+            a.id,
+            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS
+            district,
+            g.`name` AS area_id,
+            h.`name` AS building_id,
+            i.`name` AS unit_id,
+            j.`name` AS house_id,
+            (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS
+            source,
+            k.dict_label AS engin_classification,
+            CASE
+            a.engin_type
+            WHEN 'new_built' THEN
+            '新建' ELSE '旧改'
+            END AS engin_type,
+            a.completion_status,
+            b.type,
+            (select r.review_status from z_engineering_review_${name} r where b.id=r.eng_info_id ORDER BY r.review_time
+            desc LIMIT 1 ) AS reviewStatus
+            FROM
+            z_engineering_civil a
+            LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
+            LEFT JOIN z_area g ON g.id = a.area_id
+            LEFT JOIN z_building h ON h.id = a.building_id
+            LEFT JOIN z_unit i ON i.id = a.unit_id
+            LEFT JOIN z_house j ON j.id = a.house_id
+            LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
+            AND k.dict_value = a.engin_classification
+            WHERE
+            a.create_time LIKE CONCAT(REPLACE(#{name}, '_', '-'),'%')
+            <if test="p.district != null and p.district != ''">
+                and a.district = #{p.district}
+            </if>
+            <if test="p.areaId != null and p.areaId != ''">
+                and a.area_id = #{p.areaId}
+            </if>
+            <if test="p.buildingId != null and p.buildingId != ''">
+                and a.building_id = #{p.buildingId}
+            </if>
+            <if test="p.unitId != null and p.unitId != ''">
+                and a.unit_id = #{p.unitId}
+            </if>
+            <if test="p.enginType != null and p.enginType != ''">
+                and a.engin_type = #{p.enginType}
+            </if>
+            <if test="p.enginClassification != null and p.enginClassification != ''">
+                and a.engin_classification = #{p.enginClassification}
+            </if>
+            <if test="p.enginCycle != null and p.enginCycle != ''">
+                and a.engin_cycle = 0
             </if>
             <if test="p.createBy != null and p.createBy != ''">
                 and c.create_by like CONCAT(#{p.createBy},'%')
             </if>
-            <foreach collection="tableNames" item="name">
-                union
-                SELECT
-                a.id,
-                (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'district' AND dict_value = a.district) AS district,
-                g.`name` AS area_id,
-                h.`name` AS building_id,
-                i.`name` AS unit_id,
-                j.`name` AS house_id,
-                (SELECT dict_label FROM `sys_dict_data` WHERE dict_type = 'community_source' AND dict_value = j.`source`) AS source,
-                k.dict_label AS engin_classification,
-                CASE
-                a.engin_type
-                WHEN 'new_built' THEN
-                '新建' ELSE '旧改'
-                END AS engin_type,
-                a.completion_status,
-                b.type,
-                c.construct_addre,
-                c.construct_according_drawings,
-                c.segmented_compression_qualified,
-                c.backfill_time,
-                c.construct_phone,
-                c.construct_time,
-                c.head_name,
-                c.head_phone,
-                d.visit_type,
-                d.corrosion_level AS corrosion_level,
-                n.name as self_closing_valve_type,
-                m.name as brand,
-                e.`name` AS material_quality,
-                f.`name` AS specifications,
-                d.number,
-                c.update_info_time as updateInfoTime,
-                c.create_by as createBy,
-                c.remark,
-                d.remark as remarkd
-                FROM
-                z_engineering_civil a
-                LEFT JOIN z_engineering_node_${name} b ON a.id = b.civli_id
-                LEFT JOIN z_engineering_info_${name} c ON b.id = c.eng_info_id
-                LEFT JOIN z_engineering_material_${name} d ON c.id = d.details_id
-                LEFT JOIN z_engin_material_quality e ON e.id = d.material_quality
-                LEFT JOIN z_engin_specifications f ON f.id = d.specifications
-                LEFT JOIN z_area g ON g.id = a.area_id
-                LEFT JOIN z_building h ON h.id = a.building_id
-                LEFT JOIN z_unit i ON i.id = a.unit_id
-                LEFT JOIN z_house j ON j.id = a.house_id
-                LEFT JOIN sys_dict_data k ON k.dict_type = a.engin_type
-                AND k.dict_value = a.engin_classification
-                LEFT JOIN z_engin_specifications l ON l.id = d.corrosion_level
-                LEFT JOIN z_engin_material_quality m ON m.id = d.brand
-                LEFT JOIN z_engin_material_quality n ON n.id = d.self_closing_valve_type
-                WHERE
-                 a.create_time LIKE CONCAT(REPLACE(#{name}, '_', '-'),'%')
-                <if test="p.district != null and p.district != ''">
-                    and a.district = #{p.district}
-                </if>
-                <if test="p.areaId != null and p.areaId != ''">
-                    and a.area_id = #{p.areaId}
-                </if>
-                <if test="p.buildingId != null and p.buildingId != ''">
-                    and a.building_id = #{p.buildingId}
-                </if>
-                <if test="p.unitId != null and p.unitId != ''">
-                    and a.unit_id = #{p.unitId}
-                </if>
-                <if test="p.enginType != null and p.enginType != ''">
-                    and a.engin_type = #{p.enginType}
-                </if>
-                <if test="p.enginClassification != null and p.enginClassification != ''">
-                    and a.engin_classification = #{p.enginClassification}
-                </if>
-                <if test="p.enginCycle != null and p.enginCycle != ''">
-                    and a.engin_cycle = 0
-                </if>
-                <if test="p.beginTime != null and p.beginTime != ''">
-                    and  c.update_info_time between #{beginTime[0]} and #{beginTime[1]}
-                </if>
-                <if test="p.createBy != null and p.createBy != ''">
-                    and c.create_by like CONCAT(#{p.createBy},'%')
-                </if>
-            </foreach>
+        </foreach>
         ) z
         ORDER BY
         z.area_id,
@@ -666,8 +957,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
         a.*
         FROM
-        z_engineering_civil  a
-        LEFT JOIN  z_engineering_node b ON a.id=b.civli_id
+        z_engineering_civil a
+        LEFT JOIN z_engineering_node b ON a.id=b.civli_id
         where 1=1
         <if test="p.district != null and p.district != ''">
             and a.district = #{p.district}
@@ -691,7 +982,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             and a.engin_cycle = 0
         </if>
         <if test="p.beginTime != null and p.beginTime != ''">
-            and  c.update_info_time between #{beginTime[0]} and #{beginTime[1]}
+            and a.update_info_time between #{p.beginTime[0]} and #{p.beginTime[1]}
         </if>
         <if test="p.type != null and p.type != ''">
             and b.type =#{p.type}
@@ -701,8 +992,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             SELECT
             a.*
             FROM
-            z_engineering_civil  a
-            LEFT JOIN  z_engineering_node_${name} b ON a.id=b.civli_id
+            z_engineering_civil a
+            LEFT JOIN z_engineering_node_${name} b ON a.id=b.civli_id
             where 1=1
             <if test="p.district != null and p.district != ''">
                 and a.district = #{p.district}
@@ -726,12 +1017,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 and a.engin_cycle = 0
             </if>
             <if test="p.beginTime != null and p.beginTime != ''">
-                and  a.update_info_time between #{beginTime[0]} and #{beginTime[1]}
+                and a.update_info_time between #{p.beginTime[0]} and #{p.beginTime[1]}
             </if>
             <if test="p.type != null and p.type != ''">
                 and b.type =#{p.type}
             </if>
         </foreach>
-                                                     ) as c
+        ) as c
+    </select>
+    <select id="getexportNotInstalled" resultType="com.ruoyi.zdsz.domain.vo.ZEngineeringCivilExportVo">
+
     </select>
 </mapper>

+ 25 - 15
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringNodeMapper.xml

@@ -19,22 +19,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
     <select id="selectNodeListByMonth" resultMap="ZEngineeringNodeResult">
         <foreach collection="monthList" item="month" open="" separator=" union all " close="">
-            SELECT DISTINCT a.*
-            FROM
-            z_engineering_node_${month} a
-            left join z_engineering_info_${month} b on a.id=b.eng_info_id and b.del_flag=0
-            WHERE
-            a.del_flag = 0
-            AND a.type = #{type}
-            and a.civli_id in
-            <foreach collection="civilIds" item="id" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-            <if test="state == 2" >
-                and state is null
+            <if test="state != 99" >
+                SELECT DISTINCT a.*,b.id
+                FROM
+                z_engineering_node_${month} a
+                left join z_engineering_info_${month} b on a.id=b.eng_info_id and b.del_flag=0
+                WHERE
+                a.del_flag = 0
+                AND a.type = #{type}
+                and a.civli_id in
+                <foreach collection="civilIds" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+                <if test="state == 2" >
+                    and (state is null or state = '')
+                </if>
+                <if test="state != 2" >
+                    and state = #{state}
+                </if>
+                HAVING b.id is not null
             </if>
-            <if test="state != 2" >
-                and state = #{state}
+            <if test="state == 99" >
+                select a.* from z_engineering_node_${month} a where a.del_flag = 0 AND a.type = #{type}
+                and a.civli_id in
+                <foreach collection="civilIds" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
             </if>
         </foreach>
     </select>