|
|
@@ -34,9 +34,11 @@ import com.ydtech.modules.order.entity.api.zijin.request.SubmitVerifyRequest;
|
|
|
import com.ydtech.modules.order.entity.api.zijin.response.QueryClauseDataResponse;
|
|
|
import com.ydtech.modules.order.entity.config.PingAnConfigureParameters;
|
|
|
import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
|
|
|
+import com.ydtech.modules.order.entity.dto.InsTaskImagesDto;
|
|
|
import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
|
|
|
import com.ydtech.modules.order.entity.po.InsTaskImages;
|
|
|
import com.ydtech.modules.order.entity.po.InsUploadFiles;
|
|
|
+import com.ydtech.modules.order.entity.po.PinganRecord;
|
|
|
import com.ydtech.modules.order.entity.po.PinganShUploafile;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.InsDrivingIntentionInsuranceVo;
|
|
|
@@ -113,6 +115,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
|
|
|
private final PinganShUploafileService pinganShUploafileService;
|
|
|
|
|
|
+
|
|
|
+ private final PinganRecordService pinganRecordService;
|
|
|
/**
|
|
|
* @Description 获取财意险险种套餐列表 调用 4.4
|
|
|
* @Author hxl
|
|
|
@@ -476,6 +480,8 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
//小微险保费
|
|
|
quoteRespVo.setAhsUpcActualPremium(ahsUpcActualPremium);
|
|
|
quoteRespVo.setXwActualPremium(xwActualPremium);
|
|
|
+ quoteRespVo.setCombinationPremium(combinationPremium);
|
|
|
+
|
|
|
List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
|
|
|
// 非车险
|
|
|
double jyPremium = 0;
|
|
|
@@ -483,15 +489,24 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
// 财意险总保费
|
|
|
double ahsUpcTotalPremium = Double.parseDouble(ahsUpcActualPremium.getAhsUpcTotalPremium() == null ? "0" : ahsUpcActualPremium.getAhsUpcTotalPremium());;
|
|
|
jyPremium += ahsUpcTotalPremium;
|
|
|
- quoteRespVo.setCyPremium(ahsUpcTotalPremium);
|
|
|
+ double ahsPremium = Double.parseDouble(ahsUpcActualPremium.getAhsPremium() == null ? "0" : ahsUpcActualPremium.getAhsPremium());;
|
|
|
+ double upcPremium = Double.parseDouble(ahsUpcActualPremium.getUpcPremium() == null ? "0" : ahsUpcActualPremium.getUpcPremium());;
|
|
|
+ quoteRespVo.setAhsUpcTotalPremium(ahsUpcTotalPremium);
|
|
|
+ quoteRespVo.setCyPremium(ahsPremium);
|
|
|
+ quoteRespVo.setCcPremium(upcPremium);
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(xwActualPremium)) {
|
|
|
double xwPremium = Double.parseDouble(xwActualPremium.getXwPremium() == null ? "0" : xwActualPremium.getXwPremium());
|
|
|
jyPremium += xwPremium;
|
|
|
quoteRespVo.setXwPremium(xwPremium);
|
|
|
}
|
|
|
- jyPremium += zhAmount;
|
|
|
- quoteRespVo.setZhPremium(zhAmount);
|
|
|
+ if (!ObjectUtils.isEmpty(combinationPremium)) {
|
|
|
+ // 财意险总保费
|
|
|
+ double zhPremium = Double.parseDouble(combinationPremium.getComPremium() == null ? "0" : combinationPremium.getComPremium());;
|
|
|
+ zhAmount = zhPremium;
|
|
|
+ jyPremium += zhAmount;
|
|
|
+ quoteRespVo.setZhPremium(zhAmount);
|
|
|
+ }
|
|
|
// 报价险种放入保费
|
|
|
List<QuoteRiskRespVo> riskList1 = QuoteRiskRespVo.toQuoteRiskRespVoList(riskList, jqPremium, syPremium);
|
|
|
quoteRespVo.setRiskList(riskList1);
|
|
|
@@ -545,6 +560,11 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
insAreaCompany.setJqRenewal("2".equals(carConfirmResponse.getForceRenewalType())?"1":carConfirmResponse.getForceRenewalType());
|
|
|
insAreaCompany.setSyRenewal("2".equals(carConfirmResponse.getBizRenewalType())?"1":carConfirmResponse.getBizRenewalType());
|
|
|
insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
|
+ PinganRecord pingAnRecord= new PinganRecord(insAreaCompany.getId(), new BigDecimal(quoteRespVo.getAhsUpcTotalPremium()), new BigDecimal(quoteRespVo.getCyPremium()),
|
|
|
+ new BigDecimal(quoteRespVo.getCcPremium()), new BigDecimal(quoteRespVo.getXwPremium()),
|
|
|
+ new BigDecimal(quoteRespVo.getZhPremium()), new Date());
|
|
|
+ //插入費用关联表
|
|
|
+ pinganRecordService.save(pingAnRecord);
|
|
|
quoteRespVo.setCompanyId(insAreaCompany.getId());
|
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
}
|
|
|
@@ -2232,10 +2252,17 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
@Override
|
|
|
public HttpResult<Object> additionalInformation(AdditionalInformation additionalInformation) {
|
|
|
String companyId = additionalInformation.getCompanyId();
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
|
|
|
+
|
|
|
+ InsOrders insOrders = insOrdersService.existOrder(insAreaCompany.getOrderno());
|
|
|
+ // 账号信息
|
|
|
+ PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
+ PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
|
|
|
+ ptlAgreementAttribution);
|
|
|
if(StringUtils.isBlank(companyId)){
|
|
|
throw new SystemException("子订单id不能为空!!!");
|
|
|
}
|
|
|
- List<String> imageList = additionalInformation.getImageList();
|
|
|
+ List<InsTaskImages> imageList = additionalInformation.getImageList();
|
|
|
if(imageList ==null || imageList.size()==0){
|
|
|
throw new SystemException("补传资料不能为空!!!");
|
|
|
}
|
|
|
@@ -2249,43 +2276,117 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
|
|
|
String errorMsg="";
|
|
|
if(list ==null || list.size()==0){
|
|
|
throw new SystemException("没有事后补传资料不必上传!!!");
|
|
|
- }else{
|
|
|
- msg ="需要补传资料为:";
|
|
|
+ }else {
|
|
|
+ msg = "需要补传资料为:";
|
|
|
//判断上传的资料是否包含需要补传的信息资料不包含提示信息
|
|
|
- List<InsUploadImagesDto> imgList = insTaskImagesMapper.findByIds(imageList);
|
|
|
-
|
|
|
- if(imgList!=null && imgList.size()>0){
|
|
|
-
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
- for(InsUploadImagesDto dto :imgList){
|
|
|
- PingAnDocumentClassEnum fileEnum = PingAnDocumentClassEnum.getCode(dto.getImageType());
|
|
|
- String documentType = fileEnum.getDocumentType();
|
|
|
- map.put(documentType,documentType);
|
|
|
+ //刪除资料重新添加
|
|
|
+ List<InsTaskImages> insTaskImagesList = imageList
|
|
|
+ .stream()
|
|
|
+ .map(x -> new InsTaskImages(x, insOrders.getQuoteno(), insOrders.getUserid()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<InsTaskImages> imageOldList =insTaskImagesService.lambdaQuery().eq(InsTaskImages::getQuoteNo, insOrders.getQuoteno()).list();
|
|
|
+
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ List<String> collect = imageOldList.stream().map(InsTaskImages::getId).collect(Collectors.toList());
|
|
|
+ insTaskImagesService.removeBatchByIds(collect);
|
|
|
+ }
|
|
|
+ //保存
|
|
|
+ boolean b = insTaskImagesService.saveBatch(insTaskImagesList);
|
|
|
+ if(b){
|
|
|
+ List<InsTaskImagesDto> insTaskImagesDtos = insTaskImagesMapper.getByQuoteNoInsTaskImagesDtoList(insOrders.getQuoteno());
|
|
|
+ List<UploadFilesRequest.DocListDTO> docList = new ArrayList<>();
|
|
|
+ if (insTaskImagesDtos != null && insTaskImagesDtos.size() > 0) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ for (InsTaskImagesDto dto : insTaskImagesDtos) {
|
|
|
+ PingAnDocumentClassEnum fileEnum = PingAnDocumentClassEnum.getCode(dto.getImageType());
|
|
|
+ String documentType = fileEnum.getDocumentType();
|
|
|
+ map.put(documentType, documentType);
|
|
|
+ }
|
|
|
+ for (PinganShUploafile dto : list) {
|
|
|
+ String val = map.get(dto.getDocumentType());
|
|
|
+ if (StringUtils.isBlank(val)) {
|
|
|
+ errorMsg += dto.getDocumentClassName() + "-" + dto.getDocumentTypeName() + ";";
|
|
|
+ }
|
|
|
+ msg += dto.getDocumentClassName() + "-" + dto.getDocumentTypeName() + ";";
|
|
|
+ }
|
|
|
}
|
|
|
- for(PinganShUploafile dto :list){
|
|
|
- String val = map.get(dto.getDocumentType());
|
|
|
- if(StringUtils.isBlank(val)){
|
|
|
- errorMsg+=dto.getDocumentClassName()+"-"+dto.getDocumentTypeName()+";";
|
|
|
+ if (StringUtils.isNotBlank(errorMsg)) {
|
|
|
+ throw new SystemException(msg + "(" + errorMsg + "未上传)");
|
|
|
+ } else {
|
|
|
+ List<InsTaskImages> dtoList =new ArrayList<>();
|
|
|
+ //上传文件接口
|
|
|
+ for (InsTaskImagesDto dto : insTaskImagesDtos) {
|
|
|
+ InsUploadFiles fiels = insUploadFilesService.getById(dto.getImageId());
|
|
|
+ File file = new File(fiels.getFilePath());
|
|
|
+ PingAnDocumentClassEnum fileEnum = PingAnDocumentClassEnum.getCode(dto.getImageType());
|
|
|
+ String key = "";
|
|
|
+ String documentClass = fileEnum.getDocument();
|
|
|
+ String documentType = fileEnum.getDocumentType();
|
|
|
+ String fileName = file.getName();
|
|
|
+ String documentName = fileName.split("\\.")[0];
|
|
|
+ String documentFormat = fileName.split("\\.")[1];
|
|
|
+ if (StringUtils.isBlank(dto.getPinganKey())) {
|
|
|
+ key = parameters.getUserId() + "-" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + "-" + UUID.randomUUID();
|
|
|
+ boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
|
|
|
+ if (!upLoadFileFlag) {
|
|
|
+ throw new SystemException("上传影像文件失败");
|
|
|
+ }
|
|
|
+ dto.setPinganKey(key);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ key = dto.getPinganKey();
|
|
|
+ }
|
|
|
+ UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(dto.getPinganKey(), documentClass, documentType, documentName, documentFormat, null);
|
|
|
+ docList.add(docListDTO);
|
|
|
+ InsTaskImages dtoNew = new InsTaskImages(dto, insOrders.getQuoteno(), insOrders.getUserid());
|
|
|
+ dtoList.add(dtoNew);
|
|
|
+ }
|
|
|
+ //更新文件平安key
|
|
|
+ boolean flag = insTaskImagesService.saveBatch(dtoList);
|
|
|
+ //组装上传的资料信息提交
|
|
|
+ UploadFilesResponse uploadFilesResponse = null;
|
|
|
+ PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(), insAreaCompany.getId(), insAreaCompany.getAgreementId());
|
|
|
+ //调用文件上传
|
|
|
+ UploadFilesRequest uploadRequest = new UploadFilesRequest(docList, insAreaCompany.getJqapplyno(), insAreaCompany.getJqapplyno(), parameters.getUserId(), "openApi");
|
|
|
+ try {
|
|
|
+ uploadFilesResponse = pinganRequestApiComponents.uploadFiles(uploadRequest, pinganApiLog);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new SystemException(e.getMessage());
|
|
|
+ }
|
|
|
+ if (uploadFilesResponse != null && "0".equals(uploadFilesResponse.getResultCode())) {
|
|
|
+ //将补传资料的数据更新为1
|
|
|
+ List<PinganShUploafile> newList = list.stream()
|
|
|
+ .map(item -> {
|
|
|
+ item.setStatus("1");
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ pinganShUploafileService.updateBatchById(newList);
|
|
|
}
|
|
|
- msg+=dto.getDocumentClassName()+"-"+dto.getDocumentTypeName()+";";
|
|
|
}
|
|
|
- errorMsg+="未上传";
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(errorMsg)){
|
|
|
- throw new SystemException(msg+"("+errorMsg+")");
|
|
|
- }else{
|
|
|
- //将补传资料的数据更新为1
|
|
|
- List<PinganShUploafile> newList = list.stream()
|
|
|
- .map(item -> {
|
|
|
- item.setStatus("1");
|
|
|
- return item;
|
|
|
- })
|
|
|
- .collect(Collectors.toList());
|
|
|
- pinganShUploafileService.updateBatchById(newList);
|
|
|
}
|
|
|
}
|
|
|
return HttpResult.ok("补传资料成功!!");
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/8/20 10:48
|
|
|
+ * @Description: 判断是否需要补传资料
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult<Object> checkAdditional(String companyId) {
|
|
|
+ //通过子订单id查询需要补传的数据集合
|
|
|
+ LambdaQueryWrapper<PinganShUploafile> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(PinganShUploafile::getSubOrderNo, companyId);
|
|
|
+ queryWrapper.eq(PinganShUploafile::getStatus, "0");
|
|
|
+ List<PinganShUploafile> list = pinganShUploafileService.list(queryWrapper);
|
|
|
+ //判断前台数据是否包含所有的回传资料
|
|
|
+ if(list ==null || list.size()==0) {
|
|
|
+ throw new SystemException("没有事后补传资料不必上传!!!");
|
|
|
+ }
|
|
|
+ return HttpResult.ok("需要补传资料!!");
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @version
|