|
|
@@ -7,6 +7,8 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.ydtech.config.properties.PingAnApiConfigurationProperties;
|
|
|
+import com.ydtech.constants.enums.InsuranceOrderPdf;
|
|
|
+import com.ydtech.constants.enums.InsuranceRisk;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
@@ -16,10 +18,7 @@ import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
|
import com.ydtech.modules.order.components.pingan.PinganRequestApiComponents;
|
|
|
import com.ydtech.modules.order.constants.UnderwritingStatus;
|
|
|
import com.ydtech.modules.order.dao.InsTaskImagesMapper;
|
|
|
-import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
-import com.ydtech.modules.order.entity.InsDrivingIntentionInsuranceSon;
|
|
|
-import com.ydtech.modules.order.entity.InsOrders;
|
|
|
-import com.ydtech.modules.order.entity.TaxArrears;
|
|
|
+import com.ydtech.modules.order.entity.*;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.constants.accept.AcceptResponseStatusCodeEnum;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.constants.dict.document.PingAnDocumentClassEnum;
|
|
|
import com.ydtech.modules.order.entity.api.pingan.constants.index.IndexResposeCodeEnum;
|
|
|
@@ -39,12 +38,14 @@ import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
|
|
|
import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
|
|
|
import com.ydtech.modules.order.entity.dto.InsTaskImagesDto;
|
|
|
import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
|
|
|
+import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
|
|
|
import com.ydtech.modules.order.entity.po.InsTaskImages;
|
|
|
import com.ydtech.modules.order.entity.po.InsUploadFiles;
|
|
|
import com.ydtech.modules.order.entity.po.PinganRecord;
|
|
|
import com.ydtech.modules.order.entity.po.PinganShUploafile;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
|
|
|
+import com.ydtech.modules.order.entity.vo.PolicyPrintVo;
|
|
|
import com.ydtech.modules.order.entity.vo.SpecialAuditVo;
|
|
|
import com.ydtech.modules.order.entity.vo.bohai.ProductDetailsQueryVo;
|
|
|
import com.ydtech.modules.order.entity.vo.pingan.*;
|
|
|
@@ -123,6 +124,14 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
|
|
|
|
|
|
private final InsSubOrderUpdateDetailService insSubOrderUpdateDetailService;
|
|
|
+
|
|
|
+
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String showFileUrl;
|
|
|
+
|
|
|
+ @Value("${api.url}")
|
|
|
+ private String apiUrl;
|
|
|
+
|
|
|
/**
|
|
|
* @Description 获取财意险险种套餐列表 调用 4.4
|
|
|
* @Author hxl
|
|
|
@@ -2520,6 +2529,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
return HttpResult.ok("需要补传资料!!");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
@@ -2610,4 +2621,102 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/10/21 15:59
|
|
|
+ * @Description: 统一处理保单路径
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ReadPdfUrlListDto getPolicyByCompanyIdPdfList(InsAreaCompany insAreaCompany, InsOrders insOrders, boolean flag) {
|
|
|
+ String jqPath = getPdfUrl(insAreaCompany, insOrders, InsuranceRisk.TRAFFIC_CODE, PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getJqpolicyno(),flag);
|
|
|
+ String jqSignPath = getPdfUrl(insAreaCompany, insOrders,InsuranceRisk.TRAFFIC_CODE,PolicyPrintVo.PolicyPrintType.PPT_1.getCode(),insAreaCompany.getJqpolicyno(),flag);
|
|
|
+ String syPath = getPdfUrl(insAreaCompany, insOrders,InsuranceRisk.BUSINESS_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getSypolicyno(),flag);
|
|
|
+ String jyPath = getPdfUrl(insAreaCompany, insOrders,InsuranceRisk.ACCIDENT_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getJyPolicyNo(),flag);
|
|
|
+ InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy =new InsAreaCompanyExternalPolicy(insAreaCompany.getId(),jqPath,syPath,jyPath,jqSignPath);
|
|
|
+ return new ReadPdfUrlListDto(insAreaCompanyExternalPolicy,insAreaCompany,null);
|
|
|
+ }
|
|
|
+ public String getPdfUrl(InsAreaCompany insAreaCompany, InsOrders insOrders,String jqFlag,String jqSignFlag,String policyNo,boolean flag) {
|
|
|
+ String path=null;
|
|
|
+ //文件前缀
|
|
|
+ String pathPrefix = insAreaCompany.getInscompany()+"-"+insAreaCompany.getId()+"-"+insOrders.getLicenseno() +"-"+policyNo+"-";
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(policyNo)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ // 账号信息
|
|
|
+ PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
+ // 通过 协议id获取配置实体
|
|
|
+ PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
|
|
|
+ ptlAgreementAttribution);
|
|
|
+ //车主信息
|
|
|
+ CustomerInfoVo ownerInfo = insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
|
|
|
+ CarInfoVo carInfoVo = insOrders.getCarinfo().toJavaObject(CarInfoVo.class);
|
|
|
+ PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(), insAreaCompany.getId(), insAreaCompany.getAgreementId());
|
|
|
+
|
|
|
+ String jyFlag ="";
|
|
|
+ String templateName ="";
|
|
|
+ //交强险
|
|
|
+ if (InsuranceRisk.TRAFFIC.getCode().equals(jqFlag)) {
|
|
|
+ if (PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(jqSignFlag)) {
|
|
|
+ templateName = pathPrefix+ InsuranceOrderPdf.JQBZ.getDesc();
|
|
|
+ } else {
|
|
|
+ templateName = pathPrefix+ InsuranceOrderPdf.JQBD.getDesc();
|
|
|
+ }
|
|
|
+ } else if (InsuranceRisk.BUSINESS.getCode().equals(jqFlag)) {
|
|
|
+ //商业险
|
|
|
+ templateName = pathPrefix+ InsuranceOrderPdf.SYBD.getDesc();
|
|
|
+ } else if (InsuranceRisk.ACCIDENT.getCode().equals(jqFlag)) {
|
|
|
+ //驾意险
|
|
|
+ templateName = pathPrefix+ InsuranceOrderPdf.JYBD.getDesc();
|
|
|
+ jyFlag ="true";
|
|
|
+ }
|
|
|
+ String decipher = templateName.replaceAll(".pdf","")+"-decipher.pdf";
|
|
|
+ String dir = "carInsPolicyNew/" + insAreaCompany.getId() + "/";
|
|
|
+ PolicyPdfRequest policyPdfRequest = new PolicyPdfRequest(parameters.getUserId(), policyNo, ownerInfo.getIdentifyNumber(), carInfoVo.getLicenseNo(), carInfoVo.getFrameNo(),jyFlag);
|
|
|
+ PolicyPdfResponse policyPdfResponse = null;
|
|
|
+ try {
|
|
|
+ policyPdfResponse = pinganRequestApiComponents.getPolicyPdf(policyPdfRequest, pinganApiLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
+ }
|
|
|
+ if (policyPdfResponse != null) {
|
|
|
+ if (PolicyPdfResponseCodeEnum.POLICY_PDF_CODE_MSG_0.getCode().equals(policyPdfResponse.getResultCode())) {
|
|
|
+ String policyPdfBase64Str = policyPdfResponse.getPolicyPdf();
|
|
|
+ String flagPdf = policyPdfResponse.getFlagPdf();
|
|
|
+ String jqbdPath = pathPrefix+decipher;
|
|
|
+ String jqBzTargertPath = uploadPath + dir + jqbdPath;
|
|
|
+ File existFile = new File(jqBzTargertPath);
|
|
|
+ String showPath = apiUrl+ showFileUrl+ dir+jqbdPath;
|
|
|
+ if (existFile.exists()) {
|
|
|
+ if(!flag){
|
|
|
+ path=showPath;
|
|
|
+ }else{
|
|
|
+ //刪除重新生成
|
|
|
+ existFile.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保单
|
|
|
+ if(policyPdfBase64Str!=null && PolicyPrintVo.PolicyPrintType.PPT_2.getCode().equals(jqSignFlag)) {
|
|
|
+ try {
|
|
|
+ PDFUtil.decryptFileByPassword(policyPdfBase64Str, jqBzTargertPath, properties.getPingAnPublicKey());
|
|
|
+ } catch (Exception e) {
|
|
|
+ path = null;
|
|
|
+ }
|
|
|
+ path=showPath;
|
|
|
+ }
|
|
|
+ //标志
|
|
|
+ if(flagPdf!=null && PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(jqSignFlag)) {
|
|
|
+ try {
|
|
|
+ PDFUtil.decryptFileByPassword(policyPdfBase64Str, jqBzTargertPath, properties.getPingAnPublicKey());
|
|
|
+ } catch (Exception e) {
|
|
|
+ path = null;
|
|
|
+ }
|
|
|
+ path=showPath;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return path;
|
|
|
+ }
|
|
|
+
|
|
|
}
|