|
|
@@ -1,9 +1,11 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.order.components.FileComponents;
|
|
|
import com.ydtech.modules.order.dao.InsOrderPdfUrlMapper;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompanyExternalPolicy;
|
|
|
@@ -16,6 +18,7 @@ import com.ydtech.utils.OrderUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
@@ -82,6 +85,9 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
|
|
|
@Autowired
|
|
|
private YangGuangOrderApiService yangGuangOrderApiService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FileComponents fileComponents;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @version
|
|
|
@@ -136,6 +142,62 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
|
|
|
return readPdfUrlList(subOrderId,true);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String uploadInsurancePolicy(MultipartFile file, String policyType, String subOrderId, boolean flag) {
|
|
|
+ boolean existsFlag = true;
|
|
|
+ String policyPath = fileComponents.gainCarInsPolicyNew(file, subOrderId, flag);
|
|
|
+ if(StringUtils.isBlank(policyPath)){
|
|
|
+ throw new SystemException("文件上传失败");
|
|
|
+ }
|
|
|
+ // pdf 表中插入数据
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(subOrderId);
|
|
|
+ if(Objects.isNull(insAreaCompany)){
|
|
|
+ throw new SystemException("订单不存在");
|
|
|
+ }
|
|
|
+ InsOrderPdfUrl entityBySubOrderId = insOrderPdfUrlMapper.findEntityBySubOrderId(subOrderId);
|
|
|
+ if(Objects.isNull(entityBySubOrderId)){
|
|
|
+ existsFlag = false;
|
|
|
+ // 创建一个新的数据
|
|
|
+ entityBySubOrderId = new InsOrderPdfUrl();
|
|
|
+ entityBySubOrderId.setSubOrderNo(subOrderId);
|
|
|
+ entityBySubOrderId.setRiskCode(insAreaCompany.getProduct());
|
|
|
+ }
|
|
|
+ if (policyType.equals("1")) {
|
|
|
+ if(insAreaCompany.getJqapplyno().equals("")){
|
|
|
+ throw new SystemException("未查询到交强保单号");
|
|
|
+ }
|
|
|
+ entityBySubOrderId.setJqNo(insAreaCompany.getJqapplyno());
|
|
|
+ entityBySubOrderId.setJqUrl(policyPath);
|
|
|
+ }
|
|
|
+ if (policyType.equals("2")){
|
|
|
+ if(insAreaCompany.getJqapplyno().equals("")){
|
|
|
+ throw new SystemException("未查询到交强保单号");
|
|
|
+ }
|
|
|
+ entityBySubOrderId.setJqNo(insAreaCompany.getJqapplyno());
|
|
|
+ entityBySubOrderId.setJqSignUrl(policyPath);
|
|
|
+ }
|
|
|
+ if (policyType.equals("3")){
|
|
|
+ if(insAreaCompany.getSyapplyno().equals("")){
|
|
|
+ throw new SystemException("未查询到商业保单号");
|
|
|
+ }
|
|
|
+ entityBySubOrderId.setSyNo(insAreaCompany.getSyapplyno());
|
|
|
+ entityBySubOrderId.setSyUrl(policyType);
|
|
|
+ }
|
|
|
+ if (policyType.equals("4")){
|
|
|
+ if (insAreaCompany.getCrossInsurance().size() > 0) {
|
|
|
+ entityBySubOrderId.setJyNo(((JSONObject) insAreaCompany.getCrossInsurance().get(0)).getString("applicationNumber"));
|
|
|
+ entityBySubOrderId.setJyUrl(policyType);
|
|
|
+ }else{
|
|
|
+ throw new SystemException("未查询到驾意保单号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!existsFlag) {
|
|
|
+ insOrderPdfUrlMapper.insert(entityBySubOrderId);
|
|
|
+ }else{
|
|
|
+ insOrderPdfUrlMapper.updateById(entityBySubOrderId);
|
|
|
+ }
|
|
|
+ return policyPath;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public ReadPdfUrlListDto insertOrderPdfData(InsAreaCompany subOrder,InsOrders insOrders,boolean flag,InsOrderPdfUrl jqUrlEntity){
|