Browse Source

保险公司归属信息查询回显

Qchen 1 year ago
parent
commit
84672f8b93

+ 2 - 1
src/main/java/com/ydtech/modules/protocol/controller/PtlInsAttributionTemplateController.java

@@ -4,6 +4,7 @@ package com.ydtech.modules.protocol.controller;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.entity.dto.PtlInsAttributionTemplateQueryDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
@@ -27,7 +28,7 @@ public class PtlInsAttributionTemplateController {
 
     @PostMapping("/getPtlInsAttributionTemplate")
     @ApiOperation("通过保险公司id和api类型查询请求模板")
-    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(@RequestBody PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
+    public HttpResult<PtlAgreementAttribution> getPtlInsAttributionTemplate(@RequestBody PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
         return ptlInsAttributionTemplateService.getPtlInsAttributionTemplate(ptlInsAttributionTemplateVo);
     }
 

+ 3 - 0
src/main/java/com/ydtech/modules/protocol/entity/vo/PtlInsAttributionTemplateVo.java

@@ -19,4 +19,7 @@ public class PtlInsAttributionTemplateVo implements Serializable {
     @ApiModelProperty("保险公司ID")
     private String insCompanyId;
 
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
 }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.entity.dto.PtlInsAttributionTemplateQueryDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
@@ -70,6 +71,6 @@ public interface PtlInsAttributionTemplateService extends IService<PtlInsAttribu
      * @param ptlInsAttributionTemplateVo 保险公司id和api类型
      * @return PtlInsAttributionTemplate
      */
-    HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo);
+    HttpResult<PtlAgreementAttribution> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo);
 
 }

+ 19 - 7
src/main/java/com/ydtech/modules/protocol/service/impl/PtlInsAttributionTemplateServiceImpl.java

@@ -11,12 +11,14 @@ import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.dao.PtlInsAttributionTemplateMapper;
 import com.ydtech.modules.protocol.entity.constants.PtlApiType;
 import com.ydtech.modules.protocol.entity.dto.PtlInsAttributionTemplateQueryDto;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
 import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
 import com.ydtech.modules.protocol.entity.vo.PtlCrawlerApiSaveVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
 import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
+import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.protocol.service.PtlInsAttributionTemplateService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
@@ -46,11 +48,14 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
 
     private final PtlInsAttributionTemplateService proxyService;
 
+    private final PtlAgreementAttributionService ptlAgreementAttributionService;
+
     public PtlInsAttributionTemplateServiceImpl(EsmInsCompanyService esmInsCompanyService, PtlCrawlerApiService ptlCrawlerApiService,
-                                                @Lazy PtlInsAttributionTemplateService proxyService) {
+                                                @Lazy PtlInsAttributionTemplateService proxyService,PtlAgreementAttributionService ptlAgreementAttributionService) {
         this.esmInsCompanyService = esmInsCompanyService;
         this.ptlCrawlerApiService = ptlCrawlerApiService;
         this.proxyService = proxyService;
+        this.ptlAgreementAttributionService = ptlAgreementAttributionService;
     }
 
 
@@ -152,15 +157,14 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
     }
 
     @Override
-    public HttpResult<PtlInsAttributionTemplate> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
+    public HttpResult<PtlAgreementAttribution> getPtlInsAttributionTemplate(PtlInsAttributionTemplateVo ptlInsAttributionTemplateVo) {
         String code = "000000";
         String substring = ptlInsAttributionTemplateVo.getInsCompanyId().substring(0, 5);
         String companyId = substring + code;
-
-        LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = byInsCompanyIdAndApiType(companyId, ptlInsAttributionTemplateVo.getApiType());
-        PtlInsAttributionTemplate ptlInsAttributionTemplate = getOne(wrapper);
-        AssertionUtils.isEmpty(ptlInsAttributionTemplate, "保险公司归属信息模板查询失败");
-        return HttpResult.ok(ptlInsAttributionTemplate);
+        LambdaQueryWrapper<PtlAgreementAttribution> wrapper = byInsCompanyIdAndApiTypeAndAgreementId(ptlInsAttributionTemplateVo.getAgreementId(),companyId, ptlInsAttributionTemplateVo.getApiType());
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getOne(wrapper);
+        AssertionUtils.isEmpty(ptlAgreementAttribution, "保险公司归属信息模板查询失败");
+        return HttpResult.ok(ptlAgreementAttribution);
     }
 
     private LambdaQueryWrapper<PtlInsAttributionTemplate> byInsCompanyIdAndApiType(String insCompanyId, Integer apiType) {
@@ -170,6 +174,14 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
         return wrapper;
     }
 
+    private LambdaQueryWrapper<PtlAgreementAttribution> byInsCompanyIdAndApiTypeAndAgreementId(String agreementId, String insCompanyId, Integer apiType) {
+        LambdaQueryWrapper<PtlAgreementAttribution> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PtlAgreementAttribution::getId, agreementId)
+                .eq(PtlAgreementAttribution::getInsCompanyId, insCompanyId)
+                .eq(PtlAgreementAttribution::getApiType, apiType);
+        return wrapper;
+    }
+
 }