Переглянути джерело

驾意险座位险匹配修改

wanghao 3 місяців тому
батько
коміт
af6ecf01c6

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/po/jyxSetting.java

@@ -27,5 +27,9 @@ public class jyxSetting extends BaseModel {
     private BigDecimal premium;
 
     private String systemCode;
+    /**
+     * 产品编码
+     */
+    private String productCode;
 
 }

+ 2 - 2
tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java

@@ -96,8 +96,8 @@ public class SchemeController {
 
     @Operation(summary = "获取方案结果")
     @GetMapping("/getSchemeResult")
-    public HttpResult getSchemeResult(String companyId,String productId){
-        SchemeResultVo schemeResultVo = ptlSchemeService.getSchemeResult(companyId,productId);
+    public HttpResult getSchemeResult(String companyId,String productId,String seatCount){
+         SchemeResultVo schemeResultVo = ptlSchemeService.getSchemeResult(companyId,productId,seatCount);
         return HttpResult.ok(schemeResultVo);
     }
 

+ 9 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/jyxSettingMapper.java

@@ -0,0 +1,9 @@
+package com.jzg.organization.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.po.jyxSetting;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface jyxSettingMapper extends BaseMapper<jyxSetting> {
+}

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java

@@ -80,7 +80,7 @@ public interface PtlSchemeService extends IService<PtlScheme> {
      * @param productId
      * @return
      */
-    public SchemeResultVo getSchemeResult(String companyId,String productId);
+    public SchemeResultVo getSchemeResult(String companyId,String productId,String seatCount);
 
     List<InsBusinessInsuranceVo> getBusinessInsuranceListByKindType(String kindCode);
 

+ 29 - 1
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -20,6 +20,7 @@ import com.jzg.commons.entity.agreement.dispatch.vo.PtlAgreementDispatchVo;
 import com.jzg.commons.entity.agreement.dispatch.vo.ValidateDispatchRuleVo;
 import com.jzg.commons.entity.costs.vo.ValidateSchemeRuleVo;
 import com.jzg.commons.entity.po.*;
+import com.jzg.commons.entity.po.jyxSetting;
 import com.jzg.commons.entity.quote.vo.SalespersonInfoVo;
 import com.jzg.commons.entity.scheme.po.*;
 import com.jzg.commons.entity.scheme.vo.*;
@@ -92,6 +93,9 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
     @Autowired
     SysUserJzgInfoService sysUserJzgInfoService;
 
+    @Autowired
+    jyxSettingMapper jyxSettingMapper;
+
     /**
      * 添加方案
      * @param ptlSchemeSaveVo 车险报价的方案
@@ -487,10 +491,14 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
     }
 
     @Override
-    public SchemeResultVo getSchemeResult(String companyId, String productId) {
+    public SchemeResultVo getSchemeResult(String companyId, String productId,String seatCount) {
         log.info("根据保司Id和产品id查询协议信息。 companyId=[{}],productId=[{}]", companyId, productId);
         List<SchemeResultVo.SchemeVo> schemeInsuranceInfo = ptlSchemeMapper.getSchemeInsuranceInfo(companyId, productId);
         List<SchemeResultVo.SchemeVo> schemeDrivingInfo = ptlSchemeMapper.getSchemeDrivingInfo(companyId, productId);
+
+
+
+
         // 创建一个 Map,Key: info.id, Value: List<Driving>
         Map<String, List<SchemeResultVo.Driving>> drivingMap = new HashMap<>();
 
@@ -500,6 +508,26 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                 drivingMap.put(info.getId(), info.getDrivings());
             }
         }
+        // 处理驾意险中的座位险逻辑,根据座位数匹配实际保险金额
+        if (StrUtil.isNotBlank(seatCount)) {
+            int seats = Integer.parseInt(seatCount);
+            drivingMap.forEach((infoId, drivings) -> {
+                drivings.forEach(driving -> {
+                    jyxSetting setting = jyxSettingMapper.selectOne(
+                            new LambdaQueryWrapper<jyxSetting>()
+                                    .eq(jyxSetting::getJyxConfigId, driving.getId())
+                                    .eq(jyxSetting::getSeats, seats)
+                                    .last("limit 1"));
+                    if (setting != null) {
+                        driving.setProductCode(setting.getProductCode());
+                        driving.setPremium(setting.getPremium() != null ? setting.getPremium().toString() : null);
+                        driving.setCoverage(setting.getCoverage() != null ? setting.getCoverage().toString() : null);
+                    }
+                });
+            });
+        }
+
+
 
         // 遍历 schemeInsuranceInfo,把 drivings 合并
         for (SchemeResultVo.SchemeVo insuranceScheme : schemeInsuranceInfo) {

+ 1 - 0
tenant/organization/src/main/resources/application.yml

@@ -68,6 +68,7 @@ tenant:
     - esm_ins_company
     - qr_barcode_config
     - jyx_config
+    - jyx_setting
     - sys_user_jzg_app
     - sys_dept
     - sys_user_jzg_info_salesman