|
@@ -1,19 +1,24 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ArrayUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.ydtech.constants.enums.InsuranceRisk;
|
|
import com.ydtech.constants.enums.InsuranceRisk;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
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.PersonAreaVo;
|
|
|
|
|
+import com.ydtech.modules.admin.model.vo.SysAreaVo;
|
|
|
import com.ydtech.modules.admin.service.SysAreaService;
|
|
import com.ydtech.modules.admin.service.SysAreaService;
|
|
|
import com.ydtech.modules.fee.service.FeeRuleSchemeService;
|
|
import com.ydtech.modules.fee.service.FeeRuleSchemeService;
|
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
|
import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
|
|
import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
|
|
|
import com.ydtech.modules.order.components.dajia.DaJiaRequestApiComponents;
|
|
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.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.TaxArrears;
|
|
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.constants.Message;
|
|
|
import com.ydtech.modules.order.entity.api.dajia.request.*;
|
|
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.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.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.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.order.entity.vo.PolicyPrintVo;
|
|
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.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
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;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -141,7 +146,6 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 报价
|
|
* 报价
|
|
|
- *
|
|
|
|
|
* @param quoteInfoVo 报价实体
|
|
* @param quoteInfoVo 报价实体
|
|
|
* @param t
|
|
* @param t
|
|
|
* @return
|
|
* @return
|
|
@@ -265,20 +269,22 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
insAreaCompany.setId(companyId);
|
|
insAreaCompany.setId(companyId);
|
|
|
insAreaCompany.setOrderno(orderNo);
|
|
insAreaCompany.setOrderno(orderNo);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(odr1009Response.getResult()));
|
|
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(odr1009Response.getResult()));
|
|
|
- jsonObject.put("busiId", busiId);
|
|
|
|
|
|
|
+ jsonObject.put("busiId",busiId);
|
|
|
insAreaCompany.setReptxt(jsonObject);
|
|
insAreaCompany.setReptxt(jsonObject);
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
|
|
|
insAreaCompany.setInsOrderNo(orderId);
|
|
insAreaCompany.setInsOrderNo(orderId);
|
|
|
//交强投保单号
|
|
//交强投保单号
|
|
|
- if (!Objects.isNull(odr1009Response.getResult().getBasePart().getJqProposalNo())) {
|
|
|
|
|
|
|
+ if(!Objects.isNull(odr1009Response.getResult().getBasePart().getJqProposalNo()))
|
|
|
|
|
+ {
|
|
|
insAreaCompany.setJqapplyno(odr1009Response.getResult().getBasePart().getJqProposalNo().toString());
|
|
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());
|
|
insAreaCompany.setSyapplyno(odr1009Response.getResult().getBasePart().getSyProposalNo().toString());
|
|
|
}
|
|
}
|
|
|
//驾意险信息
|
|
//驾意险信息
|
|
|
- if (!Objects.isNull(nvhlodr1001Response)) {
|
|
|
|
|
|
|
+ if(!Objects.isNull(nvhlodr1001Response)){
|
|
|
insAreaCompany.setCrossInsurance(JSONArray.parseArray(JSON.toJSONString(nvhlodr1001Response.getPolicyInfos())));
|
|
insAreaCompany.setCrossInsurance(JSONArray.parseArray(JSON.toJSONString(nvhlodr1001Response.getPolicyInfos())));
|
|
|
}
|
|
}
|
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
@@ -286,7 +292,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
quoteRespVo.setOrderno(orderNo);
|
|
quoteRespVo.setOrderno(orderNo);
|
|
|
// 车船税
|
|
// 车船税
|
|
|
ODR1009Response.ResultDTO.VehicleTaxationDTO carShipTax = odr1009Response.getResult().getVehicleTaxation();
|
|
ODR1009Response.ResultDTO.VehicleTaxationDTO carShipTax = odr1009Response.getResult().getVehicleTaxation();
|
|
|
- if (!Objects.isNull(carShipTax)) {
|
|
|
|
|
|
|
+ if(!Objects.isNull(carShipTax)) {
|
|
|
TaxArrears taxArrears = new TaxArrears("往年欠税", Double.parseDouble(carShipTax.getTaxableAmt()),
|
|
TaxArrears taxArrears = new TaxArrears("往年欠税", Double.parseDouble(carShipTax.getTaxableAmt()),
|
|
|
Double.parseDouble(carShipTax.getTaxOverdueAmt()));
|
|
Double.parseDouble(carShipTax.getTaxOverdueAmt()));
|
|
|
List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
|
|
List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
|
|
@@ -298,14 +304,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取CCvrgNo Code
|
|
* 获取CCvrgNo Code
|
|
|
- *
|
|
|
|
|
* @param code
|
|
* @param code
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public CCvrgNo getCCvrgNoByCode(String code) {
|
|
|
|
|
|
|
+ public CCvrgNo getCCvrgNoByCode(String code){
|
|
|
CCvrgNo[] values = CCvrgNo.values();
|
|
CCvrgNo[] values = CCvrgNo.values();
|
|
|
for (CCvrgNo value : values) {
|
|
for (CCvrgNo value : values) {
|
|
|
- if (value.getCode().equals(code)) {
|
|
|
|
|
|
|
+ if(value.getCode().equals(code)){
|
|
|
return value;
|
|
return value;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -314,12 +319,11 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据id 获取驾意险信息
|
|
* 根据id 获取驾意险信息
|
|
|
- *
|
|
|
|
|
* @param id
|
|
* @param id
|
|
|
* @param quantity
|
|
* @param quantity
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public InsAccidentalDrivingDajia getAccidentalDrivingByCode(String id, Integer quantity) {
|
|
|
|
|
|
|
+ public InsAccidentalDrivingDajia getAccidentalDrivingByCode(String id,Integer quantity){
|
|
|
InsAccidentalDrivingDajia byId = insAccidentalDrivingDaJiaService.getById(id);
|
|
InsAccidentalDrivingDajia byId = insAccidentalDrivingDaJiaService.getById(id);
|
|
|
byId.setQuantity(quantity);
|
|
byId.setQuantity(quantity);
|
|
|
return byId;
|
|
return byId;
|
|
@@ -337,13 +341,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
QuoteRespVo quoteRespVo = new QuoteRespVo();
|
|
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.setStartDateJq(String.valueOf(odr1009Response.getResult().getBasePart().getJqEffectiveDate()));
|
|
|
quoteRespVo.setEndDateJq(String.valueOf(odr1009Response.getResult().getBasePart().getJqExpireDate()));
|
|
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.setStartDateSy(odr1009Response.getResult().getBasePart().getSyEffectiveDate());
|
|
|
quoteRespVo.setEndDateSy(odr1009Response.getResult().getBasePart().getSyExpireDate());
|
|
quoteRespVo.setEndDateSy(odr1009Response.getResult().getBasePart().getSyExpireDate());
|
|
|
}
|
|
}
|
|
@@ -353,22 +357,22 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
// 报价险种放入保费
|
|
// 报价险种放入保费
|
|
|
List<QuoteRiskRespVo> riskList = new ArrayList<>();
|
|
List<QuoteRiskRespVo> riskList = new ArrayList<>();
|
|
|
// risk列表
|
|
// risk列表
|
|
|
- if (odr1009Response.getResult().getBasePart().getJqProposalNo() != null) {
|
|
|
|
|
|
|
+ if(odr1009Response.getResult().getBasePart().getJqProposalNo() != null){
|
|
|
QuoteRiskRespVo jqRisk = new QuoteRiskRespVo();
|
|
QuoteRiskRespVo jqRisk = new QuoteRiskRespVo();
|
|
|
jqRisk.setRiskCode(InsuranceRisk.TRAFFIC.getCode());
|
|
jqRisk.setRiskCode(InsuranceRisk.TRAFFIC.getCode());
|
|
|
jqRisk.setRiskName(InsuranceRisk.TRAFFIC.getDesc());
|
|
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.setPremium(Double.parseDouble(odr1009Response.getResult().getBasePart().getJqPremium().toString()));
|
|
|
jqRisk.setStartDate(odr1009Response.getResult().getBasePart().getJqEffectiveDate().toString());
|
|
jqRisk.setStartDate(odr1009Response.getResult().getBasePart().getJqEffectiveDate().toString());
|
|
|
jqRisk.setEndDate(odr1009Response.getResult().getBasePart().getJqExpireDate().toString());
|
|
jqRisk.setEndDate(odr1009Response.getResult().getBasePart().getJqExpireDate().toString());
|
|
|
}
|
|
}
|
|
|
riskList.add(jqRisk);
|
|
riskList.add(jqRisk);
|
|
|
}
|
|
}
|
|
|
- if (odr1009Response.getResult().getBasePart().getSyProposalNo() != null) {
|
|
|
|
|
|
|
+ if(odr1009Response.getResult().getBasePart().getSyProposalNo() != null){
|
|
|
QuoteRiskRespVo syRisk = new QuoteRiskRespVo();
|
|
QuoteRiskRespVo syRisk = new QuoteRiskRespVo();
|
|
|
syRisk.setRiskCode(InsuranceRisk.BUSINESS.getCode());
|
|
syRisk.setRiskCode(InsuranceRisk.BUSINESS.getCode());
|
|
|
syRisk.setRiskName(InsuranceRisk.BUSINESS.getDesc());
|
|
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.setPremium(Double.parseDouble(odr1009Response.getResult().getBasePart().getSyPremium().toString()));
|
|
|
syRisk.setStartDate(odr1009Response.getResult().getBasePart().getSyEffectiveDate().toString());
|
|
syRisk.setStartDate(odr1009Response.getResult().getBasePart().getSyEffectiveDate().toString());
|
|
|
syRisk.setEndDate(odr1009Response.getResult().getBasePart().getSyExpireDate().toString());
|
|
syRisk.setEndDate(odr1009Response.getResult().getBasePart().getSyExpireDate().toString());
|
|
@@ -454,7 +458,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
|
|
DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
|
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
|
//先进行影像提交
|
|
//先进行影像提交
|
|
|
-// submitImage(companyId);
|
|
|
|
|
|
|
+ submitImage(companyId);
|
|
|
|
|
|
|
|
//1009返回数据
|
|
//1009返回数据
|
|
|
ODR1009Response.ResultDTO resultDTO = JSONObject.parseObject(
|
|
ODR1009Response.ResultDTO resultDTO = JSONObject.parseObject(
|
|
@@ -477,6 +481,24 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
insOrders);
|
|
insOrders);
|
|
|
ODR1010Response odr1010Response = daJiaRequestApiComponents.underwriting(odr1010Request);
|
|
ODR1010Response odr1010Response = daJiaRequestApiComponents.underwriting(odr1010Request);
|
|
|
if (odr1010Response.getStatus().equals(Message.M0000.getCode())) {
|
|
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,
|
|
ODR1011Request odr1011Request = new ODR1011Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters,
|
|
|
policyInfosDTOS);
|
|
policyInfosDTOS);
|
|
@@ -496,14 +518,13 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return HttpResult.error("核保失败");
|
|
return HttpResult.error("核保失败");
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
|
+ }catch(Exception e){
|
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 上传影像
|
|
* 上传影像
|
|
|
- *
|
|
|
|
|
* @param companyId
|
|
* @param companyId
|
|
|
* @return
|
|
* @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();
|
|
DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
|
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
|
- ODR2010Request odr2010Request = new ODR2010Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters);
|
|
|
|
|
|
|
+ ODR2010Request odr2010Request = new ODR2010Request(insAreaCompany.getInsOrderNo(),daJiaConfigureParameters);
|
|
|
ODR2010Response odr2010Response = daJiaRequestApiComponents.verifyPayment(odr2010Request);
|
|
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> 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());
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
for (int i = 0, length = collect.size(); i < length; i++) {
|
|
for (int i = 0, length = collect.size(); i < length; i++) {
|
|
@@ -562,17 +647,17 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
}
|
|
}
|
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
}
|
|
}
|
|
|
- return HttpResult.ok("查询订单状态成功");
|
|
|
|
|
}
|
|
}
|
|
|
- return HttpResult.error("查询订单状态错误");
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
|
+ return HttpResult.ok("查询订单状态成功");
|
|
|
|
|
+ }catch (Exception e){
|
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取保单
|
|
* 获取保单
|
|
|
- *
|
|
|
|
|
* @param policyPrintVo
|
|
* @param policyPrintVo
|
|
|
* @return
|
|
* @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
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
@@ -670,6 +774,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
|
|
private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
|
String dir = "carInsPolicy/" + licensePlate + "/";
|
|
String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
|
|
+ url = url.replaceAll("http://","https://");
|
|
|
return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
}
|
|
}
|
|
|
|
|
|