|  | @@ -69,6 +69,7 @@ import org.springblade.manager.mapper.*;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.INodeBaseInfoService;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.ITableFileService;
 | 
	
		
			
				|  |  |  import org.springblade.manager.service.IWbsTreeContractService;
 | 
	
		
			
				|  |  | +import org.springblade.manager.service.WbsTreeContractExtendService;
 | 
	
		
			
				|  |  |  import org.springblade.manager.util.DataStructureFormatUtils;
 | 
	
		
			
				|  |  |  import org.springblade.manager.utils.CompositeKey;
 | 
	
		
			
				|  |  |  import org.springblade.manager.vo.*;
 | 
	
	
		
			
				|  | @@ -139,6 +140,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 | 
	
		
			
				|  |  |      private final TrialCyAccessoriesClient trialCyAccessoriesClient;
 | 
	
		
			
				|  |  |      private final WbsTreeContractStatisticsClient wbsTreeContractStatisticsClient;
 | 
	
		
			
				|  |  |      private final FormulaDataBlockMapper formulaDataBlockMapper;
 | 
	
		
			
				|  |  | +    private final WbsTreeContractExtendService wbsTreeContractExtendService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -6109,4 +6111,48 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 | 
	
		
			
				|  |  |          // 如果共同部分都相同,长度短的排在前面(父级在子级前面)
 | 
	
		
			
				|  |  |          return Integer.compare(arr1.length, arr2.length);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void setFormulaReference(FormulaReferenceDTO dto) {
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            dto.setKey(dto.getKey().split("__")[0]);
 | 
	
		
			
				|  |  | +            //查询父节点
 | 
	
		
			
				|  |  | +            WbsTreeContract parentNode = wbsTreeContractMapper.selectById(dto.getPId());
 | 
	
		
			
				|  |  | +            //查询父节点的扩展信息
 | 
	
		
			
				|  |  | +            WbsTreeContractExtend byId = wbsTreeContractExtendService.getById(dto.getPKeyId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(byId != null){
 | 
	
		
			
				|  |  | +                String formulaConfig = byId.getFormulaConfig();
 | 
	
		
			
				|  |  | +                if(StringUtils.isNotEmpty(formulaConfig)){
 | 
	
		
			
				|  |  | +                    List<String> list = Arrays.asList(formulaConfig.split(","));
 | 
	
		
			
				|  |  | +                    HashSet<String> strings = new HashSet<>(list);
 | 
	
		
			
				|  |  | +                    if(dto.getStatus() == 1){
 | 
	
		
			
				|  |  | +                        strings.remove(dto.getInitTableName() + ":" + dto.getKey());
 | 
	
		
			
				|  |  | +                    }else{
 | 
	
		
			
				|  |  | +                        strings.add(dto.getInitTableName() + ":" + dto.getKey());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    byId.setFormulaConfig(StringUtils.join(strings, ","));
 | 
	
		
			
				|  |  | +                }else{
 | 
	
		
			
				|  |  | +                    if(dto.getStatus() == 0){
 | 
	
		
			
				|  |  | +                        byId.setFormulaConfig(dto.getInitTableName() + ":" + dto.getKey());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                wbsTreeContractExtendService.updateById(byId);
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                if(dto.getStatus() == 0){
 | 
	
		
			
				|  |  | +                    WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setPKeyId(parentNode.getPKeyId());
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setContractId(Long.valueOf(parentNode.getContractId()));
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setType(null);
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setIsSync(0);
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setAncestors(parentNode.getAncestorsPId());
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtend.setFormulaConfig(dto.getInitTableName() + ":" + dto.getKey());
 | 
	
		
			
				|  |  | +                    wbsTreeContractExtendService.save(wbsTreeContractExtend);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } catch (NumberFormatException e) {
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +            throw new RuntimeException("失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |