Browse Source

添加前台不传非默认状态时,且公司协议有默认值时,应该走默认逻辑实际没有走,排查不出原因,因此添加未在排除部门中且前台未传默认,且有该保险公司已经配置默认值的情况下强制走默认判断逻辑

hxl13994548489 2 năm trước cách đây
mục cha
commit
9e31d49324

+ 40 - 4
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.aop.aspect;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.constants.enums.InsuranceRisk;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.constants.enums.dict.agreement.ProductsType;
@@ -28,6 +29,11 @@ import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
 import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
 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.PtlTaxSourceNew;
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
 import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
@@ -81,6 +87,12 @@ public class QuoteVerificationAspect {
 
     private final PtlTaxSourceNewService ptlTaxSourceNewService;
 
+
+    private final ITaxSourceExcludeService taxSourceExcludeService;
+
+
+    private final PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -160,13 +172,37 @@ public class QuoteVerificationAspect {
                 }
                 **/
                 String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
-                //默认协议走逻辑判断
-                if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource)){
+                boolean isExclude = true;
+                //排除的部门信息
+                List<TaxSourceExcludeDto> excludeDepts =
+                        taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+                //部门排除
+                String finalDeptId = deptId;
+                if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(finalDeptId))) {
+                    isExclude = false;
+                }
+                //默认协议走逻辑判断 且不在排除部门中走默认判断逻辑
+                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);
-               }
+                     //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
+               }else{
+                    //不在排除部门内进行默认判断
+                    if(isExclude){
+                        //走正常协议判断是错误的   判断是否有默认配置,如果有不可能进来,前台报错
+                        List<PtlTaxSourceNew> taxSourceDtoList = ptlTaxSourceNewMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
+                                .eq(PtlTaxSourceNew::getInsCompanyId, companyId)
+                                .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
+                        if(taxSourceDtoList!=null && taxSourceDtoList.size()>0){
+                            //throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
+                          //强制走默认状态
+                            String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
+                            ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
+                        }
+                    }
+
+                }
                 //else{
                 //    throw new SystemException("走正常协议逻辑!");
                // }

+ 7 - 6
src/main/java/com/ydtech/modules/protocol/service/impl/PtlTaxSourceServiceImpl.java

@@ -532,13 +532,13 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
                 .orderByAsc(PtlTaxSourceNew::getPriority));
         boolean isExclude = true;
         //排除的部门信息
-        List<TaxSourceExcludeDto> excludeDepts =
-                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+        //List<TaxSourceExcludeDto> excludeDepts =
+        //        taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
 
         //部门排除
-        if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
-            isExclude = false;
-        }
+       // if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
+        //    isExclude = false;
+       // }
         if(prioritySortList!=null && prioritySortList.size()>0){
             int size = prioritySortList.size();
             for (int i = 0; i < size; i++) {
@@ -644,7 +644,8 @@ public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper,
         logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"协议调度规则内容为:"+ptlTaxSourceNew.getDispatchContent()+"===============================");
         logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"报价参数信息为:"+msg+"===============================");
         logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"未匹配信息为:"+quoteInfoErorMsg+"===============================");
-        if (isExclude && isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
+        //if (isExclude && isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
+        if (isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse  && isExcludeYqInsureFlag  && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
             agreementId = ptlTaxSourceNew.getAgreementId();
         }
         PtlTaxSourceNewRecord  ptlTaxSourceNewRecord=new PtlTaxSourceNewRecord(orderno, ptlTaxSourceNew.toString(), ptlTaxSourceNew.getDispatchContent(), msg, quoteInfoErorMsg,new Date(), userId);