Przeglądaj źródła

Merge branch 'master' into test

wks 2 lat temu
rodzic
commit
9482bbcc6b

+ 3 - 0
src/main/java/com/ydtech/modules/ins/model/guoren/PremiumReq.java

@@ -18,6 +18,7 @@ import com.ydtech.modules.order.entity.api.guoren.constants.RelifReason;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.VehicleAndVesselTax;
 import com.ydtech.modules.order.entity.vo.guoren.GuoRenSpecialAgreementVo;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.DateTimeUtil;
 import com.ydtech.utils.StringUtils;
 import lombok.Data;
@@ -868,6 +869,8 @@ public class PremiumReq {
 
             public PrpTcarshipTaxDTO(VehicleAndVesselTax vehicleAndVesselTax) {
                 RelifReason flag = Enum.valueOf(RelifReason.class, RelifReason.TITLE + vehicleAndVesselTax.getTaxRelifFlag());
+                AssertionUtils.isEmpty(flag, "车船税信息不能为空");
+
                 this.taxRelifFlag = flag.getCode();
 
                 //返回空

+ 8 - 2
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Base.java

@@ -371,8 +371,10 @@ public class Base {
         }
 
         if (null != biRiskInfo) {
-            base.setTInsrncBgnTmSY(biRiskInfo.getStartDate());
-            base.setTInsrncEndTmSY(biRiskInfo.getEndDate());
+            CarInsDateDto bidd = base.buildInsDate(ciRiskInfo.getStartDate(), ciRiskInfo.getEndDate());
+            base.setTInsrncBgnTmSY(bidd.getStartDate());
+            base.setTInsrncEndTmSY(bidd.getEndDate());
+
             base.setAppSYFlag("Y");
             if("1,2,3,".contains(carInfo.getEnergyType())){
                 //新能源险种拼装
@@ -411,6 +413,10 @@ public class Base {
         } else {
             cidd.setStartDate(startDate);
             cidd.setEndDate(endDate);
+            LocalDateTime sEndDateTime = DateTimeUtil.parseLocalDateTime(startDate, DateTimeUtil.DATETIME_PATTERN);
+            sEndDateTime = sEndDateTime.plusYears(1).minusSeconds(1);
+
+            cidd.setEndDate(DateTimeUtil.format(sEndDateTime, "yyyy-MM-dd HH:mm:ss"));
 
         }
         return cidd;

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

@@ -1,11 +1,15 @@
 package com.ydtech.modules.order.aop.aspect;
 
 
+import com.ydtech.constants.enums.InsuranceRisk;
+import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.constants.sys.SystemConstant;
 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.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.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
@@ -20,6 +24,7 @@ import org.aspectj.lang.annotation.Before;
 import org.springframework.stereotype.Component;
 
 import java.util.Arrays;
+import java.util.List;
 
 @Slf4j
 @Aspect
@@ -54,7 +59,34 @@ public class QuoteVerificationAspect {
 
                 //税源查询
                 BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
-                String productid = quoteInfo.getProductid();
+                String productid ;
+                List<KindInfoVo> kinds = quoteInfo.getKindList();
+                List<RiskInfoVo> risks = quoteInfo.getRiskList();
+
+                boolean haveCarDamageKind = false;//是否含车损
+                boolean haveBusiKind = false;//是否含车损外的商业险种
+                for (KindInfoVo kindInfoVo : kinds) {
+                    String code = kindInfoVo.getKindCode();
+                    // 车损
+                    if ("A".equalsIgnoreCase(code)) {
+                        haveCarDamageKind = true;
+                    }
+                    if ("B,D3,D4,".contains(code + ",")) {
+                        haveBusiKind = true;
+                    }
+                }
+                if (risks.size() == 1 && InsuranceRisk.TRAFFIC.getCode().equals(risks.get(0).getRiskCode())) {
+                    productid = ProductsType.PT_0330.getCode();//单交
+                } else if (risks.size() == 1 && !haveCarDamageKind && haveBusiKind) {
+                    productid = ProductsType.PT_034002.getCode();//单三
+                } else if (risks.size() == 1) {
+                    productid = ProductsType.PT_034001.getCode();//单商
+                } else if (risks.size() == 2 && !haveCarDamageKind && haveBusiKind) {
+                    productid = ProductsType.PT_0330034002.getCode();//交三
+                } else {
+                    productid = ProductsType.PT_0330034001.getCode();//交商
+                }
+
                 String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(), quoteInfo.getCarInfo().getEnginedesc(), productid);
                 if(!"".equals(taxAgreementId)){
                     ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);

+ 4 - 0
src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java

@@ -51,6 +51,10 @@ public class InsOrdersComponents {
     }
 
 
+
+
+
+
     /**
      * 通过订单号校验核保规则
      * 通订单号获取报价信息

+ 1 - 1
src/main/java/com/ydtech/modules/order/components/ZhongmeiRequestApiComponents.java

@@ -206,7 +206,7 @@ public class ZhongmeiRequestApiComponents {
 
     public <T extends BaseResponse> void validationResults(T t) {
         if ("-1".equals(t.getHead().getReturnCode())) {
-            if(StringUtils.isNotEmpty(t.getHead().getReturnMessage())&& t.getHead().getReturnMessage().contains("平台返回") && t.getHead().getReturnMessage().contains("重复投保")){
+            if(StringUtils.isNotEmpty(t.getHead().getReturnMessage())&& t.getHead().getReturnMessage().contains("商业险重复投保") && t.getHead().getReturnMessage().contains("重复投保的本公司的保单信息")){
 
             }else{
                 throw new SystemException(t.getHead().getReturnMessage());

+ 1 - 4
src/main/java/com/ydtech/modules/order/entity/vo/BaseQuoteInfoVo.java

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

+ 38 - 29
src/main/java/com/ydtech/modules/protocol/service/impl/TaxSourceServiceImpl.java

@@ -24,6 +24,7 @@ import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
 import com.ydtech.modules.protocol.service.ITaxSourceService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -79,10 +80,10 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     @Transactional
     public boolean saveTaxSource(TaxSourceVo taxSourceVo) {
         //删除排除的信息
-        taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId,
-                taxSourceVo.getInsCompanyId()));
+        taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
         //删除税源配置信息
-        baseMapper.delete(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
+        baseMapper.delete(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
+                taxSourceVo.getInsCompanyId()));
         //组装税源数据
         List<TaxSourceDto> dtos = new ArrayList<>();
         List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
@@ -140,16 +141,15 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     public TaxSourceVo getTaxSource(String companyId) {
         TaxSourceVo taxSourceVo = new TaxSourceVo();
         //税源信息
-        List<TaxSourceDto> taxSourceDto = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
-                companyId));
+        List<TaxSourceDto> taxSourceDto =
+                baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
+                        companyId));
         //排除的部门信息
-        List<TaxSourceExcludeDto> taxSourceExcludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
-                .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
-                .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
+        List<TaxSourceExcludeDto> taxSourceExcludeDepts =
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
         //排除的车牌号信息
-        List<TaxSourceExcludeDto> taxSourceExcludeLicense = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>()
-                .eq(TaxSourceExcludeDto::getInsCompanyId, companyId)
-                .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+        List<TaxSourceExcludeDto> taxSourceExcludeLicense =
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
 
         taxSourceVo.setInsCompanyId(companyId);
 
@@ -207,24 +207,28 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
     }
 
 //    @Override
-//    public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,String volume) {
+//    public List<PtlAgreementInsCompanyDto> getAgreementInsCompany(String deptId, String userId, String license,
+//    String volume) {
 //        //查出所有协议
 //        List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
 //        if(license != null && volume != null) {
 //            //排除的部门信息
-//            List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq
+//            List<TaxSourceExcludeDto> excludeDepts = taxSourceExcludeService.list(new
+//            LambdaQueryWrapper<TaxSourceExcludeDto>().eq
 //            (TaxSourceExcludeDto::getExcludeInfo, deptId)
 //                    .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
 //
 //            agreementInsCompany.forEach(item ->
 //                    excludeDepts.stream()
-//                            .filter(taxSourceDto -> item.getId().equals(taxSourceDto.getInsCompanyId()) && taxSourceDto.getExcludeInfo
+//                            .filter(taxSourceDto -> item.getId().equals(taxSourceDto.getInsCompanyId()) &&
+//                            taxSourceDto.getExcludeInfo
 //                            ().equals(deptId))
 //                            .findFirst()
 //                            .ifPresent(taxSourceDto -> item.setIsExclude(TaxSourceStatusConstants.TAX_SOURCE_START))
 //            );
 //            //查找排除的车牌号
-//            List<TaxSourceExcludeDto> licenseExclude = taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq
+//            List<TaxSourceExcludeDto> licenseExclude = taxSourceExcludeService.list(new
+//            LambdaQueryWrapper<TaxSourceExcludeDto>().eq
 //            (TaxSourceExcludeDto::getExcludeInfo, license)
 //                    .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
 //            agreementInsCompany.forEach(item -> {
@@ -292,8 +296,8 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         List<PtlAgreementInsCompanyDto> agreementInsCompany = this.getAgreementInsCompany(deptId, userId);
 
         //查找是否配置税源
-        List<TaxSourceDto> taxSourceDtos = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource,
-                "1"));
+        List<TaxSourceDto> taxSourceDtos =
+                baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getIsTaxSource, "1"));
         //设置税源参数
         agreementInsCompany.forEach(item -> {
             if (!TaxSourceStatusConstants.TAX_SOURCE_START.equals(item.getIsExclude())) {
@@ -324,27 +328,31 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
      * @return
      */
     @Override
-    public String getAgreementId(String deptId, String userId, String companyId, String license, String volume, String productid) {
+    public String getAgreementId(String deptId, String userId, String companyId, String license, String volume,
+                                 String productid) {
         // 车牌前两位
         String firstTwoPlates = license.substring(0, 2);
         String resultId = "";
 
         //查找配置的默认项
-        List<TaxSourceDto> taxSourceDtoList = baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>()
-                .eq(TaxSourceDto::getInsCompanyId, companyId));
+        List<TaxSourceDto> taxSourceDtoList =
+                baseMapper.selectList(new LambdaQueryWrapper<TaxSourceDto>().eq(TaxSourceDto::getInsCompanyId,
+                        companyId));
+
+        if(taxSourceDtoList.isEmpty()){
+            return resultId;
+        }
 
         List<TaxSourceDto> taxSource =
                 taxSourceDtoList.stream().filter(x -> x.getLicense().equals(firstTwoPlates)).collect(Collectors.toList());
         if (!taxSource.isEmpty()) {
-            resultId = taxSourceDtoList.get(0).getAgreementId();
+            resultId = taxSource.get(0).getAgreementId();
         }
 
         boolean isExclude = false;
         //排除的部门信息
-        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))) {
@@ -353,9 +361,7 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
 
         //查找排除的车牌号
         List<TaxSourceExcludeDto> licenseExclude =
-                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo,
-                                firstTwoPlates)
-                        .eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
+                taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, firstTwoPlates).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_LICENSE));
 
         //车牌排除
         if (licenseExclude.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(firstTwoPlates))) {
@@ -365,16 +371,19 @@ public class TaxSourceServiceImpl extends ServiceImpl<TaxSourceMapper, TaxSource
         // 税源
         TaxSourceDto taxSourceDtos =
                 taxSourceDtoList.stream().filter(x -> x.getIsTaxSource().equals("1")).collect(Collectors.toList()).get(0);
+
         if (!isExclude && (Float.parseFloat(volume) >= 1) && (taxSourceDtos != null)) {
             resultId = taxSourceDtos.getAgreementId();
         }
 
         // 不包含险种 随机其他保险公司
-        if (taxSourceDtos != null && taxSourceDtos.getInsuranceRepertoire().contains(productid) && Objects.equals(resultId, taxSourceDtos.getAgreementId())) {
+
+        if (taxSourceDtos != null && taxSourceDtos.getAgreementId().equals(resultId) && taxSourceDtos.getInsuranceRepertoire().contains(productid+",")) {
             resultId = taxSourceDtos.getBanishAgreementId();
         }
 
         return resultId;
     }
 
+
 }