|
@@ -41,6 +41,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -111,7 +112,7 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
/** 4. 报价 */
|
|
/** 4. 报价 */
|
|
|
PersonAreaVo personAreaVo = new PersonAreaVo();
|
|
PersonAreaVo personAreaVo = new PersonAreaVo();
|
|
|
buildRegion(quoteInfoVo,personAreaVo);
|
|
buildRegion(quoteInfoVo,personAreaVo);
|
|
|
- InsurePremiumRequest insurePremiumRequest = new InsurePremiumRequest(quoteInfoVo,carModelListDTO, carActualValueResponse,personAreaVo,parameters,quoteVo);
|
|
|
|
|
|
|
+ InsurePremiumRequest insurePremiumRequest = new InsurePremiumRequest(quoteInfoVo,carModelListDTO, carActualValueResponse,personAreaVo,parameters,quoteVo, carModelListDTO);
|
|
|
InsurePremiumResponse insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
InsurePremiumResponse insurePremiumResponse = chengTaiRequestApiComponents.quoteApi(insurePremiumRequest,httpHeaders);
|
|
|
|
|
|
|
|
String message = "";
|
|
String message = "";
|
|
@@ -136,7 +137,7 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
// 警告信息
|
|
// 警告信息
|
|
|
CarInfoVo carInfo = quoteInfoVo.getCarInfo();
|
|
CarInfoVo carInfo = quoteInfoVo.getCarInfo();
|
|
|
boolean isEnergy = carInfo.isNewEnergy();
|
|
boolean isEnergy = carInfo.isNewEnergy();
|
|
|
- QuoteRespVo quoteRespVo = getQuoteRespVo(insurePremiumResponse, quoteInfoVo, isEnergy);
|
|
|
|
|
|
|
+ QuoteRespVo quoteRespVo = getQuoteRespVo(insurePremiumResponse, quoteInfoVo, isEnergy,quoteVo);
|
|
|
if (!StringUtils.isEmpty(message)) {
|
|
if (!StringUtils.isEmpty(message)) {
|
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
ArrayList<String> objects = new ArrayList<>();
|
|
|
objects.add(message);
|
|
objects.add(message);
|
|
@@ -167,10 +168,21 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ List<AccidentResponseVo> accident = quoteRespVo.getAccidentInfo();
|
|
|
|
|
+ List<InsAreaCompanyAccidentalDriving> insAreaCompanyAccidentalDrivings = new ArrayList<>();
|
|
|
|
|
+ accident.forEach(accidentalDriving -> {
|
|
|
|
|
+ InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = new InsAreaCompanyAccidentalDriving();
|
|
|
|
|
+ insAreaCompanyAccidentalDriving.setCompanyId(insAreaCompany.getCompanyId());
|
|
|
|
|
+ insAreaCompanyAccidentalDriving.setQuantity(Integer.parseInt(accidentalDriving.getQuantity()));
|
|
|
|
|
+ insAreaCompanyAccidentalDriving.setRideRiskCode(accidentalDriving.getProjectCode());
|
|
|
|
|
+ insAreaCompanyAccidentalDriving.setRideRiskName(accidentalDriving.getProjectName());
|
|
|
|
|
+ insAreaCompanyAccidentalDrivings.add(insAreaCompanyAccidentalDriving);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// 特约
|
|
// 特约
|
|
|
insAreaCompany.setJqappoint(quoteRespVo.getJqappoint());
|
|
insAreaCompany.setJqappoint(quoteRespVo.getJqappoint());
|
|
|
insAreaCompany.setSyappoint(quoteRespVo.getSyappoint());
|
|
insAreaCompany.setSyappoint(quoteRespVo.getSyappoint());
|
|
|
- insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, new ArrayList<>());
|
|
|
|
|
|
|
+ insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDrivings);
|
|
|
quoteRespVo.setCompanyId(insAreaCompany.getId());
|
|
quoteRespVo.setCompanyId(insAreaCompany.getId());
|
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
|
|
|
|
@@ -178,7 +190,7 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
|
|
|
|
|
private QuoteRespVo getQuoteRespVo(InsurePremiumResponse insurePremiumResponse,
|
|
private QuoteRespVo getQuoteRespVo(InsurePremiumResponse insurePremiumResponse,
|
|
|
BaseQuoteInfoVo quoteInfoVo,
|
|
BaseQuoteInfoVo quoteInfoVo,
|
|
|
- boolean isEnergy) {
|
|
|
|
|
|
|
+ boolean isEnergy, BaseQuoteVo<InsDrivingIntentionInsurance> quoteVo) {
|
|
|
Double jqPremium = 0D;
|
|
Double jqPremium = 0D;
|
|
|
Double syPremium = 0D;
|
|
Double syPremium = 0D;
|
|
|
Double sumPayTax = 0D;
|
|
Double sumPayTax = 0D;
|
|
@@ -202,7 +214,14 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
quoteRespVo.setEndDateSy(biContractMain.getExpiryDate());
|
|
quoteRespVo.setEndDateSy(biContractMain.getExpiryDate());
|
|
|
}
|
|
}
|
|
|
// 意外险
|
|
// 意外险
|
|
|
-
|
|
|
|
|
|
|
+ InsurePremiumResponse.AccContractDTO accContract = insurePremiumResponse.getAccContract();
|
|
|
|
|
+ if(Objects.nonNull(accContract)){
|
|
|
|
|
+ List<AccidentResponseVo> accidentResponseVos =
|
|
|
|
|
+ InsurePremiumResponse.AccContractDTO.toAccidentResponseVoList(accContract,quoteVo);
|
|
|
|
|
+ quoteRespVo.setAccident(accidentResponseVos);
|
|
|
|
|
+ // 驾意险价格
|
|
|
|
|
+ jyPremium = Double.parseDouble(accContract.getContractMain().getTotalPremium());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
|
List<RiskInfoVo> riskList = quoteInfoVo.getRiskList();
|
|
List<RiskInfoVo> riskList = quoteInfoVo.getRiskList();
|
|
@@ -249,9 +268,6 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
if(Objects.nonNull(insurePremiumResponse.getCiContract())){
|
|
if(Objects.nonNull(insurePremiumResponse.getCiContract())){
|
|
|
List<InsurePremiumResponse.CiContractDTO.EngageDTO> ciEngageDTOS = insurePremiumResponse.getCiContract().getEngage();
|
|
List<InsurePremiumResponse.CiContractDTO.EngageDTO> ciEngageDTOS = insurePremiumResponse.getCiContract().getEngage();
|
|
|
if(CollUtil.isNotEmpty(ciEngageDTOS)){
|
|
if(CollUtil.isNotEmpty(ciEngageDTOS)){
|
|
|
-// for (InsurePremiumResponse.CiContractDTO.EngageDTO ciEngageDTO : ciEngageDTOS) {
|
|
|
|
|
-// ciEngageDTO.set
|
|
|
|
|
-// }
|
|
|
|
|
quoteRespVo.setJqappoint(JSON.toJSONString(ciEngageDTOS));
|
|
quoteRespVo.setJqappoint(JSON.toJSONString(ciEngageDTOS));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -426,6 +442,16 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (RiskCodeEnum.R1116.getCode().equals(dataDTO.getRiskCode())) {
|
|
|
|
|
+ List<AccidentResponseVo> accidentResponseVos = insAreaCompany.getAccidentInfo().toJavaList(AccidentResponseVo.class);
|
|
|
|
|
+ if(CollUtil.isNotEmpty(accidentResponseVos)){
|
|
|
|
|
+ for (AccidentResponseVo accidentResponseVo : accidentResponseVos) {
|
|
|
|
|
+ accidentResponseVo.setPolicyNumber(dataDTO.getPolicyCode());
|
|
|
|
|
+ accidentResponseVo.setApplicationNumber(dataDTO.getInsCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(accidentResponseVos)));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
@@ -497,6 +523,16 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (RiskCodeEnum.R1116.getCode().equals(dataDTO.getRiskCode())) {
|
|
|
|
|
+ List<AccidentResponseVo> accidentResponseVos = insAreaCompany.getAccidentInfo().toJavaList(AccidentResponseVo.class);
|
|
|
|
|
+ if(CollUtil.isNotEmpty(accidentResponseVos)){
|
|
|
|
|
+ for (AccidentResponseVo accidentResponseVo : accidentResponseVos) {
|
|
|
|
|
+ accidentResponseVo.setPolicyNumber(dataDTO.getPolicyCode());
|
|
|
|
|
+ accidentResponseVo.setApplicationNumber(dataDTO.getInsCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(accidentResponseVos)));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -536,6 +572,16 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
insAreaCompany.setSypolicyno(dataDTO.getPolicyCode());
|
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
insAreaCompany.setSyapplyno(dataDTO.getInsCode());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (RiskCodeEnum.R1116.getCode().equals(dataDTO.getRiskCode())) {
|
|
|
|
|
+ List<AccidentResponseVo> accidentResponseVos = insAreaCompany.getAccidentInfo().toJavaList(AccidentResponseVo.class);
|
|
|
|
|
+ if(CollUtil.isNotEmpty(accidentResponseVos)){
|
|
|
|
|
+ for (AccidentResponseVo accidentResponseVo : accidentResponseVos) {
|
|
|
|
|
+ accidentResponseVo.setPolicyNumber(dataDTO.getPolicyCode());
|
|
|
|
|
+ accidentResponseVo.setApplicationNumber(dataDTO.getInsCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompany.setAccidentInfo(JSON.parseArray(JSON.toJSONString(accidentResponseVos)));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
@@ -686,5 +732,4 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
|
|
|
String dir = "carInsPolicy/" + licensePlate + "/";
|
|
String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|