Selaa lähdekoodia

1.修改没有配置保险账号不能提交问题

wks 3 vuotta sitten
vanhempi
commit
8003372145

+ 2 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementAttributionService.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.protocol.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 
@@ -21,7 +22,7 @@ public interface PtlAgreementAttributionService extends IService<PtlAgreementAtt
      * @param insuranceCompanyId 保险公司id
      * @param attribution        协议归属信息
      */
-    void saveAttribution(String agreementId, String insuranceCompanyId, PtlAgreementAttributionDto attribution);
+    void saveAttribution(String agreementId, EsmInsCompany esmInsCompany, PtlAgreementAttributionDto attribution);
 
     /**
      * 根据保险公司id 和 配置查询归属

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -87,7 +87,7 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param agreementId 协议id
      * @param agreement   提交内容
      */
-    void saveAssociationInformation(String agreementId, String insuranceCompanyId, PtlAgreementSaveVo agreement);
+    void saveAssociationInformation(String agreementId, EsmInsCompany insuranceCompanyId, PtlAgreementSaveVo agreement);
 
     /**
      * 删除关联信息  产品费用 承保规则 账号信息 授权部门

+ 1 - 8
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementAttributionServiceImpl.java

@@ -21,15 +21,8 @@ import java.util.List;
 public class PtlAgreementAttributionServiceImpl extends ServiceImpl<PtlAgreementAttributionMapper, PtlAgreementAttribution>
         implements PtlAgreementAttributionService {
 
-    private final EsmInsCompanyService esmInsCompanyService;
-
-    public PtlAgreementAttributionServiceImpl(EsmInsCompanyService esmInsCompanyService) {
-        this.esmInsCompanyService = esmInsCompanyService;
-    }
-
     @Override
-    public void saveAttribution(String agreementId, String insuranceCompany, PtlAgreementAttributionDto attribution) {
-        EsmInsCompany esmInsCompany = esmInsCompanyService.getById(insuranceCompany);
+    public void saveAttribution(String agreementId, EsmInsCompany esmInsCompany, PtlAgreementAttributionDto attribution) {
         PtlAgreementAttribution ptlAgreementAttribution = new PtlAgreementAttribution(agreementId, esmInsCompany.getId(), esmInsCompany.getNamesimple(), attribution);
         save(ptlAgreementAttribution);
     }

+ 7 - 6
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -119,8 +119,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         ptlAgreement.setCreateTime(LocalDateTime.now());
         save(ptlAgreement);
         // 产品费用
-        String insuranceCompanyId = esmInsCompany.getId();
-        proxyObject.saveAssociationInformation(ptlAgreement.getId(), insuranceCompanyId, agreement);
+        proxyObject.saveAssociationInformation(ptlAgreement.getId(), esmInsCompany, agreement);
         return HttpResult.ok("添加成功");
     }
 
@@ -189,19 +188,21 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 关联表都是先删除后添加
         proxyObject.deleteAssociationInformation(agreementId);
 
-        String insuranceCompanyId = esmInsCompany.getId();
-        proxyObject.saveAssociationInformation(agreementId, insuranceCompanyId, agreement);
+        proxyObject.saveAssociationInformation(agreementId, esmInsCompany, agreement);
         return HttpResult.ok("修改成功");
     }
 
     @Override
-    public void saveAssociationInformation(String agreementId, String insuranceCompanyId, PtlAgreementSaveVo agreement) {
+    public void saveAssociationInformation(String agreementId,  EsmInsCompany esmInsCompany, PtlAgreementSaveVo agreement) {
         // 产品费用
         ptlAgreementProductCostsService.saveBatchProductCosts(agreementId, agreement.getScheme());
         // 承包规则
         ptlAgreementUnderwritingRulesService.saveBatchUnderwritingRules(agreementId, agreement.getUnderwritingRules());
         // 账号添加
-        ptlAgreementAttributionService.saveAttribution(agreementId, insuranceCompanyId, agreement.getAttribution());
+        PtlAgreementAttributionDto attribution = agreement.getAttribution();
+        if(StringUtils.isNotEmpty(attribution.getTemplateId())){
+            ptlAgreementAttributionService.saveAttribution(agreementId, esmInsCompany, agreement.getAttribution());
+        }
         // 部门授权
         ptlAgreementDeptService.saveBatchDept(agreementId, agreement.getDept());
     }

+ 2 - 1
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -68,9 +68,10 @@
     <select id="getAgreementCompany" resultMap="AgreementCompanyResultMap">
         select eic.*, pa.id as agreement_id, pa.agreement_name, paa.api_type
         from esm_ins_company as eic
-                 right join ptl_agreement as pa on pa.insurance_company_id = eic.id
+                 left join ptl_agreement as pa on pa.insurance_company_id = eic.id
                  left join ptl_agreement_attribution as paa on paa.id = pa.id
         where (#{localDate} between start_date and end_date)
+          and (paa.template_id is not null)
           and pa.id in (select distinct agreement_id
                         from ptl_agreement_dept
                         where dept_id = #{deptId})