785834757 пре 3 месеци
родитељ
комит
a870bba025

+ 2 - 1
commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java

@@ -13,9 +13,10 @@ import java.util.stream.Collectors;
 public class BuildDescUtils {
 
 
-    public static String buildDesc(List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
+    public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
         StringBuilder desc = new StringBuilder();
         Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream()
+                .filter(attr -> "all".equals(attr.getCompanyIds()) || attr.getCompanyIds().equals(companyId))
                 .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity()));
 
         for (PtlAgreementUndwrtRulesAttr link : linkList) {

+ 10 - 8
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -26,10 +26,7 @@ import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.mapper.PtlAgreementCostMapper;
 import com.jzg.organization.mapper.PtlAgreementCostRuleMapper;
 import com.jzg.organization.mapper.PtlAgreementCostTypeMapper;
-import com.jzg.organization.service.PtlAgreementCostRuleService;
-import com.jzg.organization.service.PtlAgreementCostService;
-import com.jzg.organization.service.PtlAgreementCostTypeService;
-import com.jzg.organization.service.PtlAgreementUndwrtRulesAttrService;
+import com.jzg.organization.service.*;
 import com.jzg.organization.state.CostState;
 import com.jzg.organization.state.listener.CostStateListener;
 import io.seata.spring.annotation.GlobalTransactional;
@@ -89,6 +86,9 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     @Autowired
     private PtlAgreementCostRuleMapper ptlAgreementCostRuleMapper;
 
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
     /**
      * 报价配置/费用管理/新增费用
      *
@@ -117,6 +117,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                     log.info("新增费用的时候,需要指定关联的协议信息。ptlAgreemenCostAdd=[{}]", JSONUtil.toJsonStr(ptlAgreemenCostAdd));
                     return HttpResult.error("新增费用的时候,需要指定关联的协议信息");
                 }
+                PtlAgreement agreement = ptlAgreementService.getById(costAdd.getPtlAgreementId());
                 ptlAgreementCostAdd.setPtlAgreementId(costAdd.getPtlAgreementId());
                 ptlAgreementCostAdd.setProductId(costAdd.getProductId());
                 ptlAgreementCostAdd.setProductName(costAdd.getProductName());
@@ -127,7 +128,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 //                    throw new SystemException("已存在相同且有效的费用规则,请检查");
 //                }
                 PtlAgreementCost ptlAgreementCost = BeanUtil.copyProperties(ptlAgreementCostAdd, PtlAgreementCost.class);
-                ptlAgreementCost.setCostRules(buildDescString(ptlAgreementCostAdd.getRuleConditions()));
+                ptlAgreementCost.setCostRules(buildDescString(agreement.getCompanyId(), ptlAgreementCostAdd.getRuleConditions()));
                 if (baseMapper.insert(ptlAgreementCost) <= 0) {
                     log.error("插入操作失败");
                     throw new RuntimeException(ReturnInformation.FAILURE_MESSAGE);
@@ -167,10 +168,11 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
                 }
             }
         }
+        PtlAgreement agreement = ptlAgreementService.getById(ptlAgreementCostEnd.getPtlAgreementId());
         PtlAgreementCost ptlAgreementCost = BeanUtil.copyProperties(ptlAgreementCostEnd, PtlAgreementCost.class);
         // modify by lipf, 2026年5月22日11:28:34 设置为待审核状态
         ptlAgreementCost.setApproved(0);
-        ptlAgreementCost.setCostRules(buildDescString(ptlAgreementCostEnd.getRuleConditions()));
+        ptlAgreementCost.setCostRules(buildDescString(agreement.getCompanyId(), ptlAgreementCostEnd.getRuleConditions()));
         if (baseMapper.updateById(ptlAgreementCost) <= 0) {
             throw new RuntimeException(ReturnInformation.UPDATE_FAILED);
         }
@@ -196,11 +198,11 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     }
 
 
-    public String buildDescString(List<?> list){
+    public String buildDescString(String companyId, List<?> list){
         if (CollectionUtils.isEmpty(list)){
             return null;
         }
-        return BuildDescUtils.buildDesc(BeanUtil.copyToList(list, PtlAgreementUndwrtRulesAttr.class), agreementUndwrtRulesAttrService.getUndwrtRulesAttrList());
+        return BuildDescUtils.buildDesc(companyId, BeanUtil.copyToList(list, PtlAgreementUndwrtRulesAttr.class), agreementUndwrtRulesAttrService.getUndwrtRulesAttrList());
     }
 
     public boolean verify(PtlAgreementCostAdd ptlAgreementCostAdd){