Prechádzať zdrojové kódy

提交报价错误的记录表

hxl13994548489 2 rokov pred
rodič
commit
7c5befe448

+ 62 - 37
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -23,16 +23,19 @@ import com.ydtech.modules.order.components.InsOrdersComponents;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
 import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
+import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
 import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
 import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementDept;
 import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
 import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
@@ -46,6 +49,7 @@ import com.ydtech.utils.idgen.IdGenerate;
 import lombok.RequiredArgsConstructor;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.AfterThrowing;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.slf4j.Logger;
@@ -53,6 +57,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 @Aspect
@@ -97,6 +102,8 @@ public class QuoteVerificationAspect {
 
     private final PtlAgreementService ptlAgreementService;
 
+    private final InsAreaCompanyErrorService insAreaCompanyErrorService;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -152,20 +159,20 @@ public class QuoteVerificationAspect {
                 String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
                 //由于前台未传userid判断不了,从主订单表获取用户id和机构id保证待客录单和录单员录单的信息一致
                 /**
-                String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
-                String userId = ((BaseQuoteVo<?>) arg).getUserId();
-                //待客录单传入userId
-                if (StringUtils.isNotEmpty(userId)) {
-                    //通过用户id查询所在的机构
-                    SysUser user = sysUserService.getById(userId);
-                    deptId = user.getDeptId();
-                } else {
-                    // 判断协议是否可以报价(代客录单时,机构需要传过来 没传为空时,为车险录单进来的 直接取登录用户机构即可)
-                    //if (StringUtils.isEmpty(deptId)) {
-                    deptId = new BaseController().getDeptId();
-                    //}
-                    userId = new BaseController().getUserId();
-                }
+                 String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
+                 String userId = ((BaseQuoteVo<?>) arg).getUserId();
+                 //待客录单传入userId
+                 if (StringUtils.isNotEmpty(userId)) {
+                 //通过用户id查询所在的机构
+                 SysUser user = sysUserService.getById(userId);
+                 deptId = user.getDeptId();
+                 } else {
+                 // 判断协议是否可以报价(代客录单时,机构需要传过来 没传为空时,为车险录单进来的 直接取登录用户机构即可)
+                 //if (StringUtils.isEmpty(deptId)) {
+                 deptId = new BaseController().getDeptId();
+                 //}
+                 userId = new BaseController().getUserId();
+                 }
                  **/
                 //添加外部订单的限制  add by hxl  2024-07-12
                 List<InsAreaCompany> insAreaList = insAreaCompanyService.getBaseMapper().selectList(new LambdaQueryWrapper<InsAreaCompany>().eq(InsAreaCompany::getOrderno, orderno));
@@ -173,13 +180,13 @@ public class QuoteVerificationAspect {
                     for(InsAreaCompany subOrder : insAreaList){
                         PtlAgreement ptlAgreement = ptlAgreementService.getById(subOrder.getAgreementId());
                         if(ptlAgreement!=null && ptlAgreement.getIsExternal()!=null && ptlAgreement.getIsExternal()==1){
-                           // throw new SystemException("外部订单不允许报价,请到外部订单编辑页面进行编辑!!");
+                            // throw new SystemException("外部订单不允许报价,请到外部订单编辑页面进行编辑!!");
                         }
                     }
                 }
                 //税源查询
                 BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
-                 //add by hxl  2024-06-12  改为从主订单表中获取数据用户id和部门id
+                //add by hxl  2024-06-12  改为从主订单表中获取数据用户id和部门id
                 SysUser user = sysUserService.getById(quoteInfo.getUserId());
                 String userId=quoteInfo.getUserId();
                 String deptId = user.getDeptId();
@@ -190,12 +197,12 @@ public class QuoteVerificationAspect {
                 //
                 //注释之前的的税源判断   add by hxl
                 /**
-                String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(),
-                        quoteInfo.getCarInfo().getEnginedesc(), insuranceRisk.getCode());
-                if (!"".equals(taxAgreementId)) {
-                    ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
-                }
-                **/
+                 String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(),
+                 quoteInfo.getCarInfo().getEnginedesc(), insuranceRisk.getCode());
+                 if (!"".equals(taxAgreementId)) {
+                 ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
+                 }
+                 **/
                 String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
                 boolean isExclude = true;
                 //排除的部门信息
@@ -214,9 +221,9 @@ public class QuoteVerificationAspect {
                 if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
                     String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
                     ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
-                     log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
-                     //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
-               }else{
+                    log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
+                    //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
+                }else{
                     //不在排除部门内进行默认判断
                     if(isExclude){
                         //走正常协议判断是错误的   判断是否有默认配置,如果有不可能进来,前台报错
@@ -225,7 +232,7 @@ public class QuoteVerificationAspect {
                                 .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
                         if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
                             //throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
-                          //强制走默认状态
+                            //强制走默认状态
                             String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
                             ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
                         }
@@ -234,7 +241,7 @@ public class QuoteVerificationAspect {
                 }
                 //else{
                 //    throw new SystemException("走正常协议逻辑!");
-               // }
+                // }
                 SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
                 if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
                     return;
@@ -252,7 +259,7 @@ public class QuoteVerificationAspect {
      * @Date: 2024/4/27 15:18
      * @Description: 添加报价接口的报价失败状态的后置通知
      */
-    // @AfterReturning(value="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning="response")
+    @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) {
@@ -261,8 +268,9 @@ public class QuoteVerificationAspect {
                 if (arg instanceof BaseQuoteVo) {
                     String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
                     String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
+                    String userId = ((BaseQuoteVo<?>) arg).getUserId();
                     String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
-                    insertInsAreaCompany(companyId, orderno, agreementId);
+                    insertInsAreaCompany(companyId, orderno, agreementId,response.getMsg(),userId);
                 }
             }
         }
@@ -274,7 +282,7 @@ public class QuoteVerificationAspect {
      * @Date: 2024/4/27 16:54
      * @Description: 添加报价接口的报价失败状态的异常通知
      */
-    //@AfterThrowing(pointcut="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", throwing="ex")
+    @AfterThrowing(pointcut="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", throwing="ex")
     public void handleException(JoinPoint point, Exception ex) {
         // 处理异常的逻辑
         Object[] args = point.getArgs();
@@ -283,24 +291,41 @@ public class QuoteVerificationAspect {
             if (arg instanceof BaseQuoteVo) {
                 String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
                 String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
+                String userId = ((BaseQuoteVo<?>) arg).getUserId();
                 String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
-                insertInsAreaCompany(companyId, orderno, agreementId);
+                insertInsAreaCompany(companyId, orderno, agreementId,ex.getMessage(),userId);
             }
         }
     }
 
-    public void insertInsAreaCompany(String companyId, String orderno, String agreementId) {
+    public void insertInsAreaCompany(String companyId, String orderno, String agreementId,String msg,String userId) {
         EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
+        //  agreement
+        PtlAgreement agreement = ptlAgreementService.getById(agreementId);
         //保存订单信息
-        InsAreaCompany insAreaCompany = new InsAreaCompany();
+        InsAreaCompanyError insAreaCompany = new InsAreaCompanyError();
         insAreaCompany.setId(IdGenerate.nextId());
         insAreaCompany.setOrderno(orderno);
         insAreaCompany.setAgreementId(agreementId);
-        insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode()); // "1"
+        insAreaCompany.setErrorMsg(msg);
         insAreaCompany.setCompanyId(esmInsCompany.getId());
-        insAreaCompany.setInscompany(esmInsCompany.getNamesimple());
-        //insAreaCompany.setErrorStatus(500);
-        insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
+        insAreaCompany.setCompanyName(esmInsCompany.getNamesimple());
+        insAreaCompany.setPartnerCompaniesId(agreement.getPartnerCompaniesId());
+        if(StringUtils.isNotBlank(agreement.getPartnerCompaniesId())){
+            EsmInsCompany partnerCompany = esmInsCompanyService.getById(agreement.getPartnerCompaniesId());
+            insAreaCompany.setPartnerCompaniesName(partnerCompany.getNamesimple());
+        }
+        insAreaCompany.setCompanyName(esmInsCompany.getNamesimple());
+        insAreaCompany.setPartnerCompaniesId(agreement.getPartnerCompaniesId());
+        if(userId ==null ){
+            userId = new BaseController().getUserId();
+        }
+        insAreaCompany.setUserId(userId);
+        SysUser user = sysUserService.getById(userId);
+        String deptId = user.getDeptId();
+        insAreaCompany.setDeptId(deptId);
+        insAreaCompany.setCreateTime(new Date());
+        insAreaCompanyErrorService.save(insAreaCompany);
     }
 
 }

+ 18 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyErrorMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Mapper
+* @createDate 2024-08-31 15:05:08
+* @Entity generator.domain.InsAreaCompanyError
+*/
+public interface InsAreaCompanyErrorMapper extends BaseMapper<InsAreaCompanyError> {
+
+}
+
+
+
+

+ 141 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsAreaCompanyError.java

@@ -0,0 +1,141 @@
+package com.ydtech.modules.order.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 报价信息错误记录表
+ * @TableName ins_area_company_error
+ */
+@TableName(value ="ins_area_company_error")
+@Data
+public class InsAreaCompanyError implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private String id;
+
+    /**
+     * 大订单号
+     */
+    private String orderno;
+
+    /**
+     * 协议id
+     */
+    private String agreementId;
+
+    /**
+     * 保险公司id
+     */
+    private String companyId;
+
+    /**
+     * 保险公司名称
+     */
+    private String companyName;
+
+    /**
+     * 合作公司id
+     */
+    private String partnerCompaniesId;
+
+    /**
+     * 合作公司名称
+     */
+    private String partnerCompaniesName;
+
+    /**
+     * 错误信息
+     */
+    private String errorMsg;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    /**
+     * 机构id
+     */
+    private String deptId;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsAreaCompanyError other = (InsAreaCompanyError) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getOrderno() == null ? other.getOrderno() == null : this.getOrderno().equals(other.getOrderno()))
+            && (this.getAgreementId() == null ? other.getAgreementId() == null : this.getAgreementId().equals(other.getAgreementId()))
+            && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
+            && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName().equals(other.getCompanyName()))
+            && (this.getPartnerCompaniesId() == null ? other.getPartnerCompaniesId() == null : this.getPartnerCompaniesId().equals(other.getPartnerCompaniesId()))
+            && (this.getPartnerCompaniesName() == null ? other.getPartnerCompaniesName() == null : this.getPartnerCompaniesName().equals(other.getPartnerCompaniesName()))
+            && (this.getErrorMsg() == null ? other.getErrorMsg() == null : this.getErrorMsg().equals(other.getErrorMsg()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getOrderno() == null) ? 0 : getOrderno().hashCode());
+        result = prime * result + ((getAgreementId() == null) ? 0 : getAgreementId().hashCode());
+        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
+        result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode());
+        result = prime * result + ((getPartnerCompaniesId() == null) ? 0 : getPartnerCompaniesId().hashCode());
+        result = prime * result + ((getPartnerCompaniesName() == null) ? 0 : getPartnerCompaniesName().hashCode());
+        result = prime * result + ((getErrorMsg() == null) ? 0 : getErrorMsg().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", orderno=").append(orderno);
+        sb.append(", agreementId=").append(agreementId);
+        sb.append(", companyId=").append(companyId);
+        sb.append(", companyName=").append(companyName);
+        sb.append(", partnerCompaniesId=").append(partnerCompaniesId);
+        sb.append(", partnerCompaniesName=").append(partnerCompaniesName);
+        sb.append(", errorMsg=").append(errorMsg);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", userId=").append(userId);
+        sb.append(", deptId=").append(deptId);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 13 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyErrorService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Service
+* @createDate 2024-08-31 15:05:08
+*/
+public interface InsAreaCompanyErrorService extends IService<InsAreaCompanyError> {
+
+}

+ 22 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyErrorServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsAreaCompanyErrorMapper;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Service实现
+* @createDate 2024-08-31 15:05:08
+*/
+@Service
+public class InsAreaCompanyErrorServiceImpl extends ServiceImpl<InsAreaCompanyErrorMapper, InsAreaCompanyError>
+    implements InsAreaCompanyErrorService {
+
+}
+
+
+
+

+ 27 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyErrorMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.order.dao.InsAreaCompanyErrorMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.po.InsAreaCompanyError">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="orderno" column="orderno" jdbcType="VARCHAR"/>
+            <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
+            <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
+            <result property="companyName" column="company_name" jdbcType="VARCHAR"/>
+            <result property="partnerCompaniesId" column="partner_companies_id" jdbcType="VARCHAR"/>
+            <result property="partnerCompaniesName" column="partner_companies_name" jdbcType="VARCHAR"/>
+            <result property="errorMsg" column="error_msg" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,orderno,agreement_id,
+        company_id,company_name,partner_companies_id,
+        partner_companies_name,error_msg,create_time,
+        user_id,dept_id
+    </sql>
+</mapper>