|
|
@@ -37,14 +37,15 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
|
import com.ydtech.utils.CalculateUtils;
|
|
|
+import com.ydtech.utils.DateTimeUtil;
|
|
|
import com.ydtech.utils.baidu.FileUtil;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
+import java.lang.String;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.Period;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
@@ -136,7 +137,8 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
private ODR1008Response confirmationVehicleCustomerInformation(String orderNo, String busiId, BaseQuoteInfoVo quoteInfoVo,
|
|
|
DaJiaConfigureParameters daJiaConfigureParameters,
|
|
|
ODR2009Response odr2009Request, PersonAreaVo policyHolderPersonArea,
|
|
|
- PersonAreaVo insuredPersonArea, PersonAreaVo ownerPersonArea, CoreModelsVo coreModelsVo) throws Exception {
|
|
|
+ PersonAreaVo insuredPersonArea, PersonAreaVo ownerPersonArea,
|
|
|
+ CoreModelsVo coreModelsVo) throws Exception {
|
|
|
|
|
|
ODR1008Request odr1008Request = new ODR1008Request(orderNo, busiId, quoteInfoVo, daJiaConfigureParameters, odr2009Request,
|
|
|
policyHolderPersonArea, insuredPersonArea, ownerPersonArea, coreModelsVo);
|
|
|
@@ -194,8 +196,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
CoreModelsVo coreModelsVo = new CoreModelsVo();
|
|
|
|
|
|
ODR1008Response odr1008Response = confirmationVehicleCustomerInformation(orderNo, busiId, quoteInfoVo,
|
|
|
- daJiaConfigureParameters, odr2009Response, policyHolderPersonArea, insuredPersonArea, ownerPersonArea,
|
|
|
- coreModelsVo);
|
|
|
+ daJiaConfigureParameters, odr2009Response, policyHolderPersonArea, insuredPersonArea, ownerPersonArea, coreModelsVo);
|
|
|
if (!odr1008Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
return HttpResult.error("车辆与客户信息确认接口失败");
|
|
|
}
|
|
|
@@ -208,8 +209,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
//查询车辆商业起保日期
|
|
|
InsOrders insOrders = insOrdersService.getById(quoteInfoVo.getOrderNo());
|
|
|
- String bxStartDate = Objects.isNull(insOrders.getSystartdate()) ?
|
|
|
- insOrders.getJqstartdate() : insOrders.getSystartdate();
|
|
|
+ String bxStartDate = Objects.isNull(insOrders.getSystartdate()) ? insOrders.getJqstartdate() : insOrders.getSystartdate();
|
|
|
//4.车辆实际价值计算接口
|
|
|
ODR1016Request odr1016Request = new ODR1016Request(orderNo, bxStartDate);
|
|
|
ODR1016Response odr1016Response = daJiaRequestApiComponents.carValueCalculation(odr1016Request);
|
|
|
@@ -232,8 +232,8 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
listByAccId = insAccidentalDrivingSubDaJiaService.getListByAccId(accidentalDriving.getId());
|
|
|
}
|
|
|
//6.报价
|
|
|
- ODR1009Response odr1009Response = quotation(orderNo, kindList, riskList, quoteInfoVo, odr1016Response,
|
|
|
- accidentalDriving, listByAccId, daJiaConfigureParameters, isEnergy);
|
|
|
+ ODR1009Response odr1009Response = quotation(orderNo, kindList, riskList, quoteInfoVo, odr1016Response, accidentalDriving,
|
|
|
+ listByAccId, daJiaConfigureParameters, isEnergy);
|
|
|
|
|
|
NVHLODR1001Response nvhlodr1001Response = null;
|
|
|
|
|
|
@@ -242,9 +242,8 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
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())) {
|
|
|
return HttpResult.error("驾意险报价失败");
|
|
|
@@ -278,35 +277,37 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
/**
|
|
|
* 获取重复投保时间
|
|
|
*
|
|
|
- * @param startDateStr
|
|
|
- * @param endDateStr
|
|
|
* @param newStDate
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getDuplicateDate(String startDateStr, String endDateStr, String newStDate) {
|
|
|
+ public List<String> getDuplicateDate(String newStDate) {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- //处理23:59:59
|
|
|
- if (endDateStr.endsWith("23:59:59")) {
|
|
|
- LocalDateTime time = LocalDateTime.parse(endDateStr, formatter);
|
|
|
+// //处理23:59:59
|
|
|
+ if (newStDate.endsWith("59")) {
|
|
|
+ LocalDateTime time = LocalDateTime.parse(newStDate, formatter);
|
|
|
LocalDateTime timePlusOneSecond = time.plusSeconds(1);
|
|
|
- endDateStr = timePlusOneSecond.format(formatter);
|
|
|
+ newStDate = timePlusOneSecond.format(formatter);
|
|
|
}
|
|
|
|
|
|
- LocalDateTime startDate = LocalDateTime.parse(startDateStr, formatter);
|
|
|
- LocalDateTime endDate = LocalDateTime.parse(endDateStr, formatter);
|
|
|
-
|
|
|
- Period period = Period.between(startDate.toLocalDate(), endDate.toLocalDate());
|
|
|
-
|
|
|
- LocalDateTime newStartDate = LocalDateTime.parse(newStDate, formatter);
|
|
|
- LocalDateTime newEndDate = newStartDate.plus(period);
|
|
|
- //减一秒
|
|
|
- newEndDate = newEndDate.minusSeconds(1);
|
|
|
+ LocalDateTime start = DateTimeUtil.parseLocalDateTime(newStDate, DateTimeUtil.DATETIME_PATTERN);
|
|
|
List<String> result = new ArrayList<>();
|
|
|
- result.add(newStartDate.format(formatter));
|
|
|
- result.add(newEndDate.format(formatter));
|
|
|
+ String newStartDate;
|
|
|
+ String newEndDate;
|
|
|
+ //及时起保
|
|
|
+ LocalDateTime end = start.plusYears(1L);
|
|
|
+ if (start.getHour() > 0) {
|
|
|
+ newStartDate = DateTimeUtil.format(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ newEndDate = DateTimeUtil.format(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ } else {
|
|
|
+ newStartDate = DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ }
|
|
|
+ result.add(newStartDate);
|
|
|
+ result.add(newEndDate);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 报价 处理重复投保
|
|
|
*
|
|
|
@@ -323,11 +324,10 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public ODR1009Response quotation(String orderNo, List<KindInfoVo> kindInfoVos, List<RiskInfoVo> riskInfoVos,
|
|
|
- BaseQuoteInfoVo quoteInfoVo,
|
|
|
- ODR1016Response odr1016Response, InsAccidentalDrivingDajia insAccidentalDrivingDajia,
|
|
|
+ BaseQuoteInfoVo quoteInfoVo, ODR1016Response odr1016Response,
|
|
|
+ InsAccidentalDrivingDajia insAccidentalDrivingDajia,
|
|
|
List<InsAccidentalDrivingSubDajia> insAccidentalDrivingSubDajias,
|
|
|
- DaJiaConfigureParameters daJiaConfigureParameters,
|
|
|
- boolean isEnergy) throws Exception {
|
|
|
+ DaJiaConfigureParameters daJiaConfigureParameters, boolean isEnergy) throws Exception {
|
|
|
|
|
|
ODR1009Request odr1009Request = new ODR1009Request(orderNo, kindInfoVos, riskInfoVos, quoteInfoVo, odr1016Response,
|
|
|
insAccidentalDrivingDajia, insAccidentalDrivingSubDajias, daJiaConfigureParameters, isEnergy);
|
|
|
@@ -343,31 +343,29 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
for (RiskInfoVo riskInfoVo : riskInfoVos) {
|
|
|
if (riskInfoVo.getRiskCode().equals(InsuranceRisk.TRAFFIC.getCode()) && !jqAppStatusMessage.isEmpty()) {
|
|
|
String jqEndDate = getTheExpiryDate(jqAppStatusMessage, THE_FIRST_REGEX);
|
|
|
- List<String> duplicateDate = getDuplicateDate(riskInfoVo.getStartDate(), riskInfoVo.getEndDate(), jqEndDate);
|
|
|
+ List<String> duplicateDate = getDuplicateDate(jqEndDate);
|
|
|
riskInfoVo.setStartDate(duplicateDate.get(0));
|
|
|
riskInfoVo.setEndDate(duplicateDate.get(1));
|
|
|
}
|
|
|
//商业重复投保
|
|
|
if (riskInfoVo.getRiskCode().equals(InsuranceRisk.BUSINESS.getCode()) && !syAppStatusMessage.isEmpty()) {
|
|
|
String syEndDate = getTheExpiryDate(syAppStatusMessage, THE_SECOND_REGEX);
|
|
|
- List<String> duplicateDate = getDuplicateDate(riskInfoVo.getStartDate(), riskInfoVo.getEndDate(), syEndDate);
|
|
|
+ List<String> duplicateDate = getDuplicateDate(syEndDate);
|
|
|
riskInfoVo.setStartDate(duplicateDate.get(0));
|
|
|
riskInfoVo.setEndDate(duplicateDate.get(1));
|
|
|
}
|
|
|
}
|
|
|
- return quotation(orderNo, kindInfoVos, riskInfoVos, quoteInfoVo, odr1016Response,
|
|
|
- insAccidentalDrivingDajia, insAccidentalDrivingSubDajias, daJiaConfigureParameters, isEnergy);
|
|
|
+ return quotation(orderNo, kindInfoVos, riskInfoVos, quoteInfoVo, odr1016Response, insAccidentalDrivingDajia,
|
|
|
+ insAccidentalDrivingSubDajias, daJiaConfigureParameters, isEnergy);
|
|
|
}
|
|
|
}
|
|
|
return odr1009Response;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public HttpResult<QuoteRespVo> responseOrder(ODR1009Response odr1009Response,
|
|
|
- QuoteRespVo quoteRespVo,
|
|
|
+ public HttpResult<QuoteRespVo> responseOrder(ODR1009Response odr1009Response, QuoteRespVo quoteRespVo,
|
|
|
PtlAgreementAttribution ptlAgreementAttribution, String orderId,
|
|
|
- BaseQuoteInfoVo quoteInfoVo, String busiId,
|
|
|
- NVHLODR1001Response nvhlodr1001Response) {
|
|
|
+ BaseQuoteInfoVo quoteInfoVo, String busiId, NVHLODR1001Response nvhlodr1001Response) {
|
|
|
// 保存订单信息
|
|
|
InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
|
|
|
// 协议id
|
|
|
@@ -439,8 +437,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public QuoteRespVo getQuoteRespVo(ODR1009Response odr1009Response,
|
|
|
- BaseQuoteInfoVo yaQuoteInfoVo,
|
|
|
+ public QuoteRespVo getQuoteRespVo(ODR1009Response odr1009Response, BaseQuoteInfoVo yaQuoteInfoVo,
|
|
|
NVHLODR1001Response nvhlodr1001Response) {
|
|
|
double jqPremium = 0;
|
|
|
double syPremium = 0;
|
|
|
@@ -573,8 +570,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
configureParametersComponents.toEntity(daJiaConfigureParameters, insAreaCompany.getAgreementId());
|
|
|
|
|
|
//1009返回数据
|
|
|
- ODR1009Response.ResultDTO resultDTO = JSONObject.parseObject(
|
|
|
- JSON.toJSONString(insAreaCompany.getReptxt()),
|
|
|
+ ODR1009Response.ResultDTO resultDTO = JSONObject.parseObject(JSON.toJSONString(insAreaCompany.getReptxt()),
|
|
|
ODR1009Response.ResultDTO.class);
|
|
|
|
|
|
//驾意险 返回数据
|
|
|
@@ -585,12 +581,8 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
}
|
|
|
|
|
|
//核保构造request
|
|
|
- ODR1010Request odr1010Request = new ODR1010Request(
|
|
|
- insAreaCompany.getInsOrderNo(),
|
|
|
- insAreaCompany.getReptxt().getString("busiId"),
|
|
|
- daJiaConfigureParameters,
|
|
|
- resultDTO,
|
|
|
- insOrders);
|
|
|
+ ODR1010Request odr1010Request = new ODR1010Request(insAreaCompany.getInsOrderNo(), insAreaCompany.getReptxt().getString(
|
|
|
+ "busiId"), daJiaConfigureParameters, resultDTO, insOrders);
|
|
|
ODR1010Response odr1010Response = daJiaRequestApiComponents.underwriting(odr1010Request);
|
|
|
if (odr1010Response.getStatus().equals(Message.M0000.getCode())) {
|
|
|
if ("0".equals(odr1010Response.getResult().getJqAppStatus()) || "0".equals(odr1010Response.getResult().getSyAppStatus())) {
|
|
|
@@ -921,8 +913,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
*/
|
|
|
@Override
|
|
|
public HttpResult<Object> accidentalDrivingList(AccidentalInsuranceQueryVo queryVo) {
|
|
|
- List<InsAccidentalDrivingDajia> list =
|
|
|
- insAccidentalDrivingDaJiaService.list();
|
|
|
+ List<InsAccidentalDrivingDajia> list = insAccidentalDrivingDaJiaService.list();
|
|
|
|
|
|
return HttpResult.ok("获取驾意险列表成功", list);
|
|
|
}
|