Prechádzať zdrojové kódy

客户端合同段树搜索接口颜色显示bug

liuyc 2 rokov pred
rodič
commit
984741b78d

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -725,8 +725,8 @@ public class ContractInfoController extends BladeController {
     @ApiOperation(value = "资料填报(资料查询)节点搜索输入框查询接口", notes = "传入合同段id、输入框搜索的queryValue")
     public R getTreeNodeByValueAndContractId(@RequestParam String queryValue, @RequestParam String contractId) {
         R list = contractInfoService.getTreeNodeByValueAndContractId(queryValue, contractId);
-        Object data = list.getData();
-        if (data != null) {
+        if (ObjectUtil.isNotEmpty(list) && ObjectUtil.isNotEmpty(list.getData())) {
+            Object data = list.getData();
             ContractInfo contractInfo = contractInfoService.getBaseMapper().selectById(contractId);
             if (data instanceof List) {
                 if (contractInfo.getContractType().equals(1)) {

+ 28 - 39
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -442,13 +442,8 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         for (int i = reNodes.size() - 1; i >= 0; i--) {
             WbsTreeContractTreeAllVO node = reNodes.get(i);
             if (node.getChildren() != null && !node.getChildren().isEmpty()) {
-                long childSubmitCounts = 0L;
-                int colorStatus = 1;
-
-                boolean allChildStatusEquals3 = true;
-                boolean allChildStatusEquals4 = true;
-
                 //计数
+                long childSubmitCounts = 0L;
                 for (WbsTreeContractTreeAllVO child : node.getChildren()) {
                     if (child.getSubmitCounts() == 1L) {
                         childSubmitCounts++;
@@ -456,50 +451,44 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                         childSubmitCounts = child.getSubmitCounts();
                     }
                 }
+                node.setSubmitCounts(childSubmitCounts);
 
                 //颜色
+                boolean allThree = true; //是否所有子节点的getColorStatus都等于3
+                boolean allFour = true; //是否所有子节点的getColorStatus都等于4
+                boolean hasTwo = false; //是否存在子节点的getColorStatus等于2
+                boolean hasOne = false; //是否存在子节点的getColorStatus等于1
+                boolean hasThreeOrFour = false; //是否存在子节点的getColorStatus等于3或4
                 for (WbsTreeContractTreeAllVO child : node.getChildren()) {
-                    if (ObjectUtils.isNotEmpty(child.getColorStatus())) {
-                        //只要有一个子级是已填报-未上报,那么上级默认已填报-未上报(蓝色)
-                        if (child.getColorStatus().equals(2)) {
-                            colorStatus = 2;
-                            break;
-                        }
-
-                        if (child.getColorStatus().equals(3)) {
-                            allChildStatusEquals4 = false;
-                            colorStatus = 4;
-
-                        } else if (child.getColorStatus().equals(4)) {
-                            allChildStatusEquals3 = false;
-                            colorStatus = 3;
-
-                        } else {
-                            allChildStatusEquals3 = false;
-                            allChildStatusEquals4 = false;
-                            colorStatus = 1;
-                            break;
-                        }
+                    if (child.getColorStatus() != 3) {
+                        allThree = false;
+                    }
+                    if (child.getColorStatus() != 4) {
+                        allFour = false;
+                    }
+                    if (child.getColorStatus() == 2) {
+                        hasTwo = true;
+                    }
+                    if (child.getColorStatus() == 1) {
+                        hasOne = true;
+                    }
+                    if (child.getColorStatus() == 3 || child.getColorStatus() == 4) {
+                        hasThreeOrFour = true;
                     }
                 }
-
-                //父节点计数
-                node.setSubmitCounts(childSubmitCounts);
-
-                //父节点颜色
-                if (allChildStatusEquals3) {
+                if (allThree) {
                     node.setColorStatus(3);
-                    continue;
-                }
-                if (allChildStatusEquals4) {
+                } else if (allFour) {
                     node.setColorStatus(4);
-                    continue;
+                } else if (hasTwo || (hasOne && hasThreeOrFour)) {
+                    node.setColorStatus(2);
+                } else {
+                    node.setColorStatus(1);
                 }
-                node.setColorStatus(colorStatus);
 
             } else if (node.getSubmitCounts() == 1L) {
                 node.setSubmitCounts(1L);
-                //最底层颜色
+                //最底层节点颜色
                 if (ObjectUtils.isNotEmpty(node.getColorStatus())) {
                     if (node.getColorStatus().equals(0)) { //任务状态=0,未上报
                         node.setColorStatus(2); //蓝色

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -630,7 +630,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                     }
                                 }
 
-                                lazyNodeVO.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(lazyNodeVO.getPKeyId())) ? countMap.get(lazyNodeVO.getPKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(lazyNodeVO.getPKeyId())) ? queryInfoMaps.get(lazyNodeVO.getPKeyId()) : 0));
+                                lazyNodeVO.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(lazyNodeVO.getPKeyId())) ? countMap.get(lazyNodeVO.getPKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(lazyNodeVO.getPKeyId())) ? 1 : 0));
 
                                 WbsTreeContractLazyVO vo = nodeMap.get(lazyNodeVO.getId());
                                 if (vo != null) {