|
|
@@ -2,6 +2,7 @@ package com.jzg.quotation.summary.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.util.ArrayUtil;
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
@@ -21,18 +22,17 @@ import com.jzg.commons.entity.quote.vo.base.LoginBase;
|
|
|
import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
|
|
|
import com.jzg.commons.entity.quote.vo.underwriting.SpecialAppointmentsVo;
|
|
|
import com.jzg.commons.entity.rights.dto.InsOrderRightsDto;
|
|
|
+import com.jzg.commons.entity.rights.dto.InsOrderRightsInfoDto;
|
|
|
import com.jzg.commons.entity.rights.dto.InsOrderRightsPackageDto;
|
|
|
import com.jzg.commons.entity.vo.CompanyClauseVo;
|
|
|
import com.jzg.commons.entity.vo.InsCompanyClauseVo;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.exception.TokenExpireException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
-import com.jzg.commons.util.MinioUtils;
|
|
|
import com.jzg.quotation.commons.client.OrgClient;
|
|
|
import com.jzg.quotation.commons.client.PlatformClient;
|
|
|
import com.jzg.quotation.commons.service.QuotationBaseService;
|
|
|
import com.jzg.quotation.commons.utils.SnowFlakeUtil;
|
|
|
-import com.jzg.quotation.hengbang.crawler.service.HengBangCrawlerRequest;
|
|
|
import com.jzg.quotation.summary.aop.AuditVerification;
|
|
|
import com.jzg.quotation.summary.aop.OrderOperationLog;
|
|
|
import com.jzg.quotation.summary.aop.QuoteVerification;
|
|
|
@@ -41,18 +41,16 @@ import com.jzg.quotation.summary.constants.QuoteNumberConstant;
|
|
|
import com.jzg.quotation.summary.converter.QuoteInfoConverter;
|
|
|
import com.jzg.quotation.summary.entity.po.QuoteRuleMapping;
|
|
|
import com.jzg.quotation.summary.factory.CompanyFactory;
|
|
|
-import com.jzg.quotation.summary.mapper.SysUploadFilesMapper;
|
|
|
import com.jzg.quotation.summary.service.*;
|
|
|
import com.jzg.quotation.summary.state.listener.OrderStateListener;
|
|
|
import com.jzg.quotation.zhongmei.crawler.service.ZhongMeiCrawlerRequest;
|
|
|
-import io.minio.MinioClient;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.val;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
@@ -116,15 +114,6 @@ public class UnifyOrderManager {
|
|
|
@Autowired
|
|
|
OrderStateListener orderStateListener;
|
|
|
|
|
|
- @Autowired
|
|
|
- MinioClient minioClient;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- MinioUtils minioUtils;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SysUploadFilesMapper sysUploadFilesMapper;
|
|
|
-
|
|
|
@Autowired
|
|
|
InsOrdersPdfUrlService insOrdersPdfUrlService;
|
|
|
|
|
|
@@ -134,15 +123,6 @@ public class UnifyOrderManager {
|
|
|
@Autowired
|
|
|
InsFeeOrdersService insFeeOrdersService;
|
|
|
|
|
|
- @Value("${minio.bucket-name}")
|
|
|
- private String bucketName;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private InsOrdersTrackService insOrdersTrackService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private HengBangCrawlerRequest hengBangCrawlerRequest;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ZhongMeiCrawlerRequest zhongMeiCrawlerRequest;
|
|
|
@Autowired
|
|
|
@@ -218,12 +198,12 @@ public class UnifyOrderManager {
|
|
|
String companyName = CompanyConstants.getCompanyNameByCode(esmInsCompanyHttpResult.getData().getCompanyCode());
|
|
|
|
|
|
|
|
|
- HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(esmInsCompanyHttpResult.getData().getId(),systemCode);
|
|
|
+ HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(esmInsCompanyHttpResult.getData().getId(), systemCode);
|
|
|
if (byCompanyId.getData().isEmpty()) {
|
|
|
AssertionUtils.isFail(true, "保司未配置协议");
|
|
|
}
|
|
|
- PtlAgreement ptlAgreement = byCompanyId.getData().stream().filter(x->x.getId().equals(quoteVo.getOrder().getAgreementId())).findFirst().orElse(null);
|
|
|
- if(Objects.isNull(ptlAgreement)){
|
|
|
+ PtlAgreement ptlAgreement = byCompanyId.getData().stream().filter(x -> x.getId().equals(quoteVo.getOrder().getAgreementId())).findFirst().orElse(null);
|
|
|
+ if (Objects.isNull(ptlAgreement)) {
|
|
|
throw new SystemException("协议不存在");
|
|
|
}
|
|
|
quoteVo.getOrder().setAgreementId(ptlAgreement.getId());
|
|
|
@@ -263,14 +243,14 @@ public class UnifyOrderManager {
|
|
|
quoteResultsVo.setOrdersNo(ordersNo);
|
|
|
// 报价后更新订单
|
|
|
insOrdersService.orderAfterUpdateQuote(ordersNo, quoteResultsVo);
|
|
|
- }catch(Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
Throwable root = e.getCause() != null ? e.getCause() : e;
|
|
|
insOrdersService.orderAfterUpdateFailedQuote(ordersNo, root.getMessage());
|
|
|
throw new SystemException(root.getMessage());
|
|
|
}
|
|
|
return quoteResultsVo.getQuoteStatusEnum()
|
|
|
- .equals(InsOrderStatusEnum.WAIT_AUDIT) ? HttpResult.ok(quoteResultsVo) : HttpResult.error(500,quoteResultsVo,quoteResultsVo.getErrorMessage());
|
|
|
+ .equals(InsOrderStatusEnum.WAIT_AUDIT) ? HttpResult.ok(quoteResultsVo) : HttpResult.error(500, quoteResultsVo, quoteResultsVo.getErrorMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -303,9 +283,9 @@ public class UnifyOrderManager {
|
|
|
InsOrdersPolicy insOrdersPolicy = insOrdersPolicyService.getById(insOrders.getId());
|
|
|
// 核保之前判断是否是待核保 或 核保失败
|
|
|
StateResult stateResult;
|
|
|
- if(insOrders.getOrderStatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode()) || insOrders.getOrderStatus().equals(InsOrderStatusEnum.AUDIT_FAIL.getCode())){
|
|
|
+ if (insOrders.getOrderStatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode()) || insOrders.getOrderStatus().equals(InsOrderStatusEnum.AUDIT_FAIL.getCode())) {
|
|
|
stateResult = orderStateListener.statusChange(InsOrderStatusEnum.AUDIT_ING, InsOrderStatusEnum.WAIT_AUDIT.getCode());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stateResult = orderStateListener.statusChange(InsOrderStatusEnum.AUDIT_ING, insOrders.getOrderStatus());
|
|
|
}
|
|
|
//核保之前更新订单为待核保
|
|
|
@@ -313,7 +293,7 @@ public class UnifyOrderManager {
|
|
|
insOrdersService.updateById(insOrders);
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
- insOrdersCarInfo,insOrdersCosts,
|
|
|
+ insOrdersCarInfo, insOrdersCosts,
|
|
|
baseController.getToken(), MessageCodeEnum.TEMPLATE_2);
|
|
|
//拼装参数
|
|
|
underwritingVo.setInsOrders(insOrders);
|
|
|
@@ -341,12 +321,16 @@ public class UnifyOrderManager {
|
|
|
}
|
|
|
underwritingVo.setSpecialAppointmentsVos(specialAppointmentsVos);
|
|
|
|
|
|
+ if (ArrayUtil.isEmpty(underwritingVo.getInsOrderRightsInfoDto())) {
|
|
|
+ underwritingVo.setInsOrderRightsInfoDto(new InsOrderRightsInfoDto());
|
|
|
+ }
|
|
|
+
|
|
|
boolean hasRights = CollectionUtils.isNotEmpty(underwritingVo.getInsOrderRightsInfoDto().getInsOrderRightsList());//权益券
|
|
|
boolean hasPackages = CollectionUtils.isNotEmpty(underwritingVo.getInsOrderRightsInfoDto().getInsOrderRightsPackageList());//权益套餐
|
|
|
//核保前需要判断如果有选权益需要判断选中权益总价不超过可用金额
|
|
|
- if(hasRights || hasPackages){
|
|
|
+ if (hasRights || hasPackages) {
|
|
|
InsFeeOrders feeOrders = insFeeOrdersService.getById(underwritingVo.getOrder().getOrdersNo());
|
|
|
- AssertionUtils.isFail(Objects.isNull(feeOrders),"费用信息不匹配");
|
|
|
+ AssertionUtils.isFail(Objects.isNull(feeOrders), "费用信息不匹配");
|
|
|
checkUsedAmount(feeOrders.getAvailableAmount(), underwritingVo.getInsOrderRightsInfoDto().getInsOrderRightsList(), underwritingVo.getInsOrderRightsInfoDto().getInsOrderRightsPackageList());
|
|
|
}
|
|
|
|
|
|
@@ -358,13 +342,13 @@ public class UnifyOrderManager {
|
|
|
if (underwritingResultsVo.getUnderwritingStatus().equals(InsOrderStatusEnum.PAY_PENDING)) {
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
- insOrdersCarInfo,insOrdersCosts,
|
|
|
+ insOrdersCarInfo, insOrdersCosts,
|
|
|
baseController.getToken(), MessageCodeEnum.TEMPLATE_5);
|
|
|
//核保成功将权益信息入库
|
|
|
- if(null != underwritingVo.getInsOrderRightsInfoDto()){
|
|
|
- if(hasRights || hasPackages){
|
|
|
- insOrderRightsInfoService.saveInsOrderRightsInfo(underwritingVo.getInsOrderRightsInfoDto(),underwritingVo.getOrder().getOrdersNo());
|
|
|
- }
|
|
|
+ if (null != underwritingVo.getInsOrderRightsInfoDto()) {
|
|
|
+ if (hasRights || hasPackages) {
|
|
|
+ insOrderRightsInfoService.saveInsOrderRightsInfo(underwritingVo.getInsOrderRightsInfoDto(), underwritingVo.getOrder().getOrdersNo());
|
|
|
+ }
|
|
|
}
|
|
|
return HttpResult.ok("核保成功");
|
|
|
} else {
|
|
|
@@ -375,7 +359,7 @@ public class UnifyOrderManager {
|
|
|
insOrdersService.updateById(insOrders);
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
- insOrdersCarInfo,insOrdersCosts,
|
|
|
+ insOrdersCarInfo, insOrdersCosts,
|
|
|
baseController.getToken(), MessageCodeEnum.TEMPLATE_4);
|
|
|
}
|
|
|
throw new SystemException(underwritingResultsVo.getUnderwritingResult());
|
|
|
@@ -440,7 +424,7 @@ public class UnifyOrderManager {
|
|
|
String systemCode = getSystemCode();
|
|
|
|
|
|
//先默认第一个协议
|
|
|
- HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(insOrders.getCompanyId(),systemCode);
|
|
|
+ HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(insOrders.getCompanyId(), systemCode);
|
|
|
if (byCompanyId.getData().isEmpty()) {
|
|
|
AssertionUtils.isFail(true, "保司未配置协议");
|
|
|
}
|
|
|
@@ -471,7 +455,7 @@ public class UnifyOrderManager {
|
|
|
String systemCode = getSystemCode();
|
|
|
|
|
|
//先默认第一个协议
|
|
|
- HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(insOrders.getCompanyId(),systemCode);
|
|
|
+ HttpResult<List<PtlAgreement>> byCompanyId = orgClient.getByCompanyId(insOrders.getCompanyId(), systemCode);
|
|
|
if (byCompanyId.getData().isEmpty()) {
|
|
|
AssertionUtils.isFail(true, "保司未配置协议");
|
|
|
}
|
|
|
@@ -609,7 +593,7 @@ public class UnifyOrderManager {
|
|
|
|
|
|
// 发送订单状态变更消息
|
|
|
insOrdersService.orderStatusMessage(insOrders,
|
|
|
- carInfo,costs,
|
|
|
+ carInfo, costs,
|
|
|
baseController.getToken(), MessageCodeEnum.TEMPLATE_7);
|
|
|
return HttpResult.ok(insOrdersPdfUrl);
|
|
|
}
|
|
|
@@ -618,10 +602,12 @@ public class UnifyOrderManager {
|
|
|
@Operation(summary = "测试")
|
|
|
public HttpResult test(@RequestBody LoginBase loginBase) {
|
|
|
zhongMeiCrawlerRequest.login(loginBase);
|
|
|
- return HttpResult.ok();
|
|
|
+ return HttpResult.ok();
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 判断已使用金额不超过可用金额
|
|
|
+ *
|
|
|
* @param availableAmount
|
|
|
* @param rightsList
|
|
|
* @param rightsPackageList
|
|
|
@@ -658,7 +644,6 @@ public class UnifyOrderManager {
|
|
|
if (usedAmount.compareTo(availableAmount) > 0) {
|
|
|
AssertionUtils.isFail(true, "权益金额不足!");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|