浏览代码

华泰对接新建实体

cuixinpeng 2 年之前
父节点
当前提交
affe8d0937

+ 7 - 0
src/main/java/com/ydtech/modules/ins/model/vo/QuoteRespVo.java

@@ -94,6 +94,13 @@ public class QuoteRespVo {
     @ApiModelProperty("扩展字段")
     private Object extendInfo;
 
+    @ApiModelProperty("交强投保单号")
+    private String jqApplyNo;
+
+    @ApiModelProperty("商业投保单号")
+    private String syApplyNo;
+
+
     public List<AccidentResponseVo> getAccidentInfo() {
         return accident == null ? Collections.emptyList() : accident;
     }

+ 12 - 2
src/main/java/com/ydtech/modules/order/entity/api/huatai/constants/HuaTaiBaseCode.java

@@ -11,7 +11,6 @@ import java.util.Map;
  */
 public class HuaTaiBaseCode {
 
-
     protected static final Map<String, String> SaPromoteId = new HashMap<>();
 
     static {
@@ -25,11 +24,16 @@ public class HuaTaiBaseCode {
         SaPromoteId.put("2008000008", "综改折扣下浮15%");
     }
 
+    /**
+     * 活动
+     * @return
+     */
     public static Map<String, String> getSaPromoteId() {
         return SaPromoteId;
     }
 
 
+
     protected static final List<String> Occupation = new ArrayList<>();
     static {
         Occupation.add("10000");//党的机关国家机关群众团体和社会组织企事业单位负责人
@@ -56,6 +60,12 @@ public class HuaTaiBaseCode {
         Occupation.add("80000");//不便分类的其他从业人员
     }
 
-
+    /**
+     * 职业
+     * @return
+     */
+    public static List<String> getOccupation() {
+        return Occupation;
+    }
 
 }

+ 3 - 1
src/main/java/com/ydtech/modules/order/entity/api/huatai/request/HuaTaiQuotedPriceRequest.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.ins.model.vo.RiskInfoVo;
 import com.ydtech.modules.order.constants.InsuranceTypeCorrespondence;
 import com.ydtech.modules.order.entity.api.huatai.HuaTaiBaseRequest;
 import com.ydtech.modules.order.entity.api.huatai.HuaTaiBaseRequestHead;
+import com.ydtech.modules.order.entity.api.huatai.constants.HuaTaiBaseCode;
 import com.ydtech.modules.order.entity.api.huatai.constants.HuaTaiTransCode;
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiActualValueResponse;
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiModelsQueryResponse;
@@ -690,7 +691,8 @@ public class HuaTaiQuotedPriceRequest extends HuaTaiBaseRequest {
             this.mobile = customerInfoVo.getMobile();
             this.type = "1";
             this.role = role;
-            this.occupationCode = "20114";//后续需要根据接口维护返参到表里
+            int randomNum = new Random().nextInt(HuaTaiBaseCode.getOccupation().size());
+            this.occupationCode = HuaTaiBaseCode.getOccupation().get(randomNum);//后续需要根据接口维护返参到表里
             this.identifyValidDate = customerInfoVo.getIdentifyValidDate() + " " + TimeConstants.START_TIME;
             this.identifyValidEndDate = customerInfoVo.getIdentifyValidEndDate() + " " + TimeConstants.END_TIME;
             if("2".equals(role)){

+ 284 - 162
src/main/java/com/ydtech/modules/order/entity/api/huatai/request/HuaTaiSubmitRequest.java

@@ -1,16 +1,33 @@
 package com.ydtech.modules.order.entity.api.huatai.request;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.modules.ins.model.vo.CarInfoVo;
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import com.ydtech.modules.order.constants.InsuranceTypeCorrespondence;
 import com.ydtech.modules.order.entity.api.huatai.HuaTaiBaseRequest;
 import com.ydtech.modules.order.entity.api.huatai.HuaTaiBaseRequestHead;
 import com.ydtech.modules.order.entity.api.huatai.constants.HuaTaiTransCode;
+import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiActualValueResponse;
+import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiModelsQueryResponse;
+import com.ydtech.modules.order.entity.api.zhongmei.constants.TimeConstants;
+import com.ydtech.modules.order.entity.config.HuaTaiConfigureParameters;
+import com.ydtech.modules.order.entity.vo.AccidentalDrivingVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.VehicleAndVesselTax;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
-import java.util.List;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
 
 @EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
@@ -18,9 +35,9 @@ import java.util.List;
 public class HuaTaiSubmitRequest extends HuaTaiBaseRequest  {
 
     private static final long serialVersionUID = -3434101420731502321L;
-    @JsonProperty("businessData")
+    @JSONField(name="businessData")
     //投保单信息
-    private HuaTaiSubmitRequest.BusinessData businessData;
+    private BusinessDataDto businessData;
 
     @Override
     public void setHead(HuaTaiBaseRequestHead head) {
@@ -31,78 +48,136 @@ public class HuaTaiSubmitRequest extends HuaTaiBaseRequest  {
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class BusinessData implements Serializable {
+    public static class BusinessDataDto implements Serializable {
 
         private static final long serialVersionUID = -4470540010039479454L;
         // 投保主信息
-        @JsonProperty("businessMain")
-        private BusinessMain businessMain;
+        @JSONField(name="businessMain")
+        private BusinessMainDto businessMain;
         // 业务信息(列表)
-        @JsonProperty("contract")
-        private List<Contract> contract;
+        @JSONField(name="contract")
+        private List<ContractDto> contract;
         // 客户信息(列表)
-        @JsonProperty("customer")
-        private List<Customer> customer;
+        @JSONField(name="customer")
+        private List<CustomerDto> customer;
         //  销售信息
-        @JsonProperty("saleInfo")
-        private SaleInfo saleInfo;
+        @JSONField(name="saleInfo")
+        private SaleInfoDto saleInfo;
 
+        public BusinessDataDto(BaseQuoteInfoVo baseQuoteInfoVo, HuaTaiModelsQueryResponse.CarModelDto.FullCarDataDto fullCarDataDto, HuaTaiActualValueResponse actualValueResponse,  HuaTaiConfigureParameters huaTaiConfigureParameters) {
+            CarInfoVo carInfo = baseQuoteInfoVo.getCarInfo();
+            List<RiskInfoVo> riskList = baseQuoteInfoVo.getRiskList();
+            List<KindInfoVo> kindList = baseQuoteInfoVo.getKindList();
+            VehicleAndVesselTax vesselTax = baseQuoteInfoVo.getVehicleAndVesselTax();
+            CustomerInfoVo ownerInfo = baseQuoteInfoVo.getOwnerInfo();
+            CustomerInfoVo policyHolderInfo = baseQuoteInfoVo.getPolicyHolderInfo();
+            CustomerInfoVo insuredPersonInfo = baseQuoteInfoVo.getInsuredPersonInfo();
+            int i = Integer.parseInt(carInfo.getSeatCount());
+            // 保单归属地
+            this.businessMain = new BusinessMainDto(huaTaiConfigureParameters);
+            // 保险信息
+            this.contract = new ContractDto().getContract(riskList,huaTaiConfigureParameters);
+            // 客户信息
+            this.customer = new CustomerDto().getCustomers(ownerInfo, policyHolderInfo, insuredPersonInfo);
+            //销售信息
+            this.saleInfo = new SaleInfoDto(huaTaiConfigureParameters);
+
+        }
     }
 
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class BusinessMain implements Serializable{
+    public static class BusinessMainDto implements Serializable{
 
         private static final long serialVersionUID = -3901160212812740520L;
         // 操作机构代码
-        @JsonProperty("makeCom")
+        @JSONField(name="makeCom")
         private String makeCom;
         // 操作员代码
-        @JsonProperty("operatorCode")
+        @JSONField(name="operatorCode")
         private String operatorCode;
 
+        public BusinessMainDto(HuaTaiConfigureParameters huaTaiConfigureParameters) {
+            this.makeCom = huaTaiConfigureParameters.getComCode();
+            this.operatorCode = huaTaiConfigureParameters.getOperatorCode();
+        }
     }
 
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class Contract implements Serializable{
+    public static class ContractDto implements Serializable{
 
         private static final long serialVersionUID = 2452110821283897129L;
         // 业务主信息
-        @JsonProperty("contractMain")
-        private ContractMain contractMain;
+        @JSONField(name="contractMain")
+        private ContractMainDto contractMain;
         // 平台交互信息
-        @JsonProperty("platFormMessage")
+        @JSONField(name="platFormMessage")
         private PlatFormMessage platFormMessage;
+        //CY	自定义特别约定列表
+        @JSONField(name="engage")
+        private List engage;
 
+        public List<ContractDto> getContract(List<RiskInfoVo> riskInfoVos, HuaTaiConfigureParameters huaTaiConfigureParameters) {
+            List<ContractDto> contractDTOS = new ArrayList<>();
+            for (RiskInfoVo riskInfoVo : riskInfoVos) {
+                ContractDto contractDto = new ContractDto();
+                this.contractMain = new ContractMainDto(riskInfoVo,huaTaiConfigureParameters);
+                contractDto.setContractMain(contractMain);
+                contractDTOS.add(contractDto);
+            }
+            return contractDTOS;
+        }
     }
 
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class ContractMain implements Serializable{
+    public static class ContractMainDto implements Serializable{
 
         private static final long serialVersionUID = -827498526562322815L;
         //报价单号(需传入报价接口返回的值)
-        @JsonProperty("contractNo")
+        @JSONField(name="contractNo")
         private String contractNo;
         //参见险种代码
-        @JsonProperty("riskCode")
+        @JSONField(name="riskCode")
         private String riskCode;
         //起保日期(YYYY-MM-DD HH24:MI:SS)
-        @JsonProperty("validDate")
+        @JSONField(name="validDate")
         private String validDate;
         //终保日期(YYYY-MM-DD HH24:MI:SS)
-        @JsonProperty("expiryDate")
+        @JSONField(name="expiryDate")
         private String expiryDate;
         //总签单保费
-        @JsonProperty("totalPremium")
+        @JSONField(name="totalPremium")
         private String totalPremium;
         //备注
-        @JsonProperty("remark")
+        @JSONField(name="remark")
         private String remark;
+
+        public ContractMainDto(RiskInfoVo riskInfoVo, HuaTaiConfigureParameters huaTaiConfigureParameters) {
+            this.contractNo = "";
+            this.riskCode = InsuranceTypeCorrespondence.getHuaTaiRisk().get(riskInfoVo.getRiskCode());
+            String startDate = riskInfoVo.getStartDate();
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            LocalDate localDate = LocalDate.parse(startDate, formatter);
+            LocalDate nextYears = localDate.plusYears(1);
+            if (startDate.contains(TimeConstants.START_TIME)) {
+                LocalDate expiry = nextYears.minusDays(1);
+                this.validDate = riskInfoVo.getStartDate();
+                this.expiryDate = expiry + " " + TimeConstants.END_TIME;
+            } else {
+                // 及时
+                LocalDateTime localDateTime = LocalDateTime.parse(startDate, formatter);
+                LocalDateTime expiryDateTime = localDateTime.plusYears(1);
+                this.validDate = startDate;
+                this.expiryDate = expiryDateTime.format(formatter);
+            }
+            this.totalPremium = "";
+
+        }
     }
 
     @AllArgsConstructor
@@ -112,172 +187,198 @@ public class HuaTaiSubmitRequest extends HuaTaiBaseRequest  {
 
         private static final long serialVersionUID = 7957269957188794595L;
         // 业务主信息
-        @JsonProperty("querySequenceNo")
+        @JSONField(name="querySequenceNo")
         private String querySequenceNo;
     }
 
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class Customer implements Serializable{
+    public static class CustomerDto implements Serializable{
 
         private static final long serialVersionUID = 3423549173956690508L;
-        //证件号码(个人客户必传)
-        @JsonProperty("identifyNumber")
+        //Y	证件号码(个人客户必传)
+        @JSONField(name="identifyNumber")
         private String identifyNumber;
-        //组织机构代码(机构客户必录
-        @JsonProperty("organizeCode")
+        //CY	组织机构代码(机构客户必录
+        @JSONField(name="organizeCode")
         private String organizeCode;
-        //参见客户证件类型代码
-        @JsonProperty("identifyType")
+        //Y	参见客户证件类型代码(机构客户传99)
+        @JSONField(name="identifyType")
         private String identifyType;
-        //客户名称
-        @JsonProperty("name")
+        //Y	名称
+        @JSONField(name="name")
         private String name;
-        //客户角色身份(1-投保人;2-被保险人;3-车主)
-        @JsonProperty("role")
+        //Y	客户角色身份(1-投保人;2-被保险人;3-车主)
+        @JSONField(name="role")
         private String role;
-        //手机号码
-        @JsonProperty("mobile")
+        //Y	手机号码
+        @JSONField(name="mobile")
         private String mobile;
-        //证件有效起期(格式:YYYY-MM-DD HH24:MI:SS)
-        @JsonProperty("identifyValidDate")
+        //Y	证件有效起期(格式:YYYY-MM-DD HH24:MI:SS)
+        @JSONField(name="identifyValidDate")
         private String identifyValidDate;
-        //证件有效止期(格式:YYYY-MM-DD HH24:MI:SS)
-        @JsonProperty("identifyValidEndDate")
+        //Y	证件有效止期(格式:YYYY-MM-DD HH24:MI:SS)
+        @JSONField(name="identifyValidEndDate")
         private String identifyValidEndDate;
-        //客户职业(传值要求通过职业查询接口获得)
-        @JsonProperty("occupationCode")
+        //Y	客户职业(通过职业查询接口获得)
+        @JSONField(name="occupationCode")
         private String occupationCode;
-        //客户类型(1-个人,2-机构)
-        @JsonProperty("type")
+        //Y	客户地址
+        @JSONField(name="addr")
+        private String addr;
+        //Y	客户邮箱
+        @JSONField(name="email")
+        private String email;
+        //Y	客户类型(1-个人,2-机构)
+        @JSONField(name="type")
         private String type;
-        //车辆与被保险人所属关系(1-所有;2-使用;3-管理)
-        @JsonProperty("carInsuredRelation")
+        //CY	车辆与被保险人所属关系(1-所有;2-使用;3-管理,当角色是被保险人时必传
+        @JSONField(name="carInsuredRelation")
         private String carInsuredRelation;
-        //参见投保人与被保人关系代码(投保人和被保人均为个人客户时必传)
-        @JsonProperty("aiRelation")
+        //CY 参见投保人与被保人关系代码(投保人和被保人均为个人客户时必传)
+        @JSONField(name="aiRelation")
         private String aiRelation;
-        //客户地址
-        @JsonProperty("addr")
-        private String addr;
-        //客户邮箱
-        @JsonProperty("email")
-        private String email;
-        //客户地址(省)代码(江西必传)
-        @JsonProperty("Province")
+        //CY	客户地址(省)代码(江西必传)
+        @JSONField(name="Province")
         private String province;
-        //客户地址(省)名称(江西必传)
-        @JsonProperty("ProvinceName")
+        //CY	客户地址(省)名称(江西必传)
+        @JSONField(name="ProvinceName")
         private String provinceName;
-        //客户地址(市)代码(江西必传)
-        @JsonProperty("City")
+        //CY	客户地址(市)代码(江西必传)
+        @JSONField(name="City")
         private String city;
-        //客户地址(市)名称(江西必传)
-        @JsonProperty("CityName")
+        //CY	客户地址(市)名称(江西必传)
+        @JSONField(name="CityName")
         private String cityName;
-        //客户地址(区)代码(江西必传)
-        @JsonProperty("District")
+        //CY	客户地址(区)代码(江西必传)
+        @JSONField(name="District")
         private String district;
-        //客户地址(区)名称(江西必传)
-        @JsonProperty("DistrictName")
+        //CY	客户地址(区)名称(江西必传)
+        @JSONField(name="DistrictName")
         private String districtName;
-        //手机实际持有人姓名(上海出单必录)
-        @JsonProperty("ActualHolderName")
+        //CY	手机实际持有人姓名(上海出单必录)
+        @JSONField(name="ActualHolderName")
         private String actualHolderName;
-        //手机实际持有人证件类型(上海出单必录)(参见客户证件类型代码)
-        @JsonProperty("ActualHolderIdentifyType")
+        //CY	手机实际持有人证件类型(参见客户证件类型代码)(上海出单必录)
+        @JSONField(name="ActualHolderIdentifyType")
         private String actualHolderIdentifyType;
-        //手机实际持有人证件号码(上海出单必录)
-        @JsonProperty("ActualHolderIdentifyCode")
+        //CY	手机实际持有人证件号码(上海出单必录)
+        @JSONField(name="ActualHolderIdentifyCode")
         private String actualHolderIdentifyCode;
-        //参见企业经办人类别代码(上海机构客户出单必录)
-        @JsonProperty("transactorType")
+        //CY	企业经办人类别(传值参见企业经办人类别)(上海机构客户出单必录)
+        @JSONField(name="transactorType")
         private String transactorType;
-        //营业性质/主要业务范围(机构客户必录
-        @JsonProperty("businessDetail")
+        //CY	营业性质/主要业务范围(机构客户)
+        @JSONField(name="businessDetail")
         private String businessDetail;
-        //参见行业代码(机构客户必传
-        @JsonProperty("BusinessSource")
+        //CY	行业代码(机构客户)(传值参见行业代码
+        @JSONField(name="BusinessSource")
         private String businessSource;
-        //参见国籍代码
-        @JsonProperty("CitizenshipCode")
+        //CY	国籍代码(传值参见国籍代码
+        @JSONField(name="CitizenshipCode")
         private String citizenshipCode;
-        //参见股权结构(机构客户必传
-        @JsonProperty("EquityStructure")
+        //CY	股权结构(机构客户)(传值参见股权结构
+        @JSONField(name="EquityStructure")
         private String equityStructure;
-        //法定代表人姓名(机构客户必传
-        @JsonProperty("leaderName")
+        //CY	法定代表人姓名(机构客户)
+        @JSONField(name="leaderName")
         private String leaderName;
-        //法定代表人姓名其他身份证明号码(机构客户必传
-        @JsonProperty("leaderIdentifyNumber")
+        //CY	法定代表人姓名其他身份证明号码(机构客户)
+        @JSONField(name="leaderIdentifyNumber")
         private String leaderIdentifyNumber;
-        //法定代表人姓名其他身份证明种类(机构客户必传)(参见客户证件类型代码)
-        @JsonProperty("leaderOtherIdentifyType")
+        //CY	法定代表人姓名其他身份证明种类(机构客户)(参见客户证件类型代码)
+        @JSONField(name="leaderOtherIdentifyType")
         private String leaderOtherIdentifyType;
-        //法定代表人姓名其他身份证明号码(机构客户必传
-        @JsonProperty("leaderOtherIdentifyNumber")
+        //CY	法定代表人姓名其他身份证明号码(机构客户)
+        @JSONField(name="leaderOtherIdentifyNumber")
         private String leaderOtherIdentifyNumber;
-        //法定代表人姓名其他身份证明有效期(机构客户必传
-        @JsonProperty("leaderOtherEffectiveDate")
+        //CY	法定代表人姓名其他身份证明有效期(机构客户)
+        @JSONField(name="leaderOtherEffectiveDate")
         private String leaderOtherEffectiveDate;
-        //注册所在地代码(机构客户必传)(参见注册所在地代码)
-        @JsonProperty("nationalityCode")
+        //CY	注册所在地代码(机构客户)(参见注册所在地代码)
+        @JSONField(name="nationalityCode")
         private String nationalityCode;
-        //注册资本金币种(机构客户必传
-        @JsonProperty("registCurrency")
+        //CY	注册资本金币种(机构客户)
+        @JSONField(name="registCurrency")
         private String registCurrency;
-        //注册资本金(机构客户必传
-        @JsonProperty("registFund")
+        //CY	注册资本金(机构客户)
+        @JSONField(name="registFund")
         private String registFund;
-        //税务号(机构客户必传
-        @JsonProperty("RevenueCode")
+        //CY	税务号(机构客户)
+        @JSONField(name="RevenueCode")
         private String revenueCode;
-        //参见反洗钱交易监测记录
-        @JsonProperty("MonitorRecord")
+        //CY	反洗钱交易监测记录(参见风险提示信息或权威媒体报道)
+        @JSONField(name="MonitorRecord")
         private String monitorRecord;
-        //参见风险提示信息或权威媒体报道
-        @JsonProperty("RiskWarnInfo")
+        //CY	风险提示信息或权威媒体报道(参见风险提示信息或权威媒体报道)
+        @JSONField(name="RiskWarnInfo")
         private String riskWarnInfo;
-        //执照、证明名称(机构客户必传)
-        @JsonProperty("supportDocuName")
+        //CY	执照、证明名称(机构客户必传)
+        @JSONField(name="supportDocuName")
         private String supportDocuName;
-        //执照、证明号码(机构客户必传)
-        @JsonProperty("supportDocuNumber")
+        //CY	执照、证明号码(机构客户必传)
+        @JSONField(name="supportDocuNumber")
         private String supportDocuNumber;
-        //执照、证明有效期(机构客户必传)
-        @JsonProperty("supportDocuValidDate")
+        //CY	执照、证明有效期(机构客户必传)
+        @JSONField(name="supportDocuValidDate")
         private String supportDocuValidDate;
-        //办理人姓名(机构客户必传)
-        @JsonProperty("TransactorName")
+        //CY	办理人姓名(机构客户必传)
+        @JSONField(name="TransactorName")
         private String transactorName;
-        //办理人证件类型代码(机构客户必传)(参见客户证件类型代码)
-        @JsonProperty("transactorIdentifyType")
+        //CY	办理人证件类型代码(机构客户必传)(参见客户证件类型代码)
+        @JSONField(name="transactorIdentifyType")
         private String transactorIdentifyType;
-        //办理人证件号码(机构客户必传)
-        @JsonProperty("transactorIdentifyCode")
+        //CY	办理人证件号码(机构客户必传)
+        @JSONField(name="transactorIdentifyCode")
         private String transactorIdentifyCode;
-        //办理人手机号码(机构客户必传)
-        @JsonProperty("transactorMobile")
+        //CY	办理人手机号码(机构客户必传)
+        @JSONField(name="transactorMobile")
         private String transactorMobile;
-        //办理人证件有效期(机构客户必传)
-        @JsonProperty("transactorExpiryDate")
+        //CY	办理人证件有效期(机构客户必传)
+        @JSONField(name="transactorExpiryDate")
         private String transactorExpiryDate;
-        //工作单位名称(个人客户必传)
-        @JsonProperty("workUnit")
+        //CY	工作单位名称(个人客户必传)
+        @JSONField(name="workUnit")
         private String workUnit;
-        //工作单位地址(个人客户必传)
-        @JsonProperty("workAddress")
+        //CY	工作单位地址(个人客户必传)
+        @JSONField(name="workAddress")
         private String workAddress;
-        //其他联系方式(个人客户必传)
-        @JsonProperty("otherContact")
+        //CY	其他联系方式(个人客户必传)
+        @JSONField(name="otherContact")
         private String otherContact;
-        //其他住所地或工作单位地址(个人客户必传)
-        @JsonProperty("otherWorkAddress")
+        //CY	其他住所地或工作单位地址(个人客户必传)
+        @JSONField(name="otherWorkAddress")
         private String otherWorkAddress;
-        //联系人信息
-        @JsonProperty("contact")
-        private List<Contact> contact;
+        //CY	联系人信息
+        @JSONField(name="contact")
+        private List<InsuredLinkerBean> insuredLinkerList;
+
+
+        public CustomerDto(CustomerInfoVo customerInfoVo, String role) {
+            this.identifyNumber = customerInfoVo.getIdentifyNumber();
+            this.identifyType = "01";
+            this.name = customerInfoVo.getName();
+            this.mobile = customerInfoVo.getMobile();
+            this.role = role;
+            this.type = "1";
+            this.occupationCode = "20114";//后续需要根据接口维护返参到表里
+            this.identifyValidDate = customerInfoVo.getIdentifyValidDate() + " " + TimeConstants.START_TIME;
+            this.identifyValidEndDate = customerInfoVo.getIdentifyValidEndDate() + " " + TimeConstants.END_TIME;
+            this.addr = customerInfoVo.getAddr();
+            this.email = customerInfoVo.getEmail();
+            if("2".equals(role)){
+                this.carInsuredRelation = "1";
+            }
+            this.aiRelation = "";
+            this.workUnit = "";
+            this.workAddress = "";
+            this.otherWorkAddress = "";
+        }
+
+        public List<CustomerDto> getCustomers(CustomerInfoVo ownerInfo, CustomerInfoVo policyHolderInfo, CustomerInfoVo insuredPersonInfo) {
+            return Arrays.asList(new CustomerDto(ownerInfo, "3"), new CustomerDto(policyHolderInfo, "1"), new CustomerDto(insuredPersonInfo, "2"));
+        }
 
     }
 
@@ -286,52 +387,73 @@ public class HuaTaiSubmitRequest extends HuaTaiBaseRequest  {
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class Contact implements Serializable{
+    public static class InsuredLinkerBean implements Serializable{
 
         private static final long serialVersionUID = -7819712018066777471L;
-        // 联系人名称
-        @JsonProperty("linkName")
+        // Y	联系人名称
+        @JSONField(name="linkName")
         private String linkName;
-        // 联系人关联关系
-        @JsonProperty("related")
-        private String related;
-        // 电话
-        @JsonProperty("mobile")
-        private String mobile;
-        // 邮箱(电子保单必传)
-        @JsonProperty("email")
-        private String email;
-        // 单位电话(机构客户出单必传)
-        @JsonProperty("tel")
-        private String tel;
-        // 省(需传省国标码)
-        @JsonProperty("province")
+        // Y	联系人关联关系(默认传01,对应本人)
+        @JSONField(name="linkerRelation")
+        private String linkerRelation;
+        // CY	单位电话(机构客户出单必传)
+        @JSONField(name="unitPhoneNumber")
+        private String unitPhoneNumber;
+        //Y	省(需传省国标码)
+        @JSONField(name="province")
         private String province;
-        // 市(需传市国标码)
-        @JsonProperty("city")
+        //Y	市(需传市国标码)
+        @JSONField(name="city")
         private String city;
-        // 区(需传区国标码)
-        @JsonProperty("district")
+        //Y	区(需传区国标码)
+        @JSONField(name="district")
         private String district;
-        // 地址
-        @JsonProperty("street")
+        //Y	地址
+        @JSONField(name="street")
         private String street;
+        // Y	电话
+        @JSONField(name="mobile")
+        private String mobile;
+        // CY	邮箱(电子保单必传)
+        @JSONField(name="email")
+        private String email;
+
+
 
     }
 
     @AllArgsConstructor
     @NoArgsConstructor
     @Data
-    public static class SaleInfo implements Serializable{
+    public static class SaleInfoDto implements Serializable{
 
         private static final long serialVersionUID = 2631084372177408934L;
         // 操作机构代码
-        @JsonProperty("agentCode")
+        @JSONField(name="agentCode")
         private String agentCode;
         // 操作员代码
-        @JsonProperty("agreementNo")
+        @JSONField(name="agreementNo")
         private String agreementNo;
 
+        public SaleInfoDto(HuaTaiConfigureParameters huaTaiConfigureParameters) {
+            this.agentCode = huaTaiConfigureParameters.getAgentCode();
+            this.agreementNo = huaTaiConfigureParameters.getAgreementNo();
+        }
+
     }
+    @AllArgsConstructor
+    @NoArgsConstructor
+    @Data
+    public static class EngageDto implements Serializable{
+        //Y	参见特约编码
+        @JSONField(name="engageCode")
+        private String engageCode;
+        //Y	特约名称
+        @JSONField(name="engageTitle")
+        private String engageTitle;
+        //Y	特约内容
+        @JSONField(name="engageDetail")
+        private String engageDetail;
 
+    }
 }

+ 48 - 14
src/main/java/com/ydtech/modules/order/entity/api/huatai/response/HuaTaiQuotedPriceResponse.java

@@ -73,10 +73,10 @@ public class HuaTaiQuotedPriceResponse extends HuaTaiBaseResponse {
             private String riskCode;
             //Y	总浮动系数
             @JsonProperty("totalAdjustRate")
-            private String totalAdjustRate;
+            private double totalAdjustRate;
             //Y	总签单保费
             @JsonProperty("totalPremium")
-            private String totalPremium;
+            private double totalPremium;
             //Y	核保业务品质
             @JsonProperty("category")
             private String category;
@@ -103,6 +103,27 @@ public class HuaTaiQuotedPriceResponse extends HuaTaiBaseResponse {
             //Y	险别名称
             @JsonProperty("kindName")
             private String kindName;
+            //CY	单位保额(传值参见险别代码)
+            @JsonProperty("unitAmount")
+            private String unitAmount;
+            //CY	数量
+            @JsonProperty("quantity")
+            private String quantity;
+            //CY	服务次数(传值参见险别代码)
+            @JsonProperty("serviceTimes")
+            private String serviceTimes;
+            //CY	免赔率(传值参见险别代码)
+            @JsonProperty("deductibleRate")
+            private String deductibleRate;
+            //CY	可选免赔额(传值参见险别代码)
+            @JsonProperty("deductible")
+            private String deductible;
+            //Y	不含税保费
+            @JsonProperty("premExcludeVAT")
+            private String premExcludeVAT;
+            //Y	增值税
+            @JsonProperty("vAT")
+            private String vAT;
         }
 
         @NoArgsConstructor
@@ -167,6 +188,9 @@ public class HuaTaiQuotedPriceResponse extends HuaTaiBaseResponse {
         @Data
         public static class TaxDto implements Serializable{
             private static final long serialVersionUID = -5447178202141350948L;
+            //Y	合计金额
+            @JsonProperty("sumTax")
+            private double sumTax;
             //Y	参见纳税类型代码
             @JsonProperty("taxConditionCode")
             private String taxConditionCode;
@@ -227,29 +251,39 @@ public class HuaTaiQuotedPriceResponse extends HuaTaiBaseResponse {
             //CY	滞纳天数
             @JsonProperty("exceedDaysCount")
             private int exceedDaysCount;
-            //Y	合计金额
-            @JsonProperty("sumTax")
-            private double sumTax;
+
         }
         @NoArgsConstructor
         @Data
         public static class ChargingPostDto implements Serializable{
             private static final long serialVersionUID = -1914275609505968266L;
-            //Y	充电桩序号
-            @JsonProperty("itemNo")
-            private String itemNo;
+            //Y	险种代码
+            @JsonProperty("riskCode")
+            private String riskCode;
+            //Y	险别代码
+            @JsonProperty("kindCode")
+            private String kindCode;
             //Y	充电桩型号
             @JsonProperty("chargingPostType")
             private String chargingPostType;
             //Y	充电桩编码
             @JsonProperty("chargingPostCode")
             private String chargingPostCode;
-            //CY	UAP对应保额(投保UAP险必传,传值要求参见险别代码)
-            @JsonProperty("premiumUAP")
-            private String premiumUAP;
-            //CY	UBP对应保额(投保UBP险必传,传值要求参见险别代码)
-            @JsonProperty("premiumUBP")
-            private String premiumUBP;
+            //Y	保险金额/赔偿限额
+            @JsonProperty("amount")
+            private String amount;
+            //Y	保费/储金(含税)
+            @JsonProperty("premium")
+            private String premium;
+            //Y	增值税金额
+            @JsonProperty("vat")
+            private String vat;
+            //Y	签单保费(不含税)
+            @JsonProperty("premExcludeVat")
+            private String premExcludeVat;
+            //Y	充电桩序号(1开始,自动递增)
+            @JsonProperty("itemNo")
+            private String itemNo;
         }
     }
 }

+ 56 - 27
src/main/java/com/ydtech/modules/order/service/impl/HuaTaiOrderApiServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ydtech.modules.order.service.impl;
 
+import cn.hutool.core.util.ArrayUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
@@ -14,6 +16,7 @@ import com.ydtech.modules.order.components.huatai.HuaTaiRequestApiComponents;
 import com.ydtech.modules.order.constants.InsuranceTypeCorrespondence;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.TaxArrears;
 import com.ydtech.modules.order.entity.api.huatai.HuaTaiBaseRequestHead;
 import com.ydtech.modules.order.entity.api.huatai.request.HuaTaiQuotedPriceRequest;
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiQuotedPriceResponse;
@@ -29,8 +32,11 @@ import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
+import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.baidu.FileUtil;
+import com.ydtech.utils.idgen.IdGenerate;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.ParameterizedTypeReference;
@@ -40,6 +46,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 @Slf4j
@@ -338,17 +345,29 @@ public class HuaTaiOrderApiServiceImpl implements HuaTaiOrderApiService {
         double syPremium = 0;
         double jqDiscount = 0;
         double syDiscount = 0;
-
-        /*if (!ObjectUtils.isEmpty(quotedPriceResponse.getForcePrimium())) {
-            jqPremium = quotedPriceResponse.getForcePrimium().getPremium();
+        String jqApplyNo = "";
+        String syApplyNo = "";
+        List<HuaTaiQuotedPriceResponse.ContractDto.CoverageDto> syCoverageDtoList =null;
+        HuaTaiQuotedPriceResponse.ContractDto.TaxDto taxDto = null;
+        List<HuaTaiQuotedPriceResponse.ContractDto> contractDtoList = quotedPriceResponse.getBusinessData().getContract();
+        for(HuaTaiQuotedPriceResponse.ContractDto contractDto:contractDtoList){
+            HuaTaiQuotedPriceResponse.ContractDto.ContractMainDto contractMain = contractDto.getContractMain();
+            if("1002".equals(contractMain.getRiskCode())){
+                taxDto = contractDto.getTax();
+                jqDiscount = contractMain.getTotalAdjustRate();
+                jqPremium = contractMain.getTotalPremium();
+                jqApplyNo = contractMain.getContractNo();
+            }else{
+                syCoverageDtoList = contractDto.getCoverage();
+                syDiscount = contractMain.getTotalAdjustRate();
+                syPremium = contractMain.getTotalPremium();
+                syApplyNo = contractMain.getContractNo();
+            }
         }
-        if (!ObjectUtils.isEmpty(quotedPriceResponse.getBizPremium())) {
-            syPremium = quotedPriceResponse.getBizPremium().getSumPremium();
-        }*/
 
         QuoteRespVo quoteRespVo = new QuoteRespVo();
 
-       /* List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
+        List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
         // 报价险种放入保费
         List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
 
@@ -363,9 +382,7 @@ public class HuaTaiOrderApiServiceImpl implements HuaTaiOrderApiService {
         }
         List<QuoteKindRespVo> kindList1 = new ArrayList<>();
         QuoteKindRespVo kind;
-        List<QuotedPriceResponse.BizPremiumDTO.CoverageListDTO> coverageList;
-        if (!ObjectUtils.isEmpty(quotedPriceResponse.getBizPremium())) {
-            coverageList = quotedPriceResponse.getBizPremium().getCoverageList();
+        if (!ObjectUtils.isEmpty(syCoverageDtoList)) {
             List<KindInfoVo> kindList = yaQuoteInfoVo.getKindList();
             for (KindInfoVo kindInfoVo : kindList) {
                 kind = new QuoteKindRespVo();
@@ -374,9 +391,9 @@ public class HuaTaiOrderApiServiceImpl implements HuaTaiOrderApiService {
                 kind.setAmount(kindInfoVo.getAmount());
                 int i = ArrayUtil.indexOf(InsuranceTypeCorrespondence.getJinZhangGuiType(), kindInfoVo.getKindCode());
 
-                QuotedPriceResponse.BizPremiumDTO.CoverageListDTO coverageListDTOS = coverageList.stream().filter(a -> a.getKindCode().equals(InsuranceTypeCorrespondence.getZmConnectInsuranceType()[i])).collect(Collectors.toList()).get(0);
+                HuaTaiQuotedPriceResponse.ContractDto.CoverageDto coverageDto = syCoverageDtoList.stream().filter(a -> a.getKindCode().equals(InsuranceTypeCorrespondence.getHuaTaiConnectInsuranceType()[i])).collect(Collectors.toList()).get(0);
 
-                kind.setCoveragePremium(coverageListDTOS.getPremium());
+                kind.setCoveragePremium(coverageDto.getCoveragePremium());
                 kind.setUnitAmount(kindInfoVo.getUnitAmount());
                 if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
                     kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));
@@ -389,35 +406,47 @@ public class HuaTaiOrderApiServiceImpl implements HuaTaiOrderApiService {
         quoteRespVo.setKindList(kindList1);
         quoteRespVo.setJqPremium(jqPremium);
         quoteRespVo.setSyPremium(syPremium);
+        quoteRespVo.setJqApplyNo(jqApplyNo);
+        quoteRespVo.setSyApplyNo(syApplyNo);
         quoteRespVo.setJqAdjustRate(String.valueOf(jqDiscount));
         quoteRespVo.setSyAdjustRate(String.valueOf(syDiscount));
-        QuotedPriceResponse.TaxinfoDTO taxinfo = quotedPriceResponse.getTaxinfo();
 
-        double sumPayTax = ObjectUtils.isEmpty(taxinfo) ? 0 : taxinfo.getSumPayTax();
+        double sumPayTax = 0;
+        if (!ObjectUtils.isEmpty(taxDto)) {
+            sumPayTax =  taxDto.getSumTax();
+        }
         quoteRespVo.setCiSumPermium(CalculateUtils.add(jqPremium, sumPayTax));//交强险和车船税合计
         quoteRespVo.setSumPermium(CalculateUtils.add(jqPremium, syPremium, sumPayTax));//保费合计
         quoteRespVo.setTaxAmount(sumPayTax);//车船税
         quoteRespVo.setTotalAdjustRate(0);
-        String zmScore = quotedPriceResponse.getPlatMain().getZmScore();
-        quoteRespVo.setILogPreUdwMess(zmScore);//评分
         quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo()); //订单号
-*/
         return quoteRespVo;
     }
 
     public HttpResult<QuoteRespVo> responseOrder(HuaTaiQuotedPriceResponse quotedPriceResponse, QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution) {
         //保存订单信息
-        /*InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
-        insAreaCompany.setId(quotedPriceResponse.getBusinessNo());
-        insAreaCompany.setInsOrderNo(quotedPriceResponse.getBusinessNo());
-        // 车船税
-        TaxArrears taxArrears = new TaxArrears("往年欠税", quotedPriceResponse.getTaxinfo().getPrePayTax(), quotedPriceResponse.getTaxinfo().getDelayPayTax());
-        List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
-        insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
-
-        insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
+        InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
+        //华泰没有总订单号,使用自定义订单号
+        String orderNo = IdGenerate.nextId();
+        insAreaCompany.setId(orderNo);
+        insAreaCompany.setInsOrderNo(orderNo);
+        insAreaCompany.setJqapplyno(quoteRespVo.getJqApplyNo());
+        insAreaCompany.setSyapplyno(quoteRespVo.getSyApplyNo());
+        HuaTaiQuotedPriceResponse.ContractDto.TaxDto taxDto = null;
+        List<HuaTaiQuotedPriceResponse.ContractDto> contractDtoList = quotedPriceResponse.getBusinessData().getContract();
+        for(HuaTaiQuotedPriceResponse.ContractDto contractDto:contractDtoList) {
+            HuaTaiQuotedPriceResponse.ContractDto.ContractMainDto contractMain = contractDto.getContractMain();
+            if ("1002".equals(contractMain.getRiskCode())) {
+                taxDto = contractDto.getTax();
+                // 车船税
+                TaxArrears taxArrears = new TaxArrears("往年欠税",taxDto.getSumTaxDefault(), taxDto.getSumOverdue());
+                List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
+                insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
+                quoteRespVo.setTaxArrears(taxArrearsList);
+            }
+        }
         quoteRespVo.setCompanyId(insAreaCompany.getId());
-        quoteRespVo.setTaxArrears(taxArrearsList);*/
+        insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
         return HttpResult.ok(quotedPriceResponse.getHead().getReturnMessage(), quoteRespVo);
     }