wks преди 2 години
родител
ревизия
ab6cc6b8e7

+ 3 - 1
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -35,6 +35,7 @@ public class QuoteVerificationAspect {
 
     private final TaxSourceServiceImpl taxSourceService;
 
+
     @Before("@annotation(com.ydtech.modules.order.aop.QuoteVerification)")
     public void doBefore(JoinPoint point) {
         Object[] args = point.getArgs();
@@ -53,7 +54,8 @@ public class QuoteVerificationAspect {
 
                 //税源查询
                 BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
-                String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(), quoteInfo.getCarInfo().getEnginedesc());
+                String productid = quoteInfo.getProductid();
+                String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(), quoteInfo.getCarInfo().getEnginedesc(), productid);
                 if(!"".equals(taxAgreementId)){
                     ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
                 }

+ 5 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java

@@ -24,12 +24,17 @@ public class BaseQuoteInfoVo extends YaQuoteInfoVo {
     @ApiModelProperty("代客录单用-实际业务归属人")
     private String userId;
 
+    @ApiModelProperty("险种id")
+    private String productid;
+
     public BaseQuoteInfoVo() {
     }
 
     public BaseQuoteInfoVo(InsOrders insOrders) {
         super(insOrders);
         this.orderNo = insOrders.getOrderno();
+        // 返回险种
+        this.productid = insOrders.getProductid();
         this.vehicleAndVesselTax = insOrders.getVehicleAndVesselTax().toJavaObject(VehicleAndVesselTax.class);
     }
 

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/entity/dto/TaxSourceDto.java

@@ -9,7 +9,6 @@ import lombok.Data;
 @TableName("ptl_tax_source")
 public class TaxSourceDto {
 
-
     private String id;
 
     private String license;
@@ -22,5 +21,6 @@ public class TaxSourceDto {
 
     private String isTaxSource;
 
+    private String insuranceRepertoire;
 
 }

+ 10 - 8
src/main/java/com/ydtech/modules/protocol/entity/vo/TaxSourceVo.java

@@ -1,23 +1,25 @@
 package com.ydtech.modules.protocol.entity.vo;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.List;
 
 @Data
+@ApiModel("险种")
 public class TaxSourceVo {
 
-    /**
-     * 保险公司id
-     */
-    @TableField(value = "ins_company_id")
+    @ApiModelProperty("保险公司id")
     private String insCompanyId;
-    /**
-     * 保险公司名称
-     */
-    @TableField(value = "ins_company_name")
+
+    @ApiModelProperty("保险公司名称")
     private String insCompanyName;
+
+    @ApiModelProperty("支持险种")
+    private String insuranceRepertoire;
+
     /**
      * 税源配置信息
      */

+ 0 - 1
src/main/java/com/ydtech/modules/protocol/service/ITaxSourceExcludeService.java

@@ -9,7 +9,6 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 
-@Service
 public interface ITaxSourceExcludeService extends IService<TaxSourceExcludeDto> {
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/protocol/service/ITaxSourceService.java

@@ -27,5 +27,5 @@ public interface ITaxSourceService extends IService<TaxSourceDto> {
 
     List<PtlAgreementInsCompanyDto> getAllAgreement(String deptId, String userId);
 
-    String getAgreementId(String deptId, String userId,String companyId,String license,String volume);
+    String getAgreementId(String deptId, String userId, String companyId, String license, String volume, String productid);
 }

+ 19 - 10
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -28,9 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSourceDto> implements ITaxSourceService {
@@ -67,7 +66,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
                 }
             }
         }
-        QueryWrapper queryWrapper = new QueryWrapper();
+        QueryWrapper<PtlAgreement> queryWrapper = new QueryWrapper<>();
         queryWrapper.in("id", agreementIds);
         List<PtlAgreement> list = ptlAgreementService.list(queryWrapper);
         return list;
@@ -92,6 +91,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
             dto.setAgreementId(agreementTax.getAgreementId());
             dto.setIsTaxSource(agreementTax.getIsTaxSource());
             dto.setLicense(agreementTax.getLicense());
+            dto.setInsuranceRepertoire(taxSourceVo.getInsuranceRepertoire());
             dtos.add(dto);
         });
         //组装排除的部门信息
@@ -320,17 +320,18 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
      * @return
      */
     @Override
-    public String getAgreementId(String deptId, String userId, String companyId, String license, String volume) {
+    public String getAgreementId(String deptId, String userId, String companyId, String license, String volume, String productid) {
         // 车牌前两位
         String firstTwoPlates = license.substring(0, 2);
         String resultId = "";
 
         //查找配置的默认项
-        TaxSourceDto taxSourceDefaultDto = baseMapper.selectOne(new LambdaQueryWrapper<TaxSourceDto>()
-                .eq(TaxSourceDto::getInsCompanyId, companyId)
-                .eq(TaxSourceDto::getLicense, firstTwoPlates));
-        if (taxSourceDefaultDto != null) {
-            resultId = taxSourceDefaultDto.getAgreementId();
+        List<TaxSourceDto> taxSourceDtoList = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>()
+                .eq(TaxSourceDto::getInsCompanyId, companyId));
+
+        List<TaxSourceDto> taxSource = taxSourceDtoList.stream().filter(x -> x.getLicense().equals(firstTwoPlates)).collect(Collectors.toList());
+        if (!taxSource.isEmpty()) {
+            resultId = taxSourceDtoList.get(0).getAgreementId();
         }
 
         boolean isExclude = false;
@@ -363,6 +364,14 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
             if (taxSourceDtos != null) {
                 resultId = taxSourceDtos.getAgreementId();
             }
+
+            // 不包含险种 随机其他保险公司
+            if(taxSourceDtos != null && !taxSourceDtos.getInsuranceRepertoire().contains(productid)){
+                List<TaxSourceDto> collect = taxSourceDtoList.stream().filter(x -> !x.getAgreementId().equals(taxSourceDtos.getAgreementId())).collect(Collectors.toList());
+                Collections.shuffle(collect);
+                resultId = collect.get(0).getAgreementId();
+            }
+
         }
 
         return resultId;