Przeglądaj źródła

永诚内部协议 优惠不-1

785834757 1 rok temu
rodzic
commit
0644d0ab8b

+ 2 - 2
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java

@@ -57,7 +57,7 @@ public interface FeeRuleSchemeNewService {
      * @param insAreaCompany
      * @param insOrders
      */
-    void verificationCostFactor(QuoteRespVo quoteRespVo, InsAreaCompany insAreaCompany, InsOrders insOrders, StringBuilder logs);
+    void verificationCostFactor(QuoteRespVo quoteRespVo, InsAreaCompany insAreaCompany, InsOrders insOrders, StringBuilder logs, boolean isInternalAgreement);
 
     /**
      * 查找匹配承保规则的因子
@@ -96,7 +96,7 @@ public interface FeeRuleSchemeNewService {
      *
      * @param costsId
      */
-    void calcCosts(String costsId, InsAreaCompany insAreaCompany);
+    void calcCosts(String costsId, InsAreaCompany insAreaCompany, boolean isInternalAgreement);
 
 
     void calcCostsTest(String costsId, InsAreaCompany insAreaCompany);

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

@@ -48,6 +48,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.math.RoundingMode;
 import java.text.DateFormat;
 import java.time.LocalDate;
@@ -138,7 +139,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
      * 校验费用因子
      */
     @Override
-    public void verificationCostFactor(QuoteRespVo quoteRespVo, InsAreaCompany insAreaCompany, InsOrders insOrders, StringBuilder logs) {
+    public void verificationCostFactor(QuoteRespVo quoteRespVo, InsAreaCompany insAreaCompany, InsOrders insOrders, StringBuilder logs, boolean isInternalAgreement) {
 
         List<AgreementProductCosts> agreementProductCostsNoMatched =
                 ptlAgreementProductCostsNewService.costsGetList(insAreaCompany.getAgreementId(), insAreaCompany.getProductid());
@@ -198,7 +199,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
             //遍历费用因子
             String costsId = verificationCosts(agreementProductCosts, quoteRespVo, insAreaCompany, insOrders, logs);
             if (costsId != null) {
-                calcCosts(costsId, insAreaCompany);
+                calcCosts(costsId, insAreaCompany, isInternalAgreement);
                 log.debug("费用因子校验通过,子订单id:" + insAreaCompany.getId() + ",费用id:" + costsId);
             }
         } else {
@@ -335,7 +336,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
      * @param insAreaCompany
      */
     @Override
-    public void calcCosts(String costsId, InsAreaCompany insAreaCompany) {
+    public void calcCosts(String costsId, InsAreaCompany insAreaCompany, boolean isInternalAgreement) {
         //获取协议信息
         PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
         InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
@@ -468,8 +469,13 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                 .add(retailProportion.getNoRetailLevel2Proportion())
                 .add(retailProportion.getNoRetailLevel3Proportion());
 
-        // 外部订单比例
-        BigDecimal enterProportion = sysSwitchConfigService.getEnterProportion(insOrders.getDeptid(), insOrders.getEntryStatus());
+        BigDecimal enterProportion = new BigDecimal(BigInteger.ZERO);
+        
+        // 待客录单订单比例 根据前端传值 判断是否使用待客录单比例
+        if(!isInternalAgreement){
+            enterProportion = sysSwitchConfigService.getEnterProportion(insOrders.getDeptid(), insOrders.getEntryStatus());
+        }
+        
 
         //重新计算比例  入口是否超出支付的比例
         ReCalcuLateProportion jqReCalcuLateProportion = recalculateProportion(

+ 14 - 5
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -35,11 +35,9 @@ 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.PtlAgreementGroupLinkAgreement;
 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.PtlAgreementService;
-import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
+import com.ydtech.modules.protocol.service.*;
 import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
@@ -111,6 +109,8 @@ public class QuoteVerificationAspect {
 
     private final SysQuoteRedisService sysQuoteRedisService;
 
+    private final PtlAgreementGroupLinkAgreementService ptlAgreementGroupLinkAgreementService;
+
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result) {
         //计算费用因子
@@ -120,6 +120,15 @@ public class QuoteVerificationAspect {
                     insAreaCompanyAccidentalDrivingService.getByCompanyId(insAreaCompany.getId());
             insAreaCompany.setAccidentalDriving(insAreaCompanyAccidentalDriving);
             InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+            String agreementId = insAreaCompany.getAgreementId();
+            boolean isInternalAgreement = false;
+            // 查找是否是内部协议
+            PtlAgreementGroupLinkAgreement ptlAgreementGroupLinkAgreement = ptlAgreementGroupLinkAgreementService.getOne(new LambdaQueryWrapper<PtlAgreementGroupLinkAgreement>()
+                    .eq(PtlAgreementGroupLinkAgreement::getPtlAgreementId, agreementId)
+                    .eq(PtlAgreementGroupLinkAgreement::getPtlAgreementGroupId, 2));
+            if (ptlAgreementGroupLinkAgreement != null){
+                isInternalAgreement = true;
+            }
             // 更新数据
             if (StringUtils.isNotEmpty(insAreaCompany.getLeaderId())) {
                 SysUser sysUser = sysUserService.getById(insOrders.getUserid());
@@ -132,7 +141,7 @@ public class QuoteVerificationAspect {
             StringBuilder logs = new StringBuilder();
             //再进行费用因子判断
             try {
-                feeRuleSchemeNewService.verificationCostFactor(result.getData(), insAreaCompany, insOrders, logs);
+                feeRuleSchemeNewService.verificationCostFactor(result.getData(), insAreaCompany, insOrders, logs, isInternalAgreement);
                 InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(insAreaCompany.getId());
                 if (insFeeOrderNew != null) {
                     //出口