Explorar el Código

大家非车险接口

785834757 hace 2 años
padre
commit
bcd116e5df

+ 8 - 9
src/main/java/com/ydtech/modules/admin/service/impl/SysAreaServiceImpl.java

@@ -72,23 +72,22 @@ public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea>
                 provincesArea.add(collect.get(0));
             }
             List<SysArea> sysAreas = this.queryAllParent(provincesArea.get(0));
-            sysAreas.sort((o1, o2) -> o2.getLevel() - o1.getLevel());
             //如果等于2 说明是直辖市
             if (sysAreas.size() >= 2) {
                 if (sysAreas.size() == 2) {
-                    personAreaVo.setProvinceCode(Integer.valueOf(sysAreas.get(0).getAreaCode()));
-                    personAreaVo.setProvinceName(sysAreas.get(0).getAreaCname());
+                    personAreaVo.setCountyCode(Integer.valueOf(sysAreas.get(0).getAreaCode()));
+                    personAreaVo.setCountyName(sysAreas.get(0).getAreaCname());
                     personAreaVo.setCityCode(Integer.valueOf(sysAreas.get(0).getAreaCode()));
                     personAreaVo.setCityName(sysAreas.get(0).getAreaCname());
-                    personAreaVo.setCountyCode(Integer.valueOf(sysAreas.get(1).getAreaCode()));
-                    personAreaVo.setCountyName(sysAreas.get(1).getAreaCname());
+                    personAreaVo.setProvinceCode(Integer.valueOf(sysAreas.get(1).getAreaCode()));
+                    personAreaVo.setProvinceName(sysAreas.get(1).getAreaCname());
                 } else {
-                    personAreaVo.setProvinceCode(Integer.valueOf(sysAreas.get(0).getAreaCode()));
-                    personAreaVo.setProvinceName(sysAreas.get(0).getAreaCname());
+                    personAreaVo.setCountyCode(Integer.valueOf(sysAreas.get(0).getAreaCode()));
+                    personAreaVo.setCountyName(sysAreas.get(0).getAreaCname());
                     personAreaVo.setCityCode(Integer.valueOf(sysAreas.get(1).getAreaCode()));
                     personAreaVo.setCityName(sysAreas.get(1).getAreaCname());
-                    personAreaVo.setCountyCode(Integer.valueOf(sysAreas.get(2).getAreaCode()));
-                    personAreaVo.setCountyName(sysAreas.get(2).getAreaCname());
+                    personAreaVo.setProvinceCode(Integer.valueOf(sysAreas.get(2).getAreaCode()));
+                    personAreaVo.setProvinceName(sysAreas.get(2).getAreaCname());
                 }
                 return personAreaVo;
             }

+ 11 - 1
src/main/java/com/ydtech/modules/order/components/dajia/DaJiaRequestApiComponents.java

@@ -71,7 +71,7 @@ public class DaJiaRequestApiComponents {
         JSONObject resultObj = JSON.parseObject(body);
         String code = resultObj.getString("code");
         if(!code.equals("2000")) {
-            throw new SystemException(resultObj.getString("msg"));
+            throw new SystemException(resultObj.getString("message"));
         }
 
         S s = JSON.parseObject(resultObj.getJSONObject("body").toJSONString(),tClass);
@@ -177,6 +177,16 @@ public class DaJiaRequestApiComponents {
         return post(vhlins2005Request, DJ_TQBD_200000, VHLINS2005Response.class);
     }
 
+    /**
+     * 业务订单撤回
+     * @param odr1014Request
+     * @return
+     * @throws Exception
+     */
+    public ODR1014Response orderBack(ODR1014Request odr1014Request) throws Exception{
+        return post(odr1014Request, DJ_TQBD_100014, ODR1014Response.class);
+    }
+
     /**
      * 非车险核保接口
      * @param nvhlodr1001Request

+ 6 - 0
src/main/java/com/ydtech/modules/order/controller/DaJiaOrderController.java

@@ -62,6 +62,12 @@ public class DaJiaOrderController {
         return this.daJiaOrderService.obtainWarranty(policyPrintVo);
     }
 
+    @PostMapping(value = "/orderBack")
+    @ApiOperation(value = "订单撤回")
+    public HttpResult<Object> orderBack(@RequestSingleParam(value = "companyId") String companyId) {
+        return this.daJiaOrderService.orderBack(companyId);
+    }
+
     @PostMapping(value = "/accidentalDrivingList")
     @ApiOperation(value = "驾意险列表")
     public HttpResult<Object> accidentalDrivingList() {

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

@@ -64,7 +64,7 @@ public class NVHLODR1001Request extends DaJiaBaseRequest {
 
         policyInfos._0684_tgtList_1 = setTag0684List(baseQuoteInfoVo);
 
-        policyInfos.prodCvrgList = setProdCvrgList(insAccidentalDrivingDajia);
+//        policyInfos.prodCvrgList = setProdCvrgList(insAccidentalDrivingDajia);
         body.policyInfos.add(policyInfos);
 
     }
@@ -133,6 +133,8 @@ public class NVHLODR1001Request extends DaJiaBaseRequest {
         applicantDTO.setAppEffectiveDate(quoteInfoVo.getPolicyHolderInfo().getIdentifyValidDate());
         //证件有效止期
         applicantDTO.setAppExpiredDate(quoteInfoVo.getPolicyHolderInfo().getIdentifyValidEndDate());
+        //电子邮箱
+        applicantDTO.setAppEmail(quoteInfoVo.getPolicyHolderInfo().getEmail());
         return applicantDTO;
     }
 

+ 2 - 2
src/main/java/com/ydtech/modules/order/entity/api/dajia/request/ODR1008Request.java

@@ -556,7 +556,7 @@ public class ODR1008Request extends DaJiaBaseRequest {
         insuredInfoDTO.setInsuredProvince(insuredPersonArea.getProvinceCode());
         insuredInfoDTO.setInsuredCity(insuredPersonArea.getCityCode());
         insuredInfoDTO.setInsuredCounty(insuredPersonArea.getCountyCode());
-        insuredInfoDTO.setInsuredSuffixAddr(quoteInfoVo.getInsuredPersonInfo().getIdentifyValidEndDate());
+        insuredInfoDTO.setInsuredSuffixAddr(quoteInfoVo.getInsuredPersonInfo().getAddr());
         //邮编
 //        insuredInfoDTO.setInsuredZipCde("030024");
         this.body.setInsuredInfo(insuredInfoDTO);
@@ -644,7 +644,7 @@ public class ODR1008Request extends DaJiaBaseRequest {
         boolean consistentPrice = false;
         ODR2009Response.ResultDTO resultDTO = new ODR2009Response.ResultDTO();
         for(ODR2009Response.ResultDTO item : odr2009Response.getResult()){
-            if(item.getVehiclePriceTax().equals(quoteInfoVo.getCarInfo().getPurchasePrice())){
+            if(item.getVehiclePrice().equals(quoteInfoVo.getCarInfo().getPurchasePrice())){
                 consistentPrice = true;
                 resultDTO = item;
                 break;

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/api/dajia/request/ODR1009Request.java

@@ -122,6 +122,7 @@ public class ODR1009Request extends DaJiaBaseRequest {
         basePartReqDTO.setFinType("10");//默认是10  二维码收款
         //协商实际价值
         basePartReqDTO.setConsultPurchaseValue(odr1016Response.getResult().getActualValue());
+        basePartReqDTO.setRemark("【分公司特批:测试服务使用】");
         this.body.setBasePartReq(basePartReqDTO);
     }
 

+ 3 - 2
src/main/java/com/ydtech/modules/order/entity/api/dajia/request/ODR1014Request.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.entity.api.dajia.request;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.order.entity.api.dajia.DaJiaBaseRequest;
+import com.ydtech.modules.order.entity.api.dajia.DaJiaConfigureParameters;
 import com.ydtech.modules.order.entity.api.dajia.constants.ServiceCode;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -28,8 +29,8 @@ public class ODR1014Request extends DaJiaBaseRequest {
     @JsonProperty("body")
     private BodyDTO body;
 
-    public ODR1014Request(String orderNo) {
-        super("TQBD", ServiceCode.ODR1014.getCode());
+    public ODR1014Request(String orderNo, DaJiaConfigureParameters daJiaConfigureParameters) {
+        super(daJiaConfigureParameters.getChannelCode(), ServiceCode.ODR1014.getCode());
         if(body == null){
             body = new BodyDTO();
         }

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/api/dajia/response/ODR1013Response.java

@@ -17,4 +17,5 @@ public class ODR1013Response extends DaJiaBaseResponse {
 
     private static final long serialVersionUID = 272886779414029674L;
 
+
 }

+ 16 - 0
src/main/java/com/ydtech/modules/order/entity/api/dajia/response/ODR1014Response.java

@@ -1,10 +1,13 @@
 package com.ydtech.modules.order.entity.api.dajia.response;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.order.entity.api.dajia.DaJiaBaseResponse;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 
+import java.io.Serializable;
+
 /**
  * @description: 大家财险 业务订单撤回接口 响应参数
  * @author: wenks
@@ -17,4 +20,17 @@ public class ODR1014Response extends DaJiaBaseResponse {
 
     private static final long serialVersionUID = 272886779414029674L;
 
+    @JsonProperty("result")
+    private ResultDTO result;
+
+    @NoArgsConstructor
+    @Data
+    public static class ResultDTO implements Serializable {
+        //状态
+        @JsonProperty("status")
+        private String status;
+        //提示消息
+        @JsonProperty("message")
+        private String message;
+    }
 }

+ 7 - 0
src/main/java/com/ydtech/modules/order/service/DaJiaOrderService.java

@@ -21,6 +21,13 @@ public interface DaJiaOrderService extends BaseOrderService<Object>{
      */
     HttpResult<Object> obtainWarranty(PolicyPrintVo policyPrintVo);
 
+    /**
+     * 业务订单撤回
+     * @param companyId
+     * @return
+     */
+    HttpResult<Object> orderBack(String companyId);
+
     /**
      * 获取驾意险列表
      * @return

+ 139 - 34
src/main/java/com/ydtech/modules/order/service/impl/DaJiaOrderServiceImpl.java

@@ -1,19 +1,24 @@
 package com.ydtech.modules.order.service.impl;
 
+import cn.hutool.core.util.ArrayUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.SysArea;
 import com.ydtech.modules.admin.model.vo.PersonAreaVo;
+import com.ydtech.modules.admin.model.vo.SysAreaVo;
 import com.ydtech.modules.admin.service.SysAreaService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
 import com.ydtech.modules.ins.model.vo.*;
 import com.ydtech.modules.order.components.ConfigureParametersComponents;
 import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
 import com.ydtech.modules.order.components.dajia.DaJiaRequestApiComponents;
+import com.ydtech.modules.order.constants.InsuranceTypeCorrespondence;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.TaxArrears;
@@ -23,7 +28,9 @@ import com.ydtech.modules.order.entity.api.dajia.constants.CProdNo;
 import com.ydtech.modules.order.entity.api.dajia.constants.Message;
 import com.ydtech.modules.order.entity.api.dajia.request.*;
 import com.ydtech.modules.order.entity.api.dajia.response.*;
+import com.ydtech.modules.order.entity.api.zijin.constants.enums.BusType;
 import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
+import com.ydtech.modules.order.entity.vo.AccidentalDrivingQueryVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import com.ydtech.modules.order.entity.vo.PolicyPrintVo;
@@ -40,10 +47,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.math.BigDecimal;
+import java.util.*;
 import java.util.stream.Collectors;
 
 
@@ -141,7 +146,6 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
 
     /**
      * 报价
-     *
      * @param quoteInfoVo 报价实体
      * @param t
      * @return
@@ -265,20 +269,22 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         insAreaCompany.setId(companyId);
         insAreaCompany.setOrderno(orderNo);
         JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(odr1009Response.getResult()));
-        jsonObject.put("busiId", busiId);
+        jsonObject.put("busiId",busiId);
         insAreaCompany.setReptxt(jsonObject);
         insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
         insAreaCompany.setInsOrderNo(orderId);
         //交强投保单号
-        if (!Objects.isNull(odr1009Response.getResult().getBasePart().getJqProposalNo())) {
+        if(!Objects.isNull(odr1009Response.getResult().getBasePart().getJqProposalNo()))
+        {
             insAreaCompany.setJqapplyno(odr1009Response.getResult().getBasePart().getJqProposalNo().toString());
         }
         //商业投保单号
-        if (!Objects.isNull(odr1009Response.getResult().getBasePart().getSyProposalNo())) {
+        if(!Objects.isNull(odr1009Response.getResult().getBasePart().getSyProposalNo()))
+        {
             insAreaCompany.setSyapplyno(odr1009Response.getResult().getBasePart().getSyProposalNo().toString());
         }
         //驾意险信息
-        if (!Objects.isNull(nvhlodr1001Response)) {
+        if(!Objects.isNull(nvhlodr1001Response)){
             insAreaCompany.setCrossInsurance(JSONArray.parseArray(JSON.toJSONString(nvhlodr1001Response.getPolicyInfos())));
         }
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
@@ -286,7 +292,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         quoteRespVo.setOrderno(orderNo);
         // 车船税
         ODR1009Response.ResultDTO.VehicleTaxationDTO carShipTax = odr1009Response.getResult().getVehicleTaxation();
-        if (!Objects.isNull(carShipTax)) {
+        if(!Objects.isNull(carShipTax)) {
             TaxArrears taxArrears = new TaxArrears("往年欠税", Double.parseDouble(carShipTax.getTaxableAmt()),
                     Double.parseDouble(carShipTax.getTaxOverdueAmt()));
             List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
@@ -298,14 +304,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
 
     /**
      * 获取CCvrgNo Code
-     *
      * @param code
      * @return
      */
-    public CCvrgNo getCCvrgNoByCode(String code) {
+    public CCvrgNo getCCvrgNoByCode(String code){
         CCvrgNo[] values = CCvrgNo.values();
         for (CCvrgNo value : values) {
-            if (value.getCode().equals(code)) {
+            if(value.getCode().equals(code)){
                 return value;
             }
         }
@@ -314,12 +319,11 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
 
     /**
      * 根据id 获取驾意险信息
-     *
      * @param id
      * @param quantity
      * @return
      */
-    public InsAccidentalDrivingDajia getAccidentalDrivingByCode(String id, Integer quantity) {
+    public InsAccidentalDrivingDajia getAccidentalDrivingByCode(String id,Integer quantity){
         InsAccidentalDrivingDajia byId = insAccidentalDrivingDaJiaService.getById(id);
         byId.setQuantity(quantity);
         return byId;
@@ -337,13 +341,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         QuoteRespVo quoteRespVo = new QuoteRespVo();
 
         // 交强
-        if (odr1009Response.getResult().getBasePart().getJqEffectiveDate() != null) {
+        if(odr1009Response.getResult().getBasePart().getJqEffectiveDate() != null) {
             quoteRespVo.setStartDateJq(String.valueOf(odr1009Response.getResult().getBasePart().getJqEffectiveDate()));
             quoteRespVo.setEndDateJq(String.valueOf(odr1009Response.getResult().getBasePart().getJqExpireDate()));
         }
 
         // 商业
-        if (odr1009Response.getResult().getBasePart().getSyEffectiveDate() != null) {
+        if(odr1009Response.getResult().getBasePart().getSyEffectiveDate() != null){
             quoteRespVo.setStartDateSy(odr1009Response.getResult().getBasePart().getSyEffectiveDate());
             quoteRespVo.setEndDateSy(odr1009Response.getResult().getBasePart().getSyExpireDate());
         }
@@ -353,22 +357,22 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         //  报价险种放入保费
         List<QuoteRiskRespVo> riskList = new ArrayList<>();
         // risk列表
-        if (odr1009Response.getResult().getBasePart().getJqProposalNo() != null) {
+        if(odr1009Response.getResult().getBasePart().getJqProposalNo() != null){
             QuoteRiskRespVo jqRisk = new QuoteRiskRespVo();
             jqRisk.setRiskCode(InsuranceRisk.TRAFFIC.getCode());
             jqRisk.setRiskName(InsuranceRisk.TRAFFIC.getDesc());
-            if (!Objects.isNull(odr1009Response.getResult().getBasePart().getJqPremium())) {
+            if(!Objects.isNull(odr1009Response.getResult().getBasePart().getJqPremium())) {
                 jqRisk.setPremium(Double.parseDouble(odr1009Response.getResult().getBasePart().getJqPremium().toString()));
                 jqRisk.setStartDate(odr1009Response.getResult().getBasePart().getJqEffectiveDate().toString());
                 jqRisk.setEndDate(odr1009Response.getResult().getBasePart().getJqExpireDate().toString());
             }
             riskList.add(jqRisk);
         }
-        if (odr1009Response.getResult().getBasePart().getSyProposalNo() != null) {
+        if(odr1009Response.getResult().getBasePart().getSyProposalNo() != null){
             QuoteRiskRespVo syRisk = new QuoteRiskRespVo();
             syRisk.setRiskCode(InsuranceRisk.BUSINESS.getCode());
             syRisk.setRiskName(InsuranceRisk.BUSINESS.getDesc());
-            if (!Objects.isNull(odr1009Response.getResult().getBasePart().getSyPremium())) {
+            if(!Objects.isNull(odr1009Response.getResult().getBasePart().getSyPremium())) {
                 syRisk.setPremium(Double.parseDouble(odr1009Response.getResult().getBasePart().getSyPremium().toString()));
                 syRisk.setStartDate(odr1009Response.getResult().getBasePart().getSyEffectiveDate().toString());
                 syRisk.setEndDate(odr1009Response.getResult().getBasePart().getSyExpireDate().toString());
@@ -454,7 +458,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
             DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
             configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
             //先进行影像提交
-//            submitImage(companyId);
+            submitImage(companyId);
 
             //1009返回数据
             ODR1009Response.ResultDTO resultDTO = JSONObject.parseObject(
@@ -477,6 +481,24 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                     insOrders);
             ODR1010Response odr1010Response = daJiaRequestApiComponents.underwriting(odr1010Request);
             if (odr1010Response.getStatus().equals(Message.M0000.getCode())) {
+                if("0".equals(odr1010Response.getResult().getJqAppStatus()) || "0".equals(odr1010Response.getResult().getSyAppStatus())){
+                    if("0".equals(odr1010Response.getResult().getJqAppStatus())) {
+                        return HttpResult.error("自核失败,原因:" + odr1010Response.getResult().getJqAppStatusMessage());
+                    }else{
+                        return HttpResult.error("自核失败,原因:" + odr1010Response.getResult().getSyAppStatusMessage());
+                    }
+                }
+                if("1".equals(odr1010Response.getResult().getJqAppStatus()) || "1".equals(odr1010Response.getResult().getSyAppStatus())){
+                    //修改状态 转人工
+                    insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_AUDIT.getCode());
+                    insAreaCompanyService.updateById(insAreaCompany);
+                    if("1".equals(odr1010Response.getResult().getJqAppStatus())) {
+                        return HttpResult.error("自核转人工,原因:" + odr1010Response.getResult().getJqAppStatusMessage());
+                    }else{
+                        return HttpResult.error("自核转人工,原因:" + odr1010Response.getResult().getSyAppStatusMessage());
+                    }
+
+                }
                 //核保成功  获取支付二维码
                 ODR1011Request odr1011Request = new ODR1011Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters,
                         policyInfosDTOS);
@@ -496,14 +518,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                 }
             }
             return HttpResult.error("核保失败");
-        } catch (Exception e) {
+        }catch(Exception e){
             throw new RuntimeException(e.getMessage());
         }
     }
 
     /**
      * 上传影像
-     *
      * @param companyId
      * @return
      */
@@ -530,6 +551,41 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         }
     }
 
+    //region 订单状态查询
+
+    //检测是否进入人工
+    public boolean checkArtificial(List<ODR2010Response.ResultDTO> result){
+        List<ODR2010Response.ResultDTO> artificialCollect = result.stream().filter(x -> x.getNotifyType().equals("2002")).collect(Collectors.toList());
+        if(artificialCollect.size() > 0){
+            return true;
+        }
+        return false;
+    }
+
+    //检测是否核保退回
+    public boolean checkBack(List<ODR2010Response.ResultDTO> result){
+        List<ODR2010Response.ResultDTO> backCollect = result.stream().filter(x -> x.getNotifyType().equals("2003") || x.getNotifyType().equals("2004")).collect(Collectors.toList());
+        if(backCollect.size() > 0){
+            return true;
+        }
+        return false;
+    }
+
+    //检测核保通过是否存在支付连接
+    public boolean checkPayLink(List<ODR2010Response.ResultDTO> result,InsAreaCompany insAreaCompany){
+        List<ODR2010Response.ResultDTO> traverseCollect = result.stream().filter(x -> x.getNotifyType().equals("2005")).collect(Collectors.toList());
+        if(traverseCollect.size() > 0 && ("".equals(insAreaCompany.getPaymentLink()) || insAreaCompany.getPaymentLink() != null)) {
+            return true;
+        }
+        return false;
+    }
+
+    //检测是否存在保单生成状态
+    public boolean checkBdGen(List<ODR2010Response.ResultDTO> result){
+        List<ODR2010Response.ResultDTO> collect = result.stream().filter(x -> x.getNotifyType().equals("2009")).collect(Collectors.toList());
+        return !collect.isEmpty();
+    }
+
     /**
      * 查询订单状态
      *
@@ -543,13 +599,42 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
             //获取公司配置信息
             DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
             configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
-            ODR2010Request odr2010Request = new ODR2010Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters);
+            ODR2010Request odr2010Request = new ODR2010Request(insAreaCompany.getInsOrderNo(),daJiaConfigureParameters);
             ODR2010Response odr2010Response = daJiaRequestApiComponents.verifyPayment(odr2010Request);
-            if (odr2010Response.getStatus().equals(Message.M0000.getCode())) {
+            if(odr2010Response.getStatus().equals(Message.M0000.getCode())){
                 List<ODR2010Response.ResultDTO> result = odr2010Response.getResult();
-                List<ODR2010Response.ResultDTO> collect =
-                        result.stream().filter(x -> x.getNotifyType().equals("2009")).collect(Collectors.toList());
-                if (collect.size() > 0) {
+                //是否人工核保
+                if(checkArtificial(result))
+                {
+                    //是否存在核保退回
+                    if(checkBack(result)){
+                        insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_AUDIT.getCode());
+                        insAreaCompanyService.updateById(insAreaCompany);
+                    }else
+                        //存在 核保通过 并且 不存在支付连接 则 生成支付连接
+                        if(!checkPayLink(result,insAreaCompany)){
+                            //核保成功  获取支付二维码
+                            //驾意险 返回数据
+                            List<NVHLODR1001Response.policyInfosDTO> policyInfosDTOS = null;
+                            if(!Objects.isNull(insAreaCompany.getCrossInsurance())){
+                                policyInfosDTOS = JSON.parseArray(JSON.toJSONString(insAreaCompany.getCrossInsurance()),NVHLODR1001Response.policyInfosDTO.class);
+                            }
+                            ODR1011Request odr1011Request = new ODR1011Request(insAreaCompany.getInsOrderNo(),daJiaConfigureParameters,policyInfosDTOS);
+                            ODR1011Response payNo = daJiaRequestApiComponents.getPayNo(odr1011Request);
+                            if(payNo.getStatus().equals(Message.M0000.getCode())) {
+                                //获取支付二维码成功  保存支付二维码
+                                insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
+                                insAreaCompany.setPaymentLink(payNo.getResult().getSignInfoUrl());
+                                insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+                            }else{
+                                return HttpResult.error("获取支付二维码失败");
+                            }
+                        }
+                }
+                //是否存在保单生成
+                if(checkBdGen(result))
+                {
+                    List<ODR2010Response.ResultDTO> collect = result.stream().filter(x -> x.getNotifyType().equals("2009")).collect(Collectors.toList());
                     //更新订单状态
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                     for (int i = 0, length = collect.size(); i < length; i++) {
@@ -562,17 +647,17 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                     }
                     insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
                 }
-                return HttpResult.ok("查询订单状态成功");
             }
-            return HttpResult.error("查询订单状态错误");
-        } catch (Exception e) {
+            return HttpResult.ok("查询订单状态成功");
+        }catch (Exception e){
             throw new RuntimeException(e.getMessage());
         }
     }
 
+    //endregion
+
     /**
      * 获取保单
-     *
      * @param policyPrintVo
      * @return
      */
@@ -657,9 +742,28 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
         }
     }
 
+    @Override
+    public HttpResult<Object> orderBack(String companyId) {
+        try {
+            InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
+            //获取公司配置信息
+            DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
+            configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
+
+            ODR1014Request odr1014Request = new ODR1014Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters);
+            ODR1014Response odr1014Response = daJiaRequestApiComponents.orderBack(odr1014Request);
+            if("0000".equals(odr1014Response.getStatus())){
+                return HttpResult.ok("退单成功");
+            }else{
+                return HttpResult.error("退单失败");
+            }
+        }catch(Exception e){
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
     /**
      * 获取驾意险列表
-     *
      * @return
      */
     @Override
@@ -670,6 +774,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
 
     private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
         String dir = "carInsPolicy/" + licensePlate + "/";
+        url = url.replaceAll("http://","https://");
         return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
     }