瀏覽代碼

质检-资料填报-同步标识
1、查询WBS树判断是否展示同步标识

LHB 1 月之前
父節點
當前提交
686b21f515

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeAllVO.java

@@ -41,6 +41,9 @@ public class WbsTreeContractTreeAllVO implements INode<WbsTreeContractTreeAllVO>
     @ApiModelProperty(value = "是否为自定义新增节点 1=是")
     private Integer isCustom;
 
+    @ApiModelProperty(value = "是否为自定义新增节点 1=是")
+    private Integer isSync;
+
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private List<WbsTreeContractTreeAllVO> children;
 

+ 27 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -18,6 +18,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.bean.NodeVO;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
@@ -33,6 +34,7 @@ import org.springblade.system.user.feign.IUserClient;
 import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -367,6 +369,21 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     public R<Object> getTreeNodeByValueAndContractId(String queryValue, String contractId, String tableOwner) {
         if (StringUtils.isNotEmpty(queryValue) && StringUtils.isNotEmpty(contractId)) {
             ContractInfo contractInfo = contractInfoMapper.selectById(contractId);
+
+            //查询wbs同步信息
+            String contractExtendSql = "select ancestors from m_wbs_tree_contract_extend where type = " + tableOwner + " and is_sync = 1 and is_deleted = 0 and contract_id = " + contractId;
+            Set<String> syncPKeyIds = new HashSet<>();
+            List<String> strings = null;
+            try {
+                strings = jdbcTemplate.queryForList(contractExtendSql, String.class);
+            } catch (DataAccessException e) {
+                e.printStackTrace();
+                //TODO 暂时忽略错误
+            }
+            if(CollectionUtil.isNotEmpty(strings)){
+                strings.stream().filter(com.alibaba.nacos.common.utils.StringUtils::isNotEmpty).forEach(f -> syncPKeyIds.addAll(Arrays.asList(f.split(","))));
+            }
+
             if (contractInfo != null) {
                 /*质检施工合同段*/
                 if (contractInfo.getContractType().equals(1)) {
@@ -482,6 +499,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                     countMap.put(key, 1L);
                                 }
                             }
+                            List<String> finalStrings = strings;
                             List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
                                     .map(node -> {
                                         WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
@@ -502,6 +520,10 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                                     vo.setColorStatus(lowestNode.getColorStatus());
                                                 }
                                             }
+                                            if(CollectionUtil.isNotEmpty(finalStrings)){
+                                                //判断是否展示同步标识
+                                                vo.setIsSync(finalStrings.contains(vo.getPrimaryKeyId()) ? 1 : 0);
+                                            }
                                         }
                                         return vo;
                                     }).collect(Collectors.toList());
@@ -630,6 +652,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                         countMap.put(key, 1L);
                                     }
                                 }
+                                List<String> finalStrings = strings;
                                 List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
                                         .map(node -> {
                                             WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
@@ -649,6 +672,10 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                                         vo.setColorStatus(lowestNode.getColorStatus());
                                                     }
                                                 }
+                                                if(CollectionUtil.isNotEmpty(finalStrings)){
+                                                    //判断是否展示同步标识
+                                                    vo.setIsSync(finalStrings.contains(vo.getPrimaryKeyId()) ? 1 : 0);
+                                                }
                                             }
                                             return vo;
                                         }).collect(Collectors.toList());