|
@@ -41,8 +41,10 @@ import com.ydtech.modules.order.service.*;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.utils.CalculateUtils;
|
|
import com.ydtech.utils.CalculateUtils;
|
|
|
|
|
+import com.ydtech.utils.baidu.FileUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -73,6 +75,15 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
|
|
|
|
|
|
|
|
private final InsFeeOrderService insFeeOrderService;
|
|
private final InsFeeOrderService insFeeOrderService;
|
|
|
|
|
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.url}")
|
|
|
|
|
+ private String showFileUrl;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${api.url}")
|
|
|
|
|
+ private String apiUrl;
|
|
|
|
|
+
|
|
|
public ZhongMeiOrderApiServiceImpl(InsOrdersService insOrdersService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService,
|
|
public ZhongMeiOrderApiServiceImpl(InsOrdersService insOrdersService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService,
|
|
|
ZhongmeiRequestApiComponents zhongmeiRequestApiComponents, ZhongmeiRequestComponents zhongmeiRequestComponents,
|
|
ZhongmeiRequestApiComponents zhongmeiRequestApiComponents, ZhongmeiRequestComponents zhongmeiRequestComponents,
|
|
|
ConfigureParametersComponents configureParametersComponents, PtlAgreementAttributionService ptlAgreementAttributionService,
|
|
ConfigureParametersComponents configureParametersComponents, PtlAgreementAttributionService ptlAgreementAttributionService,
|
|
@@ -294,7 +305,8 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(policyPrintVo.getCompanyId());
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(policyPrintVo.getCompanyId());
|
|
|
// 1. 协议id获取配置实体
|
|
// 1. 协议id获取配置实体
|
|
|
ZmConfigureParameters zmConfigureParameters = configureParametersComponents.toEntity(ZmConfigureParameters.class, insAreaCompany.getAgreementId());
|
|
ZmConfigureParameters zmConfigureParameters = configureParametersComponents.toEntity(ZmConfigureParameters.class, insAreaCompany.getAgreementId());
|
|
|
-
|
|
|
|
|
|
|
+ InsOrders order = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
|
|
+ String licensePlate = order.getLicenseno();
|
|
|
String policyNo;
|
|
String policyNo;
|
|
|
String code = DocumentTypeEnum.code(policyPrintVo.getType());
|
|
String code = DocumentTypeEnum.code(policyPrintVo.getType());
|
|
|
String riskCode = policyPrintVo.getRiskCode();
|
|
String riskCode = policyPrintVo.getRiskCode();
|
|
@@ -313,9 +325,36 @@ public class ZhongMeiOrderApiServiceImpl implements ZhongMeiOrderApiService {
|
|
|
request.setDocumentType(code);
|
|
request.setDocumentType(code);
|
|
|
request.setHead(new BaseRequestHead(zmConfigureParameters));
|
|
request.setHead(new BaseRequestHead(zmConfigureParameters));
|
|
|
InsurancePolicyPrintResponse response = zhongmeiRequestApiComponents.insurancePolicyPrint(request, InsurancePolicyPrintResponse.class);
|
|
InsurancePolicyPrintResponse response = zhongmeiRequestApiComponents.insurancePolicyPrint(request, InsurancePolicyPrintResponse.class);
|
|
|
|
|
+ if("1".equals(response.getStatusCode())){
|
|
|
|
|
+ List<String> urlList = response.getDownloadUrl();
|
|
|
|
|
+
|
|
|
|
|
+ if(urlList!=null && urlList.size()>0){
|
|
|
|
|
+ String url = urlList.get(0);
|
|
|
|
|
+ String templateName = "";
|
|
|
|
|
+ if("DZ_AJ".equals(code)){
|
|
|
|
|
+ templateName = "-交强险标志.pdf";
|
|
|
|
|
+ }else if("DZ_AE".equals(code)){
|
|
|
|
|
+ if("0330".equals(request.getRiskCode())){
|
|
|
|
|
+ templateName = "-交强险保单.pdf";
|
|
|
|
|
+ }else {
|
|
|
|
|
+ templateName = "-商业险保单.pdf";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, licensePlate);
|
|
|
|
|
+ List<String> transferUrlList = new ArrayList<>();
|
|
|
|
|
+ transferUrlList.add(transferUrl);
|
|
|
|
|
+ response.setDownloadUrl(transferUrlList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return HttpResult.error("中煤电子保单生成失败,请重试或联系中煤!");
|
|
|
|
|
+ }
|
|
|
return HttpResult.ok("下载成功", response.getDownloadUrl());
|
|
return HttpResult.ok("下载成功", response.getDownloadUrl());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
|
|
|
+ String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
|
|
+ return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* @param orderNo 中煤订单号
|
|
* @param orderNo 中煤订单号
|
|
|
* @param frameNo 车架号
|
|
* @param frameNo 车架号
|