|
|
@@ -2,20 +2,26 @@ package com.ydtech.modules.order.aop.aspect;
|
|
|
|
|
|
|
|
|
import com.ydtech.constants.enums.InsuranceRisk;
|
|
|
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.constants.enums.dict.agreement.ProductsType;
|
|
|
import com.ydtech.constants.sys.SystemConstant;
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.admin.model.SysUserRole;
|
|
|
import com.ydtech.modules.admin.service.SysUserRoleService;
|
|
|
-import com.ydtech.modules.admin.service.SysUserService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
+import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
import com.ydtech.modules.ins.model.vo.KindInfoVo;
|
|
|
import com.ydtech.modules.ins.model.vo.RiskInfoVo;
|
|
|
import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
+import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
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.protocol.service.PtlAgreementDeptService;
|
|
|
import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
|
+import com.ydtech.utils.idgen.IdGenerate;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
@@ -40,6 +46,10 @@ public class QuoteVerificationAspect {
|
|
|
|
|
|
private final TaxSourceServiceImpl taxSourceService;
|
|
|
|
|
|
+ private final EsmInsCompanyService esmInsCompanyService;
|
|
|
+
|
|
|
+ private final InsAreaCompanyService insAreaCompanyService;
|
|
|
+
|
|
|
|
|
|
@Before("@annotation(com.ydtech.modules.order.aop.QuoteVerification)")
|
|
|
public void doBefore(JoinPoint point) {
|
|
|
@@ -103,4 +113,59 @@ public class QuoteVerificationAspect {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/4/27 15:18
|
|
|
+ * @Description: 添加报价接口的报价失败状态的后置通知
|
|
|
+ */
|
|
|
+ // @AfterReturning(value="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning="response")
|
|
|
+ public void after(JoinPoint point, HttpResult response) {
|
|
|
+ Object[] args = point.getArgs();
|
|
|
+ if (response.getCode() != 200) {
|
|
|
+ //报价失败 查询信息的信息表
|
|
|
+ for (Object arg : args) {
|
|
|
+ if (arg instanceof BaseQuoteVo) {
|
|
|
+ String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
|
+ String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
+ String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/4/27 16:54
|
|
|
+ * @Description: 添加报价接口的报价失败状态的异常通知
|
|
|
+ */
|
|
|
+ //@AfterThrowing(pointcut="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", throwing="ex")
|
|
|
+ public void handleException(JoinPoint point, Exception ex) {
|
|
|
+ // 处理异常的逻辑
|
|
|
+ Object[] args = point.getArgs();
|
|
|
+ //报价失败 查询信息的信息表
|
|
|
+ for (Object arg : args) {
|
|
|
+ if (arg instanceof BaseQuoteVo) {
|
|
|
+ String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
|
+ String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
+ String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void insertInsAreaCompany(String companyId, String orderno, String agreementId) {
|
|
|
+ EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
|
|
|
+ //保存订单信息
|
|
|
+ InsAreaCompany insAreaCompany = new InsAreaCompany();
|
|
|
+ insAreaCompany.setId(IdGenerate.nextId());
|
|
|
+ insAreaCompany.setOrderno(orderno);
|
|
|
+ insAreaCompany.setAgreementId(agreementId);
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode()); // "1"
|
|
|
+ insAreaCompany.setCompanyId(esmInsCompany.getId());
|
|
|
+ insAreaCompany.setInscompany(esmInsCompany.getNamesimple());
|
|
|
+ //insAreaCompany.setErrorStatus(500);
|
|
|
+ insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
|
+ }
|
|
|
+
|
|
|
}
|