Explorar o código

1. 修改永诚订单状态错误问题。
2. 永诚省市区改为自动识别,识别不到需要按照永诚的方式手动录入。
3. 永诚保单下载修改。
4. 解决永诚核保随机问题,核保系统错误。

ligang134 %!s(int64=2) %!d(string=hai) anos
pai
achega
aac30c4479

+ 4 - 1
README.md

@@ -272,7 +272,10 @@
 * 更新日期:2023-00-00
 * 更新时间:00:00  ~  00:00
 * 更新内容:
-  1. 
+  1. 修改永诚订单状态错误问题。
+  2. 永诚省市区改为自动识别,识别不到需要按照永诚的方式手动录入。
+  3. 永诚保单下载修改。
+  4. 解决永诚核保随机问题,核保系统错误。
 
 
 

+ 15 - 7
src/main/java/com/ydtech/modules/ins/model/vo/CustomerInfoVo.java

@@ -8,6 +8,8 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.List;
+
 /**
  * @author qinfenglong
  * @version 1.0.0
@@ -30,14 +32,20 @@ public class CustomerInfoVo {
     @ApiModelProperty("身份证类型")
     private String identifyType;
 
-    @ApiModelProperty("省")
-    private String province;
+//    @ApiModelProperty("省")
+//    private String province;
+//
+//    @ApiModelProperty("市")
+//    private String city;
+//
+//    @ApiModelProperty("县")
+//    private String county;
+
+    @ApiModelProperty("省市区数组")
+    private List<String> provinceData;
+
 
-    @ApiModelProperty("市")
-    private String city;
 
-    @ApiModelProperty("县")
-    private String county;
 
     @ApiModelProperty("地址")
     private String addr;
@@ -57,4 +65,4 @@ public class CustomerInfoVo {
     private String identifyValidEndDate;
 
 
-}
+}

+ 1 - 0
src/main/java/com/ydtech/modules/ins/model/yc/audit/response/AuditResponse.java

@@ -30,6 +30,7 @@ public class AuditResponse {
     /**
      * 交强险核保标志
      * 0:待核保;1:已核保;3:退回修改;9:已核保未缴费;
+     *
      */
     @JacksonXmlProperty(localName = "statusJQ")
     private String statusJq;

+ 298 - 96
src/main/java/com/ydtech/modules/ins/service/impl/InsAlltrustApiServiceImpl.java

@@ -12,6 +12,7 @@ import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.constants.InsTaskHistoryEnum;
 import com.ydtech.constants.SysConstants;
 import com.ydtech.constants.enums.InsQuoteFlow;
+import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.AttachInsureEnum;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.constants.enums.dict.WhetherEnum;
@@ -26,6 +27,7 @@ import com.ydtech.modules.esm.service.*;
 import com.ydtech.modules.ins.dao.InsAlltrustRegionMapper;
 import com.ydtech.modules.ins.model.InsApiLog;
 import com.ydtech.modules.ins.model.InsOrder;
+import com.ydtech.modules.ins.model.dto.CarInsPolicyDto;
 import com.ydtech.modules.ins.model.vo.CarInfoVo;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
 import com.ydtech.modules.ins.model.vo.QuoteRespVo;
@@ -315,6 +317,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
         String textHead = "==========永诚API方式 - 车架号:" + carInfo.getVinNo() + " - 报价 ";
         while (!boo) {
             rr = requestApi(m, new RuoteResponse(), iac, YcBuildData.API_QUOTE, InsQuoteFlow.Q_S_0, textHead);
+            if (rr.getHead().getErrorCode().equals("009999")) return HttpResult.error(rr.getHead().getErrorMessage());
             //处理返回信息
             //1、交强险重复投保处理
             boo = ciRepetitionInsure(rr, m);
@@ -351,6 +354,18 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 
         }
         if (null == rr) return HttpResult.error("远程请求报价失败");
+        StringBuffer sb = new StringBuffer();
+        if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("车主省市县码值不符合规范"))
+            sb.append("|永诚 - 保司 - 车主地区自动解析失败");
+//            throw new SystemException("车主地区自动解析失败");
+        if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("投保人省市县码值不符合规范"))
+            sb.append("|永诚 - 保司 -  投保人地区自动解析失败");
+//            throw new SystemException("投保人地区自动解析失败");
+        if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("被保人省市县码值不符合规范"))
+            sb.append("|永诚 - 保司 -  被保人地区自动解析失败");
+//            throw new SystemException("被保人地区自动解析失败");
+        if (StringUtils.isNotEmpty(sb)) throw new SystemException(sb.toString());
+
         if (!rr.getHead().getErrorCode().equals("000000")) return HttpResult.error(rr.getHead().getErrorMessage());
 
         QuoteRespVo quoteRespVo = YcBuildData.buildQuoteRespVo(order, rr, yaQuoteInfoVo);
@@ -573,17 +588,23 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             //组装参数
             Audit m = Audit.buildAuditParam(ownerInfo, insureInfo, applyInfo, ycConfigureParameters, iac);
 
+            List<String> insureProvinceData = insureInfo.getProvinceData();
+
             //构造被保人地区
-            Map<String, String> insureMap = gainRegionCode(insureInfo.getAddr());
-            m.getRequestLabel().getCondition().getCustomer().setCProvince(insureMap.get("provinceCode"));
-            m.getRequestLabel().getCondition().getCustomer().setCCity(insureMap.get("cityCode"));
-            m.getRequestLabel().getCondition().getCustomer().setCCounty(insureMap.get("areaCode"));
+            m.getRequestLabel().getCondition().getCustomer().setCProvince(insureProvinceData.get(0));
+            m.getRequestLabel().getCondition().getCustomer().setCCity(insureProvinceData.get(1));
+            m.getRequestLabel().getCondition().getCustomer().setCCounty(insureProvinceData.get(2));
+//            //构造被保人地区
+//            Map<String, String> insureMap = gainRegionCode(insureInfo.getAddr());
+//            m.getRequestLabel().getCondition().getCustomer().setCProvince(insureMap.get("provinceCode"));
+//            m.getRequestLabel().getCondition().getCustomer().setCCity(insureMap.get("cityCode"));
+//            m.getRequestLabel().getCondition().getCustomer().setCCounty(insureMap.get("areaCode"));
 
 
 //            findRegion()
 
             //接口请求
-            String responseData = httpPostResultLog(xmlMapper, m, YcBuildData.API_AUDIT, "永诚API方式 - 核保 - ");
+            String responseData = httpPostResultLog(gainXmlMapper(), m, YcBuildData.API_AUDIT, "永诚API方式 - 核保 - ");
 
             String cleanStr = YcBuildData.cleanResponseStr(responseData);
             AuditResponse rd = xmlMapper.readValue(cleanStr, AuditResponse.class);
@@ -632,7 +653,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             }
             log.info(logNo + "车牌号:" + order.getLicenseno() + ",永诚核保未获取缴费地址,状态为:" + InsOrderStatusEnum.matchKey(iac.getOrderstatus()).getDesc());
             insAreaCompanyService.updateById(iac);
-            insOrdersService.updateByOrderStatus(order.getOrderno(), order.getOrderstatus());
+            insOrdersService.updateById(order);
 
             return HttpResult.ok("核保操作成功");
 
@@ -839,14 +860,14 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             AssertionUtils.isEmpty(iac, "报价订单不存在");
             InsOrders order = insOrdersService.getById(iac.getOrderno());
 
-            try {
-                String ip = InetAddress.getLocalHost().getHostAddress();
-                log.debug("------------------------------");
-                log.debug("----测试服务器IP----" + ip);
-                log.debug("------------------------------");
-            } catch (UnknownHostException e) {
-                throw new RuntimeException(e);
-            }
+            String ip = IPUtil.gainServerNo();
+            log.debug("------------------------------");
+            log.debug("----测试服务器IP----" + ip);
+            log.debug("------------------------------");
+
+            String jqbz = "-交强险标志.pdf";
+            String jqbd = "-交强险保单.pdf";
+            String sybd = "-商业险保单.pdf";
 
 
             String licensePlate = order.getLicenseno();
@@ -854,14 +875,47 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 
             Map m = new HashMap();
 
-            String jqFlagUrl = gainExistCarInsPolicy(licensePlate + "-交强险标志.pdf", licensePlate);
-            String jqUrl = gainExistCarInsPolicy(licensePlate + "-交强险保单.pdf", licensePlate);
-            String syUrl = gainExistCarInsPolicy(licensePlate + "-商业险保单.pdf", licensePlate);
-            if (StringUtils.isNotEmpty(jqFlagUrl) || StringUtils.isNotEmpty(jqUrl) || StringUtils.isNotEmpty(syUrl)) {
-                m.put("jqFlagUrl", jqFlagUrl);
-                m.put("jqUrl", jqUrl);
-                m.put("syUrl", syUrl);
-                return HttpResult.ok(m);
+
+            CarInsPolicyDto cipDto = new CarInsPolicyDto();
+
+            String insFlag = "dj";
+
+            if (StringUtils.isNotEmpty(iac.getJqapplyno()) && StringUtils.isNotEmpty(iac.getSyapplyno()))
+                insFlag = "js";
+            if (StringUtils.isEmpty(iac.getJqapplyno()) && StringUtils.isNotEmpty(iac.getSyapplyno())) insFlag = "ds";
+
+
+            //单交
+            if (insFlag.equals("dj")) {
+                String jqFlagUrl = gainExistCarInsPolicy(licensePlate + jqbz, licensePlate);
+                String jqUrl = gainExistCarInsPolicy(licensePlate + jqbd, licensePlate);
+
+                if (StringUtils.isNotEmpty(jqFlagUrl) && StringUtils.isNotEmpty(jqUrl)) {
+                    cipDto.setJqFlagUrl(jqFlagUrl);
+                    cipDto.setJqUrl(jqUrl);
+                    return HttpResult.ok(cipDto);
+                }
+
+            } else if (insFlag.equals("ds")) {//单商
+                String syUrl = gainExistCarInsPolicy(licensePlate + sybd, licensePlate);
+
+                if (StringUtils.isNotEmpty(syUrl)) {
+                    cipDto.setSyUrl(syUrl);
+                    return HttpResult.ok(cipDto);
+                }
+            } else if (insFlag.equals("js")) {//交商业
+
+                String syUrl = gainExistCarInsPolicy(licensePlate + sybd, licensePlate);
+                String jqFlagUrl = gainExistCarInsPolicy(licensePlate + jqbz, licensePlate);
+                String jqUrl = gainExistCarInsPolicy(licensePlate + jqbd, licensePlate);
+
+                if (StringUtils.isNotEmpty(jqFlagUrl) && StringUtils.isNotEmpty(jqUrl) && StringUtils.isNotEmpty(syUrl)) {
+                    cipDto.setJqFlagUrl(jqFlagUrl);
+                    cipDto.setJqUrl(jqUrl);
+                    cipDto.setSyUrl(syUrl);
+                    return HttpResult.ok(cipDto);
+                }
+
             }
 
 
@@ -886,28 +940,26 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
                 //标志
                 if (StringUtils.isNotEmpty(pResp.getPolicyBZUrl())) {
                     String bzInsUrl = pResp.getPolicyBZUrl().replaceAll(";pkid", "&pkid");
-                    jqFlagUrl = gainCarInsPolicy(bzInsUrl, licensePlate + "-交强险标志.pdf", licensePlate);
+                    String jqFlagUrl = gainCarInsPolicy(bzInsUrl, licensePlate + jqbz, licensePlate);
+                    cipDto.setJqFlagUrl(jqFlagUrl);
                 }
                 //交强
                 if (StringUtils.isNotEmpty(pResp.getJqpolicyUrl())) {
                     String jqInsUrl = pResp.getJqpolicyUrl().replaceAll(";pkid", "&pkid");
-                    jqUrl = gainCarInsPolicy(jqInsUrl, licensePlate + "-交强险保单.pdf", licensePlate);
+                    String jqUrl = gainCarInsPolicy(jqInsUrl, licensePlate + jqbd, licensePlate);
+                    cipDto.setJqUrl(jqUrl);
 
                 }
 
                 //商业
                 if (StringUtils.isNotEmpty(pResp.getSypolicyUrl())) {
                     String syInsUrl = pResp.getSypolicyUrl().replaceAll(";pkid", "&pkid");
-                    syUrl = gainCarInsPolicy(syInsUrl, licensePlate + "-商业险保单.pdf", licensePlate);
+                    String syUrl = gainCarInsPolicy(syInsUrl, licensePlate + sybd, licensePlate);
+                    cipDto.setSyUrl(syUrl);
 
                 }
 
-                m.put("jqFlagUrl", jqFlagUrl);
-                m.put("jqUrl", jqUrl);
-                m.put("syUrl", syUrl);
-
-
-                return HttpResult.ok(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription(), m);
+                return HttpResult.ok(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription(), cipDto);
 
             } else {
                 return HttpResult.error(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription());
@@ -1738,11 +1790,90 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
             rMap.put("areaCode", areaList.get(0).getAreaCode());
             return rMap;
         }
-        throw new SystemException("永诚(日志号:" + IPUtil.gainServerNo() + ") - 被保人地区解析失败,请联系管理员,地址:" + address);
+        throw new SystemException("永诚(日志号:" + IPUtil.gainServerNo() + ") - 被保人地区自动解析失败,请手动填写。");
 //        return null;
     }
 
 
+    /**
+     * 新的
+     *
+     * @author: lig
+     * @date: 2023年10月12日 0012
+     */
+    public Map<String, String> gainRegionCode(String address, String type) {
+
+        log.debug("*********永诚API方式 - 身份证地址解析 参数:" + address);
+        Map rMap = new HashMap();
+
+
+//        if (address.indexOf("湖北省仙桃市") == 0) {
+//            rMap.put("provinceCode", "420000");
+//            rMap.put("cityCode", "429004");
+//            rMap.put("areaCode", "");
+//            return rMap;
+//        }
+
+//        if (address.contains("邢台县")) {
+//            address.replaceAll("邢台县", "信都区");
+//        }
+        if (address.contains("旬阳县")) {
+            address.replaceAll("旬阳县", "旬阳市");
+        }
+        if (address.contains("开县")) {
+            address.replaceAll("开县", "开州区");
+        }
+
+
+        Map<String, String> m = IDCardUtils.addressResolution(address);
+        if (null == m) return null;
+        String city = m.get("city");
+        String district = m.get("district");
+//        if(StringUtils.isNullOrEmpty(district)){
+//            //第二级赋值到第三级
+//            district = city;
+//        }
+
+        List<InsAlltrustRegion> areaList = new ArrayList<>();
+        if (StringUtils.isNotEmpty(district)) {
+            //查询地区
+            LambdaQueryWrapper<InsAlltrustRegion> lqw = new LambdaQueryWrapper<>();
+            lqw.eq(InsAlltrustRegion::getArea, district);
+            areaList = insAlltrustRegionMapper.selectList(lqw);
+        }
+
+
+        //如果地区查不到 用城市当地区查
+        if (null == areaList || areaList.size() < 1) {
+            LambdaQueryWrapper<InsAlltrustRegion> cityLqw = new LambdaQueryWrapper<>();
+            cityLqw.eq(InsAlltrustRegion::getArea, city);
+            areaList = insAlltrustRegionMapper.selectList(cityLqw);
+        }
+        //如果地区查不到 用城市当地区查
+        if (null == areaList || areaList.size() < 1) {
+            LambdaQueryWrapper<InsAlltrustRegion> cityLqw = new LambdaQueryWrapper<>();
+            cityLqw.eq(InsAlltrustRegion::getArea, city);
+            areaList = insAlltrustRegionMapper.selectList(cityLqw);
+        }
+        //如果地区查不到 查市
+        if (null == areaList || areaList.size() < 1) {
+            LambdaQueryWrapper<InsAlltrustRegion> cityLqw = new LambdaQueryWrapper<>();
+            cityLqw.eq(InsAlltrustRegion::getCity, city);
+            areaList = insAlltrustRegionMapper.selectList(cityLqw);
+        }
+
+
+        if (null != areaList && areaList.size() > 0) {
+            rMap.put("provinceCode", areaList.get(0).getProvinceCode());
+            rMap.put("cityCode", areaList.get(0).getCityCode());
+            rMap.put("areaCode", areaList.get(0).getAreaCode());
+            return rMap;
+        }
+
+        return null;
+    }
+
+
     private void buildRegion(Ruote m, BaseQuoteInfoVo yaQuoteInfoVo) {
         //车主
         CustomerInfoVo owner = yaQuoteInfoVo.getOwnerInfo();
@@ -1751,93 +1882,164 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
         //投保人
         CustomerInfoVo applicant = yaQuoteInfoVo.getPolicyHolderInfo();
 
-        String province = "";
-        String city = "";
-        String area = "";
 
+        Map<String, String> ownerMap = null;
+        //被保人省市区
+        Map<String, String> insureMap = null;
+        Map<String, String> applicantMap = null;
 
-        if (null != owner) {
-            //处理地区 车主
-            Map<String, String> ownerMap = gainRegionCode(owner.getAddr());
-            m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerMap.get("provinceCode"));
-            m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerMap.get("cityCode"));
-            m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerMap.get("areaCode"));
+        //车主省市区
+        List<String> ownerProvinceData = owner.getProvinceData();
+        //被保人省市区
+        List<String> insuredProvinceData = insured.getProvinceData();
+        //投保人 省市区
+        List<String> applicantProvinceData = applicant.getProvinceData();
+
+        if (CollUtil.isNotEmpty(ownerProvinceData) && CollUtil.isNotEmpty(insuredProvinceData) && CollUtil.isNotEmpty(applicantProvinceData)) {
+            yaQuoteInfoVo.getOwnerInfo().setProvinceData(ownerProvinceData);
+            m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerProvinceData.get(0));
+            m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerProvinceData.get(1));
+            m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerProvinceData.get(2));
+
+
+            yaQuoteInfoVo.getInsuredPersonInfo().setProvinceData(insuredProvinceData);
+            m.getRequestLabel().getCondition().getInsured().setCProvince(insuredProvinceData.get(0));
+            m.getRequestLabel().getCondition().getInsured().setCCity(insuredProvinceData.get(1));
+            m.getRequestLabel().getCondition().getInsured().setCCounty(insuredProvinceData.get(2));
+
+
+            yaQuoteInfoVo.getPolicyHolderInfo().setProvinceData(applicantProvinceData);
+            m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantProvinceData.get(0));
+            m.getRequestLabel().getCondition().getApplicant().setCCity(applicantProvinceData.get(1));
+            m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantProvinceData.get(2));
+            return;
+        }
 
 
-//            InsAlltrustRegion ownerRegion = findRegion(owner);
-//            if (null != ownerRegion) {
-//                m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerRegion.getProvinceCode());
-//                m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerRegion.getCityCode());
-//                m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerRegion.getAreaCode());
+        if (null != owner && CollUtil.isEmpty(ownerProvinceData)) {
+
+            ownerProvinceData = new ArrayList<>();
+            //处理地区 车主
+            ownerMap = gainRegionCode(owner.getAddr(), "车主");
+//            if(CollUtil.isNotEmpty(ownerMap)){
+//                m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerMap.get("provinceCode"));
+//                m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerMap.get("cityCode"));
+//                m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerMap.get("areaCode"));
 //            }
+
+
         }
 
-        if (null != insured) {
+        if (null != insured && CollUtil.isEmpty(insuredProvinceData)) {
+
+            insuredProvinceData = new ArrayList<>();
             //处理地区 被保人
-            Map<String, String> insureMap = gainRegionCode(insured.getAddr());
-            m.getRequestLabel().getCondition().getInsured().setCProvince(insureMap.get("provinceCode"));
-            m.getRequestLabel().getCondition().getInsured().setCCity(insureMap.get("cityCode"));
-            m.getRequestLabel().getCondition().getInsured().setCCounty(insureMap.get("areaCode"));
+            insureMap = gainRegionCode(insured.getAddr(), "被保人");
+//            if(CollUtil.isNotEmpty(insureMap)){
+//                m.getRequestLabel().getCondition().getInsured().setCProvince(insureMap.get("provinceCode"));
+//                m.getRequestLabel().getCondition().getInsured().setCCity(insureMap.get("cityCode"));
+//                m.getRequestLabel().getCondition().getInsured().setCCounty(insureMap.get("areaCode"));
+//            }
 
 
-//            InsAlltrustRegion insuredRegion = findRegion(insured);
-//            if (null != insuredRegion) {
-//                m.getRequestLabel().getCondition().getInsured().setCProvince(insuredRegion.getProvinceCode());
-//                m.getRequestLabel().getCondition().getInsured().setCCity(insuredRegion.getCityCode());
-//                m.getRequestLabel().getCondition().getInsured().setCCounty(insuredRegion.getAreaCode());
-//            }
         }
 
-        if (null != applicant) {
+        if (null != applicant && CollUtil.isEmpty(applicantProvinceData)) {
+
+            applicantProvinceData = new ArrayList<>();
             //处理地区 投保人
-            Map<String, String> applicantMap = gainRegionCode(applicant.getAddr());
-            m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantMap.get("provinceCode"));
-            m.getRequestLabel().getCondition().getApplicant().setCCity(applicantMap.get("cityCode"));
-            m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantMap.get("areaCode"));
+            applicantMap = gainRegionCode(applicant.getAddr(), "投保人");
+//            if(CollUtil.isNotEmpty(applicantMap)){
+//                m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantMap.get("provinceCode"));
+//                m.getRequestLabel().getCondition().getApplicant().setCCity(applicantMap.get("cityCode"));
+//                m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantMap.get("areaCode"));
+//            }
 
+        }
 
-//            InsAlltrustRegion applicantRegion = findRegion(applicant);
-//            if (null != applicantRegion) {
-//                m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantRegion.getProvinceCode());
-//                m.getRequestLabel().getCondition().getApplicant().setCCity(applicantRegion.getCityCode());
-//                m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantRegion.getAreaCode());
-//            }
+        StringBuffer sb = new StringBuffer();
+        if (null == ownerMap && CollUtil.isEmpty(ownerProvinceData)) {
+            sb.append("|永诚 - 车主地区自动解析失败,请手动填写。");
+        }
+        if (null == insureMap && CollUtil.isEmpty(insuredProvinceData)) {
+            sb.append("|永诚 - 被保人地区自动解析失败,请手动填写。");
+        }
+        if (null == applicantMap && CollUtil.isEmpty(applicantProvinceData)) {
+            sb.append("|永诚 - 投保人地区自动解析失败,请手动填写。");
         }
 
-    }
+        if (StringUtils.isNotEmpty(sb)) throw new SystemException(sb.toString());
 
-    private InsAlltrustRegion findRegion(CustomerInfoVo info) {
-        String province = info.getProvince();
-        String city = info.getCity();
-        String area = info.getCounty();
+        if (CollUtil.isNotEmpty(ownerMap)) {
+            m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerMap.get("provinceCode"));
+            m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerMap.get("cityCode"));
+            m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerMap.get("areaCode"));
+            ownerProvinceData.add(ownerMap.get("provinceCode"));
+            ownerProvinceData.add(ownerMap.get("cityCode"));
+            ownerProvinceData.add(ownerMap.get("areaCode"));
 
-        //lig 2023-09-21 临时解决   页面解决后可删除。
-        if (StringUtils.isEmpty(province) && StringUtils.isEmpty(city) && StringUtils.isEmpty(area)) {
-            throw new SystemException("永诚报价需要录入省市县");
         }
 
-        if (info.getAddr().indexOf("湖北省仙桃市") == 0) {
-            InsAlltrustRegion r = new InsAlltrustRegion();
-            r.setProvinceCode("420000");
-            r.setProvince("湖北省");
-            r.setCityCode("429004");
-            r.setCity("仙桃市");
-            r.setArea("");
-            r.setAreaCode("");
-            return r;
+        if (CollUtil.isNotEmpty(insureMap)) {
+            m.getRequestLabel().getCondition().getInsured().setCProvince(insureMap.get("provinceCode"));
+            m.getRequestLabel().getCondition().getInsured().setCCity(insureMap.get("cityCode"));
+            m.getRequestLabel().getCondition().getInsured().setCCounty(insureMap.get("areaCode"));
+            insuredProvinceData.add(insureMap.get("provinceCode"));
+            insuredProvinceData.add(insureMap.get("cityCode"));
+            insuredProvinceData.add(insureMap.get("areaCode"));
+
         }
 
-        LambdaQueryWrapper<InsAlltrustRegion> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(StringUtils.isNotEmpty(province), InsAlltrustRegion::getProvince, province);
-        lqw.eq(StringUtils.isNotEmpty(city), InsAlltrustRegion::getCity, city);
-        lqw.eq(StringUtils.isNotEmpty(area), InsAlltrustRegion::getArea, area);
-        try {
-            return insAlltrustRegionMapper.selectOne(lqw);
-        } catch (Exception e) {
-            throw new SystemException("永诚 - 省市县校验失败," + province + city + area);
+
+        if (CollUtil.isNotEmpty(applicantMap)) {
+            m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantMap.get("provinceCode"));
+            m.getRequestLabel().getCondition().getApplicant().setCCity(applicantMap.get("cityCode"));
+            m.getRequestLabel().getCondition().getApplicant().setCCounty(applicantMap.get("areaCode"));
+            applicantProvinceData.add(applicantMap.get("provinceCode"));
+            applicantProvinceData.add(applicantMap.get("cityCode"));
+            applicantProvinceData.add(applicantMap.get("areaCode"));
         }
+
+
+        yaQuoteInfoVo.getOwnerInfo().setProvinceData(ownerProvinceData);
+        yaQuoteInfoVo.getInsuredPersonInfo().setProvinceData(insuredProvinceData);
+        yaQuoteInfoVo.getPolicyHolderInfo().setProvinceData(applicantProvinceData);
+
+
     }
 
+//    private InsAlltrustRegion findRegion(CustomerInfoVo info) {
+//        String province = info.getProvince();
+//        String city = info.getCity();
+//        String area = info.getCounty();
+//
+//        //lig 2023-09-21 临时解决   页面解决后可删除。
+//        if (StringUtils.isEmpty(province) && StringUtils.isEmpty(city) && StringUtils.isEmpty(area)) {
+//            throw new SystemException("永诚报价需要录入省市县");
+//        }
+//
+//        if (info.getAddr().indexOf("湖北省仙桃市") == 0) {
+//            InsAlltrustRegion r = new InsAlltrustRegion();
+//            r.setProvinceCode("420000");
+//            r.setProvince("湖北省");
+//            r.setCityCode("429004");
+//            r.setCity("仙桃市");
+//            r.setArea("");
+//            r.setAreaCode("");
+//            return r;
+//        }
+//
+//        LambdaQueryWrapper<InsAlltrustRegion> lqw = new LambdaQueryWrapper<>();
+//        lqw.eq(StringUtils.isNotEmpty(province), InsAlltrustRegion::getProvince, province);
+//        lqw.eq(StringUtils.isNotEmpty(city), InsAlltrustRegion::getCity, city);
+//        lqw.eq(StringUtils.isNotEmpty(area), InsAlltrustRegion::getArea, area);
+//        try {
+//            return insAlltrustRegionMapper.selectOne(lqw);
+//        } catch (Exception e) {
+//            throw new SystemException("永诚 - 省市县校验失败," + province + city + area);
+//        }
+//    }
+
 
 //    private void buildRegion(Ruote m) {
 //        //车主
@@ -2061,9 +2263,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
                 }
             }
             //订单状态 已核保待缴费  不处理
-    //        if (order.getOrderstatus().equals(InsOrderStatusEnum.WAIT_PAY.getCode())) {
-    //                order.setOrderstatus(iac.getOrderstatus());
-    //        }
+            //        if (order.getOrderstatus().equals(InsOrderStatusEnum.WAIT_PAY.getCode())) {
+            //                order.setOrderstatus(iac.getOrderstatus());
+            //        }
 
             //订单状态 核保退回  不处理
             if (order.getOrderstatus().equals(InsOrderStatusEnum.TO_BACK.getCode())) {

+ 13 - 14
src/main/java/com/ydtech/utils/HttpXmlUtil.java

@@ -167,15 +167,15 @@ public class HttpXmlUtil {
      * @param xmlString 发送的xml数据流
      * @return
      */
-    public static String sendXmlPostReq(String url, String xmlString, Logger log,String textHead) {
+    public static String sendXmlPostReq(String url, String xmlString, Logger log, String textHead) {
 
 //        System.out.println("请求参数=" + xmlString);
-        if(null != log) log.debug(textHead + "XML请求url:{},\n请求参数:{}", url, xmlString);
+        if (null != log) log.debug(textHead + "XML请求url:{},\n请求参数:{}", url, xmlString);
 
         String responseString = null;
         Response response = null;
+        Call call = null;
         try {
-
             OkHttpClient client = new OkHttpClient.Builder()
                     .connectTimeout(60, TimeUnit.SECONDS)
                     .writeTimeout(60, TimeUnit.SECONDS)
@@ -191,30 +191,29 @@ public class HttpXmlUtil {
                     .addHeader("cache-control", "no-cache")
                     .build();
 
-            response = client.newCall(request).execute();
+            call = client.newCall(request);
+            response = call.execute();
             if (response.isSuccessful()) {
                 responseString = response.body().string();
             }
 
         } catch (Exception e) {
             e.printStackTrace();
-            log.error(textHead + "请求异常:"+e.getMessage() + ",原始返回:" + response);
+            log.error(textHead + "请求异常:" + e.getMessage() + ",原始返回:" + response);
             throw new SystemException("远程接口请求失败,请联系管理员。");
         } finally {
-            if(null != log) log.debug(textHead + "XML返回url:{},\n响应参数:{}", url, responseString.replaceAll("\n","").replaceAll("&lt;","<").replaceAll("&gt;",">"));
+            if (null != log)
+                log.debug(textHead + "XML返回url:{},\n响应参数:{}", url, responseString.replaceAll("\n", "").replaceAll("&lt;", "<").replaceAll("&gt;", ">"));
             response.close();
+            call.cancel();
         }
 
         return responseString;
 
 
-
-
     }
 
 
-
-
     //报价返回
     private static String AAA = "<?xml version=\"1.0\" ?><S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><ns2:queryVehicleXnyQuotationServiceResponse xmlns:ns2=\"http://newWS.front.app.echannel.ebiz.alltrust.com/\"><response>&lt;?xml version='1.0' encoding='UTF-8'?&gt;\n" +
             "&lt;responseMessage&gt;\n" +
@@ -1441,11 +1440,11 @@ public class HttpXmlUtil {
 //        String responseStr = FFF;
 //        String responseStr = GGG;
         String responseStr = HHH;
-        System.err.println("responseStr:"+responseStr.replaceAll("\n",""));
-        String s0 = responseStr.replaceAll("\n","");
+        System.err.println("responseStr:" + responseStr.replaceAll("\n", ""));
+        String s0 = responseStr.replaceAll("\n", "");
 //        System.err.println("responseStrForm:"+s0);
-        String s1 = s0.replaceAll("&lt;","<");
-        System.err.println("responseStrForm:"+s1.replaceAll("&gt;",">"));
+        String s1 = s0.replaceAll("&lt;", "<");
+        System.err.println("responseStrForm:" + s1.replaceAll("&gt;", ">"));
 
         String[] patterns = new String[]{
                 // This will remove empty elements that look like <ElementName/>

+ 20 - 8
src/main/java/com/ydtech/utils/IPUtil.java

@@ -1,8 +1,8 @@
 package com.ydtech.utils;
 
 import javax.servlet.http.HttpServletRequest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+import java.net.*;
+import java.util.Enumeration;
 
 /**
  * @program: market
@@ -61,15 +61,27 @@ public class IPUtil {
      * @date: 2023年10月09日 0009
      */
     public static String gainServerNo() {
-        String ip = "";
         String serverNo = "0";
         try {
-            ip = InetAddress.getLocalHost().getHostAddress();
-        } catch (UnknownHostException e) {
-            throw new RuntimeException(e);
+            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
+            while (networkInterfaces.hasMoreElements()) {
+                NetworkInterface networkInterface = networkInterfaces.nextElement();
+                if (networkInterface.getName().equals("eth0")) {
+                    Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
+                    while (inetAddresses.hasMoreElements()) {
+                        InetAddress inetAddress = inetAddresses.nextElement();
+                        if (inetAddress instanceof Inet4Address) {
+                            String ip = inetAddress.getHostAddress();
+                            if(ip.equals("172.24.144.220"))serverNo = "1";
+                            if(ip.equals("172.24.144.219"))serverNo = "2";
+                            System.out.println("eth0的IP地址是:" + ip);
+                        }
+                    }
+                }
+            }
+        } catch (SocketException e) {
+            e.printStackTrace();
         }
-        if(ip.equals("172.24.144.220"))serverNo = "1";
-        if(ip.equals("172.24.144.219"))serverNo = "2";
         return serverNo;
     }
 }