|
|
@@ -1,23 +1,19 @@
|
|
|
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;
|
|
|
@@ -27,9 +23,7 @@ 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;
|
|
|
@@ -46,8 +40,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -86,6 +82,9 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
@Autowired
|
|
|
private InsAccidentalDrivingSubDaJiaService insAccidentalDrivingSubDaJiaService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InsImagesUploadCacheComponents insImagesUploadCacheComponents;
|
|
|
+
|
|
|
@Value("${upload.file.path}")
|
|
|
private String uploadFilePath;
|
|
|
|
|
|
@@ -96,45 +95,53 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
private String apiUrl;
|
|
|
|
|
|
//region 报价
|
|
|
+
|
|
|
/**
|
|
|
* 获取OrderNo
|
|
|
+ *
|
|
|
* @param daJiaConfigureParameters
|
|
|
* @return
|
|
|
*/
|
|
|
- private String getOrderNo(DaJiaConfigureParameters daJiaConfigureParameters) throws Exception {
|
|
|
+ private String getOrderNo(DaJiaConfigureParameters daJiaConfigureParameters) throws Exception {
|
|
|
ODR1007Request odr1007Request = new ODR1007Request(daJiaConfigureParameters);
|
|
|
ODR1007Response odr1007Response = daJiaRequestApiComponents.queryBusinessOrders(odr1007Request);
|
|
|
- if(odr1007Response.getStatus().equals(Message.M0000.getCode())){
|
|
|
+ if (odr1007Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
//接口返回 订单号
|
|
|
String orderNo = odr1007Response.getResult().getOrderNo();
|
|
|
return orderNo;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new Exception("获取业务订单号接口失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 车辆与客户信息确认
|
|
|
+ *
|
|
|
* @param orderNo
|
|
|
* @param quoteInfoVo
|
|
|
* @param daJiaConfigureParameters
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- private ODR1008Response ConfirmationVehicleCustomerInformation(String orderNo, String busiId,BaseQuoteInfoVo quoteInfoVo, DaJiaConfigureParameters daJiaConfigureParameters,ODR2009Response odr2009Request,PersonAreaVo policyHolderPersonArea,PersonAreaVo insuredPersonArea) throws Exception {
|
|
|
+ private ODR1008Response ConfirmationVehicleCustomerInformation(String orderNo, String busiId, BaseQuoteInfoVo quoteInfoVo,
|
|
|
+ DaJiaConfigureParameters daJiaConfigureParameters,
|
|
|
+ ODR2009Response odr2009Request, PersonAreaVo policyHolderPersonArea,
|
|
|
+ PersonAreaVo insuredPersonArea) throws Exception {
|
|
|
|
|
|
- ODR1008Request odr1008Request = new ODR1008Request(orderNo,busiId,quoteInfoVo,daJiaConfigureParameters,odr2009Request,policyHolderPersonArea,insuredPersonArea);
|
|
|
+ ODR1008Request odr1008Request = new ODR1008Request(orderNo, busiId, quoteInfoVo, daJiaConfigureParameters, odr2009Request,
|
|
|
+ policyHolderPersonArea, insuredPersonArea);
|
|
|
ODR1008Response odr1008Response = daJiaRequestApiComponents.carOrCustomInfoConfirm(odr1008Request);
|
|
|
- if(odr1008Response.getStatus().equals(Message.M0000.getCode())){
|
|
|
+ if (odr1008Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
//车辆与客户信息确认返回
|
|
|
return odr1008Response;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new Exception("车辆与客户信息确认接口失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 报价
|
|
|
+ *
|
|
|
* @param quoteInfoVo 报价实体
|
|
|
* @param t
|
|
|
* @return
|
|
|
@@ -144,18 +151,20 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
try {
|
|
|
//获取公司配置信息
|
|
|
DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
|
|
|
- configureParametersComponents.toEntity(daJiaConfigureParameters,t.getAgreementId());
|
|
|
+ configureParametersComponents.toEntity(daJiaConfigureParameters, t.getAgreementId());
|
|
|
PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(t.getAgreementId());
|
|
|
|
|
|
//投保人区划信息
|
|
|
- PersonAreaVo policyHolderPersonArea = sysAreaService.queryByAddress(quoteInfoVo.getPolicyHolderInfo().getAddr(), quoteInfoVo.getPolicyHolderInfo().getIdentifyNumber());
|
|
|
+ PersonAreaVo policyHolderPersonArea = sysAreaService.queryByAddress(quoteInfoVo.getPolicyHolderInfo().getAddr(),
|
|
|
+ quoteInfoVo.getPolicyHolderInfo().getIdentifyNumber());
|
|
|
PersonAreaVo insuredPersonArea;
|
|
|
//投保人等于被保人
|
|
|
- if(quoteInfoVo.getPolicyHolderInfo().getIdentifyNumber().equals(quoteInfoVo.getInsuredPersonInfo().getIdentifyNumber())){
|
|
|
+ if (quoteInfoVo.getPolicyHolderInfo().getIdentifyNumber().equals(quoteInfoVo.getInsuredPersonInfo().getIdentifyNumber())) {
|
|
|
insuredPersonArea = policyHolderPersonArea;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//被保人区划信息
|
|
|
- insuredPersonArea = sysAreaService.queryByAddress(quoteInfoVo.getInsuredPersonInfo().getAddr(), quoteInfoVo.getInsuredPersonInfo().getIdentifyNumber());
|
|
|
+ insuredPersonArea = sysAreaService.queryByAddress(quoteInfoVo.getInsuredPersonInfo().getAddr(),
|
|
|
+ quoteInfoVo.getInsuredPersonInfo().getIdentifyNumber());
|
|
|
}
|
|
|
|
|
|
// 1.获取业务订单号接口
|
|
|
@@ -164,18 +173,19 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
String busiId = IdGenerate.nextId();
|
|
|
|
|
|
// 2.车型查询
|
|
|
- ODR2009Request odr2009Request = new ODR2009Request(orderNo,quoteInfoVo,daJiaConfigureParameters);
|
|
|
+ ODR2009Request odr2009Request = new ODR2009Request(orderNo, quoteInfoVo, daJiaConfigureParameters);
|
|
|
ODR2009Response odr2009Response = daJiaRequestApiComponents.queryVehicleTypes(odr2009Request);
|
|
|
|
|
|
// 3.车辆与客户信息确认
|
|
|
- ODR1008Response odr1008Response = ConfirmationVehicleCustomerInformation(orderNo,busiId,quoteInfoVo,daJiaConfigureParameters,odr2009Response,policyHolderPersonArea,insuredPersonArea);
|
|
|
- if(!odr1008Response.getStatus().equals(Message.M0000.getCode())){
|
|
|
+ ODR1008Response odr1008Response = ConfirmationVehicleCustomerInformation(orderNo, busiId, quoteInfoVo,
|
|
|
+ daJiaConfigureParameters, odr2009Response, policyHolderPersonArea, insuredPersonArea);
|
|
|
+ if (!odr1008Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
return HttpResult.error("车辆与客户信息确认接口失败");
|
|
|
}
|
|
|
|
|
|
String fuelType = odr1008Response.getResult().getVehicleInfo().getVehicleFuelType();
|
|
|
boolean isEnergy = false;
|
|
|
- if("1,2,3,".contains(fuelType+",")) {//纯电动 燃料电池 插电式混合动力 归属为新能源产品
|
|
|
+ if ("1,2,3,".contains(fuelType + ",")) {//纯电动 燃料电池 插电式混合动力 归属为新能源产品
|
|
|
isEnergy = true;
|
|
|
}
|
|
|
//查询车辆商业起保日期
|
|
|
@@ -183,9 +193,9 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
String bxStartDate = Objects.isNull(insOrders.getSystartdate()) ?
|
|
|
insOrders.getJqstartdate() : insOrders.getSystartdate();
|
|
|
//4.车辆实际价值计算接口
|
|
|
- ODR1016Request odr1016Request = new ODR1016Request(orderNo,bxStartDate);
|
|
|
+ ODR1016Request odr1016Request = new ODR1016Request(orderNo, bxStartDate);
|
|
|
ODR1016Response odr1016Response = daJiaRequestApiComponents.carValueCalculation(odr1016Request);
|
|
|
- if(!odr1016Response.getStatus().equals(Message.M0000.getCode())){
|
|
|
+ if (!odr1016Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
return HttpResult.error("车辆实际价值计算接口失败");
|
|
|
}
|
|
|
|
|
|
@@ -196,43 +206,47 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
JSONObject accidentalDrivingVo = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
|
|
|
InsAccidentalDrivingDajia accidentalDriving = null;
|
|
|
List<InsAccidentalDrivingSubDajia> listByAccId = null;
|
|
|
- if(!Objects.isNull(accidentalDrivingVo) && accidentalDrivingVo.size() > 0){
|
|
|
+ if (!Objects.isNull(accidentalDrivingVo) && accidentalDrivingVo.size() > 0) {
|
|
|
//驾意险
|
|
|
- accidentalDriving = getAccidentalDrivingByCode(accidentalDrivingVo.getString("rideRiskCode"), accidentalDrivingVo.getInteger("quantity"));
|
|
|
+ accidentalDriving = getAccidentalDrivingByCode(accidentalDrivingVo.getString("rideRiskCode"),
|
|
|
+ accidentalDrivingVo.getInteger("quantity"));
|
|
|
//驾意险详细信息
|
|
|
listByAccId = insAccidentalDrivingSubDaJiaService.getListByAccId(accidentalDriving.getId());
|
|
|
}
|
|
|
- ODR1009Request odr1009Request = new ODR1009Request(orderNo, kindList, riskList,quoteInfoVo,odr1016Response,accidentalDriving,listByAccId,daJiaConfigureParameters,isEnergy);
|
|
|
+ ODR1009Request odr1009Request = new ODR1009Request(orderNo, kindList, riskList, quoteInfoVo, odr1016Response,
|
|
|
+ accidentalDriving, listByAccId, daJiaConfigureParameters, isEnergy);
|
|
|
ODR1009Response odr1009Response = daJiaRequestApiComponents.newPremiumXnyCalculation(odr1009Request);
|
|
|
NVHLODR1001Response nvhlodr1001Response = null;
|
|
|
- if(!Objects.isNull(accidentalDrivingVo) && !accidentalDrivingVo.isEmpty()){
|
|
|
+ if (!Objects.isNull(accidentalDrivingVo) && !accidentalDrivingVo.isEmpty()) {
|
|
|
//6.驾意险报价
|
|
|
- NVHLODR1001Request nvhlodr1001Request = new NVHLODR1001Request(daJiaConfigureParameters,odr1009Response,
|
|
|
- quoteInfoVo,accidentalDriving,accidentalDrivingVo.getString("quantity"),policyHolderPersonArea,insuredPersonArea);
|
|
|
+ NVHLODR1001Request nvhlodr1001Request = new NVHLODR1001Request(daJiaConfigureParameters, odr1009Response,
|
|
|
+ quoteInfoVo, accidentalDriving, accidentalDrivingVo.getString("quantity"), policyHolderPersonArea,
|
|
|
+ insuredPersonArea);
|
|
|
nvhlodr1001Response = daJiaRequestApiComponents.accidentPremiumCalculation(nvhlodr1001Request);
|
|
|
- if(!"2000".equals(nvhlodr1001Response.getStatus())){
|
|
|
+ if (!"2000".equals(nvhlodr1001Response.getStatus())) {
|
|
|
return HttpResult.error("驾意险报价失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(Message.M0000.getCode().equals(odr1009Response.getStatus())){
|
|
|
+ if (Message.M0000.getCode().equals(odr1009Response.getStatus())) {
|
|
|
|
|
|
//保费计算接口返回
|
|
|
- QuoteRespVo quoteRespVo = getQuoteRespVo(odr1009Response, quoteInfoVo,nvhlodr1001Response);
|
|
|
+ QuoteRespVo quoteRespVo = getQuoteRespVo(odr1009Response, quoteInfoVo, nvhlodr1001Response);
|
|
|
//添加调用费用匹配功能
|
|
|
// feeRuleSchemeService.dealFeeOrderInfo(quoteInfoVo, quoteRespVo, t.getAgreementId(),
|
|
|
// odr1009Request.getBody().getOrderNo());
|
|
|
- HttpResult<QuoteRespVo> quoteRespVoHttpResult = responseOrder(odr1009Response, quoteRespVo, ptlAgreementAttribution, orderNo, quoteInfoVo.getOrderNo(),busiId,nvhlodr1001Response);
|
|
|
+ HttpResult<QuoteRespVo> quoteRespVoHttpResult = responseOrder(odr1009Response, quoteRespVo, ptlAgreementAttribution,
|
|
|
+ orderNo, quoteInfoVo.getOrderNo(), busiId, nvhlodr1001Response);
|
|
|
return quoteRespVoHttpResult;
|
|
|
- }else{
|
|
|
- if(odr1009Response.getResult().getJqAppStatus().equals("0") && odr1009Response.getStatus().equals("0002")) {
|
|
|
- return HttpResult.error("报价失败,原因:"+odr1009Response.getResult().getJqAppStatusMessage());
|
|
|
- }else if(odr1009Response.getResult().getSyAppStatus().equals("0") && odr1009Response.getStatus().equals("0002")) {
|
|
|
+ } else {
|
|
|
+ if (odr1009Response.getResult().getJqAppStatus().equals("0") && odr1009Response.getStatus().equals("0002")) {
|
|
|
+ return HttpResult.error("报价失败,原因:" + odr1009Response.getResult().getJqAppStatusMessage());
|
|
|
+ } else if (odr1009Response.getResult().getSyAppStatus().equals("0") && odr1009Response.getStatus().equals("0002")) {
|
|
|
return HttpResult.error("报价失败,原因:" + odr1009Response.getResult().getSyAppStatusMessage());
|
|
|
}
|
|
|
return HttpResult.error("报价失败");
|
|
|
}
|
|
|
- }catch(Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
@@ -241,7 +255,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
public HttpResult<QuoteRespVo> responseOrder(ODR1009Response odr1009Response,
|
|
|
QuoteRespVo quoteRespVo,
|
|
|
PtlAgreementAttribution ptlAgreementAttribution, String orderId,
|
|
|
- String orderNo,String busiId,
|
|
|
+ String orderNo, String busiId,
|
|
|
NVHLODR1001Response nvhlodr1001Response) {
|
|
|
// 保存订单信息
|
|
|
InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
|
|
|
@@ -251,22 +265,20 @@ 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);
|
|
|
@@ -274,7 +286,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);
|
|
|
@@ -286,13 +298,14 @@ 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;
|
|
|
}
|
|
|
}
|
|
|
@@ -301,11 +314,12 @@ 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;
|
|
|
@@ -323,13 +337,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());
|
|
|
}
|
|
|
@@ -339,22 +353,22 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
// 报价险种放入保费
|
|
|
List<QuoteRiskRespVo> riskList = new ArrayList<QuoteRiskRespVo>();
|
|
|
// 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());
|
|
|
@@ -373,10 +387,10 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
kind.setKindCode(cCvrgNoByCode.getInsurCode());
|
|
|
kind.setKindName(cCvrgNoByCode.getDesc());
|
|
|
// amt里 包含座位的价格是总和 需要根据座位数 算出保费单价
|
|
|
- if(cCvrgNoByCode.getInsurCode().equals("D4") || cCvrgNoByCode.getInsurCode().equals("SY_FJ_YBW2")){
|
|
|
+ if (cCvrgNoByCode.getInsurCode().equals("D4") || cCvrgNoByCode.getInsurCode().equals("SY_FJ_YBW2")) {
|
|
|
Integer seatCount = Integer.parseInt(yaQuoteInfoVo.getCarInfo().getSeatCount());
|
|
|
kind.setAmount(dto.getAmt() / (seatCount - 1));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
kind.setAmount(dto.getAmt());
|
|
|
}
|
|
|
kind.setCoveragePremium(dto.getPremium());
|
|
|
@@ -398,20 +412,19 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
// jyPremium = bigDecimal.doubleValue();
|
|
|
// }
|
|
|
|
|
|
- if(!Objects.isNull(nvhlodr1001Response)){
|
|
|
+ if (!Objects.isNull(nvhlodr1001Response)) {
|
|
|
jyPremium = Double.parseDouble(nvhlodr1001Response.getOrderPrm());
|
|
|
}
|
|
|
|
|
|
quoteRespVo.setRiskList(riskList);
|
|
|
quoteRespVo.setKindList(kindList);
|
|
|
- if(!Objects.isNull(odr1009Response.getResult().getBasePart().getJqPremium()))
|
|
|
- {
|
|
|
+ if (!Objects.isNull(odr1009Response.getResult().getBasePart().getJqPremium())) {
|
|
|
jqPremium = Double.parseDouble(odr1009Response.getResult().getBasePart().getJqPremium().toString());
|
|
|
}
|
|
|
- if(!Objects.isNull(odr1009Response.getResult().getBasePart().getSyPremium())){
|
|
|
+ if (!Objects.isNull(odr1009Response.getResult().getBasePart().getSyPremium())) {
|
|
|
syPremium = Double.parseDouble(odr1009Response.getResult().getBasePart().getSyPremium().toString());
|
|
|
}
|
|
|
- if(!Objects.isNull(odr1009Response.getResult().getVehicleTaxation())){
|
|
|
+ if (!Objects.isNull(odr1009Response.getResult().getVehicleTaxation())) {
|
|
|
sumPayTax = Double.parseDouble(odr1009Response.getResult().getVehicleTaxation().getTaxTotalAmount());
|
|
|
}
|
|
|
quoteRespVo.setJqPremium(jqPremium);
|
|
|
@@ -419,7 +432,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
quoteRespVo.setTaxAmount(sumPayTax);
|
|
|
quoteRespVo.setJyPremium(jyPremium);
|
|
|
quoteRespVo.setCiSumPermium(CalculateUtils.add(jqPremium, sumPayTax));//交强险和车船税合计
|
|
|
- quoteRespVo.setSumPermium(CalculateUtils.add(jqPremium,syPremium,sumPayTax,jyPremium));//总保费
|
|
|
+ quoteRespVo.setSumPermium(CalculateUtils.add(jqPremium, syPremium, sumPayTax, jyPremium));//总保费
|
|
|
quoteRespVo.setTotalAdjustRate(0);
|
|
|
quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo()); //订单号
|
|
|
return quoteRespVo;
|
|
|
@@ -428,11 +441,12 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
/**
|
|
|
* 核保
|
|
|
+ *
|
|
|
* @param companyId 子订单号
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpResult<Object> audit(String companyId){
|
|
|
+ public HttpResult<Object> audit(String companyId) {
|
|
|
try {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|
|
|
InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
@@ -449,8 +463,9 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
//驾意险 返回数据
|
|
|
List<NVHLODR1001Response.policyInfosDTO> policyInfosDTOS = null;
|
|
|
- if(!Objects.isNull(insAreaCompany.getCrossInsurance())){
|
|
|
- policyInfosDTOS = JSON.parseArray(JSON.toJSONString(insAreaCompany.getCrossInsurance()),NVHLODR1001Response.policyInfosDTO.class);
|
|
|
+ if (!Objects.isNull(insAreaCompany.getCrossInsurance())) {
|
|
|
+ policyInfosDTOS = JSON.parseArray(JSON.toJSONString(insAreaCompany.getCrossInsurance()),
|
|
|
+ NVHLODR1001Response.policyInfosDTO.class);
|
|
|
}
|
|
|
|
|
|
//核保构造request
|
|
|
@@ -463,30 +478,32 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
ODR1010Response odr1010Response = daJiaRequestApiComponents.underwriting(odr1010Request);
|
|
|
if (odr1010Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
//核保成功 获取支付二维码
|
|
|
- ODR1011Request odr1011Request = new ODR1011Request(insAreaCompany.getInsOrderNo(),daJiaConfigureParameters,policyInfosDTOS);
|
|
|
+ ODR1011Request odr1011Request = new ODR1011Request(insAreaCompany.getInsOrderNo(), daJiaConfigureParameters,
|
|
|
+ policyInfosDTOS);
|
|
|
ODR1011Response payNo = daJiaRequestApiComponents.getPayNo(odr1011Request);
|
|
|
- if(payNo.getStatus().equals(Message.M0000.getCode())){
|
|
|
+ if (payNo.getStatus().equals(Message.M0000.getCode())) {
|
|
|
//获取支付二维码成功 保存支付二维码
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
insAreaCompany.setPaymentLink(payNo.getResult().getSignInfoUrl());
|
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
return HttpResult.ok("核保成功");
|
|
|
}
|
|
|
- }else{
|
|
|
- if(odr1010Response.getResult().getJqAppStatus().equals("0") && odr1010Response.getStatus().equals("0003")){
|
|
|
- return HttpResult.error("核保失败,原因:"+odr1010Response.getResult().getJqAppStatusMessage());
|
|
|
- }else if(odr1010Response.getResult().getSyAppStatus().equals("0") && odr1010Response.getStatus().equals("0003")){
|
|
|
- return HttpResult.error("核保失败,原因:"+odr1010Response.getResult().getSyAppStatusMessage());
|
|
|
+ } else {
|
|
|
+ if (odr1010Response.getResult().getJqAppStatus().equals("0") && odr1010Response.getStatus().equals("0003")) {
|
|
|
+ return HttpResult.error("核保失败,原因:" + odr1010Response.getResult().getJqAppStatusMessage());
|
|
|
+ } else if (odr1010Response.getResult().getSyAppStatus().equals("0") && odr1010Response.getStatus().equals("0003")) {
|
|
|
+ return HttpResult.error("核保失败,原因:" + odr1010Response.getResult().getSyAppStatusMessage());
|
|
|
}
|
|
|
}
|
|
|
return HttpResult.error("核保失败");
|
|
|
- }catch(Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 上传影像
|
|
|
+ *
|
|
|
* @param companyId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -494,25 +511,28 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
public HttpResult<Object> submitImage(String companyId) {
|
|
|
try {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|
|
|
- List<InsTaskImagesBase64> byOrderNo = insTaskImagesService.findByOrderNo(insAreaCompany.getOrderno());
|
|
|
+ List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insAreaCompany.getOrderno(), insAreaCompany.getId());
|
|
|
//获取公司配置信息
|
|
|
DaJiaConfigureParameters daJiaConfigureParameters = new DaJiaConfigureParameters();
|
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
|
//构造上传图片request
|
|
|
- ODR1013Request odr1013Request = new ODR1013Request(insAreaCompany, daJiaConfigureParameters, byOrderNo);
|
|
|
+ ODR1013Request odr1013Request = new ODR1013Request(insAreaCompany, daJiaConfigureParameters, insTaskImagesBase64s);
|
|
|
ODR1013Response odr1013Response = daJiaRequestApiComponents.uploadImage(odr1013Request);
|
|
|
- if(odr1013Response.getStatus().equals(Message.M0001.getCode())){
|
|
|
+ if (odr1013Response.getStatus().equals(Message.M0001.getCode())) {
|
|
|
+ // 上传的影像存入redis
|
|
|
+ insImagesUploadCacheComponents.setUploadImageCache(companyId, insTaskImagesBase64s);
|
|
|
//上传成功
|
|
|
return HttpResult.ok("上传影像成功");
|
|
|
}
|
|
|
return HttpResult.error("上传影像失败");
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询订单状态
|
|
|
+ *
|
|
|
* @param companyId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -523,19 +543,20 @@ 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) {
|
|
|
+ List<ODR2010Response.ResultDTO> collect =
|
|
|
+ result.stream().filter(x -> x.getNotifyType().equals("2009")).collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
//更新订单状态
|
|
|
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++) {
|
|
|
//交强或商业 的 保单号
|
|
|
- if(collect.get(i).getProdNo().equals(CProdNo.JQ.getCode())){
|
|
|
+ if (collect.get(i).getProdNo().equals(CProdNo.JQ.getCode())) {
|
|
|
insAreaCompany.setJqpolicyno(collect.get(i).getPlyNo());
|
|
|
- }else if(collect.get(i).getProdNo().equals(CProdNo.SY.getCode())){
|
|
|
+ } else if (collect.get(i).getProdNo().equals(CProdNo.SY.getCode())) {
|
|
|
insAreaCompany.setSypolicyno(collect.get(i).getPlyNo());
|
|
|
}
|
|
|
}
|
|
|
@@ -544,13 +565,14 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
return HttpResult.ok("查询订单状态成功");
|
|
|
}
|
|
|
return HttpResult.error("查询订单状态错误");
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取保单
|
|
|
+ *
|
|
|
* @param policyPrintVo
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -570,7 +592,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
CustomerInfoVo customerInfoVo = ownerInfo.toJavaObject(CustomerInfoVo.class);
|
|
|
String identifyNo = customerInfoVo.getIdentifyNumber();
|
|
|
//交强险
|
|
|
- if(InsuranceRisk.TRAFFIC.getCode().equals(policyPrintVo.getRiskCode())){
|
|
|
+ if (InsuranceRisk.TRAFFIC.getCode().equals(policyPrintVo.getRiskCode())) {
|
|
|
if (insAreaCompany.getJqpolicyno() != null) {
|
|
|
warrantys.add(insAreaCompany.getJqpolicyno());
|
|
|
}
|
|
|
@@ -579,29 +601,33 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
} else {
|
|
|
templateName = "-交强险保单.pdf";
|
|
|
}
|
|
|
- }else if(InsuranceRisk.BUSINESS.getCode().equals(policyPrintVo.getRiskCode())) {
|
|
|
+ } else if (InsuranceRisk.BUSINESS.getCode().equals(policyPrintVo.getRiskCode())) {
|
|
|
//商业险
|
|
|
if (insAreaCompany.getSypolicyno() != null) {
|
|
|
warrantys.add(insAreaCompany.getSypolicyno());
|
|
|
}
|
|
|
templateName = "-商业险保单.pdf";
|
|
|
- }else if(InsuranceRisk.ACCIDENT.getCode().equals(policyPrintVo.getRiskCode())){
|
|
|
+ } else if (InsuranceRisk.ACCIDENT.getCode().equals(policyPrintVo.getRiskCode())) {
|
|
|
//驾意险
|
|
|
templateName = "-驾意险保单.pdf";
|
|
|
}
|
|
|
String[] warrantysArray = warrantys.toArray(new String[0]);
|
|
|
//是否获取驾意险保单
|
|
|
- if(InsuranceRisk.ACCIDENT.getCode().equals(policyPrintVo.getRiskCode())){
|
|
|
-
|
|
|
- if(!Objects.isNull(insAreaCompany.getCrossInsurance())){
|
|
|
- List<NVHLODR1001Response.policyInfosDTO> policyInfosDTOS = JSON.parseArray(JSON.toJSONString(insAreaCompany.getCrossInsurance()), NVHLODR1001Response.policyInfosDTO.class);
|
|
|
- NVHLODR2007Request nvhlodr2007Request = new NVHLODR2007Request(policyInfosDTOS.get(0).getAppNo(),daJiaConfigureParameters);
|
|
|
+ if (InsuranceRisk.ACCIDENT.getCode().equals(policyPrintVo.getRiskCode())) {
|
|
|
+
|
|
|
+ if (!Objects.isNull(insAreaCompany.getCrossInsurance())) {
|
|
|
+ List<NVHLODR1001Response.policyInfosDTO> policyInfosDTOS =
|
|
|
+ JSON.parseArray(JSON.toJSONString(insAreaCompany.getCrossInsurance()),
|
|
|
+ NVHLODR1001Response.policyInfosDTO.class);
|
|
|
+ NVHLODR2007Request nvhlodr2007Request = new NVHLODR2007Request(policyInfosDTOS.get(0).getAppNo(),
|
|
|
+ daJiaConfigureParameters);
|
|
|
NVHLODR2007Response nvhlodr2007Response = daJiaRequestApiComponents.accidentPremiumWarranty(nvhlodr2007Request);
|
|
|
- if("2000".equals(nvhlodr2007Response.getStatus())){
|
|
|
- url = gainCarInsPolicy(nvhlodr2007Response.getPolicyInfos().get(0).getCPdfUrl(), nvhlodr2007Response.getPolicyInfos().get(0).getCAppNo() + templateName, identifyNo);
|
|
|
+ if ("2000".equals(nvhlodr2007Response.getStatus())) {
|
|
|
+ url = gainCarInsPolicy(nvhlodr2007Response.getPolicyInfos().get(0).getCPdfUrl(),
|
|
|
+ nvhlodr2007Response.getPolicyInfos().get(0).getCAppNo() + templateName, identifyNo);
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
VHLINS2005Request vhlins2005Request = new VHLINS2005Request(warrantysArray, daJiaConfigureParameters);
|
|
|
VHLINS2005Response vhlins2005Response = daJiaRequestApiComponents.obtainWarranty(vhlins2005Request);
|
|
|
if (vhlins2005Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
@@ -625,20 +651,21 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return HttpResult.ok("获取保单成功",url);
|
|
|
- }catch (Exception e){
|
|
|
+ return HttpResult.ok("获取保单成功", url);
|
|
|
+ } catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取驾意险列表
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public HttpResult<Object> accidentalDrivingList() {
|
|
|
List<InsAccidentalDrivingDajia> list = insAccidentalDrivingDaJiaService.list();
|
|
|
- return HttpResult.ok("获取驾意险列表成功",list);
|
|
|
+ return HttpResult.ok("获取驾意险列表成功", list);
|
|
|
}
|
|
|
|
|
|
private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|