|
@@ -40,8 +40,10 @@ import com.ydtech.modules.order.service.ZijinOrderApiService;
|
|
|
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.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+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;
|
|
|
|
|
|
|
@@ -67,6 +69,14 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
|
|
|
|
|
|
|
|
private final ConfigureParametersComponents configureParametersComponents;
|
|
private final ConfigureParametersComponents configureParametersComponents;
|
|
|
|
|
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.url}")
|
|
|
|
|
+ private String showFileUrl;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${api.url}")
|
|
|
|
|
+ private String apiUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|
public ZijinOrderApiServiceImpl(ZijinRequestApiComponents zijinRequestApiComponents, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsTaskImagesService insTaskImagesService, PtlAgreementAttributionService ptlAgreementAttributionService, ConfigureParametersComponents configureParametersComponents) {
|
|
public ZijinOrderApiServiceImpl(ZijinRequestApiComponents zijinRequestApiComponents, InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsTaskImagesService insTaskImagesService, PtlAgreementAttributionService ptlAgreementAttributionService, ConfigureParametersComponents configureParametersComponents) {
|
|
@@ -229,31 +239,37 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
|
|
|
if (!InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())) {
|
|
if (!InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())) {
|
|
|
throw new SystemException("此订单还未承包");
|
|
throw new SystemException("此订单还未承包");
|
|
|
}
|
|
}
|
|
|
- InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
|
|
|
|
|
|
|
- // 车主信息
|
|
|
|
|
- JSONObject ownerInfo = insOrders.getOwnerinfo();
|
|
|
|
|
|
|
+ InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
|
|
+ // 车牌号
|
|
|
|
|
+ String licensePlate = insOrders.getLicenseno();
|
|
|
|
|
+ // 被保人信息
|
|
|
|
|
+ JSONObject ownerInfo = insOrders.getInsureinfo();
|
|
|
CustomerInfoVo customerInfoVo = ownerInfo.toJavaObject(CustomerInfoVo.class);
|
|
CustomerInfoVo customerInfoVo = ownerInfo.toJavaObject(CustomerInfoVo.class);
|
|
|
String busNo;
|
|
String busNo;
|
|
|
BusType busType;
|
|
BusType busType;
|
|
|
String identifyNo = customerInfoVo.getIdentifyNumber();
|
|
String identifyNo = customerInfoVo.getIdentifyNumber();
|
|
|
-
|
|
|
|
|
|
|
+ String templateName = "";
|
|
|
switch (policyPrintVo.getRiskCode()) {
|
|
switch (policyPrintVo.getRiskCode()) {
|
|
|
case InsuranceRisk.TRAFFIC_CODE:
|
|
case InsuranceRisk.TRAFFIC_CODE:
|
|
|
busNo = insAreaCompany.getJqpolicyno();
|
|
busNo = insAreaCompany.getJqpolicyno();
|
|
|
if (PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(policyPrintVo.getType())) {
|
|
if (PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(policyPrintVo.getType())) {
|
|
|
busType = BusType.BT_2;
|
|
busType = BusType.BT_2;
|
|
|
|
|
+ templateName = "-交强险标志.pdf";
|
|
|
} else {
|
|
} else {
|
|
|
busType = BusType.BT_1;
|
|
busType = BusType.BT_1;
|
|
|
|
|
+ templateName = "-交强险保单.pdf";
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case InsuranceRisk.BUSINESS_CODE:
|
|
case InsuranceRisk.BUSINESS_CODE:
|
|
|
busNo = insAreaCompany.getSypolicyno();
|
|
busNo = insAreaCompany.getSypolicyno();
|
|
|
busType = BusType.BT_3;
|
|
busType = BusType.BT_3;
|
|
|
|
|
+ templateName = "-商业险保单.pdf";
|
|
|
break;
|
|
break;
|
|
|
case InsuranceRisk.ACCIDENT_CODE:
|
|
case InsuranceRisk.ACCIDENT_CODE:
|
|
|
busNo = policyPrintVo.getPolicyNumber();
|
|
busNo = policyPrintVo.getPolicyNumber();
|
|
|
busType = BusType.BT_4;
|
|
busType = BusType.BT_4;
|
|
|
|
|
+ templateName = busNo + "-非车险保单.pdf";
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
throw new SystemException("保险编号异常");
|
|
throw new SystemException("保险编号异常");
|
|
@@ -261,9 +277,14 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
|
|
|
|
|
|
|
|
String code = busType.getCode();
|
|
String code = busType.getCode();
|
|
|
String url = zijinRequestApiComponents.getDownLoadDocumentUrl(busNo, code, identifyNo);
|
|
String url = zijinRequestApiComponents.getDownLoadDocumentUrl(busNo, code, identifyNo);
|
|
|
- return HttpResult.ok("生成成功", url);
|
|
|
|
|
|
|
+ String transferUrl = gainCarInsPolicy(url, licensePlate + templateName, licensePlate);
|
|
|
|
|
+ return HttpResult.ok("生成成功", transferUrl);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
|
|
|
+ String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
|
|
+ return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public HttpResult<Object> getOrderDetail(String companyId) {
|
|
public HttpResult<Object> getOrderDetail(String companyId) {
|