|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.ydtech.config.properties.PingAnApiConfigurationProperties;
|
|
|
@@ -54,6 +55,7 @@ import com.ydtech.utils.CalculateUtils;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
@@ -94,7 +96,12 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
|
|
|
private final InsTaskImagesMapper insTaskImagesMapper;
|
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadPath;
|
|
|
|
|
|
+ private String EXCEL_PATH = "excel//";
|
|
|
+
|
|
|
+ private String UPLOAD_PATH = "/upload//excel//";
|
|
|
/**
|
|
|
* @Description 获取财意险险种套餐列表 调用 4.4
|
|
|
* @Author hxl
|
|
|
@@ -205,6 +212,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
|
|
|
//验证参数
|
|
|
checkData(quoteVo);
|
|
|
+ //补充身份证信息
|
|
|
+ quoteInfo = getQuoteInfoData(quoteInfo);
|
|
|
// 车型查询
|
|
|
CarInfoVo carInfo = quoteInfo.getCarInfo();
|
|
|
PinganApiLog pinganApiLog = new PinganApiLog(quoteVo.getOrderNo(),null,quoteVo.getAgreementId());
|
|
|
@@ -239,13 +248,31 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
SearchPAVehicleListResponse.ModelsDto model = new SearchPAVehicleListResponse.ModelsDto();
|
|
|
if (models != null && models.size() == 1) {
|
|
|
model = models.get(0);
|
|
|
- //通过年款和新车购置价确定唯一
|
|
|
} else if (models != null && models.size() > 1) {
|
|
|
- String modelNames="";
|
|
|
- for(SearchPAVehicleListResponse.ModelsDto dto: models){
|
|
|
- modelNames += dto.getModelName()+"||----------------------||";
|
|
|
+ //通过年款和新车购置价确定唯一
|
|
|
+ String purchasePrice = carInfo.getPurchasePrice();
|
|
|
+ String caryear = carInfo.getPurchasePrice();
|
|
|
+ Iterator<SearchPAVehicleListResponse.ModelsDto> it = models.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ SearchPAVehicleListResponse.ModelsDto x = it.next();
|
|
|
+ if(!purchasePrice.equals(x.getPrice())){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(caryear) && models.size()>1){
|
|
|
+ Iterator<SearchPAVehicleListResponse.ModelsDto> itNew = models.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ SearchPAVehicleListResponse.ModelsDto x = itNew.next();
|
|
|
+ if(!caryear.contains(x.getMarketDate())){
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(models.size()>1){
|
|
|
+ throw new SystemException("请确认车型,检索出多个下车型,请填写正确信息");
|
|
|
+ }else{
|
|
|
+ model = models.get(0);
|
|
|
}
|
|
|
- throw new SystemException("请确认车型,检索出以下车型||----------------------||"+modelNames);
|
|
|
}
|
|
|
// 3. 车辆信息确认
|
|
|
pinganApiLog.setId(null);
|
|
|
@@ -283,6 +310,34 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/9 10:29
|
|
|
+ * @Description: 补充信息
|
|
|
+ */
|
|
|
+ private static BaseQuoteInfoVo getQuoteInfoData(BaseQuoteInfoVo quoteInfo) {
|
|
|
+ // 车主
|
|
|
+ CustomerInfoVo ownerInfo = quoteInfo.getOwnerInfo();
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(ownerInfo.getIdentifyType())){
|
|
|
+ ownerInfo.setIdentifyType("01");
|
|
|
+ quoteInfo.setOwnerInfo(ownerInfo);
|
|
|
+ }
|
|
|
+ // 投保人信息
|
|
|
+ CustomerInfoVo policyHolderInfo = quoteInfo.getPolicyHolderInfo();
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(policyHolderInfo.getIdentifyType())){
|
|
|
+ policyHolderInfo.setIdentifyType("01");
|
|
|
+ quoteInfo.setPolicyHolderInfo(policyHolderInfo);
|
|
|
+ }
|
|
|
+ // 被保人信息
|
|
|
+ CustomerInfoVo insuredPersonInfo = quoteInfo.getInsuredPersonInfo();
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(insuredPersonInfo.getIdentifyType())){
|
|
|
+ insuredPersonInfo.setIdentifyType("01");
|
|
|
+ quoteInfo.setInsuredPersonInfo(insuredPersonInfo);
|
|
|
+ }
|
|
|
+ return quoteInfo;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
@@ -291,6 +346,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
*/
|
|
|
private static void checkData(PingAnQuoteVo<Map<String, Object>> quoteVo) {
|
|
|
String agreementId = quoteVo.getAgreementId();
|
|
|
+
|
|
|
if(StringUtils.isBlank(agreementId)){
|
|
|
throw new SystemException("未选择协议不能报价");
|
|
|
}
|
|
|
@@ -689,43 +745,138 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
CustomerInfoVo ownerInfo = insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
|
|
|
CarInfoVo carInfoVo = insOrders.getCarinfo().toJavaObject(CarInfoVo.class);
|
|
|
PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),subOrderNo,insAreaCompany.getAgreementId());
|
|
|
+ //交强保单号
|
|
|
String jqpolicyno = insAreaCompany.getJqpolicyno();
|
|
|
- //调用 电子保单pdf 001
|
|
|
- PolicyPdfRequest policyPdfRequest = new PolicyPdfRequest(parameters.getUserId(), jqpolicyno, ownerInfo.getIdentifyNumber(), carInfoVo.getLicenseNo(), carInfoVo.getFrameNo());
|
|
|
+ //商业保单号
|
|
|
+ String sypolicyno = insAreaCompany.getSypolicyno();
|
|
|
+ JSONArray crossInsurance = insAreaCompany.getCrossInsurance();
|
|
|
+ //非车保单号
|
|
|
+ String application = null;
|
|
|
+ if(crossInsurance!=null && crossInsurance.size() > 0) {
|
|
|
+ application = crossInsurance.getJSONObject(0).getString("application");
|
|
|
+ }
|
|
|
+ CrawlerPolicyPrintVo crawlerPolicyPrintVo =new CrawlerPolicyPrintVo();
|
|
|
+ //交强
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(jqpolicyno) ){
|
|
|
+ String fileName="_交强险保单";
|
|
|
+ String fileBZName="-交强险标志";
|
|
|
+ String jqbdUrl= uploadPath+"//" + EXCEL_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ jqpolicyno+fileName+"-decipher.pdf";
|
|
|
+ String jqbzUrl= uploadPath+"//" + EXCEL_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ jqpolicyno+fileBZName+"-decipher.pdf";
|
|
|
+ String jqbdUrl_= UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ jqpolicyno+fileName+"-decipher.pdf";
|
|
|
+ String jqbzUrl_= UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ jqpolicyno+fileBZName+"-decipher.pdf";
|
|
|
+ File jqbdURL = new File(jqbdUrl);
|
|
|
+ File jqbzURL = new File(jqbzUrl);
|
|
|
+ if(jqbdURL.exists()){
|
|
|
+ crawlerPolicyPrintVo.setJqxPolicyUrl(jqbdUrl_);
|
|
|
+ }
|
|
|
+ if(jqbzURL.exists()){
|
|
|
+ crawlerPolicyPrintVo.setJqxFlagUrl(jqbzUrl_);
|
|
|
+ }
|
|
|
+ if(!jqbdURL.exists() && !jqbzURL.exists() ){
|
|
|
+ getPdfUrl(parameters, jqpolicyno,ownerInfo,carInfoVo, pinganApiLog, insAreaCompany, crawlerPolicyPrintVo,1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(sypolicyno)){
|
|
|
+ String fileName="_商业险保单";
|
|
|
+ String sybdUrl= uploadPath+"//" + EXCEL_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ sypolicyno+fileName+"-decipher.pdf";
|
|
|
+ String sybdUrl_= UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ sypolicyno+fileName+"-decipher.pdf";
|
|
|
+ File sybdURL = new File(sybdUrl);
|
|
|
+ if(sybdURL.exists()){
|
|
|
+ crawlerPolicyPrintVo.setSyxPolicyUrl(sybdUrl_);
|
|
|
+ }
|
|
|
+ if(!sybdURL.exists()) {
|
|
|
+ getPdfUrl(parameters, sypolicyno, ownerInfo, carInfoVo, pinganApiLog, insAreaCompany, crawlerPolicyPrintVo, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(application)){
|
|
|
+ String fileName="_非车险保单";
|
|
|
+ String fcxbdUrl= uploadPath+"//" + EXCEL_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ application+fileName+"-decipher.pdf";
|
|
|
+ String fcxbdUrl_= UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ application+fileName+"-decipher.pdf";
|
|
|
+ File fcxbdURL = new File(fcxbdUrl);
|
|
|
+ if(fcxbdURL.exists()){
|
|
|
+ List<CrawlerPolicyPrintVo.JyxInfoListDTO> jyxInfoListDTOS = new ArrayList<>();
|
|
|
+ CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
|
|
|
+ jyxInfoListDTO.setJyxPolicyUrl(fcxbdUrl_);
|
|
|
+ jyxInfoListDTOS.add(jyxInfoListDTO);
|
|
|
+ crawlerPolicyPrintVo.setJyxInfoList(jyxInfoListDTOS);
|
|
|
+ }
|
|
|
+ if(!fcxbdURL.exists()) {
|
|
|
+ getPdfUrl(parameters, application,ownerInfo,carInfoVo, pinganApiLog, insAreaCompany, crawlerPolicyPrintVo,3);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return HttpResult.ok(crawlerPolicyPrintVo);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/9 15:07
|
|
|
+ * @Description: 获取保单地址
|
|
|
+ */
|
|
|
+ private void getPdfUrl(PingAnConfigureParameters parameters, String policyno, CustomerInfoVo ownerInfo, CarInfoVo carInfoVo, PinganApiLog pinganApiLog, InsAreaCompany insAreaCompany, CrawlerPolicyPrintVo crawlerPolicyPrintVo,int type) {
|
|
|
+ pinganApiLog.setId(null);
|
|
|
+ String flag ="false";
|
|
|
+ String fileName="";
|
|
|
+ String fileBZName="";
|
|
|
+ //驾意险
|
|
|
+ if(type==3){
|
|
|
+ flag="true";
|
|
|
+ fileName="_非车险保单";
|
|
|
+ }else if(type==1){
|
|
|
+ //交强
|
|
|
+ fileName="_交强险保单";
|
|
|
+ fileBZName="-交强险标志";
|
|
|
+ }else if(type==2){
|
|
|
+ //商业
|
|
|
+ fileName="_商业险保单";
|
|
|
+ }
|
|
|
+ PolicyPdfRequest policyPdfRequest = new PolicyPdfRequest(parameters.getUserId(), policyno, ownerInfo.getIdentifyNumber(), carInfoVo.getLicenseNo(), carInfoVo.getFrameNo(),flag);
|
|
|
PolicyPdfResponse policyPdfResponse = null;
|
|
|
try {
|
|
|
- policyPdfResponse = pinganRequestApiComponents.getPolicyPdf(policyPdfRequest,pinganApiLog);
|
|
|
+ policyPdfResponse = pinganRequestApiComponents.getPolicyPdf(policyPdfRequest, pinganApiLog);
|
|
|
} catch (Exception e) {
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
+ String saveFilePath = uploadPath+"//" + EXCEL_PATH;
|
|
|
+ String jqbdPath = "";
|
|
|
+ String jqbzPath = "";
|
|
|
if (policyPdfResponse != null) {
|
|
|
if (PolicyPdfResponseCodeEnum.POLICY_PDF_CODE_MSG_0.getCode().equals(policyPdfResponse.getResultCode())) {
|
|
|
- CrawlerPolicyPrintVo crawlerPolicyPrintVo = new CrawlerPolicyPrintVo();
|
|
|
String policyPdfBase64Str = policyPdfResponse.getPolicyPdf();
|
|
|
- //存储系统临时文件
|
|
|
- // 获取当前项目的目录
|
|
|
- File projectFile =new File(System.getProperty("user.dir"));
|
|
|
- // 获取上级目录
|
|
|
- String parentPath = projectFile.getParent();
|
|
|
- StringBuffer filePath = new StringBuffer();
|
|
|
- filePath.append(parentPath).append(jqpolicyno).append(File.separator).append(System.currentTimeMillis()).append(".pdf");
|
|
|
- String targertPath = filePath.toString();
|
|
|
- try {
|
|
|
- PDFUtil.decryptFileByPassword(policyPdfBase64Str, targertPath, properties.getPingAnPublicKey());
|
|
|
- if (Boolean.parseBoolean(policyPdfResponse.getPolicyPdf())) {
|
|
|
- crawlerPolicyPrintVo.setJqxPolicyUrl(targertPath);
|
|
|
- } else {
|
|
|
- crawlerPolicyPrintVo.setSyxPolicyUrl(targertPath);
|
|
|
+ String flagPdf = policyPdfResponse.getFlagPdf();
|
|
|
+ String yqbdFileName = insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ policyno+fileName+".pdf";
|
|
|
+ jqbdPath = UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ policyno+fileName+"-decipher.pdf";;
|
|
|
+ if(type==1){
|
|
|
+ String yqbzFileName = insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ policyno+fileBZName+".pdf";
|
|
|
+ jqbzPath = UPLOAD_PATH + insAreaCompany.getOrderno()+"-"+ insAreaCompany.getId()+"-"+ policyno+fileBZName+"-decipher.pdf";;
|
|
|
+ String jqBzTargertPath = saveFilePath+yqbzFileName;
|
|
|
+ try {
|
|
|
+ PDFUtil.decryptFileByPassword(flagPdf, jqBzTargertPath, properties.getPingAnPublicKey());
|
|
|
+ } catch (Exception e) {
|
|
|
+ jqbzPath=null;
|
|
|
}
|
|
|
- return HttpResult.ok(crawlerPolicyPrintVo);
|
|
|
+ crawlerPolicyPrintVo.setJqxFlagUrl(jqbzPath);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String jqBdTargertPath = saveFilePath+yqbdFileName;
|
|
|
+ PDFUtil.decryptFileByPassword(policyPdfBase64Str, jqBdTargertPath, properties.getPingAnPublicKey());
|
|
|
} catch (Exception e) {
|
|
|
- return HttpResult.error("文件解密失败!!!");
|
|
|
+ jqbdPath=null;
|
|
|
+ }
|
|
|
+ if(type==1){
|
|
|
+ crawlerPolicyPrintVo.setJqxPolicyUrl(jqbdPath);
|
|
|
+ }else if(type==2){
|
|
|
+ crawlerPolicyPrintVo.setSyxPolicyUrl(jqbdPath);
|
|
|
+ }else if(type==3){
|
|
|
+ List<CrawlerPolicyPrintVo.JyxInfoListDTO> jyxInfoListDTOS = new ArrayList<>();
|
|
|
+ CrawlerPolicyPrintVo.JyxInfoListDTO jyxInfoListDTO = new CrawlerPolicyPrintVo.JyxInfoListDTO();
|
|
|
+ jyxInfoListDTO.setJyxPolicyUrl(jqbdPath);
|
|
|
+ jyxInfoListDTOS.add(jyxInfoListDTO);
|
|
|
+ crawlerPolicyPrintVo.setJyxInfoList(jyxInfoListDTOS);
|
|
|
}
|
|
|
- } else {
|
|
|
- return HttpResult.error(PinAnEnumUtils.getEnumValueByCode(PolicyPdfResponseCodeEnum.class, policyPdfResponse.getResultCode()));
|
|
|
}
|
|
|
}
|
|
|
- return HttpResult.error("获取保单地址失败");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -860,7 +1011,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
} else {
|
|
|
return HttpResult.error("二维码支付接口报错");
|
|
|
}
|
|
|
- insAreaCompany.setPaymentLink(payUrl);
|
|
|
+ insAreaCompany.setNoticeNo(noticeNo);
|
|
|
insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
}
|
|
|
}
|
|
|
@@ -1357,6 +1508,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
noticeNo = noticeDoResponse.getNoticeNo();
|
|
|
+ insAreaCompany.setNoticeNo(noticeNo);
|
|
|
+ insAreaCompanyService.updateById(insAreaCompany);
|
|
|
}
|
|
|
|
|
|
// 获取支付的链接 只支持通知单号类型07 单证类型(01投保单02保单03批改申请单04批单05赔案号06报案号07通知单号)
|