Explorar el Código

诚泰交强商业特约的报价功能优化

dongxin hace 1 año
padre
commit
e274854db9

+ 18 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyRelatedInfoMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.InsAreaCompanyRelatedInfo;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_related_info(子订单关联信息表)】的数据库操作Mapper
+* @createDate 2024-11-29 15:26:49
+* @Entity generator.domain.InsAreaCompanyRelatedInfo
+*/
+public interface InsAreaCompanyRelatedInfoMapper extends BaseMapper<InsAreaCompanyRelatedInfo> {
+
+}
+
+
+
+

+ 149 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyRelatedInfo.java

@@ -0,0 +1,149 @@
+package com.ydtech.modules.order.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 子订单关联信息表
+ * @TableName ins_area_company_related_info
+ */
+@TableName(value = "ins_area_company_related_info")
+@Data
+@ApiModel(value = "子订单关联信息表")
+@NoArgsConstructor
+@AllArgsConstructor
+public class InsAreaCompanyRelatedInfo implements Serializable {
+    /**
+     * 主键/自增
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 子订单id
+     */
+    @ApiModelProperty(value = "子订单id")
+    private String companyId;
+
+    /**
+     * 交强特别约定
+     */
+    @ApiModelProperty(value = "交强特别约定")
+    private String jqappoint;
+
+    /**
+     * 商业特别约定
+     */
+    @ApiModelProperty(value = "商业特别约定")
+    private String syappoint;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键/自增
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * 主键/自增
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * 子订单id
+     */
+    public String getCompanyId() {
+        return companyId;
+    }
+
+    /**
+     * 子订单id
+     */
+    public void setCompanyId(String companyId) {
+        this.companyId = companyId;
+    }
+
+    /**
+     * 交强特别约定
+     */
+    public String getJqappoint() {
+        return jqappoint;
+    }
+
+    /**
+     * 交强特别约定
+     */
+    public void setJqappoint(String jqappoint) {
+        this.jqappoint = jqappoint;
+    }
+
+    /**
+     * 商业特别约定
+     */
+    public String getSyappoint() {
+        return syappoint;
+    }
+
+    /**
+     * 商业特别约定
+     */
+    public void setSyappoint(String syappoint) {
+        this.syappoint = syappoint;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsAreaCompanyRelatedInfo other = (InsAreaCompanyRelatedInfo) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
+            && (this.getJqappoint() == null ? other.getJqappoint() == null : this.getJqappoint().equals(other.getJqappoint()))
+            && (this.getSyappoint() == null ? other.getSyappoint() == null : this.getSyappoint().equals(other.getSyappoint()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
+        result = prime * result + ((getJqappoint() == null) ? 0 : getJqappoint().hashCode());
+        result = prime * result + ((getSyappoint() == null) ? 0 : getSyappoint().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", companyId=").append(companyId);
+        sb.append(", jqappoint=").append(jqappoint);
+        sb.append(", syappoint=").append(syappoint);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 13 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyRelatedInfoService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.InsAreaCompanyRelatedInfo;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_related_info(子订单关联信息表)】的数据库操作Service
+* @createDate 2024-11-29 15:26:49
+*/
+public interface InsAreaCompanyRelatedInfoService extends IService<InsAreaCompanyRelatedInfo> {
+
+}

+ 32 - 21
src/main/java/com/ydtech/modules/order/service/impl/ChengTaiOrderApiServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.ydtech.constants.enums.InsuranceOrderPdf;
 import com.ydtech.constants.enums.InsuranceRisk;
@@ -67,6 +68,9 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
     @Autowired
     private InsAreaCompanyService insAreaCompanyService;
 
+    @Autowired
+    private InsAreaCompanyRelatedInfoService insAreaCompanyRelatedInfoService;
+
     @Autowired
     private InsTaskImagesService insTaskImagesService;
 
@@ -178,11 +182,13 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
             insAreaCompanyAccidentalDriving.setRideRiskName(accidentalDriving.getProjectName());
             insAreaCompanyAccidentalDrivings.add(insAreaCompanyAccidentalDriving);
         });
-
-        // 特约
-        insAreaCompany.setJqappoint(quoteRespVo.getJqappoint());
-        insAreaCompany.setSyappoint(quoteRespVo.getSyappoint());
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDrivings);
+        // 保存交强特约信息
+        InsAreaCompanyRelatedInfo info = new InsAreaCompanyRelatedInfo();
+        info.setCompanyId(insAreaCompany.getCompanyId());
+        info.setJqappoint(quoteRespVo.getJqappoint());
+        info.setSyappoint(quoteRespVo.getSyappoint());
+        insAreaCompanyRelatedInfoService.save(info);
         quoteRespVo.setCompanyId(insAreaCompany.getId());
         return HttpResult.ok("报价成功", quoteRespVo);
 
@@ -385,6 +391,9 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
     public HttpResult<Object> audit(String companyId) throws Exception {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
         InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+        LambdaQueryWrapper<InsAreaCompanyRelatedInfo> infoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        infoLambdaQueryWrapper.eq(InsAreaCompanyRelatedInfo::getCompanyId, insAreaCompany.getCompanyId());
+        List<InsAreaCompanyRelatedInfo> infoList = insAreaCompanyRelatedInfoService.list(infoLambdaQueryWrapper);
         // 1 通过 协议id获取配置实体
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         ChengTaiConfigureParameters parameters = configureParametersComponents.toEntity(ChengTaiConfigureParameters.class,
@@ -398,25 +407,27 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
 
         List<SubmitVerifyRequest.EngageListDTO> engageDTO = new ArrayList<>();
         // 获取特约
-        List<SubmitVerifyRequest.EngageListDTO> ciEngageDTO = JSON.parseArray(insAreaCompany.getJqappoint(),
-                SubmitVerifyRequest.EngageListDTO.class);
-        if(CollUtil.isNotEmpty(ciEngageDTO)){
-            for (SubmitVerifyRequest.EngageListDTO engageListDTO : ciEngageDTO) {
-                engageListDTO.setRiskCode(RiskCodeEnum.R1002.getCode());
+        if (CollUtil.isNotEmpty(infoList)){
+            List<SubmitVerifyRequest.EngageListDTO> ciEngageDTO = JSON.parseArray(infoList.get(0).getJqappoint(),
+                    SubmitVerifyRequest.EngageListDTO.class);
+            if(CollUtil.isNotEmpty(ciEngageDTO)){
+                for (SubmitVerifyRequest.EngageListDTO engageListDTO : ciEngageDTO) {
+                    engageListDTO.setRiskCode(RiskCodeEnum.R1002.getCode());
+                }
             }
-        }
-        List<SubmitVerifyRequest.EngageListDTO> biEngageDTO = JSON.parseArray(insAreaCompany.getSyappoint(),
-                SubmitVerifyRequest.EngageListDTO.class);
-        if(CollUtil.isNotEmpty(biEngageDTO)){
-            for (SubmitVerifyRequest.EngageListDTO engageListDTO : biEngageDTO) {
-                engageListDTO.setRiskCode(RiskCodeEnum.R0821.getCode());
+            List<SubmitVerifyRequest.EngageListDTO> biEngageDTO = JSON.parseArray(infoList.get(0).getSyappoint(),
+                    SubmitVerifyRequest.EngageListDTO.class);
+            if(CollUtil.isNotEmpty(biEngageDTO)){
+                for (SubmitVerifyRequest.EngageListDTO engageListDTO : biEngageDTO) {
+                    engageListDTO.setRiskCode(RiskCodeEnum.R0821.getCode());
+                }
+            }
+            if(CollUtil.isNotEmpty(ciEngageDTO)){
+                engageDTO.addAll(ciEngageDTO);
+            }
+            if(CollUtil.isNotEmpty(biEngageDTO)){
+                engageDTO.addAll(biEngageDTO);
             }
-        }
-        if(CollUtil.isNotEmpty(ciEngageDTO)){
-            engageDTO.addAll(ciEngageDTO);
-        }
-        if(CollUtil.isNotEmpty(biEngageDTO)){
-            engageDTO.addAll(biEngageDTO);
         }
         // 投保保存
         SubmitVerifyRequest submitVerifyRequest = new SubmitVerifyRequest(parameters,insAreaCompany,

+ 22 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyRelatedInfoServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsAreaCompanyRelatedInfoMapper;
+import com.ydtech.modules.order.entity.InsAreaCompanyRelatedInfo;
+import com.ydtech.modules.order.service.InsAreaCompanyRelatedInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_related_info(子订单关联信息表)】的数据库操作Service实现
+* @createDate 2024-11-29 15:26:49
+*/
+@Service
+public class InsAreaCompanyRelatedInfoServiceImpl extends ServiceImpl<InsAreaCompanyRelatedInfoMapper, InsAreaCompanyRelatedInfo>
+    implements InsAreaCompanyRelatedInfoService {
+
+}
+
+
+
+

+ 18 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyRelatedInfoMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.order.dao.InsAreaCompanyRelatedInfoMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsAreaCompanyRelatedInfo">
+            <id property="id" column="id" jdbcType="BIGINT"/>
+            <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
+            <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
+            <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,company_id,jqappoint,
+        syappoint
+    </sql>
+</mapper>