Bladeren bron

Merge branch 'test' into test-wks

wks 1 jaar geleden
bovenliggende
commit
526b7de56f
30 gewijzigde bestanden met toevoegingen van 869 en 288 verwijderingen
  1. 35 0
      src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java
  2. 9 0
      src/main/java/com/ydtech/modules/admin/model/vo/PersonAreaVo.java
  3. 9 0
      src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java
  4. 88 3
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  5. 8 4
      src/main/java/com/ydtech/modules/ins/model/vo/CustomerInfoVo.java
  6. 1 1
      src/main/java/com/ydtech/modules/ins/model/vo/QuoteRespVo.java
  7. 79 48
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java
  8. 33 10
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Insured.java
  9. 8 3
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhl.java
  10. 18 8
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhlowner.java
  11. 1 1
      src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java
  12. 1 1
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  13. 26 19
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/InsurePremiumRequest.java
  14. 64 25
      src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/SubmitVerifyRequest.java
  15. 21 10
      src/main/java/com/ydtech/modules/order/entity/api/yangguang/request/YangGuangAccuracyCalculateRequest.java
  16. 48 4
      src/main/java/com/ydtech/modules/order/entity/api/yangguang/request/YangGuangSubmitRequest.java
  17. 20 0
      src/main/java/com/ydtech/modules/order/entity/api/yangguang/response/YangGuangBaseResponse.java
  18. 6 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java
  19. 4 0
      src/main/java/com/ydtech/modules/order/entity/vo/ya/YaExtendInfoDto.java
  20. 86 64
      src/main/java/com/ydtech/modules/order/service/impl/ChengTaiOrderApiServiceImpl.java
  21. 72 62
      src/main/java/com/ydtech/modules/order/service/impl/YangGuangOrderApiServiceImpl.java
  22. 42 2
      src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java
  23. 4 2
      src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java
  24. 43 20
      src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleAttrMappingVo.java
  25. 27 0
      src/main/java/com/ydtech/utils/IDCardUtils.java
  26. 44 0
      src/main/java/com/ydtech/validation/CodeNotNullValidator.java
  27. 30 0
      src/main/java/com/ydtech/validation/IdentifyNumberValidatorClass.java
  28. 22 0
      src/main/java/com/ydtech/validation/annotation/CheckIdentifyNumberClass.java
  29. 17 0
      src/main/java/com/ydtech/validation/annotation/CodeNotNull.java
  30. 3 1
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml

+ 35 - 0
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -410,6 +410,25 @@ public class TaskStatisticsController {
         }
     }
 
+
+
+    /**
+     * @description:   任控制台-业务数据-渠道
+     * @author: whp
+     * @date: 2024/12/05
+     **/
+    @PostMapping("getBusinessElectricData")
+    @ApiOperation(value = "任控制台-业务数据-渠道")
+    public HttpResult<IPage<BusinessAgentData>> getBusinessElectricData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+
+            IPage<BusinessAgentData> result = taskStatisticsService.getBusinessElectricData(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
     /**
      * @description:   任控制台-业务数据-代理人-合计
      * @author: whp
@@ -426,6 +445,22 @@ public class TaskStatisticsController {
         }
     }
 
+    /**
+     * @description:   任控制台-业务数据-代理人-合计
+     * @author: whp
+     *
+     **/
+    @PostMapping("getBusinessElectricDataTotal")
+    @ApiOperation(value = "控制台-业务数据-渠道-合计")
+    public HttpResult<BusinessAgentData> getBusinesElectricDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+            BusinessAgentData result = taskStatisticsService.getBusinessElectricDataTotal(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
     /**
      * @description:   任控制台-业务数据-代理人-详情
      * @author: whp

+ 9 - 0
src/main/java/com/ydtech/modules/admin/model/vo/PersonAreaVo.java

@@ -1,11 +1,14 @@
 package com.ydtech.modules.admin.model.vo;
 
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 
 
 @Data
+@NoArgsConstructor
 public class PersonAreaVo implements Serializable {
 
     private static final long serialVersionUID = -8235445978142897003L;
@@ -24,4 +27,10 @@ public class PersonAreaVo implements Serializable {
     private String countyName;
 
 
+
+    public PersonAreaVo(CustomerInfoVo customerInfoVo) {
+        this.provinceCode = customerInfoVo.getProvince();
+        this.cityCode = customerInfoVo.getCity();
+        this.countyCode = customerInfoVo.getCounty();
+    }
 }

+ 9 - 0
src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java

@@ -159,4 +159,13 @@ public interface TaskStatisticsService {
      **/
     BusinessOrderData getBusinessOrderDataTotal(TaskStatisticsVo taskStatisticsVo);
 
+    IPage<BusinessAgentData> getBusinessElectricData(TaskStatisticsVo taskStatisticsVo);
+
+
+    /**
+     *  任控制台-业务数据-电销-合计
+     * @param taskStatisticsVo
+     * @return
+     */
+    BusinessAgentData getBusinessElectricDataTotal(TaskStatisticsVo taskStatisticsVo);
 }

+ 88 - 3
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -669,8 +669,8 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
      **/
     @Override
     public IPage<BusinessAgentData> getBusinessAgentData(TaskStatisticsVo taskStatisticsVo) {
-        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
-            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
                 List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
                 if(!userIds.isEmpty() && userIds.get(0)!=null){
                     taskStatisticsVo.setUserIds(userIds);
@@ -851,7 +851,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
 
 
         if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) || "3".equals(taskStatisticsVo.getManagementSource())){
-            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType())) ||"3".equals(taskStatisticsVo.getManagementSource()) ){
+            if((StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId()) && "2".equals(taskStatisticsVo.getTreeType()))){
                 List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
                 if(!userIds.isEmpty() && userIds.get(0)!=null){
                          taskStatisticsVo.setUserIds(userIds);
@@ -1135,6 +1135,91 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         return result;
     }
 
+    /**
+     * 任控制台-业务数据-渠道"
+     * @param taskStatisticsVo
+     * @return
+     */
+    @Override
+    public IPage<BusinessAgentData> getBusinessElectricData(TaskStatisticsVo taskStatisticsVo) {
+        PageVo<TaskStatisticsVo> pageVo = new PageVo<>();
+        Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
+        page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
+        pageVo.setPageNum(taskStatisticsVo.getPageNum());
+        pageVo.setPageSize(taskStatisticsVo.getPageSize());
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
+            List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+            taskStatisticsVo.setUserIds(userIds);
+        }
+
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) &&  (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) &&  StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
+            return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+
+        IPage<BusinessAgentData> list = this.taskStatisticsMapper.getBusinessAgentData(page,taskStatisticsVo);
+        List<BusinessAgentData> records = list.getRecords();
+        for (BusinessAgentData record : records) {
+            this.appendName(record);
+            if (record.getDistributionAmountRate() == null) {
+                record.setDistributionAmountRate(new BigDecimal("0.0000"));
+            }
+        }
+        Long  total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
+        list.setTotal(total);
+        return list;
+    }
+
+    /**
+     * 任控制台-业务数据-电销-合计
+     * @param taskStatisticsVo
+     * @return
+     */
+    @Override
+    public BusinessAgentData getBusinessElectricDataTotal(TaskStatisticsVo taskStatisticsVo) {
+
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeUserId())){
+            List<String> userIds=this.getNextLevel(taskStatisticsVo.getTreeUserId());
+            taskStatisticsVo.setUserIds(userIds);
+        }
+        HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
+        taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
+        taskStatisticsVo.setCreatetimeEnd(dateMapByType.get("endDate"));
+        getDateByType(taskStatisticsVo.getDateType(), taskStatisticsVo);
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
+            return new BusinessAgentData();
+        }
+        String deptId = BaseController.getDeptId();
+        BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
+        Long  total = this.taskStatisticsMapper.getBusinessAgentDataTotal(taskStatisticsVo);
+        result.setTotalNumber(total.toString());
+        BigDecimal sumPremium = result.getSumPremium();
+        BusinessAgentData allsumPremium = this.taskStatisticsMapper.getAllsumPremium(taskStatisticsVo);
+        if(ObjectUtils.isNotEmpty(sumPremium)){
+            BigDecimal sumPremium1 = allsumPremium.getSumPremium();
+            if(sumPremium.compareTo(BigDecimal.ZERO) ==1){
+                BigDecimal multiply = sumPremium.divide(sumPremium1, 4, BigDecimal.ROUND_DOWN);
+                result.setSumPremiumProportion(multiply);
+            }
+        }else {
+            result.setSumPremiumProportion(BigDecimal.ZERO);
+        }
+        BigDecimal entranceAllFee = result.getEntranceAllFee() != null ? result.getEntranceAllFee() : BigDecimal.ZERO;
+        BigDecimal exportAllFee = result.getExportAllFee() != null ? result.getExportAllFee() : BigDecimal.ZERO;
+        BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
+        result.setDistributionAmount(subtract); //毛利润
+        if(subtract.compareTo(BigDecimal.ZERO)>0){
+            BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
+            result.setDistributionAmountRate(resultDivided);
+        }else {
+            result.setDistributionAmountRate(BigDecimal.ZERO);
+        }
+        return result;
+    }
+
     /**
      *  @version
      *  @author: hh

+ 8 - 4
src/main/java/com/ydtech/modules/ins/model/vo/CustomerInfoVo.java

@@ -1,7 +1,8 @@
 package com.ydtech.modules.ins.model.vo;
 
 import com.ydtech.validation.annotation.CheckDateTime;
-import com.ydtech.validation.annotation.CheckIdentifyNumber;
+import com.ydtech.validation.annotation.CheckIdentifyNumberClass;
+import com.ydtech.validation.annotation.CodeNotNull;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -22,21 +23,21 @@ import javax.validation.constraints.NotNull;
 @NoArgsConstructor
 @AllArgsConstructor
 @ApiModel(value = "人员信息")
+@CodeNotNull()
+@CheckIdentifyNumberClass()
 public class CustomerInfoVo {
 
     @NotNull(message = "车主、投保人、被保人姓名不能为空")
     @ApiModelProperty("姓名")
     private String name;
 
-    @NotNull(message = "车主、投保人、被保人身份证号不能为空")
     @ApiModelProperty("身份证号")
     private String identifyNumber;
 
-//    @NotNull(message = "(企业)车主、投保人、被保人组织机构代码不能为空")
     @ApiModelProperty("组织机构代码")
     private String organizationCode;
 
-//    @NotNull(message = "车主、投保人、被保人身份证类型不能为空")
+    @NotNull(message = "车主、投保人、被保人身份证类型不能为空")
     @ApiModelProperty("身份证类型")
     private String identifyType;
 
@@ -90,6 +91,9 @@ public class CustomerInfoVo {
     @ApiModelProperty(value = "经营范围")
     private String scope;
 
+    @ApiModelProperty(value = "联系人")
+    private String legalPerson;
+
 
     public boolean contrastInfo(CustomerInfoVo customerInfoVo) {
         if (!ObjectUtils.nullSafeEquals(this.name, customerInfoVo.getName())) {

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

@@ -129,7 +129,7 @@ public class QuoteRespVo {
     private double syLossRation;
 
     @ApiModelProperty("阳光 交商含增值服务合并经营成本率")
-    private double margeCostRate;
+    private double mergeCostRate;
 
     @ApiModelProperty("核心返回车型")
     private CoreModelsVo coreModels;

+ 79 - 48
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java

@@ -139,13 +139,13 @@ public class Applicant {
      */
     @JacksonXmlProperty(localName = "CResvTxt5")
     private String CResvTxt5;
-//
-//    /**
-//     * 单位性质
-//     * 代码表
-//     */
-//    @JacksonXmlProperty(localName = "CWorkDpt")
-//    private String CWorkDpt;
+
+    /**
+     * 单位性质
+     * 代码表
+     */
+    @JacksonXmlProperty(localName = "CWorkDpt")
+    private String CWorkDpt;
 //
 //    /**
 //     * 民族
@@ -167,27 +167,27 @@ public class Applicant {
 //     */
 //    @JacksonXmlProperty(localName = "TEffectedDate")
 //    private String TEffectedDate;
-//
-//    /**
-//     * 行业
-//     * 法人场景,代码表
-//     */
-//    @JacksonXmlProperty(localName = "CTrdCde")
-//    private String CTrdCde;
-//
-//    /**
-//     * 经营范围
-//     * 法人场景
-//     */
-//    @JacksonXmlProperty(localName = "COccupation")
-//    private String COccupation;
-//
-//    /**
-//     * 注册资本金
-//     * 单位万元/法人场景
-//     */
-//    @JacksonXmlProperty(localName = "NResvNum3")
-//    private String NResvNum3;
+
+    /**
+     * 行业
+     * 法人场景,代码表
+     */
+    @JacksonXmlProperty(localName = "CTrdCde")
+    private String CTrdCde;
+
+    /**
+     * 经营范围
+     * 法人场景
+     */
+    @JacksonXmlProperty(localName = "COccupation")
+    private String COccupation;
+
+    /**
+     * 注册资本金
+     * 单位万元/法人场景
+     */
+    @JacksonXmlProperty(localName = "NResvNum3")
+    private String NResvNum3;
 
     /**
      * 所在省
@@ -210,12 +210,12 @@ public class Applicant {
     @JacksonXmlProperty(localName = "CCounty")
     private String CCounty;
 
-//    /**
-//     * 注册资本金币种
-//     * 代码表
-//     */
-//    @JacksonXmlProperty(localName = "NResvNum3Cur")
-//    private String NResvNum3Cur;
+    /**
+     * 注册资本金币种
+     * 代码表
+     */
+    @JacksonXmlProperty(localName = "NResvNum3Cur")
+    private String NResvNum3Cur;
 
     /**
      * 国家/地区
@@ -236,28 +236,59 @@ public class Applicant {
 //        CustomerInfoVo ownerInfo = yaQuoteInfoVo.getOwnerInfo();
 //        CustomerInfoVo policyHolderInfo = yaQuoteInfoVo.getPolicyHolderInfo();
         Applicant applicant = new Applicant();
+        //投保人类型: 0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = policyHolderInfo.getProperty();
+        String name;
+        if ("0".equals(property)) {
+            //投保人证件类型
+            applicant.setCCertfCls("110004");
+            //投保人证件号
+            applicant.setCCertfCde(policyHolderInfo.getOrganizationCode());
+            applicant.setCClntAddr(policyHolderInfo.getAddr());
+
+            applicant.setCProvince(policyHolderInfo.getProvince());
+            applicant.setCCity(policyHolderInfo.getCity());
+            applicant.setCCounty(policyHolderInfo.getCounty());
+            //行业
+            applicant.setCTrdCde("201799");
+            applicant.setCOccupation(policyHolderInfo.getScope());
+            applicant.setNResvNum3(policyHolderInfo.getRegisteredCapital());
+            applicant.setNResvNum3Cur("01");
+            applicant.setCWorkDpt("900");
+            //联系人
+            applicant.setCCntrNme(policyHolderInfo.getLegalPerson());
+            name = policyHolderInfo.getName();
+            if (name.contains("(") || name.contains("(")) {
+                name=name.replace("(","");
+                name=name.replace(")","");
+            }
+
+        }else{
+            applicant.setCClntAddr(policyHolderInfo.getAddr());
+            applicant.setCCertfCde(policyHolderInfo.getIdentifyNumber());
+            applicant.setCCertfCls("120001");
+            applicant.setTBirthday(IDCardUtils.GetBirthday(policyHolderInfo.getIdentifyNumber()));
+            applicant.setCSex(IDCardUtils.GetYcSex(policyHolderInfo.getIdentifyNumber()));
+            applicant.setCCntrNme(policyHolderInfo.getName());
+            // 增加团车标志
+            applicant.setCMassCarMrk(ycConfigureParameters.getCCntrNme());
+            name = policyHolderInfo.getName();
+        }
 
-        applicant.setCAppNme(policyHolderInfo.getName());
-        applicant.setCClntAddr(policyHolderInfo.getAddr());
-        applicant.setCMobile(policyHolderInfo.getMobile());
-        applicant.setCCertfCde(policyHolderInfo.getIdentifyNumber());
-        applicant.setCCertfCls("120001");
         applicant.setCResvTxt5("000");
-        applicant.setCClntMrk("1");
+        applicant.setCMobile(policyHolderInfo.getMobile());
         applicant.setCAreaCde("103132");
-        applicant.setTBirthday(IDCardUtils.GetBirthday(policyHolderInfo.getIdentifyNumber()));
-        applicant.setCSex(IDCardUtils.GetYcSex(policyHolderInfo.getIdentifyNumber()));
-        applicant.setCCntrNme(policyHolderInfo.getName());
+
+        //投保人姓名
+        applicant.setCAppNme(name);
+        //投保人客户分类
+        applicant.setCClntMrk(property);
         if(StringUtils.isNullOrEmpty(applicant.getCCntrNme())){
             applicant.setCCntrNme(policyHolderInfo.getName());
         }
-        // 增加团车标志
-        applicant.setCMassCarMrk(ycConfigureParameters.getCCntrNme());
-
-//        applicant.setCProvince(Province.buildProvince(policyHolderInfo.getAddr()));
-//        applicant.setCCity(City.buildCity(policyHolderInfo.getAddr()));
         applicant.setCRelCde(ownerInfo.getName().equals(policyHolderInfo.getName()) ? "601005" : "601008");
         applicant.setTCertfClsValiDate(policyHolderInfo.getIdentifyValidEndDate());
+
         return applicant;
     }
 

+ 33 - 10
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Insured.java

@@ -251,26 +251,49 @@ public class Insured {
     @JacksonXmlProperty(localName = "CRelApplicantDesc")
     private String CRelApplicantDesc;
 
+    /**
+     * 行业
+     * 法人场景,代码表
+     */
+    @JacksonXmlProperty(localName = "CTrdCde")
+    private String CTrdCde;
+
 
     public static Insured buildApplicant(CustomerInfoVo ownerInfo, CustomerInfoVo insuredPersonInfo) {
 
         Insured insured = new Insured();
-
+        //被保人类型: 0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = insuredPersonInfo.getProperty();
+        if ("0".equals(property)) {
+            insured.setCCertfCls("110004");
+            insured.setCCertfCde(insuredPersonInfo.getOrganizationCode());
+            insured.setCProvince(insuredPersonInfo.getProvince());
+            insured.setCCity(insuredPersonInfo.getCity());
+            insured.setCCounty(insuredPersonInfo.getCounty());
+            //经营范围
+            insured.setCWorkCtt(insuredPersonInfo.getScope());
+            insured.setNResvNum3(insuredPersonInfo.getRegisteredCapital());
+            insured.setNResvNum3Cur("01");
+
+
+        }else {
+            insured.setCCertfCls("120001");
+            insured.setCCertfCde(insuredPersonInfo.getIdentifyNumber());
+            insured.setTBirthday(IDCardUtils.GetBirthday(insuredPersonInfo.getIdentifyNumber()));
+            insured.setCSex(IDCardUtils.GetYcSex(insuredPersonInfo.getIdentifyNumber()));
+        }
+
+        insured.setCWorkDpt("900");
+        insured.setCTrdCde("201799");
+        insured.setCResvTxt5("000");
         insured.setCInsuredNme(insuredPersonInfo.getName());
         insured.setCClntAddr(insuredPersonInfo.getAddr());
         insured.setCMobile(insuredPersonInfo.getMobile());
-        insured.setCCertfCde(insuredPersonInfo.getIdentifyNumber());
-        insured.setCCertfCls("120001");
-        insured.setCClntMrk("1");
+        insured.setCClntMrk(property);
         insured.setCAreaCde("103132");
-        insured.setTBirthday(IDCardUtils.GetBirthday(insuredPersonInfo.getIdentifyNumber()));
-        insured.setCSex(IDCardUtils.GetYcSex(insuredPersonInfo.getIdentifyNumber()));
-
-//        insured.setCProvince(Province.buildProvince(insuredPersonInfo.getAddr()));
-//        insured.setCCity(City.buildCity(insuredPersonInfo.getAddr()));
 
         insured.setTCertfClsValiDate(insuredPersonInfo.getIdentifyValidEndDate());
-
+        insured.setCCntrNme(insuredPersonInfo.getName());
         insured.setCRelCdes(ownerInfo.getName().equals(insuredPersonInfo.getName()) ? "601005" : "601008");
 
 

+ 8 - 3
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhl.java

@@ -400,13 +400,18 @@ public class Vhl {
         vhl.setCEngNo(carInfo.getEngineNo());
         vhl.setCFrmNo(carInfo.getVinNo());
         vhl.setCPlateTyp(carInfo.getLicenseTypeCode());
-        vhl.setCUsageCde("336001");
+        if (carInfo.getCarnature().equals("01")) {
+            vhl.setCUsageCde("336002");
+        } else if (carInfo.getCarnature().equals("02")) {
+            vhl.setCUsageCde("336001");
+        }
+        //vhl.setCUsageCde("336001");
         //所属性质(1个人 2企业 3机关)
         if (carInfo.getProperty().equals("1")) {
             vhl.setCBizMrk("338001");
-        } else if (carInfo.getCarnature().equals("2")) {
+        } else if (carInfo.getProperty().equals("2")) {
             vhl.setCBizMrk("338003");
-        } else if (carInfo.getCarnature().equals("3")) {
+        } else if (carInfo.getProperty().equals("3")) {
             vhl.setCBizMrk("338002");
         }
 

+ 18 - 8
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhlowner.java

@@ -107,19 +107,29 @@ public class Vhlowner {
 
         Vhlowner vhlowner = new Vhlowner();
         vhlowner.setCOwnerNme(ownerInfo.getName());
+        //0:法人 1:个人(中国籍) 2: 个人(非中国籍)
+        String property = ownerInfo.getProperty();
+        if ("0".equals(property)) {
 
-        vhlowner.setTBirthday(IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber()));
-        vhlowner.setCSex(IDCardUtils.GetYcSex(ownerInfo.getIdentifyNumber()));
+            vhlowner.setDrvOwnerCeritType("110004");
+            vhlowner.setDrvOwnerCertiCode(ownerInfo.getOrganizationCode());
+            vhlowner.setCProvince(ownerInfo.getProvince());
+            vhlowner.setCCity(ownerInfo.getCity());
+            vhlowner.setCCounty(ownerInfo.getCounty());
 
-        vhlowner.setDrvOwnerCertiCode(ownerInfo.getIdentifyNumber());
-        vhlowner.setDrvOwnerCeritType("120001");
+        }else{
+
+            vhlowner.setTBirthday(IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber()));
+            vhlowner.setCSex(IDCardUtils.GetYcSex(ownerInfo.getIdentifyNumber()));
+            vhlowner.setDrvOwnerCeritType("120001");
+            vhlowner.setDrvOwnerCertiCode(ownerInfo.getIdentifyNumber());
+        }
+
+//        vhlowner.setDrvOwnerCeritType("120001");
         vhlowner.setCAreaCde("103132");
         vhlowner.setCMobile(ownerInfo.getMobile());
 
-        vhlowner.setCOwnerCls("1");
-
-//        vhlowner.setCProvince(Province.buildProvince(ownerInfo.getAddr()));
-//        vhlowner.setCCity(City.buildCity(ownerInfo.getAddr()));
+        vhlowner.setCOwnerCls(property);
 
         vhlowner.setCWorkdptKind("900");
         //地址  自建

+ 1 - 1
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -107,7 +107,7 @@ public class InvAccountController {
     @PostMapping("insertAccount")
     public HttpResult insertInsAccount(@RequestBody InvAccount invAccount) {
         if (invAccountService.save(invAccount)) {
-            return HttpResult.ok();
+            return HttpResult.ok(invAccount);
         } else {
             return HttpResult.error();
         }

+ 1 - 1
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -628,7 +628,7 @@ public class InsAreaCompany implements Serializable {
         this.lossRation = quoteRespVo.getLossRation();
         this.jqLossRation = quoteRespVo.getJqLossRation();
         this.syLossRation = quoteRespVo.getSyLossRation();
-        this.mergeCostRate = quoteRespVo.getMargeCostRate();
+        this.mergeCostRate = quoteRespVo.getMergeCostRate();
         // 保单号
         this.jqapplyno = quoteRespVo.getJqApplyNo();
         this.syapplyno = quoteRespVo.getSyApplyNo();

+ 26 - 19
src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/InsurePremiumRequest.java

@@ -54,7 +54,6 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
     public InsurePremiumRequest(BaseQuoteInfoVo quoteInfoVo,
                                 CarInfoResponse.CarModelListDTO carModelListDTO,
                                 QueryCarActualValueResponse carActualValueResponse,
-                                PersonAreaVo personAreaVo,
                                 ChengTaiConfigureParameters parameters,
                                 BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo){
         super(parameters.getPartnerCode());
@@ -62,7 +61,7 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
         InsuredObjectDTO insuredObject = new InsuredObjectDTO(quoteInfoVo, carModelListDTO,carActualValueResponse);
         this.insuredObject = insuredObject;
         // 客户信息
-        OwnerDTO owner = new OwnerDTO(quoteInfoVo.getOwnerInfo(), personAreaVo);
+        OwnerDTO owner = new OwnerDTO(quoteInfoVo.getOwnerInfo());
         this.owner = owner;
         // 交强险
         Boolean isJq = InsuranceRisk.getFlagByTRAFFIC(quoteInfoVo.getRiskList());
@@ -646,25 +645,33 @@ public class InsurePremiumRequest extends ChengTaiBaseRequest{
         @JsonProperty("relationWithCar")
         private String relationWithCar;
 
-        public OwnerDTO(CustomerInfoVo ownerInfo, PersonAreaVo personAreaVo){
-            this.type = "1";
+        public OwnerDTO(CustomerInfoVo ownerInfo){
+            if ("1".equals(ownerInfo.getProperty())){
+                this.type = "1"; // 个人
+                this.identifyTypeCode = "01";
+                this.identifyTypeName = "居民身份证";
+                this.identifyNumber = ownerInfo.getIdentifyNumber();
+                this.sex = "男".equals(ownerInfo.getGender()) ? "1" : "2";
+                this.age = IDCardUtils.getAgeFromIDCard(ownerInfo.getIdentifyNumber());
+                this.birthday = IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber());
+                this.identifyValidDate = ownerInfo.getIdentifyValidDate();
+                this.identifyValidEndDate = ownerInfo.getIdentifyValidEndDate();
+                this.longTerm = "0";
+            }else{
+                this.type = "2"; // 机构
+                this.identifyTypeCode = "3";
+                this.identifyTypeName = "营业执照";
+                this.identifyNumber = ownerInfo.getOrganizationCode();
+            }
             this.isTerror = "0";
             this.name = ownerInfo.getName();
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = ownerInfo.getIdentifyNumber();
-            this.province = personAreaVo.getProvinceCode();
-            this.city = personAreaVo.getCityCode();
-            this.district = personAreaVo.getCountyCode();
-            this.addr = ownerInfo.getAddr();
-            this.mobile = ownerInfo.getMobile();
-            this.identifyValidDate = ownerInfo.getIdentifyValidDate();
-            this.identifyValidEndDate = ownerInfo.getIdentifyValidEndDate();
-            this.longTerm = "0";
-            this.sex = "男".equals(ownerInfo.getGender()) ? "1" : "2";
-            this.birthday = IDCardUtils.GetBirthday(ownerInfo.getIdentifyNumber());
-            this.relationWithInsured = "0";
-            this.relationWithCar = "1";
+//            this.province = personAreaVo.getProvinceCode();
+//            this.city = personAreaVo.getCityCode();
+//            this.district = personAreaVo.getCountyCode();
+//            this.addr = ownerInfo.getAddr();
+//            this.mobile = ownerInfo.getMobile();
+//            this.relationWithInsured = "0";
+//            this.relationWithCar = "1";
 
         }
     }

+ 64 - 25
src/main/java/com/ydtech/modules/order/entity/api/chengtai/request/SubmitVerifyRequest.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.order.entity.api.chengtai.request;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.admin.model.vo.PersonAreaVo;
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.config.ChengTaiConfigureParameters;
@@ -83,25 +85,43 @@ public class SubmitVerifyRequest extends ChengTaiBaseRequest{
         private String addr;
         @JsonProperty("mobile")
         private String mobile;
+        @JsonProperty("organizationCode")
+        private String organizationCode;
+        @JsonProperty("tel")
+        private String tel;
+        @JsonProperty("linkerName")
+        private String linkerName;
+        @JsonProperty("unitTypeCode")
+        private String unitTypeCode;
+
 
         public ApplicantDTO(InsOrders insOrders, PersonAreaVo applyPersonAreaVo){
             // 获取投保人信息
-            JSONObject applyInfo = insOrders.getApplyinfo();
-            this.type = "1";
-            this.name = applyInfo.getString("name");
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = applyInfo.getString("identifyNumber");
+            CustomerInfoVo applyInfo = JSON.toJavaObject(insOrders.getApplyinfo(),CustomerInfoVo.class);
+            if("0".equals(applyInfo.getProperty())){
+                this.type = "2";
+                this.identifyTypeCode = "1";
+                this.identifyNumber = applyInfo.getOrganizationCode();
+                this.organizationCode = applyInfo.getOrganizationCode();
+                this.tel = applyInfo.getMobile();
+                this.linkerName = applyInfo.getName();
+                this.unitTypeCode = "900"; // 单位性质 900:其他
+            }else{
+                this.type = "1";
+                this.identifyTypeCode = "01";
+                this.identifyNumber = applyInfo.getIdentifyNumber();
+                this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
+                this.birthday = IDCardUtils.GetBirthday(applyInfo.getIdentifyNumber());
+            }
+            this.name = applyInfo.getName();
             this.province = applyPersonAreaVo.getProvinceCode();
             this.city = applyPersonAreaVo.getCityCode();
             this.district = applyPersonAreaVo.getCountyCode();
-            this.addr = applyInfo.getString("addr");
-            this.mobile = applyInfo.getString("mobile");
-            this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
-            this.identifyValidDate = applyInfo.getString("identifyValidDate");
-            this.identifyValidEndDate = applyInfo.getString("identifyValidEndDate");
+            this.addr = applyInfo.getAddr();
+            this.mobile = applyInfo.getMobile();
+            this.identifyValidDate = applyInfo.getIdentifyValidDate();
+            this.identifyValidEndDate = applyInfo.getIdentifyValidEndDate();
             this.longTerm = "0";
-            this.birthday = IDCardUtils.GetBirthday(applyInfo.getString("identifyNumber"));
         }
     }
 
@@ -143,25 +163,44 @@ public class SubmitVerifyRequest extends ChengTaiBaseRequest{
         private String relationWithInsured;
         @JsonProperty("relationWithCar")
         private String relationWithCar;
+        @JsonProperty("organizationCode")
+        private String organizationCode;
+        @JsonProperty("tel")
+        private String tel;
+        @JsonProperty("linkerName")
+        private String linkerName;
+        @JsonProperty("unitTypeCode")
+        private String unitTypeCode;
 
         public InsuredDTO(InsOrders insOrders, PersonAreaVo personAreaVo){
-            // 获取被保人信息
-            JSONObject insureinfo = insOrders.getInsureinfo();
-            this.type = "1";
-            this.name = insureinfo.getString("name");
-            this.identifyTypeCode = "01";
-            this.identifyTypeName = "居民身份证";
-            this.identifyNumber = insureinfo.getString("identifyNumber");
+            // 获取投保人信息
+            CustomerInfoVo insureInfo = JSON.toJavaObject(insOrders.getInsureinfo(),CustomerInfoVo.class);
+            if("0".equals(insureInfo.getProperty())){
+                this.type = "2";
+                this.identifyTypeCode = "1";
+                this.identifyNumber = insureInfo.getOrganizationCode();
+                this.organizationCode = insureInfo.getOrganizationCode();
+                this.tel = insureInfo.getMobile();
+                this.linkerName = insureInfo.getName();
+                this.unitTypeCode = "900"; // 单位性质 900:其他
+            }else{
+                this.type = "1";
+                this.identifyTypeCode = "01";
+                this.identifyNumber = insureInfo.getIdentifyNumber();
+                this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
+                this.birthday = IDCardUtils.GetBirthday(insureInfo.getIdentifyNumber());
+                this.relationWithInsured = "0";
+                this.relationWithCar = "1";
+            }
+            this.name = insureInfo.getName();
             this.province = personAreaVo.getProvinceCode();
             this.city = personAreaVo.getCityCode();
             this.district = personAreaVo.getCountyCode();
-            this.addr = insureinfo.getString("addr");
-            this.mobile = insureinfo.getString("mobile");
-            this.sex = IDCardUtils.GetSex(identifyNumber).equalsIgnoreCase("FEMALE") ? "2" : "1";
-            this.identifyValidDate = insureinfo.getString("identifyValidDate");
-            this.identifyValidEndDate = insureinfo.getString("identifyValidEndDate");
+            this.addr = insureInfo.getAddr();
+            this.mobile = insureInfo.getMobile();
+            this.identifyValidDate = insureInfo.getIdentifyValidDate();
+            this.identifyValidEndDate = insureInfo.getIdentifyValidEndDate();
             this.longTerm = "0";
-            this.birthday = IDCardUtils.GetBirthday(insureinfo.getString("identifyNumber"));
         }
     }
 

+ 21 - 10
src/main/java/com/ydtech/modules/order/entity/api/yangguang/request/YangGuangAccuracyCalculateRequest.java

@@ -393,17 +393,27 @@ public class YangGuangAccuracyCalculateRequest extends YangGuangBaseRequest{
         private String IdentifyUseFullife;
 
         public InsuredListDTO(CustomerInfoVo policyHolderInfo, String insuredFlag) {
-            this.InsuredType = "1";
             this.InsuredFlag = insuredFlag;
-            this.IdentifyType = "01";
-            this.IdentifyNumber = policyHolderInfo.getIdentifyNumber();
             this.Name = policyHolderInfo.getName();
             this.Mobile = policyHolderInfo.getMobile();
             this.PostAddress = policyHolderInfo.getAddr();
-            int sex = IdcardUtil.getGenderByIdCard(policyHolderInfo.getIdentifyNumber());
-            this.Gender = sex == 1 ? "1" : "2";
             this.IdentifyUseFullifeStart = policyHolderInfo.getIdentifyValidDate();
             this.IdentifyUseFullife = policyHolderInfo.getIdentifyValidEndDate();
+            if (policyHolderInfo.getProperty() != null && policyHolderInfo.getProperty().equals("1")) {
+                this.InsuredType = "1";
+                this.IdentifyType = "01";
+                this.IdentifyNumber = policyHolderInfo.getIdentifyNumber();
+                int sex = IdcardUtil.getGenderByIdCard(policyHolderInfo.getIdentifyNumber());
+                this.Gender = sex == 1 ? "1" : "2";
+            } else if (policyHolderInfo.getProperty() != null && policyHolderInfo.getProperty().equals("0")) {
+                this.IdentifyType = "09";
+                this.InsuredType = "2";
+                this.IdentifyNumber = policyHolderInfo.getOrganizationCode();
+            } else if (policyHolderInfo.getProperty() != null && policyHolderInfo.getProperty().equals("2")) {
+                this.InsuredType = "2";
+                this.IdentifyType = "99";
+                this.IdentifyNumber = policyHolderInfo.getOrganizationCode();
+            }
         }
 
         public static List<YangGuangAccuracyCalculateRequest.InsuredListDTO> toInsuredListDTOList(CustomerInfoVo policyHolderInfo, CustomerInfoVo insuredPersonInfo) {
@@ -488,21 +498,22 @@ public class YangGuangAccuracyCalculateRequest extends YangGuangBaseRequest{
             this.Name = customerInfoVo.getName();
             this.Mobile = customerInfoVo.getMobile();
             this.OwnerAdress = customerInfoVo.getAddr();
-            this.IdentifyNumber = customerInfoVo.getIdentifyNumber();
-            if (carInfoVo.getProperty() != null && carInfoVo.getProperty().equals("1")) {
+            if (customerInfoVo.getProperty() != null && customerInfoVo.getProperty().equals("1")) {
                 this.InsuredType = "0";
                 this.IdentifyType = "01";
                 this.CarInsuredRelation = "1";
-            } else if (carInfoVo.getProperty() != null && carInfoVo.getProperty().equals("2")) {
+                this.IdentifyNumber = customerInfoVo.getIdentifyNumber();
+            } else if (customerInfoVo.getProperty() != null && customerInfoVo.getProperty().equals("0")) {
                 this.IdentifyType = "09";
                 this.InsuredType = "2";
                 this.CarInsuredRelation = "1";
-            } else if (carInfoVo.getProperty() != null && carInfoVo.getProperty().equals("3")) {
+                this.IdentifyNumber = customerInfoVo.getOrganizationCode();
+            } else if (customerInfoVo.getProperty() != null && customerInfoVo.getProperty().equals("2")) {
                 this.InsuredType = "1";
                 this.IdentifyType = "99";
                 this.CarInsuredRelation = "3";
+                this.IdentifyNumber = customerInfoVo.getOrganizationCode();
             }
-
         }
     }
 

+ 48 - 4
src/main/java/com/ydtech/modules/order/entity/api/yangguang/request/YangGuangSubmitRequest.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.entity.api.yangguang.request;
 
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.ydtech.modules.order.entity.InsAreaCompany;
@@ -13,6 +14,7 @@ import lombok.NoArgsConstructor;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -115,7 +117,7 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
      *  团车专票信息
      */
     @JSONField(name = "customerList")
-    private CustomerList customerList;
+    private List<CustomerList> customerList;
     /**
      *  关系人信息
      */
@@ -128,6 +130,11 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
     private List<NonVehicleProductInformationList> NonVehicleProductInformationList;
 
     public YangGuangSubmitRequest(InsOrders insOrders, InsAreaCompany insAreaCompany,String productId, YangGuangConfigureParameters ygConfigureParameters) {
+        //判断是否是企业车 1个人 2企业 3机关
+        String isProperty = insOrders.getCarinfo().getString("property");
+        if (isProperty.equals("2") || isProperty.equals("3")) {
+            this.customerList = YangGuangSubmitRequest.CustomerList.toCustomerList(insOrders);
+        }
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         this.RequestNo = "submit";
         this.ComCode = ygConfigureParameters.getComCode();
@@ -142,7 +149,7 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
             this.PolicyType = "3";
         }
         if (insAreaCompany.getAccidentInfo() != null) {
-            this.NonVehicleProductInformationList =JSONArray.parseObject(insAreaCompany.getAccidentInfo().toJSONString(), new TypeReference<List<NonVehicleProductInformationList>>(){});
+            this.NonVehicleProductInformationList = JSONArray.parseObject(insAreaCompany.getAccidentInfo().toJSONString(), new TypeReference<List<NonVehicleProductInformationList>>(){});
             this.CasualtyFlag = "1";
         } else {
             this.CasualtyFlag = "0";
@@ -210,14 +217,14 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
         private String InsuredFlag;
 
         /**
-         * 纳税人类型
+         * 纳税人类型  1. 小规模纳税人 2. 一般纳税人 3. 其他类型
          */
         @JSONField(name = "Taxpayertype")
         private String Taxpayertype;
 
         /**
          * 是否开增值税发票
-         *  0否1是
+         *  0否 1是
          */
         @JSONField(name = "Vatinvoiceflag")
         private String Vatinvoiceflag;
@@ -232,6 +239,43 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
          */
         @JSONField(name = "Revenueaddress")
         private String Revenueaddress;
+
+         public CustomerList(InsOrders insOrders,boolean flag) {
+            String addrapply= insOrders.getApplyinfo().getString("addr");
+            String addrinsurer = insOrders.getInsureinfo().getString("addr");
+             if (flag) {
+                    this.customerFlag = "1";
+                    this.Taxpayertype = "2";
+                    this.Vatinvoiceflag = "0";
+                    this.Revenueaddress = addrapply;
+                    this.InsuredFlag = "2";
+             }
+             if (!flag) {
+                    this.customerFlag = "0";
+                    this.Taxpayertype = "2";
+                    this.Vatinvoiceflag = "0";
+                    this.Revenueaddress = addrinsurer;
+                    this.InsuredFlag = "1";
+             }
+        }
+        public static List<YangGuangSubmitRequest.CustomerList> toCustomerList(InsOrders insOrders) {
+            List<YangGuangSubmitRequest.CustomerList> customerLists = new ArrayList<>();
+            YangGuangSubmitRequest.CustomerList customer;
+            String applyinfo = insOrders.getApplyinfo().getString("insuranceHolder");
+            String insurerinfo = insOrders.getInsureinfo().getString("insuranceHolder");
+                // 投被保人一致
+            if (applyinfo != null && applyinfo.equals(insurerinfo)) {
+                customer = new YangGuangSubmitRequest.CustomerList(insOrders,true);
+                customerLists.add(customer);
+            } else {
+                // 投被保人不一致
+                YangGuangSubmitRequest.CustomerList policyHolder = new YangGuangSubmitRequest.CustomerList(insOrders,true);
+                YangGuangSubmitRequest.CustomerList insuredPerson = new YangGuangSubmitRequest.CustomerList(insOrders,false);
+                customerLists.add(policyHolder);
+                customerLists.add(insuredPerson);
+            }
+            return customerLists;
+        }
     }
 
     @Data

+ 20 - 0
src/main/java/com/ydtech/modules/order/entity/api/yangguang/response/YangGuangBaseResponse.java

@@ -1,6 +1,8 @@
 package com.ydtech.modules.order.entity.api.yangguang.response;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.Data;
 
 @Data
@@ -17,4 +19,22 @@ public class YangGuangBaseResponse {
 
     @JsonProperty("ResponseDate")
     private String ResponseDate;
+
+    public String message(String ErrorMessage) {
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            JsonNode rootNode = objectMapper.readTree(ErrorMessage);
+            JsonNode hintNode = rootNode.get("hint");
+            if (hintNode != null) {
+                JsonNode systemMsgNode = hintNode.get("systemMsg");
+                if (systemMsgNode.isArray() && systemMsgNode.size() > 0) {
+                    JsonNode firstSystemMsg = systemMsgNode.get(0);
+                    return firstSystemMsg.get("info").asText();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java

@@ -217,6 +217,9 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
         @ApiModelProperty("商业赔付率")
         private double syLossRation;
 
+        @ApiModelProperty("交商合并经营成本率")
+        private double mergeCostRate;
+
 
         /**
          * 紫金能源车(鼎然-车辆风险评分  add by hxl 2024-04-09
@@ -320,6 +323,9 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
             if(!Objects.isNull(insAreaCompany.getApiType())) {
                 this.apiType = insAreaCompany.getApiType().toString();
             }
+            if (insAreaCompany.getMergeCostRate() != null) {
+                this.mergeCostRate = insAreaCompany.getMergeCostRate();
+            }
         }
     }
 

+ 4 - 0
src/main/java/com/ydtech/modules/order/entity/vo/ya/YaExtendInfoDto.java

@@ -83,6 +83,9 @@ public class YaExtendInfoDto implements Serializable {
     @ApiModelProperty("商业出险次数")
     private String syClaims;
 
+    @ApiModelProperty("交商合并经营成本率")
+    private Double mergeCostRate;
+
     /**
      * 临时增加
      *
@@ -128,6 +131,7 @@ public class YaExtendInfoDto implements Serializable {
         // 出险次数
         this.jqClaims = insAreaCompany.getJqClaims();
         this.syClaims = insAreaCompany.getSyClaims();
+        this.mergeCostRate = insAreaCompany.getMergeCostRate();
     }
 
 }

+ 86 - 64
src/main/java/com/ydtech/modules/order/service/impl/ChengTaiOrderApiServiceImpl.java

@@ -121,10 +121,7 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
         QueryCarActualValueResponse carActualValueResponse = chengTaiRequestApiComponents.queryActualValue(carActualValueRequest,httpHeaders);
 
         /** 4. 报价 */
-        PersonAreaVo personAreaVo = new PersonAreaVo();
-        buildRegion(quoteInfoVo,personAreaVo);
-        InsurePremiumRequest insurePremiumRequest = new InsurePremiumRequest(quoteInfoVo,carModelListDTO, carActualValueResponse,personAreaVo,parameters,quoteVo);
-
+        InsurePremiumRequest insurePremiumRequest = new InsurePremiumRequest(quoteInfoVo,carModelListDTO, carActualValueResponse,parameters,quoteVo);
         // 重复报价
         InsurePremiumResponse insurePremiumResponse = this.getResponse(insurePremiumRequest, httpHeaders);
 
@@ -490,62 +487,75 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
         return quoteRespVo;
     }
 
-    /**
-     * 获取地区编码
-     * @param quoteInfoVo
-     * @param personAreaVo
-     */
-    private void buildRegion(BaseQuoteInfoVo quoteInfoVo, PersonAreaVo personAreaVo) {
-
-        //车主
-        CustomerInfoVo owner = quoteInfoVo.getOwnerInfo();
-        //被保人
-        CustomerInfoVo insured = quoteInfoVo.getInsuredPersonInfo();
-        //投保人
-        CustomerInfoVo applicant = quoteInfoVo.getPolicyHolderInfo();
-
-        //车主地区信息
-        PersonAreaVo ownerPersonAreaVo = sysAreaService.queryByAddressYc(owner.getAddr(), owner.getIdentifyNumber());
-        PersonAreaVo insuredPersonAreaVo;
-        PersonAreaVo applicantPersonAreaVo;
-
-        //车主是否与投保人相同
-        if (owner.getIdentifyNumber().equals(insured.getIdentifyNumber())) {
-            insuredPersonAreaVo = ownerPersonAreaVo;
-        } else {
-            //投保人地区信息
-            insuredPersonAreaVo = sysAreaService.queryByAddressYc(insured.getAddr(), insured.getIdentifyNumber());
-        }
-
-        //车主是否与被保人相同
-        if (owner.getIdentifyNumber().equals(applicant.getIdentifyNumber())) {
-            applicantPersonAreaVo = ownerPersonAreaVo;
-        } else { //投保人是否与被保人相同
-            if (insured.getIdentifyNumber().equals(applicant.getIdentifyNumber())) {
-                applicantPersonAreaVo = insuredPersonAreaVo;
-            } else {
-                applicantPersonAreaVo = sysAreaService.queryByAddressYc(applicant.getAddr(), applicant.getIdentifyNumber());
-            }
-        }
-
-        if (!Objects.isNull(ownerPersonAreaVo)) {
-            personAreaVo.setProvinceCode(ownerPersonAreaVo.getProvinceCode());
-            personAreaVo.setCityCode(ownerPersonAreaVo.getCityCode());
-            personAreaVo.setCountyCode(ownerPersonAreaVo.getCountyCode());
-        }
-
-        if (!Objects.isNull(insuredPersonAreaVo)) {
-            personAreaVo.setProvinceCode(insuredPersonAreaVo.getProvinceCode());
-            personAreaVo.setCityCode(insuredPersonAreaVo.getCityCode());
-            personAreaVo.setCountyCode(insuredPersonAreaVo.getCountyCode());
-        }
-
-        if (!Objects.isNull(applicantPersonAreaVo)) {
-            personAreaVo.setProvinceCode(applicantPersonAreaVo.getProvinceCode());
-            personAreaVo.setCityCode(applicantPersonAreaVo.getCityCode());
-            personAreaVo.setCountyCode(applicantPersonAreaVo.getCountyCode());
-        }
-    }
+//    /**
+//     * 获取地区编码
+//     * @param quoteInfoVo
+//     * @param personAreaVo
+//     */
+//    private void buildRegion(BaseQuoteInfoVo quoteInfoVo, PersonAreaVo personAreaVo) {
+//
+//        //车主
+//        CustomerInfoVo owner = quoteInfoVo.getOwnerInfo();
+//        //被保人
+//        CustomerInfoVo insured = quoteInfoVo.getInsuredPersonInfo();
+//        //投保人
+//        CustomerInfoVo applicant = quoteInfoVo.getPolicyHolderInfo();
+//
+//        //车主地区信息
+//        PersonAreaVo ownerPersonAreaVo;
+//        if("0".equals(owner.getProperty())){
+//            ownerPersonAreaVo = sysAreaService.queryByAddressYc(owner.getAddr(), owner.getIdentifyNumber());
+//        }else {
+//            ownerPersonAreaVo = new PersonAreaVo(owner);
+//        }
+//        PersonAreaVo insuredPersonAreaVo;
+//        PersonAreaVo applicantPersonAreaVo;
+//
+//        //车主是否与投保人相同
+//        if (owner.getIdentifyNumber().equals(insured.getIdentifyNumber())) {
+//            insuredPersonAreaVo = ownerPersonAreaVo;
+//        } else {
+//            if("0".equals(owner.getProperty())){
+//                //投保人地区信息
+//                insuredPersonAreaVo = sysAreaService.queryByAddressYc(insured.getAddr(), insured.getIdentifyNumber());
+//            }else{
+//                insuredPersonAreaVo = new PersonAreaVo(insured);
+//            }
+//        }
+//
+//        //车主是否与被保人相同
+//        if (owner.getIdentifyNumber().equals(applicant.getIdentifyNumber())) {
+//            applicantPersonAreaVo = ownerPersonAreaVo;
+//        } else { //投保人是否与被保人相同
+//            if (insured.getIdentifyNumber().equals(applicant.getIdentifyNumber())) {
+//                applicantPersonAreaVo = insuredPersonAreaVo;
+//            } else {
+//                if("0".equals(owner.getProperty())){
+//                    applicantPersonAreaVo = sysAreaService.queryByAddressYc(applicant.getAddr(), applicant.getIdentifyNumber());
+//                }else{
+//                    applicantPersonAreaVo = new PersonAreaVo(applicant);
+//                }
+//            }
+//        }
+//
+//        if (!Objects.isNull(ownerPersonAreaVo)) {
+//            personAreaVo.setProvinceCode(ownerPersonAreaVo.getProvinceCode());
+//            personAreaVo.setCityCode(ownerPersonAreaVo.getCityCode());
+//            personAreaVo.setCountyCode(ownerPersonAreaVo.getCountyCode());
+//        }
+//
+//        if (!Objects.isNull(insuredPersonAreaVo)) {
+//            personAreaVo.setProvinceCode(insuredPersonAreaVo.getProvinceCode());
+//            personAreaVo.setCityCode(insuredPersonAreaVo.getCityCode());
+//            personAreaVo.setCountyCode(insuredPersonAreaVo.getCountyCode());
+//        }
+//
+//        if (!Objects.isNull(applicantPersonAreaVo)) {
+//            personAreaVo.setProvinceCode(applicantPersonAreaVo.getProvinceCode());
+//            personAreaVo.setCityCode(applicantPersonAreaVo.getCityCode());
+//            personAreaVo.setCountyCode(applicantPersonAreaVo.getCountyCode());
+//        }
+//    }
 
     @Override
     public HttpResult<Object> submitImages(String companyId) throws Exception {
@@ -602,10 +612,22 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
                 ptlAgreementAttribution);
         HttpHeaders httpHeaders = chengTaiRequestApiComponents.getHttpHeaders(parameters,ChengTaiRequestApiComponents.RECURSIVE_HIERARCHY);
         // 2 提交核保
-        JSONObject applyInfo = insOrders.getApplyinfo();
-        JSONObject insureinfo = insOrders.getInsureinfo();
-        PersonAreaVo applyPersonAreaVo = sysAreaService.queryByAddressYc(applyInfo.getString("addr"), applyInfo.getString("identifyNumber"));
-        PersonAreaVo insurePersonAreaVo = sysAreaService.queryByAddressYc(insureinfo.getString("addr"), insureinfo.getString("identifyNumber"));
+        CustomerInfoVo applyInfo = JSON.toJavaObject(insOrders.getApplyinfo(),CustomerInfoVo.class);
+        CustomerInfoVo insureInfo = JSON.toJavaObject(insOrders.getInsureinfo(),CustomerInfoVo.class);
+        String applyProperty = applyInfo.getProperty();
+        String insureProperty = insureInfo.getProperty();
+        PersonAreaVo applyPersonAreaVo;
+        PersonAreaVo insurePersonAreaVo;
+        if ("0".equals(applyProperty)) {
+            applyPersonAreaVo = new PersonAreaVo(applyInfo);
+        }else{
+            applyPersonAreaVo = sysAreaService.queryByAddressYc(applyInfo.getAddr(), applyInfo.getIdentifyNumber());
+        }
+        if ("0".equals(insureProperty)) {
+            insurePersonAreaVo = new PersonAreaVo(insureInfo);
+        }else{
+            insurePersonAreaVo = sysAreaService.queryByAddressYc(insureInfo.getAddr(), insureInfo.getIdentifyNumber());
+        }
 
         List<SubmitVerifyRequest.EngageListDTO> engageDTO = new ArrayList<>();
         // 获取特约

+ 72 - 62
src/main/java/com/ydtech/modules/order/service/impl/YangGuangOrderApiServiceImpl.java

@@ -41,10 +41,8 @@ import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.StringUtils;
-import com.ydtech.utils.baidu.FileUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.bcel.generic.LSTORE;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -134,77 +132,71 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         yangGuangAccuracyCalculateRequest.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
         YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponse = yangGuangRequestApiComponents.accuracyCalculaye(yangGuangAccuracyCalculateRequest);
         // 如果发生重复投保 将返回的终保日期带入起保日期重新报价
-        if (yangGuangAccuracyCalculateResponse.getErrorMessage().contains("重复投保")) {
-            // 定义正则表达式来匹配终保日期的格式
-            Pattern pattern = Pattern.compile("终保日期 (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})");
-            Matcher matcher = pattern.matcher(yangGuangAccuracyCalculateResponse.getErrorMessage());
-            if (matcher.find()) {
-                // 获取响应中重复投保的终保日期
-                String endDate = matcher.group(1);
-                DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
-                DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-
-                LocalDateTime dateTime = LocalDateTime.parse(endDate, inputFormatter);
-                String newDateStr = dateTime.format(outputFormatter);
-                YangGuangAccuracyCalculateRequest yangGuangAccuracyCalculateRequestRe = new YangGuangAccuracyCalculateRequest(quoteInfoVo, purchasePrice, carModelList1, riskList.get(0),newDateStr,ygConfigureParameters,quoteVo);
-                yangGuangAccuracyCalculateRequestRe.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
-                YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponseRe = yangGuangRequestApiComponents.accuracyCalculaye(yangGuangAccuracyCalculateRequestRe);
-                if (insOrders.getProductid().equals("034001") || insOrders.getProductid().equals("0330034001") || insOrders.getProductid().equals("0330034002")) {
-                    if (yangGuangAccuracyCalculateResponseRe.getErrorCode().equals("0")) {
-                        YangGuangAccuracyCalculateResponse.itemcar itemcar = yangGuangAccuracyCalculateResponseRe.getItemcar();
-                        String actualValue = itemcar.getActualValue();
-                        YangGuangAccuracyCalculateRequest yangGuangAccuracyCalculateRequest1 = new YangGuangAccuracyCalculateRequest(quoteInfoVo, actualValue, carModelList1, riskList.get(0),newDateStr,ygConfigureParameters,quoteVo);
-                        yangGuangAccuracyCalculateRequest1.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
-                        YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponse1 = yangGuangRequestApiComponents.accuracyCalculaye(yangGuangAccuracyCalculateRequest1);
-                        boolean isEnergy = carInfo.isNewEnergy();
-
-                        if (!yangGuangAccuracyCalculateResponse1.getErrorCode().equals("0")) {
-                        InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
-                        InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
-                            if (yangGuangAccuracyCalculateResponse1.getErrorMessage().contains("重复投保")) {
-                            insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
-                            }
-                        insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponse1.getErrorMessage(),insOrderStatusEnum);
-                        throw new SystemException(yangGuangAccuracyCalculateResponse1.getErrorMessage());
-                        }
-                        // 处理数据
-                        QuoteRespVo quoteRespVo = getQuoteRespVo(yangGuangAccuracyCalculateResponse1, quoteInfoVo, quoteVo.getAccidentalDrivingVo(), isEnergy);
-
-                        // 设置核心报价车型
-                        quoteRespVo.setCoreModels(carModelList1.toCoreModelsVo());
-                        return responseOrder(yangGuangAccuracyCalculateResponse1, quoteRespVo, ptlAgreementAttribution, quoteInfoVo.getOrderNo(),
-                                quoteVo.getAccidentalDrivingVo());
-                    } else {
-                        InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
-                        InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
-                        if (yangGuangAccuracyCalculateResponse.getErrorMessage().contains("重复投保")) {
-                            insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
-                        }
-                        insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponse.getErrorMessage(),insOrderStatusEnum);
-                        throw new SystemException(yangGuangAccuracyCalculateResponse.getErrorMessage());
-                    }
-                } else {
+        String endDate = extractEndDate(yangGuangAccuracyCalculateResponse);
+        if (endDate != null) {
+            DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
+            DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+            LocalDateTime dateTime = LocalDateTime.parse(endDate, inputFormatter);
+            String newDateStr = dateTime.format(outputFormatter);
+            YangGuangAccuracyCalculateRequest yangGuangAccuracyCalculateRequestRe = new YangGuangAccuracyCalculateRequest(quoteInfoVo, purchasePrice, carModelList1, riskList.get(0),newDateStr,ygConfigureParameters,quoteVo);
+            yangGuangAccuracyCalculateRequestRe.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
+            YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponseRe = yangGuangRequestApiComponents.accuracyCalculaye(yangGuangAccuracyCalculateRequestRe);
+            if (insOrders.getProductid().equals("034001") || insOrders.getProductid().equals("0330034001") || insOrders.getProductid().equals("0330034002")) {
+                if (yangGuangAccuracyCalculateResponseRe.getErrorCode().equals("0")) {
+                    YangGuangAccuracyCalculateResponse.itemcar itemcar = yangGuangAccuracyCalculateResponseRe.getItemcar();
+                    String actualValue = itemcar.getActualValue();
+                    YangGuangAccuracyCalculateRequest yangGuangAccuracyCalculateRequest1 = new YangGuangAccuracyCalculateRequest(quoteInfoVo, actualValue, carModelList1, riskList.get(0),newDateStr,ygConfigureParameters,quoteVo);
+                    yangGuangAccuracyCalculateRequest1.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
+                    YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponse1 = yangGuangRequestApiComponents.accuracyCalculaye(yangGuangAccuracyCalculateRequest1);
                     boolean isEnergy = carInfo.isNewEnergy();
-                    if (!yangGuangAccuracyCalculateResponse.getErrorCode().equals("0")) {
-                        QuoteRespVo resp  = new QuoteRespVo();
-                        InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
-                        InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
-                        if (yangGuangAccuracyCalculateResponse.getErrorMessage().contains("重复投保")) {
+
+                    if (!yangGuangAccuracyCalculateResponse1.getErrorCode().equals("0")) {
+                    InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
+                    InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
+                        if (yangGuangAccuracyCalculateResponse1.getErrorMessage().contains("重复投保")) {
                         insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
                         }
-                        insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponse.getErrorMessage(),insOrderStatusEnum);
-                        throw new SystemException(yangGuangAccuracyCalculateResponse.getErrorMessage());
+                    insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponse1.getErrorMessage(),insOrderStatusEnum);
+                    throw new SystemException(yangGuangAccuracyCalculateResponse1.getErrorMessage());
                     }
                     // 处理数据
-                    QuoteRespVo quoteRespVo = getQuoteRespVo(yangGuangAccuracyCalculateResponse, quoteInfoVo, quoteVo.getAccidentalDrivingVo(), isEnergy);
+                    QuoteRespVo quoteRespVo = getQuoteRespVo(yangGuangAccuracyCalculateResponse1, quoteInfoVo, quoteVo.getAccidentalDrivingVo(), isEnergy);
 
                     // 设置核心报价车型
                     quoteRespVo.setCoreModels(carModelList1.toCoreModelsVo());
-                    return responseOrder(yangGuangAccuracyCalculateResponse, quoteRespVo, ptlAgreementAttribution, quoteInfoVo.getOrderNo(),
+                    return responseOrder(yangGuangAccuracyCalculateResponse1, quoteRespVo, ptlAgreementAttribution, quoteInfoVo.getOrderNo(),
                             quoteVo.getAccidentalDrivingVo());
+                } else {
+                    InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
+                    InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
+                    if (yangGuangAccuracyCalculateResponse.getErrorMessage().contains("重复投保")) {
+                        insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
+                    }
+                    insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponse.getErrorMessage(),insOrderStatusEnum);
+                    throw new SystemException(yangGuangAccuracyCalculateResponse.getErrorMessage());
                 }
+            } else {
+                boolean isEnergy = carInfo.isNewEnergy();
+                if (!yangGuangAccuracyCalculateResponseRe.getErrorCode().equals("0")) {
+                    InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
+                    InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
+                    if (yangGuangAccuracyCalculateResponseRe.getErrorMessage().contains("重复投保")) {
+                    insOrderStatusEnum = InsOrderStatusEnum.REPEAT_INSURE;
+                    }
+                    insOrdersService.responseFailedOrder(quoteVo,ptlAgreementAttribution, order, yangGuangAccuracyCalculateResponseRe.getErrorMessage(),insOrderStatusEnum);
+                    throw new SystemException(yangGuangAccuracyCalculateResponseRe.getErrorMessage());
+                }
+                // 处理数据
+                QuoteRespVo quoteRespVo = getQuoteRespVo(yangGuangAccuracyCalculateResponseRe, quoteInfoVo, quoteVo.getAccidentalDrivingVo(), isEnergy);
+
+                // 设置核心报价车型
+                quoteRespVo.setCoreModels(carModelList1.toCoreModelsVo());
+                return responseOrder(yangGuangAccuracyCalculateResponseRe, quoteRespVo, ptlAgreementAttribution, quoteInfoVo.getOrderNo(),
+                        quoteVo.getAccidentalDrivingVo());
             }
         }
+        // 单商 交三 交商 需要获取车辆actualValue 进行二次报价
         if (insOrders.getProductid().equals("034001") || insOrders.getProductid().equals("0330034001") || insOrders.getProductid().equals("0330034002")) {
             if (yangGuangAccuracyCalculateResponse.getErrorCode().equals("0")) {
                 YangGuangAccuracyCalculateResponse.itemcar itemcar = yangGuangAccuracyCalculateResponse.getItemcar();
@@ -309,7 +301,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         YangGuangSubmitRequest yangGuangSubmitRequest = new YangGuangSubmitRequest(insOrders, insAreaCompany, productid, ygConfigureParameters);
         YangGuangSubmitResponse yangGuangSubmitResponse = yangGuangRequestApiComponents.submit(yangGuangSubmitRequest);
         if (!yangGuangSubmitResponse.getErrorCode().equals("0")) {
-            return HttpResult.error(yangGuangSubmitResponse.getErrorMessage());
+            return HttpResult.error(yangGuangSubmitResponse.message(yangGuangSubmitResponse.getErrorMessage()));
         }
         if (yangGuangSubmitResponse.getCiProposalNo() != null) {
             insAreaCompany.setJqapplyno(yangGuangSubmitResponse.getCiProposalNo());
@@ -739,6 +731,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
             quoteRespVo.setSyScore(discount.getMarkingnobcBI() != null ? discount.getMarkingnobcBI() : "");
             quoteRespVo.setJqLossRation(Double.parseDouble(discount.getFinalmarkingnoCi() != null ? discount.getFinalmarkingnoCi() : "0.00"));
             quoteRespVo.setSyLossRation(Double.parseDouble(discount.getFinalmarkingnoBi() != null ? discount.getFinalmarkingnoBi() : "0.00"));
+            quoteRespVo.setMergeCostRate(Double.parseDouble(yangGuangAccuracyCalculateResponse.getVascostmarginbc() != null ?yangGuangAccuracyCalculateResponse.getVascostmarginbc() : "0.00"));
         }
 
         List<QuoteKindRespVo> kindList1 = new ArrayList<>();
@@ -839,4 +832,21 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         quoteRespVo.setCompanyId(insAreaCompany.getId());
         return HttpResult.ok("报价成功", quoteRespVo);
     }
+
+    // 提取从响应中获取终保日期的逻辑为方法
+    private String extractEndDate(YangGuangAccuracyCalculateResponse response) {
+        String targetText = response.getErrorMessage();
+        if (!targetText.contains("重复投保")) {
+            targetText = response.getRemarkCi();
+            if (!targetText.contains("重复投保")) {
+                targetText = response.getRemarkBi();
+            }
+        }
+        Pattern pattern = Pattern.compile("终保日期 (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})");
+        Matcher matcher = pattern.matcher(targetText);
+        if (matcher.find()) {
+            return matcher.group(1);
+        }
+        return null;
+    }
 }

+ 42 - 2
src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java

@@ -263,8 +263,48 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
 
         //组装参数
         Ruote m = Ruote.buildQuoteParam(yaQuoteInfoVo, ycConfigureParameters, adVo, cQryCdeJQ, cQryCdeSY);
-        //构造地区
-        buildRegion(m, yaQuoteInfoVo);
+        //企业车不构建地区
+        String property = carInfo.getProperty();
+        if (!"2".equals(property)) {
+            //构造地区
+            buildRegion(m, yaQuoteInfoVo);
+        }else {
+            //车主
+            CustomerInfoVo owner = yaQuoteInfoVo.getOwnerInfo();
+            if (!"0".equals(owner.getProperty())) {
+                PersonAreaVo ownerPersonAreaVo = sysAreaService.queryByAddressYc(owner.getAddr(), owner.getIdentifyNumber());
+                if (!Objects.isNull(ownerPersonAreaVo)) {
+                    m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerPersonAreaVo.getProvinceCode());
+                    m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerPersonAreaVo.getCityCode());
+                    m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerPersonAreaVo.getCountyCode());
+                }
+
+            }
+            //投保人
+            CustomerInfoVo applicant = yaQuoteInfoVo.getPolicyHolderInfo();
+            if (!"0".equals(applicant.getProperty())) {
+                PersonAreaVo applicantPersonAreaVo = sysAreaService.queryByAddressYc(applicant.getAddr(), applicant.getIdentifyNumber());
+                if (!Objects.isNull(applicantPersonAreaVo)) {
+                    m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantPersonAreaVo.getProvinceCode());
+                    m.getRequestLabel().getCondition().getApplicant().setCCity(applicantPersonAreaVo.getCityCode());
+                    m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantPersonAreaVo.getCountyCode());
+                }
+
+            }
+            //被保人
+            CustomerInfoVo insured = yaQuoteInfoVo.getInsuredPersonInfo();
+            if (StringUtils.isNullOrEmpty(insured.getIdentifyNumber())) {
+                throw new SystemException("被保人只能为个人信息");
+            }
+            PersonAreaVo insuredPersonAreaVo = sysAreaService.queryByAddressYc(insured.getAddr(), insured.getIdentifyNumber());
+            if (!Objects.isNull(insuredPersonAreaVo)) {
+                m.getRequestLabel().getCondition().getInsured().setCProvince(insuredPersonAreaVo.getProvinceCode());
+                m.getRequestLabel().getCondition().getInsured().setCCity(insuredPersonAreaVo.getCityCode());
+                m.getRequestLabel().getCondition().getInsured().setCCounty(insuredPersonAreaVo.getCountyCode());
+            }
+
+        }
+
         return m;
     }
 

+ 4 - 2
src/main/java/com/ydtech/modules/scheme/controller/PtlSchemeController.java

@@ -213,9 +213,11 @@ public class PtlSchemeController extends BaseController {
     }
 
     @ApiOperation(value = "规则过滤保险公司")
-    @Validated
+//    @Validated
     @PostMapping("/ruleFilterCompany")
-    public HttpResult ruleFilterCompany(@Validated @RequestBody RuleFilterVo ruleFilterVo){
+    public HttpResult ruleFilterCompany(
+//            @Validated
+                                            @RequestBody RuleFilterVo ruleFilterVo){
         String userId = getUserId();
         if(!Objects.isNull(ruleFilterVo.getUserId()) && !ruleFilterVo.getUserId().equals("")){
             userId = ruleFilterVo.getUserId();

+ 43 - 20
src/main/java/com/ydtech/modules/scheme/entity/vo/SchemeRuleAttrMappingVo.java

@@ -9,6 +9,7 @@ import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -89,29 +90,51 @@ public class SchemeRuleAttrMappingVo {
         //车长
 //        ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleLength", carInfo.getCarLength()));
 
-        //车主 证件号码(前6位)
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
-        //车主 年龄
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
-        //车主 性别
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+        boolean boo = false;
+
+        // 车主
+        if (StringUtils.isBlank(ownerInfo.getProperty()) || !"0".equals(ownerInfo.getProperty())){
+            //车主 年龄
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
+            //车主 性别
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
+            //车主 证件号码(前6位)
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
+        }
+//        else{
+//            //车主 营业执照号
+//            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnersCode", ownerInfo.getOrganizationCode()));
+//        }
+
+        // 投保人
+        if (StringUtils.isBlank(policyHolderInfo.getProperty()) || !"0".equals(policyHolderInfo.getProperty())){
+            //投保人 年龄
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
+            //投保人 性别
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
+            //投保人 证件号码(前6位)
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
+        }
+//        else{
+//            //投保人 营业执照号
+//            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarPolicyCode", ownerInfo.getOrganizationCode()));
+//        }
+        // 被保人
+        if (StringUtils.isBlank(insuredPersonInfo.getProperty()) || !"0".equals(insuredPersonInfo.getProperty())){
+            //被保人 年龄
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
+            //被保人 性别
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
+            //被保人 证件号码(前6位)
+            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
+        }
+//        else{
+//            //被保人 营业执照号
+//            ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarInsuredCode", ownerInfo.getOrganizationCode()));
+//        }
         //车主 姓名
         ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
 
-        //投保人 证件号码(前6位)
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
-        //投保人 年龄
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
-        //投保人 性别
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
-
-        //被保人 证件号码(前6位)
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
-        //被保人 年龄
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
-        //被保人 性别
-        ruleAttrMappingVoList.add(new SchemeRuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
-
         //2024-06-20 起保日期 月份判断
 //        if(quoteInfoVo.get() != null && !insAreaCompany.getJqStartDate().equals("")){
 //            LocalDateTime jqStartDate = LocalDateTime.parse(insAreaCompany.getJqStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

+ 27 - 0
src/main/java/com/ydtech/utils/IDCardUtils.java

@@ -285,6 +285,33 @@ public class IDCardUtils {
         return strYear + "-" + strMonth + "-" + strDay;
     }
 
+    /**
+     * 在判定已经是正确的身份证号码之后,查找出此人年龄
+     * @param idCard
+     * @return
+     */
+    public static int getAgeFromIDCard(String idCard) {
+        String birthday = idCard.substring(6, 14);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
+        try {
+            Date birthDate = dateFormat.parse(birthday);
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(birthDate);
+            Calendar now = Calendar.getInstance();
+            int age = now.get(Calendar.YEAR) - calendar.get(Calendar.YEAR);
+            if (now.get(Calendar.MONTH) < calendar.get(Calendar.MONTH)
+                    || (now.get(Calendar.MONTH) == calendar.get(Calendar.MONTH)
+                    && now.get(Calendar.DAY_OF_MONTH) < calendar.get(Calendar.DAY_OF_MONTH))) {
+                age--;
+            }
+            return age;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
+
+
     /**
      * <p>
      * 设置地区编码

+ 44 - 0
src/main/java/com/ydtech/validation/CodeNotNullValidator.java

@@ -0,0 +1,44 @@
+package com.ydtech.validation;
+
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import com.ydtech.utils.StringUtils;
+import com.ydtech.validation.annotation.CodeNotNull;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class CodeNotNullValidator implements ConstraintValidator<CodeNotNull, Object> {
+
+
+    @Override
+    public void initialize(CodeNotNull constraintAnnotation) {
+        ConstraintValidator.super.initialize(constraintAnnotation);
+    }
+
+    @Override
+    public boolean isValid(Object value, ConstraintValidatorContext context) {
+        // 将传入的value转换为实体类对象
+        if (value instanceof CustomerInfoVo) {
+            CustomerInfoVo entity = (CustomerInfoVo) value;
+            // 现在可以通过entity对象获取所有的字段值
+            if(StringUtils.isBlank(entity.getProperty()) || "1".equals(entity.getProperty())){
+                if(StringUtils.isBlank(entity.getIdentifyNumber())){
+                    // 添加违反约束的上下文信息
+                    context.disableDefaultConstraintViolation(); // 禁用默认的违约信息
+                    context.buildConstraintViolationWithTemplate("车主、投保人、被保人身份证号不能为空")
+                            .addConstraintViolation(); // 使用自定义的message
+                    return false;
+                }
+            }else{
+                if(StringUtils.isBlank(entity.getOrganizationCode())){
+                    // 添加违反约束的上下文信息
+                    context.disableDefaultConstraintViolation(); // 禁用默认的违约信息
+                    context.buildConstraintViolationWithTemplate("(企业)车主、投保人、被保人组织机构代码不能为空")
+                            .addConstraintViolation(); // 使用自定义的message
+                    return false;
+                }
+            }
+        }
+        return true; // 假设总是返回true,实际中需要根据依赖字段和当前字段的值来判断
+    }
+}

+ 30 - 0
src/main/java/com/ydtech/validation/IdentifyNumberValidatorClass.java

@@ -0,0 +1,30 @@
+package com.ydtech.validation;
+
+import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import com.ydtech.modules.ins.utils.CommonUtil;
+import com.ydtech.utils.StringUtils;
+import com.ydtech.validation.annotation.CheckIdentifyNumberClass;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class IdentifyNumberValidatorClass implements ConstraintValidator<CheckIdentifyNumberClass, Object> {
+
+
+    @Override
+    public void initialize(CheckIdentifyNumberClass constraintAnnotation) {
+        ConstraintValidator.super.initialize(constraintAnnotation);
+    }
+    @Override
+    public boolean isValid(Object value, ConstraintValidatorContext context) {
+        // 将传入的value转换为实体类对象
+        if (value instanceof CustomerInfoVo) {
+            CustomerInfoVo entity = (CustomerInfoVo) value;
+            // 现在可以通过entity对象获取所有的字段值
+            if(StringUtils.isBlank(entity.getProperty()) || "1".equals(entity.getProperty())){
+                return CommonUtil.isIDCard(entity.getIdentifyNumber());
+            }
+        }
+        return true; // 假设总是返回true,实际中需要根据依赖字段和当前字段的值来判断
+    }
+}

+ 22 - 0
src/main/java/com/ydtech/validation/annotation/CheckIdentifyNumberClass.java

@@ -0,0 +1,22 @@
+package com.ydtech.validation.annotation;
+
+import com.ydtech.validation.CodeNotNullValidator;
+import com.ydtech.validation.IdentifyNumberValidator;
+import com.ydtech.validation.IdentifyNumberValidatorClass;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Documented
+@Constraint(validatedBy = IdentifyNumberValidatorClass.class)
+@Target({ElementType.FIELD, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CheckIdentifyNumberClass {
+
+    String message() default "身份证信息不合法";
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}

+ 17 - 0
src/main/java/com/ydtech/validation/annotation/CodeNotNull.java

@@ -0,0 +1,17 @@
+package com.ydtech.validation.annotation;
+
+import com.ydtech.validation.CodeNotNullValidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Documented
+@Constraint(validatedBy = CodeNotNullValidator.class)
+@Target({ElementType.FIELD, ElementType.TYPE, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CodeNotNull {
+    String message() default "";
+    Class<?>[] groups() default {};
+    Class<? extends Payload>[] payload() default {};
+}

+ 3 - 1
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -132,6 +132,7 @@
         <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
         <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
         <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
+        <result property="mergecostrate" column="mergecostrate" jdbcType="DOUBLE"/>
 
     </resultMap>
 
@@ -249,7 +250,8 @@
                iac.pay_date  as payDate,
                iac.agreement_id,
                o.entry_status,
-               eic.namesimple as partnerCompaniesName
+               eic.namesimple as partnerCompaniesName,
+               iac.merge_cost_rate
         from ins_orders as o
                  join ins_area_company iac on o.orderno = iac.orderno
                  LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id