Ver Fonte

include pipe laying year in export

Kazerin há 1 semana atrás
pai
commit
006d9ea567

+ 2 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterPipeExportDTO.java

@@ -12,11 +12,12 @@ public class WaterPipeExportDTO {
     @Excel(name = "管网名称") private String pipeName;
     @Excel(name = "材质") private String pipeMaterial;
     @Excel(name = "管径(mm)") private Integer pipeDiameter;
+    @Excel(name = "铺设年份") private Integer layingYear;
     @Excel(name = "长度(m)") private BigDecimal pipeLength;
     @Excel(name = "状态") private String status;
     @Excel(name = "起点经度") private BigDecimal startLongitude;
     @Excel(name = "起点纬度") private BigDecimal startLatitude;
     @Excel(name = "终点经度") private BigDecimal endLongitude;
     @Excel(name = "终点纬度") private BigDecimal endLatitude;
-    public static WaterPipeExportDTO from(WaterPipeInfo value) { WaterPipeExportDTO dto = new WaterPipeExportDTO(); dto.pipeCode=value.getPipeCode(); dto.pipeName=value.getPipeName(); dto.pipeMaterial=value.getPipeMaterial(); dto.pipeDiameter=value.getPipeDiameter(); dto.pipeLength=value.getPipeLength(); dto.status=value.getStatus(); dto.startLongitude=value.getStartLongitude(); dto.startLatitude=value.getStartLatitude(); dto.endLongitude=value.getEndLongitude(); dto.endLatitude=value.getEndLatitude(); return dto; }
+    public static WaterPipeExportDTO from(WaterPipeInfo value) { WaterPipeExportDTO dto = new WaterPipeExportDTO(); dto.pipeCode=value.getPipeCode(); dto.pipeName=value.getPipeName(); dto.pipeMaterial=value.getPipeMaterial(); dto.pipeDiameter=value.getPipeDiameter(); dto.layingYear=value.getLayingYear(); dto.pipeLength=value.getPipeLength(); dto.status=value.getStatus(); dto.startLongitude=value.getStartLongitude(); dto.startLatitude=value.getStartLatitude(); dto.endLongitude=value.getEndLongitude(); dto.endLatitude=value.getEndLatitude(); return dto; }
 }

+ 9 - 0
pipe-network-service/zksy-system/src/test/java/com/zksy/WaterSupply/WaterFacilityQueryServiceTest.java

@@ -17,6 +17,7 @@ import com.zksy.WaterSupply.WaterSourceInfo.service.impl.WaterSourceInfoServiceI
 import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
 import com.zksy.WaterSupply.WaterUserInfo.mapper.WaterUserInfoMapper;
 import com.zksy.WaterSupply.WaterUserInfo.service.impl.WaterUserInfoServiceImpl;
+import com.zksy.WaterSupply.export.WaterPipeExportDTO;
 import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentMatchers;
 import org.springframework.test.util.ReflectionTestUtils;
@@ -113,6 +114,14 @@ class WaterFacilityQueryServiceTest {
         }
     }
 
+    @Test
+    void pipeExportIncludesLayingYear() {
+        WaterPipeInfo pipe = new WaterPipeInfo();
+        pipe.setLayingYear(1998);
+
+        assertEquals(1998, WaterPipeExportDTO.from(pipe).getLayingYear());
+    }
+
     private static <T> Page<T> pageOf(T record) {
         Page<T> page = new Page<>(1, 1);
         page.setRecords(List.of(record));