Explorar el Código

诚泰企业报价

dongxin hace 1 año
padre
commit
e02d012ab6

+ 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();
+    }
 }

+ 5 - 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;
 

+ 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"));
         }
     }
 

+ 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<>();
         // 获取特约

+ 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,实际中需要根据依赖字段和当前字段的值来判断
+    }
+}

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

@@ -0,0 +1,31 @@
+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 {};
+}