소스 검색

中间计量申请,引用质检资料2

qianxb 1 년 전
부모
커밋
2cad883a36

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/dto/WbsNodeDTO.java

@@ -16,6 +16,9 @@ public class WbsNodeDTO {
     @ApiModelProperty(value = "合同id")
     private Long contractId;
 
+    @ApiModelProperty(value = "监理合同段用合同id")
+    private Long contractIdRelation;
+
     @ApiModelProperty(value = "WBS树节点id")
     private Long nodeId;
 

+ 35 - 29
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MiddleMeterApplyServiceImpl.java

@@ -633,6 +633,9 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
         if (dto.getCurrent() == null || dto.getSize() == null){
             throw new ServiceException("请传入分页信息");
         }
+        if (dto.getContractIdRelation() != null){
+            dto.setContractId(dto.getContractIdRelation());
+        }
         Integer current = dto.getCurrent();
         Integer size = dto.getSize();
         Integer start = (current-1) * size;
@@ -670,38 +673,41 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
             }
         }
         //查询节点资料
-        List<WbsFileVO> voList = baseMapper.getNodeData(ids);
-        //节点划分
-        if (voList.size() != 0){
-            StringBuilder str = new StringBuilder();
-            for (WbsFileVO vo : voList) {
-                str.append(vo.getAncestors()+",");
-            }
-            str.deleteCharAt(str.length() -1);
-            List<Long> longs = Func.toLongList(str.toString());
-            HashSet<Long> set = new HashSet<>(longs);
-            List<WbsTreeContract> infoList = baseMapper.getAllAncestors(set,dto.getContractId());
-            if (infoList.size() == 0){
-                throw new ServiceException("未获取到节点划分信息");
-            }
-            Map<Long, WbsTreeContract> map = infoList.stream().collect(Collectors.toMap(l -> l.getId(), l -> l));
-            for (WbsFileVO vo : voList) {
-                List<Long> longList = Func.toLongList(vo.getAncestors());
-                Collections.reverse(longList);
-                StringBuilder str2 = new StringBuilder();
-                if (vo.getNodeType() == 6){
-                    for (Long aLong : longList) {
-                        WbsTreeContract info = map.get(aLong);
-                        str2.append(info.getNodeName()+"/");
-                        if (info.getNodeType() == 4){
-                            break;
+        List<WbsFileVO> voList = new ArrayList<>();
+        if (ids.size() != 0) {
+            voList = baseMapper.getNodeData(ids);
+            //节点划分
+            if (voList.size() != 0) {
+                StringBuilder str = new StringBuilder();
+                for (WbsFileVO vo : voList) {
+                    str.append(vo.getAncestors() + ",");
+                }
+                str.deleteCharAt(str.length() - 1);
+                List<Long> longs = Func.toLongList(str.toString());
+                HashSet<Long> set = new HashSet<>(longs);
+                List<WbsTreeContract> infoList = baseMapper.getAllAncestors(set, dto.getContractId());
+                if (infoList.size() == 0) {
+                    throw new ServiceException("未获取到节点划分信息");
+                }
+                Map<Long, WbsTreeContract> map = infoList.stream().collect(Collectors.toMap(l -> l.getId(), l -> l));
+                for (WbsFileVO vo : voList) {
+                    List<Long> longList = Func.toLongList(vo.getAncestors());
+                    Collections.reverse(longList);
+                    StringBuilder str2 = new StringBuilder();
+                    if (vo.getNodeType() == 6) {
+                        for (Long aLong : longList) {
+                            WbsTreeContract info = map.get(aLong);
+                            str2.append(info.getNodeName() + "/");
+                            if (info.getNodeType() == 4) {
+                                break;
+                            }
                         }
+                        str2.deleteCharAt(str2.length() - 1);
+                    } else {
+                        str2.append(vo.getNodeName());
                     }
-                    str2.deleteCharAt(str2.length() -1);
-                }else {
-                    str2.append(vo.getNodeName());
+                    vo.setPartName(str2.toString());
                 }
-                vo.setPartName(str2.toString());
             }
         }
         iPage.setRecords(voList);