wang_xy 11 kuukautta sitten
vanhempi
commit
cc190ca2aa

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringCivilController.java

@@ -143,6 +143,16 @@ public class ZEngineeringCivilController extends BaseController {
     }
 
     /**
+     * 获取民用工程底腿暂存功能信息查询
+     *
+     * @param id 主键
+     */
+    @GetMapping("/lowerStaging")
+    public R<ZEngineeringCivilVo> lowerStaging(String areaId,String buildingId,String unitId, String direction ,String number) {
+        return R.ok(iZEngineeringCivilService.lowerStaging(areaId,buildingId,unitId,direction,number));
+    }
+
+    /**
      * 新增民用工程
      */
 

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringGasOpeningController.java

@@ -65,7 +65,7 @@ public class ZEngineeringGasOpeningController extends BaseController {
     @PostMapping("/export")
     public void export(ZEngineeringGasOpeningBo bo, HttpServletResponse response) {
         List<ZEngineeringGasOpeningVo> list = iZEngineeringGasOpeningService.queryList(bo);
-        ExcelUtil.exportExcel(list, "带气封堵施工", ZEngineeringGasOpeningVo.class, response);
+        ExcelUtil.exportExcel(list, "开栓施工", ZEngineeringGasOpeningVo.class, response);
     }
 
     /**

+ 0 - 45
ruoyi-admin/src/test/java/com/ruoyi/test/AssertUnitTest.java

@@ -1,45 +0,0 @@
-package com.ruoyi.test;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-
-/**
- * 断言单元测试案例
- *
- * @author Lion Li
- */
-@DisplayName("断言单元测试案例")
-public class AssertUnitTest {
-
-    @DisplayName("测试 assertEquals 方法")
-    @Test
-    public void testAssertEquals() {
-        Assertions.assertEquals("666", new String("666"));
-        Assertions.assertNotEquals("666", new String("666"));
-    }
-
-    @DisplayName("测试 assertSame 方法")
-    @Test
-    public void testAssertSame() {
-        Object obj = new Object();
-        Object obj1 = obj;
-        Assertions.assertSame(obj, obj1);
-        Assertions.assertNotSame(obj, obj1);
-    }
-
-    @DisplayName("测试 assertTrue 方法")
-    @Test
-    public void testAssertTrue() {
-        Assertions.assertTrue(true);
-        Assertions.assertFalse(true);
-    }
-
-    @DisplayName("测试 assertNull 方法")
-    @Test
-    public void testAssertNull() {
-        Assertions.assertNull(null);
-        Assertions.assertNotNull(null);
-    }
-
-}

+ 0 - 70
ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java

@@ -1,70 +0,0 @@
-package com.ruoyi.test;
-
-import com.ruoyi.common.config.RuoYiConfig;
-import org.junit.jupiter.api.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * 单元测试案例
- *
- * @author Lion Li
- */
-@SpringBootTest // 此注解只能在 springboot 主包下使用 需包含 main 方法与 yml 配置文件
-@DisplayName("单元测试案例")
-public class DemoUnitTest {
-
-    @Autowired
-    private RuoYiConfig ruoYiConfig;
-
-    @DisplayName("测试 @SpringBootTest @Test @DisplayName 注解")
-    @Test
-    public void testTest() {
-        System.out.println(ruoYiConfig);
-    }
-
-    @Disabled
-    @DisplayName("测试 @Disabled 注解")
-    @Test
-    public void testDisabled() {
-        System.out.println(ruoYiConfig);
-    }
-
-    @Timeout(value = 2L, unit = TimeUnit.SECONDS)
-    @DisplayName("测试 @Timeout 注解")
-    @Test
-    public void testTimeout() throws InterruptedException {
-        Thread.sleep(3000);
-        System.out.println(ruoYiConfig);
-    }
-
-
-    @DisplayName("测试 @RepeatedTest 注解")
-    @RepeatedTest(3)
-    public void testRepeatedTest() {
-        System.out.println(666);
-    }
-
-    @BeforeAll
-    public static void testBeforeAll() {
-        System.out.println("@BeforeAll ==================");
-    }
-
-    @BeforeEach
-    public void testBeforeEach() {
-        System.out.println("@BeforeEach ==================");
-    }
-
-    @AfterEach
-    public void testAfterEach() {
-        System.out.println("@AfterEach ==================");
-    }
-
-    @AfterAll
-    public static void testAfterAll() {
-        System.out.println("@AfterAll ==================");
-    }
-
-}

+ 0 - 72
ruoyi-admin/src/test/java/com/ruoyi/test/ParamUnitTest.java

@@ -1,72 +0,0 @@
-package com.ruoyi.test;
-
-import com.ruoyi.common.enums.UserType;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.EnumSource;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.junit.jupiter.params.provider.NullSource;
-import org.junit.jupiter.params.provider.ValueSource;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-/**
- * 带参数单元测试案例
- *
- * @author Lion Li
- */
-@DisplayName("带参数单元测试案例")
-public class ParamUnitTest {
-
-    @DisplayName("测试 @ValueSource 注解")
-    @ParameterizedTest
-    @ValueSource(strings = {"t1", "t2", "t3"})
-    public void testValueSource(String str) {
-        System.out.println(str);
-    }
-
-    @DisplayName("测试 @NullSource 注解")
-    @ParameterizedTest
-    @NullSource
-    public void testNullSource(String str) {
-        System.out.println(str);
-    }
-
-    @DisplayName("测试 @EnumSource 注解")
-    @ParameterizedTest
-    @EnumSource(UserType.class)
-    public void testEnumSource(UserType type) {
-        System.out.println(type.getUserType());
-    }
-
-    @DisplayName("测试 @MethodSource 注解")
-    @ParameterizedTest
-    @MethodSource("getParam")
-    public void testMethodSource(String str) {
-        System.out.println(str);
-    }
-
-    public static Stream<String> getParam() {
-        List<String> list = new ArrayList<>();
-        list.add("t1");
-        list.add("t2");
-        list.add("t3");
-        return list.stream();
-    }
-
-    @BeforeEach
-    public void testBeforeEach() {
-        System.out.println("@BeforeEach ==================");
-    }
-
-    @AfterEach
-    public void testAfterEach() {
-        System.out.println("@AfterEach ==================");
-    }
-
-
-}

+ 0 - 54
ruoyi-admin/src/test/java/com/ruoyi/test/TagUnitTest.java

@@ -1,54 +0,0 @@
-package com.ruoyi.test;
-
-import org.junit.jupiter.api.*;
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * 标签单元测试案例
- *
- * @author Lion Li
- */
-@SpringBootTest
-@DisplayName("标签单元测试案例")
-public class TagUnitTest {
-
-    @Tag("dev")
-    @DisplayName("测试 @Tag dev")
-    @Test
-    public void testTagDev() {
-        System.out.println("dev");
-    }
-
-    @Tag("prod")
-    @DisplayName("测试 @Tag prod")
-    @Test
-    public void testTagProd() {
-        System.out.println("prod");
-    }
-
-    @Tag("local")
-    @DisplayName("测试 @Tag local")
-    @Test
-    public void testTagLocal() {
-        System.out.println("local");
-    }
-
-    @Tag("exclude")
-    @DisplayName("测试 @Tag exclude")
-    @Test
-    public void testTagExclude() {
-        System.out.println("exclude");
-    }
-
-    @BeforeEach
-    public void testBeforeEach() {
-        System.out.println("@BeforeEach ==================");
-    }
-
-    @AfterEach
-    public void testAfterEach() {
-        System.out.println("@AfterEach ==================");
-    }
-
-
-}

+ 12 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -12,7 +12,10 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 时间工具类
@@ -165,4 +168,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
         return Date.from(zdt.toInstant());
     }
+
+    public static List<String> getMonthsBetween(LocalDate startDate, LocalDate endDate) {
+        List<String> months = new ArrayList<>();
+        while (!startDate.isAfter(endDate)) {
+            months.add(startDate.getYear()+"_"+(startDate.getMonthValue()>9?startDate.getMonthValue():"0"+startDate.getMonthValue()));
+            startDate = startDate.plus(1, ChronoUnit.MONTHS);
+        }
+        return months;
+    }
 }

+ 10 - 17
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringGasOpeningVo.java

@@ -3,6 +3,8 @@ package com.ruoyi.zdsz.domain.vo;
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ruoyi.common.annotation.ExcelDictFormat;
+import com.ruoyi.common.convert.ExcelDictConvert;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.zdsz.domain.bo.ZEngineeringNodeBo;
 import lombok.Data;
@@ -24,109 +26,101 @@ public class ZEngineeringGasOpeningVo extends BaseEntity {
     /**
      *
      */
-    @ExcelProperty(value = "")
     private String id;
-
+    @ExcelProperty(value = "是否合格", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "gas_state")
     private String state;
 
     /**
      * 工程类型
      */
-    @ExcelProperty(value = "工程类型")
+
     private String enginType;
 
     /**
      * 行政区
      */
     private String district;
+    @ExcelProperty(value = "行政区")
     private String districtName;
     /**
      * 小区id
      */
     private String areaId;
+    @ExcelProperty(value = "小区")
     private String areaName;
     /**
      * 楼栋id
      */
     private String buildingId;
+    @ExcelProperty(value = "楼栋")
     private String buildingName;
     /**
      * 单元id
      */
     private String unitId;
+    @ExcelProperty(value = "单元")
     private String unitName;
     /**
      * 房间id
      */
     private String houseId;
+    @ExcelProperty(value = "房间")
     private String houseName;
 
     /**
      * 立杠是否刷涂防腐漆
      */
-    @ExcelProperty(value = "立杠是否刷涂防腐漆")
     private String isAntiCorrosionPaint;
     /**
      * 是否有立杠卡子
      */
-    @ExcelProperty(value = "是否有立杠卡子")
     private String isVerticalBarClamp;
     /**
      * 立杠气密测试
      */
-    @ExcelProperty(value = "立杠气密测试")
     private String verticalBarTest;
     /**
      * 单户气密测试
      */
-    @ExcelProperty(value = "单户气密测试")
     private String householdTest;
     /**
      * 表号
      */
-    @ExcelProperty(value = "表号")
     private String gasMeterNumber;
     /**
      * 表字
      */
-    @ExcelProperty(value = "表字")
     private String gasMeterCount;
     /**
      * 品牌
      */
-    @ExcelProperty(value = "品牌")
     private String gasMeterBrand;
     /**
      * 进气方向(左、右表)
      */
-    @ExcelProperty(value = "进气方向")
     private String gasMeterDirection;
     private String gasMeterDirectionName;
     /**
      * 型号
      */
-    @ExcelProperty(value = "型号")
     private String gasMeterType;
     /**
      * 管表后管是否有卡子固定
      */
-    @ExcelProperty(value = "管表后管是否有卡子固定")
     private String isRearPipeClamp;
     /**
      * 是否阀管改造(是、否) Y | N
      */
-    @ExcelProperty(value = "是否阀管改造")
     private String isGasChangeType;
     /**
      * 是否阀管改造(全改、单改阀、单改管)
      */
-    @ExcelProperty(value = "阀管改造类型")
     private String gasChangeType;
     private String gasChangeTypeName;
     /**
      * 是否使用防风圈
      */
-    @ExcelProperty(value = "是否使用防风圈")
     private String isWindproofCircle;
 
     /**
@@ -232,7 +226,6 @@ public class ZEngineeringGasOpeningVo extends BaseEntity {
     /**
      * 工程名称
      */
-    @ExcelProperty(value = "工程名称")
     private String enginName;
 
 //    /**

+ 5 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/mapper/ZEngineeringNodeMapper.java

@@ -3,6 +3,9 @@ package com.ruoyi.zdsz.mapper;
 import com.ruoyi.zdsz.domain.ZEngineeringNode;
 import com.ruoyi.zdsz.domain.vo.ZEngineeringNodeVo;
 import com.ruoyi.common.core.mapper.BaseMapperPlus;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 工程节点Mapper接口
@@ -12,4 +15,6 @@ import com.ruoyi.common.core.mapper.BaseMapperPlus;
  */
 public interface ZEngineeringNodeMapper extends BaseMapperPlus<ZEngineeringNodeMapper, ZEngineeringNode, ZEngineeringNodeVo> {
 
+    List<ZEngineeringNode> selectNodeListByMonth(@Param("monthList") List<String> monthList, @Param("type")String type, @Param("state")String state,@Param("civilIds")List<String> civilIds);
+    List<String> selectNodeCivliIdListByMonth(@Param("monthList") List<String> monthList, @Param("nodeIds")List<String> nodeIds);
 }

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

@@ -26,6 +26,7 @@ public interface IZEngineeringCivilService {
      */
     ZEngineeringCivilVo queryById(String id);
     ZEngineeringCivilVo query(String id,String type);
+    ZEngineeringCivilVo lowerStaging(String areaId,String buildingId,String unitId, String direction ,String number);
     ZEngineeringCivilVo queryProcess(Map<String,String> params);
     ZEngineeringCivilVo queryByEntityBo(ZEngineeringCivilBo zEngineeringCivilBo);
 

+ 94 - 20
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java

@@ -38,11 +38,14 @@ import org.springframework.web.bind.annotation.RequestBody;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.logging.Level;
 import java.util.stream.Collectors;
 
+import static com.ruoyi.common.utils.DateUtils.getMonthsBetween;
+
 /**
  * 民用工程Service业务层处理
  *
@@ -124,6 +127,47 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
         zEngineeringCivilVo.setzEngineeringNodeBo(izEngineeringNodeService.query(zEngineeringNodeBo));
         return zEngineeringCivilVo;
     }
+    @Override
+    public ZEngineeringCivilVo lowerStaging(String areaId,String buildingId,String unitId, String direction ,String number) {
+        LambdaQueryWrapper<ZEngineeringCivil> lqw = Wrappers.lambdaQuery();
+        lqw.eq(StringUtils.isNotBlank(areaId), ZEngineeringCivil::getAreaId, areaId);
+        if (StringUtils.isEmpty(buildingId)) {
+            lqw.isNull(ZEngineeringCivil::getBuildingId);
+        } else {
+            lqw.eq(ZEngineeringCivil::getBuildingId, buildingId);
+        }
+        if (StringUtils.isEmpty(unitId)) {
+            lqw.isNull(ZEngineeringCivil::getUnitId);
+        } else {
+            lqw.eq(ZEngineeringCivil::getUnitId, unitId);
+        }
+        lqw.eq(ZEngineeringCivil::getEnginCycle, "0");
+        lqw.eq(ZEngineeringCivil::getEnginType, "old_renovation");
+        lqw.eq(ZEngineeringCivil::getEnginClassification,"bottom_leg");
+        ZEngineeringCivilVo zEngineeringCivilVo = baseMapper.selectVoOne(lqw);
+        if(!ObjectUtils.isEmpty(zEngineeringCivilVo)){
+            ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
+            zEngineeringNodeBo.setCreateTime(zEngineeringCivilVo.getCreateTime());
+            zEngineeringNodeBo.setCivliId(zEngineeringCivilVo.getId());
+            zEngineeringNodeBo.setType("底腿");
+            ZEngineeringNodeBo retNodeBo = izEngineeringNodeService.query(zEngineeringNodeBo);
+
+            Iterator<ZEngineeringInfoBo> iterator = retNodeBo.getzEngineeringInfoBoList().iterator();
+            while (iterator.hasNext()) {
+                ZEngineeringInfoBo info = iterator.next();
+                if(!direction.equals(info.getConstructAddre())||!number.equals(String.valueOf(info.getzEngineeringMaterialBo().get(0).getNumber().intValue()))){
+                    iterator.remove();
+                }
+            }
+            if(!ObjectUtils.isEmpty(retNodeBo.getzEngineeringInfoBoList())){
+                zEngineeringCivilVo.setzEngineeringNodeBo(retNodeBo);
+            }else{
+                zEngineeringCivilVo.setzEngineeringNodeBo(null);
+            }
+
+        }
+        return zEngineeringCivilVo;
+    }
 
     @Override
     public ZEngineeringCivilVo queryProcess(Map<String, String> params) {
@@ -199,7 +243,6 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
             List DateList = new ArrayList();
             list.removeLast();
             list.stream().forEach(item -> {
-
                 DateList.add(item.substring(item.indexOf("2")));
             });
             result = baseMapper.queryPageIdList(IDList, baseMapper.getTypeNumber(DateList, bo), page, pageQuery.getPageNum() - 1, pageQuery.getPageSize());
@@ -654,19 +697,18 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
         list.removeLast();
         List<ZEngineeringInfoBo> mapList = baseMapper.getsumId(list, createTime, UserName);
         List<String> zEngineeringNodeList = new ArrayList<>();
-        mapList.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.getEngInfoId()), ZEngineeringNode::getId, item.getEngInfoId());
-            ZEngineeringNode zEngineeringNode = zEngineeringNodeMapper.selectOne(lqw);
-            if (!ObjectUtils.isEmpty(zEngineeringNode))
-                zEngineeringNodeList.add(zEngineeringNode.getCivliId());
-            MonthTableNameHandler.removeData();
-        });
+
+        List<String> nodeIds = mapList.stream().map(ZEngineeringInfoBo::getEngInfoId).collect(Collectors.toList());
+        LocalDate startDate = LocalDate.of(2024, 3, 1); // 指定开始日期
+        LocalDate endDate = LocalDate.now(); // 当前日期
+        List<String> monthsBetween = getMonthsBetween(startDate, endDate);
+        if(!ObjectUtils.isEmpty(nodeIds)){
+            zEngineeringNodeList.addAll(zEngineeringNodeMapper.selectNodeCivliIdListByMonth(monthsBetween,nodeIds));
+        }
+
         List newList = zEngineeringNodeList.stream().distinct().collect(Collectors.toList());
-        List CivilList = new ArrayList();
-        newList.stream().forEach(item2 -> {
+        List<String> CivilList = new ArrayList();
+        if(!ObjectUtils.isEmpty(newList)){
             LambdaQueryWrapper<ZEngineeringCivil> lqw = Wrappers.lambdaQuery();
             lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringCivil::getEnginType, bo.getEnginType());
             lqw.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringCivil::getEnginClassification, bo.getEnginClassification());
@@ -675,12 +717,40 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
             lqw.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZEngineeringCivil::getBuildingId, bo.getBuildingId());
             lqw.eq(StringUtils.isNotBlank(bo.getUnitId()), ZEngineeringCivil::getUnitId, bo.getUnitId());
             lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), ZEngineeringCivil::getDistrict, bo.getDistrict());
-            lqw.eq(ZEngineeringCivil::getId, item2);
-            ZEngineeringCivil zEngineeringCivil = baseMapper.selectOne(lqw);
-            if (!ObjectUtils.isEmpty(zEngineeringCivil)) {
-                CivilList.add(zEngineeringCivil.getId());
-            }
-        });
+            lqw.in(ZEngineeringCivil::getId, newList);
+            List<ZEngineeringCivilVo> zEngineeringCivil = baseMapper.selectVoList(lqw);
+            CivilList = zEngineeringCivil.stream().map(ZEngineeringCivilVo::getId).collect(Collectors.toList());
+            CivilList = CivilList.stream().distinct().collect(Collectors.toList());
+        }
+
+//        mapList.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.getEngInfoId()), ZEngineeringNode::getId, item.getEngInfoId());
+//            ZEngineeringNode zEngineeringNode = zEngineeringNodeMapper.selectOne(lqw);
+//            if (!ObjectUtils.isEmpty(zEngineeringNode)){
+//                zEngineeringNodeList.add(zEngineeringNode.getCivliId());
+//                MonthTableNameHandler.removeData();
+//            }
+//        });
+//        List newList = zEngineeringNodeList.stream().distinct().collect(Collectors.toList());
+//        List CivilList = new ArrayList();
+//        newList.stream().forEach(item2 -> {
+//            LambdaQueryWrapper<ZEngineeringCivil> lqw = Wrappers.lambdaQuery();
+//            lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringCivil::getEnginType, bo.getEnginType());
+//            lqw.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringCivil::getEnginClassification, bo.getEnginClassification());
+//            lqw.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZEngineeringCivil::getEnginCycle, bo.getEnginCycle());
+//            lqw.eq(StringUtils.isNotBlank(bo.getAreaId()), ZEngineeringCivil::getAreaId, bo.getAreaId());
+//            lqw.eq(StringUtils.isNotBlank(bo.getBuildingId()), ZEngineeringCivil::getBuildingId, bo.getBuildingId());
+//            lqw.eq(StringUtils.isNotBlank(bo.getUnitId()), ZEngineeringCivil::getUnitId, bo.getUnitId());
+//            lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), ZEngineeringCivil::getDistrict, bo.getDistrict());
+//            lqw.eq(ZEngineeringCivil::getId, item2);
+//            ZEngineeringCivil zEngineeringCivil = baseMapper.selectOne(lqw);
+//            if (!ObjectUtils.isEmpty(zEngineeringCivil)) {
+//                CivilList.add(zEngineeringCivil.getId());
+//            }
+//        });
         return CivilList;
     }
 
@@ -806,8 +876,12 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
             if (!ObjectUtils.isEmpty(zEngineeringNodeBo)) {
                 zEngineeringNodeBo.setCivliId(zEngineeringCivilVo.getId());
                 zEngineeringNodeBo.setCreateTime(zEngineeringCivilVo.getCreateTime());
-                if (!ObjectUtils.isEmpty(zEngineeringNodeBo.getzEngineeringInfoBoList()))
+                if (!ObjectUtils.isEmpty(zEngineeringNodeBo.getzEngineeringInfoBoList())){
+                    zEngineeringNodeService.updateMuch(zEngineeringNodeBo);
+                }else if(!ObjectUtils.isEmpty(zEngineeringNodeBo.getzEngineeringInfoBo())){
                     zEngineeringNodeService.updateMuch(zEngineeringNodeBo);
+                }
+
             }
         }
         return flag;

+ 5 - 3
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringGasOpeningServiceImpl.java

@@ -82,7 +82,7 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
      */
     @Override
     public TableDataInfo<ZEngineeringGasOpeningVo> queryPageList(ZEngineeringGasOpeningBo bo, PageQuery pageQuery) {
-        Page<ZBuildingBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
+        Page<ZEngineeringGasOpeningBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
         Page<ZEngineeringGasOpeningVo> result = baseMapper.queryPageList(bo, page, (pageQuery.getPageNum() - 1) * pageQuery.getPageSize(), pageQuery.getPageSize());
         return TableDataInfo.build(result);
     }
@@ -104,8 +104,10 @@ public class ZEngineeringGasOpeningServiceImpl implements IZEngineeringGasOpenin
      */
     @Override
     public List<ZEngineeringGasOpeningVo> queryList(ZEngineeringGasOpeningBo bo) {
-        LambdaQueryWrapper<ZEngineeringGasOpening> lqw = buildQueryWrapper(bo);
-        return baseMapper.selectVoList(lqw);
+//        LambdaQueryWrapper<ZEngineeringGasOpening> lqw = buildQueryWrapper(bo);
+//        return baseMapper.selectVoList(lqw);
+        Page<ZEngineeringGasOpeningBo> page = new Page<>(1, 999999);
+        return baseMapper.queryPageList(bo, page, 0, 999999).getRecords();
     }
 
     private LambdaQueryWrapper<ZEngineeringGasOpening> buildQueryWrapper(ZEngineeringGasOpeningBo bo) {

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

@@ -212,7 +212,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
                     try {
                         ite.put("type", municipalEngineeringNode.stream().filter(ie -> ie.getDictValue().equals(ite.get("type"))).collect(Collectors.toList()).get(0).getDictLabel());
                     } catch (Exception e) {
-                        ite.put("type", "");
+//                        ite.put("type", "");
                     }
                     ite.put("reviewStatus", str);
                 });
@@ -259,7 +259,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
                     try {
                         ite.put("type", municipalEngineeringNode.stream().filter(ie -> ie.getDictValue().equals(ite.get("type"))).collect(Collectors.toList()).get(0).getDictLabel());
                     } catch (Exception e) {
-                        ite.put("type", "");
+//                        ite.put("type", "");
                     }
                     ite.put("reviewStatus", str);
                 });
@@ -333,7 +333,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
                     try {
                         ite.put("type", municipalEngineeringNode.stream().filter(ie -> ie.getDictValue().equals(ite.get("type"))).collect(Collectors.toList()).get(0).getDictLabel());
                     } catch (Exception e) {
-                        ite.put("type", "");
+//                        ite.put("type", "");
                     }
                     ite.put("reviewStatus", str);
                 });

+ 10 - 8
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringInfoServiceImpl.java

@@ -851,14 +851,16 @@ public class ZEngineeringInfoServiceImpl implements IZEngineeringInfoService {
         ZEngineeringInfo update = BeanUtil.toBean(bo, ZEngineeringInfo.class);
         validEntityBeforeSave(update);
         List<ZEngiineeringPhoto> photoList = new ArrayList();
-        bo.getzEngiineeringPhotoBoList().stream().forEach(item -> {
-            ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
-            zEngiineeringPhoto.setParentId(update.getId());
-            zEngiineeringPhoto.setPicUrl(item);
-            zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
-           // zEngiineeringPhoto.setUpdateTime(new Date());
-            photoList.add(zEngiineeringPhoto);
-        });
+        if (!ObjectUtils.isEmpty(bo.getzEngiineeringPhotoBoList())) {
+            bo.getzEngiineeringPhotoBoList().stream().forEach(item -> {
+                ZEngiineeringPhoto zEngiineeringPhoto = new ZEngiineeringPhoto();
+                zEngiineeringPhoto.setParentId(update.getId());
+                zEngiineeringPhoto.setPicUrl(item);
+                zEngiineeringPhoto.setCreateTime(bo.getCreateTime());
+                // zEngiineeringPhoto.setUpdateTime(new Date());
+                photoList.add(zEngiineeringPhoto);
+            });
+        }
         if (photoList.size() > 0 ) {
             izEngiineeringPhotoService.updateBatch(photoList);
         }

+ 46 - 40
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringNodeServiceImpl.java

@@ -17,10 +17,7 @@ import com.ruoyi.zdsz.domain.*;
 import com.ruoyi.zdsz.domain.bo.*;
 import com.ruoyi.zdsz.domain.vo.*;
 import com.ruoyi.zdsz.mapper.*;
-import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
-import com.ruoyi.zdsz.service.IZEngineeringInfoService;
-import com.ruoyi.zdsz.service.IZEngineeringNodeService;
-import com.ruoyi.zdsz.service.IZEngineeringReviewService;
+import com.ruoyi.zdsz.service.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.hibernate.validator.internal.util.stereotypes.Lazy;
@@ -36,12 +33,15 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static cn.hutool.core.date.DateUtil.format;
+import static com.ruoyi.common.utils.DateUtils.getMonthsBetween;
 
 /**
  * 工程节点Service业务层处理
@@ -62,6 +62,8 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
     @Autowired
     private IZEngineeringReviewService izEngineeringReviewService;
     @Autowired
+    private IZEngineeringMaterialService izEngineeringMaterialService;
+    @Autowired
     private IZEngiineeringPhotoService izEngiineeringPhotoService;
     @Autowired
     private ZEngineeringCivilMapper zEngineeringCivilMapper;
@@ -654,11 +656,18 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateMuch(ZEngineeringNodeBo bo) {
         ZEngineeringNode update = BeanUtil.toBean(bo, ZEngineeringNode.class);
-        bo.getzEngineeringInfoBoList().stream().forEach(item -> {
+        if (!ObjectUtils.isEmpty(bo.getzEngineeringInfoBoList())){
+            bo.getzEngineeringInfoBoList().stream().forEach(item -> {
+                item.setCreateTime(bo.getCreateTime());
+                item.setState("");
+                izEngineeringInfoService.update(item);
+            });
+        }else if(!ObjectUtils.isEmpty(bo.getzEngineeringInfoBo())){
+            ZEngineeringInfoBo item = bo.getzEngineeringInfoBo();
             item.setCreateTime(bo.getCreateTime());
             item.setState("");
             izEngineeringInfoService.update(item);
-        });
+        }
         izEngineeringReviewService.deleteByNodeBoId(bo);
         return baseMapper.updateById(update) > 0;
     }
@@ -680,39 +689,24 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
     @Override
     public List<String> nodeTypeList(List<ZEngineeringCivil> zEngineeringCivilList, String type, String state, ZEngineeringCivilBo bo) {
         List<ZEngineeringNode> nodeTypeList = new ArrayList<>();
-        zEngineeringCivilList.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());
-            lqw.eq(StringUtils.isNotBlank(type), ZEngineeringNode::getType, type);
-            List<ZEngineeringNode> nodeList = baseMapper.selectList(lqw);
+        List<String> civilIds = zEngineeringCivilList.stream().map(ZEngineeringCivil::getId).collect(Collectors.toList());
+        LocalDate startDate = LocalDate.of(2024, 3, 1); // 指定开始日期
+        LocalDate endDate = LocalDate.now(); // 当前日期
+        List<String> monthsBetween = getMonthsBetween(startDate, endDate);
+        if(!ObjectUtils.isEmpty(civilIds)){
             if (StringUtils.isNotBlank(state)) {
-                if (nodeList.size() > 0) {
-                    nodeList.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 (state.equals("2")) {
-                            if (ReviewList.size() == 0) {
-                                nodeTypeList.add(item2);
-                            }
-                        } else if (state.equals("1")) {
-                            if (ReviewList.size() > 0 && ReviewList.get(0).getReviewStatus().equals("1")) {
-                                nodeTypeList.add(item2);
-                            }
-                        } else if (state.equals("0")) {
-                            if (ReviewList.size() > 0 && ReviewList.get(0).getReviewStatus().equals("0")) {
-                                nodeTypeList.add(item2);
-                            }
-                        }
-                    });
+                nodeTypeList.addAll(baseMapper.selectNodeListByMonth(monthsBetween,type,state,civilIds));
+            }else{
+                for (String date:monthsBetween) {
+                    MonthTableNameHandler.setData(date);
+                    LambdaQueryWrapper<ZEngineeringNode> lqw = Wrappers.lambdaQuery();
+                    lqw.in(ZEngineeringNode::getCivliId, civilIds);
+                    lqw.eq(StringUtils.isNotBlank(type), ZEngineeringNode::getType, type);
+                    nodeTypeList.addAll(baseMapper.selectList(lqw));
+                    MonthTableNameHandler.removeData();
                 }
-            } else {
-                nodeTypeList.addAll(nodeList);
             }
-            MonthTableNameHandler.removeData();
-        });
+        }
         if ((!"".equals(bo.getBeginTime()) && !ObjectUtils.isEmpty(bo.getBeginTime())) || (!"".equals(bo.getCreateBy()) && !ObjectUtils.isEmpty(bo.getCreateBy()))) {
             Iterator<ZEngineeringNode> iterator = nodeTypeList.iterator();
             while (iterator.hasNext()) {
@@ -1062,15 +1056,27 @@ public class ZEngineeringNodeServiceImpl implements IZEngineeringNodeService {
             MonthTableNameHandler.setData(date);
             LambdaQueryWrapper<ZEngineeringNode> lqw = Wrappers.lambdaQuery();
             lqw.eq(StringUtils.isNotBlank(item.getId()), ZEngineeringNode::getCivliId, item.getId());
-            // lqw.eq(StringUtils.isNotBlank(type), ZEngineeringNode::getType, type);
             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));
-                }
+                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(""))){
+                        if (ReviewList.size() > 0) {
+                            nodeTypeList.add(ReviewList.get(0));
+                        }
+                    }
+//                }else{
+//                    if(if(!(infoList.contains(null)||infoList.size()>0||infoList.contains(""))){
+//                        if (ReviewList.size() > 0) {
+//                            nodeTypeList.add(ReviewList.get(0));
+//                        }
+//                    }
+//                }
             });
             List stateList = new ArrayList();
             List<SysDictData> list = Collections.EMPTY_LIST;

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

@@ -15,7 +15,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
+        <result property="updateInfoTime" column="update_info_time"/>
     </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>
+            <if test="state != 2" >
+                and state = #{state}
+            </if>
+        </foreach>
+    </select>
+    <select id="selectNodeCivliIdListByMonth" resultType="String">
+        <foreach collection="monthList" item="month" open="" separator=" union all " close="">
+            SELECT a.civli_id
+            FROM
+            z_engineering_node_${month} a
+            WHERE
+            a.del_flag = 0
+            and a.id in
+            <foreach collection="nodeIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </foreach>
+    </select>
 </mapper>