|
@@ -21,9 +21,11 @@ import com.ydtech.modules.order.entity.api.dajia.constants.CProdNo;
|
|
|
import com.ydtech.modules.order.entity.api.dajia.constants.Message;
|
|
import com.ydtech.modules.order.entity.api.dajia.constants.Message;
|
|
|
import com.ydtech.modules.order.entity.api.dajia.request.*;
|
|
import com.ydtech.modules.order.entity.api.dajia.request.*;
|
|
|
import com.ydtech.modules.order.entity.api.dajia.response.*;
|
|
import com.ydtech.modules.order.entity.api.dajia.response.*;
|
|
|
|
|
+import com.ydtech.modules.order.entity.api.zijin.constants.enums.BusType;
|
|
|
import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
|
|
import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.PolicyPrintVo;
|
|
|
import com.ydtech.modules.order.service.DaJiaOrderService;
|
|
import com.ydtech.modules.order.service.DaJiaOrderService;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
@@ -32,8 +34,10 @@ 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.modules.protocol.service.PtlAgreementService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
|
import com.ydtech.utils.CalculateUtils;
|
|
import com.ydtech.utils.CalculateUtils;
|
|
|
|
|
+import com.ydtech.utils.baidu.FileUtil;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -67,6 +71,15 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private InsTaskImagesService insTaskImagesService;
|
|
private InsTaskImagesService insTaskImagesService;
|
|
|
|
|
|
|
|
|
|
+ @Value("${upload.file.path}")
|
|
|
|
|
+ private String uploadFilePath;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${upload.file.url}")
|
|
|
|
|
+ private String showFileUrl;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${api.url}")
|
|
|
|
|
+ private String apiUrl;
|
|
|
|
|
+
|
|
|
//region 报价
|
|
//region 报价
|
|
|
/**
|
|
/**
|
|
|
* 获取OrderNo
|
|
* 获取OrderNo
|
|
@@ -438,32 +451,71 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取保单
|
|
* 获取保单
|
|
|
- * @param companyId
|
|
|
|
|
|
|
+ * @param policyPrintVo
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public HttpResult<Object> obtainWarranty(String companyId) {
|
|
|
|
|
|
|
+ public HttpResult<Object> obtainWarranty(PolicyPrintVo policyPrintVo) {
|
|
|
try {
|
|
try {
|
|
|
- InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|
|
|
|
|
ArrayList<String> warrantys = new ArrayList<String>();
|
|
ArrayList<String> warrantys = new ArrayList<String>();
|
|
|
- if (insAreaCompany.getJqpolicyno() != null) {
|
|
|
|
|
- warrantys.add(insAreaCompany.getJqpolicyno());
|
|
|
|
|
- }
|
|
|
|
|
- if (insAreaCompany.getSypolicyno() != null) {
|
|
|
|
|
- warrantys.add(insAreaCompany.getSypolicyno());
|
|
|
|
|
|
|
+ String templateName = "";
|
|
|
|
|
+ String url = "";
|
|
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(policyPrintVo.getCompanyId());
|
|
|
|
|
+ InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
|
|
+ // 被保人信息
|
|
|
|
|
+ JSONObject ownerInfo = insOrders.getInsureinfo();
|
|
|
|
|
+ CustomerInfoVo customerInfoVo = ownerInfo.toJavaObject(CustomerInfoVo.class);
|
|
|
|
|
+ String identifyNo = customerInfoVo.getIdentifyNumber();
|
|
|
|
|
+ //交强险
|
|
|
|
|
+ if(policyPrintVo.getRiskCode().equals(InsuranceRisk.TRAFFIC.getCode())){
|
|
|
|
|
+ if (insAreaCompany.getJqpolicyno() != null) {
|
|
|
|
|
+ warrantys.add(insAreaCompany.getJqpolicyno());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(policyPrintVo.getType())) {
|
|
|
|
|
+ templateName = "-交强险标志.pdf";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ templateName = "-交强险保单.pdf";
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(policyPrintVo.getRiskCode().equals(InsuranceRisk.BUSINESS.getCode())) {
|
|
|
|
|
+ //商业险
|
|
|
|
|
+ if (insAreaCompany.getSypolicyno() != null) {
|
|
|
|
|
+ warrantys.add(insAreaCompany.getSypolicyno());
|
|
|
|
|
+ }
|
|
|
|
|
+ templateName = "-商业险保单.pdf";
|
|
|
}
|
|
}
|
|
|
String[] warrantysArray = warrantys.toArray(new String[0]);
|
|
String[] warrantysArray = warrantys.toArray(new String[0]);
|
|
|
VHLINS2005Request vhlins2005Request = new VHLINS2005Request(warrantysArray);
|
|
VHLINS2005Request vhlins2005Request = new VHLINS2005Request(warrantysArray);
|
|
|
VHLINS2005Response vhlins2005Response = daJiaRequestApiComponents.obtainWarranty(vhlins2005Request);
|
|
VHLINS2005Response vhlins2005Response = daJiaRequestApiComponents.obtainWarranty(vhlins2005Request);
|
|
|
if(vhlins2005Response.getStatus().equals(Message.M0000.getCode())){
|
|
if(vhlins2005Response.getStatus().equals(Message.M0000.getCode())){
|
|
|
//获取保单成功
|
|
//获取保单成功
|
|
|
- return HttpResult.ok("获取保单成功",vhlins2005Response.getResult());
|
|
|
|
|
|
|
+ if(PolicyPrintVo.PolicyPrintType.PPT_1.getCode().equals(policyPrintVo.getType())){
|
|
|
|
|
+ //下载保单
|
|
|
|
|
+ if(vhlins2005Response.getResult().size() > 0){
|
|
|
|
|
+ VHLINS2005Response.ResultDTO resultDTO = vhlins2005Response.getResult().get(0);
|
|
|
|
|
+ url = gainCarInsPolicy(resultDTO.getReturnBzUrl(), insAreaCompany.getOrderno() + templateName, identifyNo);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ throw new RuntimeException("获取保单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(PolicyPrintVo.PolicyPrintType.PPT_2.getCode().equals(policyPrintVo.getType())) {
|
|
|
|
|
+ //获取保单
|
|
|
|
|
+ if (vhlins2005Response.getResult().size() > 0) {
|
|
|
|
|
+ VHLINS2005Response.ResultDTO resultDTO = vhlins2005Response.getResult().get(0);
|
|
|
|
|
+ url = gainCarInsPolicy(resultDTO.getReturnUrl(), insAreaCompany.getOrderno() + templateName, identifyNo);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new RuntimeException("获取保单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- throw new RuntimeException("获取保单失败");
|
|
|
|
|
|
|
+ return HttpResult.ok("获取保单成功",url);
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
|
|
|
+ String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
|
|
+ return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|