Quellcode durchsuchen

Merge remote-tracking branch 'origin/test' into test

wks vor 2 Jahren
Ursprung
Commit
fac3dfc44f

+ 3 - 3
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -257,7 +257,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 BigDecimal sumPremium = insFeeOrderNew.getJqPremium().add(insFeeOrderNew.getSyPremium()).add(insFeeOrderNew.getNoPremium());
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
                     insFeeOrderNew.setThirdDetailProportion(new BigDecimal(esmRetail.getDisrate3()));
-                    retailRadio = retailRadio.add(insFeeOrderNew.getThirdDetailProportion());
+                    retailRadio = retailRadio.add(insFeeOrderNew.getThirdDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
                     insFeeOrderNew.setThirdDetailPremiums(sumPremium.multiply(new BigDecimal(esmRetail.getDisrate3())).divide(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_DOWN));
                     if (parents != null && parents.size() > 2) {
                         insFeeOrderNew.setThreeLevelUserId(parents.get(2).getId());
@@ -265,7 +265,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 }
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
                     insFeeOrderNew.setSecondDetailProportion(new BigDecimal(esmRetail.getDisrate2()));
-                    retailRadio = retailRadio.add(insFeeOrderNew.getSecondDetailProportion());
+                    retailRadio = retailRadio.add(insFeeOrderNew.getSecondDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
                     insFeeOrderNew.setSecondDetailPremiums(sumPremium.multiply(new BigDecimal(esmRetail.getDisrate2())).divide(new BigDecimal("100")).setScale(2,BigDecimal.ROUND_DOWN));
                     if (parents != null && parents.size() > 1) {
                         insFeeOrderNew.setTwoLevelUserId(parents.get(1).getId());
@@ -273,7 +273,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 }
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
                     insFeeOrderNew.setFirstDetailProportion(new BigDecimal(esmRetail.getDisrate1()));
-                    retailRadio = retailRadio.add(insFeeOrderNew.getFirstDetailProportion());
+                    retailRadio = retailRadio.add(insFeeOrderNew.getFirstDetailProportion()).setScale(2, BigDecimal.ROUND_DOWN);
                     insFeeOrderNew.setFirstDetailPremiums(sumPremium.multiply(new BigDecimal(esmRetail.getDisrate1())).divide(new BigDecimal("100")).setScale(2,BigDecimal.ROUND_DOWN));
                     if (parents != null && parents.size() > 0) {
                         insFeeOrderNew.setFirstLevelUserId(parents.get(0).getId());

+ 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);

+ 7 - 5
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -831,8 +831,6 @@
                 AND day(a.signdate) =#{day}
             </if>
         </where>
-
-
     </select>
 
     <select id="allOtherAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
@@ -841,10 +839,14 @@
         MAX( a.company_name ) AS "companyName",
         MAX( a.company_id ) AS "companyId",
         MAX( a.partner_companies_name ) AS "partnerCompaniesName",
-        IFNULL ( max(c.settleMentAmount),0.00) as  "allInvoicCommissionFeevalue",
+        CASE
+        WHEN (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00)) = 0.00
+        THEN   IFNULL ( MAX(d.settleMentAmount) ,0.00)
+        ELSE (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00))
+        END AS "allInvoicCommissionFeevalue",
         IFNULL(max(f.settleMentAmount) , 0.00)  as  "readyCommissionFeevalue",
-        IFNULL ( max(d.settleMentAmount),0.00) as "invoicCommissionFeevalue",
-        sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
+        IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00)  as "invoicCommissionFeevalue",
+        sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
         sum( a.other_feevalue ) AS "otherFeevalue"
         FROM