|
@@ -128,7 +128,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
//设置其他计量总数
|
|
|
vo.setOtherMeterTotal(vo.getAllMeterTotal().subtract(vo.getCurrentMeterTotal()));
|
|
|
//设置施工图数量是否大于合同数量
|
|
|
- vo.setIsBuildThanContract(vo.getChangeTotal().compareTo(vo.getContainChangeTotal()) == 1?1:0);
|
|
|
+ vo.setIsBuildThanContract(vo.getChangeTotal().compareTo(vo.getContractChangeAllTotal()) == 1?1:0);
|
|
|
}
|
|
|
return vos;
|
|
|
}
|
|
@@ -582,11 +582,20 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
@Override
|
|
|
public String test() {
|
|
|
Long contractId = 1632993681739259906L;
|
|
|
- //获取当前合同下所以计量单元
|
|
|
+ Long pId = 1644218999308812288L;
|
|
|
+ //获取点击的WBS节点
|
|
|
+ WbsNodeVO masterId = baseMapper.getNodeInfo(pId);
|
|
|
+ //获取当前合同下所有节点
|
|
|
List<WbsNodeVO> vos = baseMapper.getAllNode(contractId);
|
|
|
+// Map<Long, WbsNodeVO> map = vos.stream().collect(Collectors.toMap(l -> l.getId(), l -> l));
|
|
|
+ Map<Long, List<WbsNodeVO>> map = vos.stream().collect(Collectors.groupingBy(WbsNodeVO::getParentId));
|
|
|
+ //获取点击节点的所有子节点
|
|
|
+ List<WbsNodeVO> list7 = new ArrayList<>();
|
|
|
+ list7.add(masterId);
|
|
|
+ this.getAllChild(masterId,map,list7);
|
|
|
//转换为树
|
|
|
Long l1 = System.currentTimeMillis();
|
|
|
- List<WbsNodeVO> list = ForestNodeMerger.merge(vos);
|
|
|
+ List<WbsNodeVO> list = ForestNodeMerger.merge(list7);
|
|
|
Long l2 = System.currentTimeMillis();
|
|
|
System.out.println("----------------------");
|
|
|
System.out.println(l2-l1);
|
|
@@ -607,6 +616,24 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
System.out.println(l4-l3);
|
|
|
return "";
|
|
|
}
|
|
|
+ //传入一个节点,重新计算祖级节点
|
|
|
+ void resetAncestor(WbsNodeVO vo, Map<Long, WbsNodeVO> map ,StringBuilder str){
|
|
|
+ if (!vo.getAncestors().contains(vo.getParentId()+"")){
|
|
|
+ resetAncestor(map.get(vo.getParentId()),map,str);
|
|
|
+ }else {
|
|
|
+ str.append(vo.getAncestors()+","+vo.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //根据首节点,组建所有子节点
|
|
|
+ void getAllChild(WbsNodeVO vo,Map<Long, List<WbsNodeVO>> map,List<WbsNodeVO> list){
|
|
|
+ List<WbsNodeVO> vos = map.get(vo.getId());
|
|
|
+ if (vos != null && vos.size() != 0){
|
|
|
+ list.addAll(vos);
|
|
|
+ for (WbsNodeVO nodeVO : vos) {
|
|
|
+ getAllChild(nodeVO,map,list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取当前节点下,当期未被计量的所有清单
|
|
@@ -636,25 +663,36 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
if (dto.getContractIdRelation() != null){
|
|
|
dto.setContractId(dto.getContractIdRelation());
|
|
|
}
|
|
|
+ //获取点击的WBS节点
|
|
|
+ WbsNodeVO masterId = baseMapper.getNodeInfo(dto.getNodeId());
|
|
|
Integer current = dto.getCurrent();
|
|
|
Integer size = dto.getSize();
|
|
|
Integer start = (current-1) * size;
|
|
|
Integer end = current * size;
|
|
|
- //获取当前合同节点下所有子节点
|
|
|
- List<WbsNodeVO> vos = baseMapper.getAllChildNode(dto);
|
|
|
- List<WbsNodeVO> list = ForestNodeMerger.merge(vos);
|
|
|
- List<WbsNodeVO> list2 = new ArrayList<>();
|
|
|
- for (WbsNodeVO vo : list) {
|
|
|
- if (vo.getId().equals(dto.getNodeId())){
|
|
|
- list2.add(vo);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (list2.size() == 0){
|
|
|
+ //获取当前合同节点下所有节点
|
|
|
+// List<WbsNodeVO> vos = baseMapper.getAllChildNode(dto);
|
|
|
+ //获取当前合同下所有节点
|
|
|
+ List<WbsNodeVO> vos = baseMapper.getAllNode2(dto);
|
|
|
+ Map<Long, WbsNodeVO> map2 = vos.stream().collect(Collectors.toMap(l -> l.getId(), l -> l));
|
|
|
+ Map<Long, List<WbsNodeVO>> map3 = vos.stream().collect(Collectors.groupingBy(WbsNodeVO::getParentId));
|
|
|
+ //获取点击节点的所有子节点
|
|
|
+ List<WbsNodeVO> list7 = new ArrayList<>();
|
|
|
+ list7.add(masterId);
|
|
|
+ this.getAllChild(masterId,map3,list7);
|
|
|
+
|
|
|
+ List<WbsNodeVO> list = ForestNodeMerger.merge(list7);
|
|
|
+// List<WbsNodeVO> list2 = new ArrayList<>();
|
|
|
+// for (WbsNodeVO vo : list) {
|
|
|
+// if (vo.getId().equals(dto.getNodeId())){
|
|
|
+// list2.add(vo);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (list.size() == 0){
|
|
|
throw new ServiceException("获取首节点错误");
|
|
|
}
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
- gatherSortNode2(list2, ids);
|
|
|
+ gatherSortNode2(list, ids);
|
|
|
IPage<WbsFileVO> iPage = new Page<WbsFileVO>(current,size);
|
|
|
iPage.setTotal(ids.size());
|
|
|
if (ids.size() == 0){
|
|
@@ -697,10 +735,19 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
if (vo.getNodeType() == 6) {
|
|
|
for (Long aLong : longList) {
|
|
|
WbsTreeContract info = map.get(aLong);
|
|
|
- str2.append(info.getNodeName() + "/");
|
|
|
- if (info.getNodeType() == 4) {
|
|
|
+ if (info == null){
|
|
|
+ WbsNodeVO nodeVO = map2.get(vo.getParentId());
|
|
|
+ str2.append(nodeVO.getNodeName() + "/");
|
|
|
+ nodeVO = map2.get(nodeVO.getParentId());
|
|
|
+ str2.append(nodeVO.getNodeName() + "/");
|
|
|
break;
|
|
|
+ }else {
|
|
|
+ str2.append(info.getNodeName() + "/");
|
|
|
+ if (info.getNodeType() == 4) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
str2.deleteCharAt(str2.length() - 1);
|
|
|
} else {
|