|
|
@@ -8,6 +8,7 @@ import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
|
import com.ydtech.modules.order.components.InsCrawlerOrderComponents;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
+import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.TaxArrears;
|
|
|
import com.ydtech.modules.order.entity.crawler.constants.CrawlerVerifyPaymentConstants;
|
|
|
import com.ydtech.modules.order.entity.crawler.request.*;
|
|
|
@@ -18,6 +19,7 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsCrawlerOrderService;
|
|
|
+import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
import com.ydtech.modules.order.service.InsTaskImagesService;
|
|
|
import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
|
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto;
|
|
|
@@ -26,7 +28,9 @@ import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import com.ydtech.utils.CalculateUtils;
|
|
|
+import com.ydtech.utils.baidu.FileUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
@@ -47,16 +51,26 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
private final InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
|
private final InsTaskImagesService insTaskImagesService;
|
|
|
+ private final InsOrdersService insOrdersService;
|
|
|
|
|
|
- public InsCrawlerOrderServiceImpl(PtlCrawlerApiService ptlCrawlerApiService, InsCrawlerOrderComponents insCrawlerOrderComponents, PtlAgreementAttributionService ptlAgreementAttributionService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService) {
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadFilePath;
|
|
|
+
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String showFileUrl;
|
|
|
+
|
|
|
+ @Value("${api.url}")
|
|
|
+ private String apiUrl;
|
|
|
+
|
|
|
+ public InsCrawlerOrderServiceImpl(PtlCrawlerApiService ptlCrawlerApiService, InsCrawlerOrderComponents insCrawlerOrderComponents, PtlAgreementAttributionService ptlAgreementAttributionService, InsAreaCompanyService insAreaCompanyService, InsTaskImagesService insTaskImagesService, InsOrdersService insOrdersService) {
|
|
|
this.ptlCrawlerApiService = ptlCrawlerApiService;
|
|
|
this.insCrawlerOrderComponents = insCrawlerOrderComponents;
|
|
|
this.ptlAgreementAttributionService = ptlAgreementAttributionService;
|
|
|
this.insAreaCompanyService = insAreaCompanyService;
|
|
|
this.insTaskImagesService = insTaskImagesService;
|
|
|
+ this.insOrdersService = insOrdersService;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public void isLogin(PtlAgreementAttributionDto attribution, String companyId, String insCompanyName) {
|
|
|
|
|
|
@@ -156,6 +170,10 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
@Override
|
|
|
public HttpResult<CrawlerPolicyPrintVo> getPolicyPrint(String subOrderNo) {
|
|
|
InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderNo);
|
|
|
+ InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
+ // 车牌号
|
|
|
+ String licensePlate = insOrders.getLicenseno();
|
|
|
+
|
|
|
// 请求地址
|
|
|
String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_6);
|
|
|
//组装参数
|
|
|
@@ -166,10 +184,19 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
throw new SystemException(request.getMessage());
|
|
|
}
|
|
|
|
|
|
- CrawlerPolicyPrintVo crawlerPolicyPrintVo = new CrawlerPolicyPrintVo(request);
|
|
|
+ CrawlerPolicyPrintVo crawlerPolicyPrintVo = new CrawlerPolicyPrintVo();
|
|
|
+ crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(request.getJqxFlagUrl(), licensePlate + "-交强险标志.pdf", licensePlate));
|
|
|
+ crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(request.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", licensePlate));
|
|
|
+ crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(request.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", licensePlate));
|
|
|
return HttpResult.ok(crawlerPolicyPrintVo);
|
|
|
}
|
|
|
|
|
|
+ private String gainCarInsPolicy(String url, String fileName, String licensePlate) {
|
|
|
+ String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
+ return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public QuoteRespVo getQuoteRespVo(CrawlerQuoteResponse response, BaseQuoteInfoVo yaQuoteInfoVo) {
|
|
|
String orderNo = yaQuoteInfoVo.getOrderNo();
|
|
|
double jqPremium = response.getForceCarInsureRisk();
|
|
|
@@ -233,10 +260,14 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
|
|
|
InsAreaCompany insAreaCompany = new InsAreaCompany(quoteRespVo, ptlAgreementAttribution);
|
|
|
insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(quoteRespVo.getTaxArrears())));
|
|
|
|
|
|
+ // 此单是否需要验车
|
|
|
+ if (CrawlerQuoteResponse.QuoteGreenWayEnum.Q_1.getCode().equals(response.getOther().getIsQuoteGreenWay())) {
|
|
|
+ quoteRespVo.setTips(CrawlerQuoteResponse.QuoteGreenWayEnum.Q_1.getDesc());
|
|
|
+ }
|
|
|
+
|
|
|
// 保险公司订单号
|
|
|
insAreaCompany.setInsOrderNo(response.getOrderNo());
|
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
|
- // 插入轨迹表 报价中
|
|
|
quoteRespVo.setCompanyId(insAreaCompany.getId());
|
|
|
return HttpResult.ok("成功", quoteRespVo);
|
|
|
}
|