Bladeren bron

1.修改时如果是含增值税结算 则不需要除1.06

wuhp 2 jaren geleden
bovenliggende
commit
f2cbfd17be
1 gewijzigde bestanden met toevoegingen van 62 en 24 verwijderingen
  1. 62 24
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

+ 62 - 24
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -72,6 +72,7 @@ import java.time.LocalTime;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -1368,42 +1369,79 @@ handlingProportion,
                 insPlyIncome.setOtherFeevalue(insPlyIncomeVo.getPtOtherFeevalue());
             }
         } else {
-            BigDecimal divisor = new BigDecimal("1.06"); // 最好是使用字符串来避免精度损失
+            String agreementId = insPlyIncomeVo.getAgreementId();
+
+
             BigDecimal jqNoTaxPremium = insPlyIncomeVo.getJqPremium();// 交强手续费  按照思路  交强不含税保费* 交强手续费比例  =交强手续费
             BigDecimal syNoTaxPremium = insPlyIncomeVo.getSyPremium();// 商业手续费  按照思路  商业不含税保费* 商业手续费比例  =商业手续费
             BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoPremium();// 非车手续费  按照思路  非车不含税保费* 非车手续费比例  =非车手续费
-            if (jqNoTaxPremium != null && insPlyIncomeVo.getJqSuperviseCostsProportion() != null && insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
 
-                insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(jqNoTaxPremium, insPlyIncomeVo.getJqSuperviseCostsProportion()));
-                insPlyIncome.setJqSuperviseCostsProportion(insPlyIncomeVo.getJqSuperviseCostsProportion());
+            if(StringUtils.isNotEmpty(agreementId)){
+                PtlAgreement ptlAgreement = ptlAgreementService.getById(agreementId);
+                if(StringUtils.isNotEmpty(ptlAgreement.getWithTax()) && "是".equals(ptlAgreement.getWithTax())){
+                    if (jqNoTaxPremium != null && insPlyIncomeVo.getJqSuperviseCostsProportion() != null && insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setJqSuperviseCostsPremiums(algorithmAmount(jqNoTaxPremium, insPlyIncomeVo.getJqSuperviseCostsProportion()));
+                        insPlyIncome.setJqSuperviseCostsProportion(insPlyIncomeVo.getJqSuperviseCostsProportion());
+                    }
 
-            }
+                    if (syNoTaxPremium != null && insPlyIncomeVo.getSySuperviseCostsProportion() != null && insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setSySuperviseCostsPremiums(algorithmAmount(syNoTaxPremium, insPlyIncomeVo.getSySuperviseCostsProportion()));
+                        insPlyIncome.setSySuperviseCostsProportion(insPlyIncomeVo.getSySuperviseCostsProportion());
+                    }
 
-            if (syNoTaxPremium != null && insPlyIncomeVo.getSySuperviseCostsProportion() != null && insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
-                insPlyIncome.setSySuperviseCostsPremiums(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getSySuperviseCostsProportion()));
-                insPlyIncome.setSySuperviseCostsProportion(insPlyIncomeVo.getSySuperviseCostsProportion());
-            }
+                    if (noNoTaxPremium != null && insPlyIncomeVo.getNoSuperviseCostsProportion() != null && insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setNoSuperviseCostsProportion(insPlyIncome.getNoSuperviseCostsProportion());
+                        insPlyIncome.setNoSuperviseCostsPremiums(algorithmAmount(noNoTaxPremium, insPlyIncomeVo.getNoSuperviseCostsProportion()));
+                    }
 
-            if (noNoTaxPremium != null && insPlyIncomeVo.getNoSuperviseCostsProportion() != null && insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
-                insPlyIncome.setNoSuperviseCostsProportion(insPlyIncome.getNoSuperviseCostsProportion());
-                insPlyIncome.setNoSuperviseCostsPremiums(getBigDecimal(noNoTaxPremium, insPlyIncomeVo.getNoSuperviseCostsProportion()));
-            }
+                    if (jqNoTaxPremium != null && insPlyIncomeVo.getJqOtherCostsProportion() != null && insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setJqOtherCostsPremium(algorithmAmount(jqNoTaxPremium, insPlyIncomeVo.getJqOtherCostsProportion()));
+                        insPlyIncome.setJqOtherCostsProportion(insPlyIncomeVo.getJqOtherCostsProportion());
+                    }
 
-            if (jqNoTaxPremium != null && insPlyIncomeVo.getJqOtherCostsProportion() != null && insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
-                insPlyIncome.setJqOtherCostsPremium(getBigDecimal(jqNoTaxPremium, insPlyIncomeVo.getJqOtherCostsProportion()));
-                insPlyIncome.setJqOtherCostsProportion(insPlyIncomeVo.getJqOtherCostsProportion());
-            }
+                    if (syNoTaxPremium != null && insPlyIncomeVo.getSyOtherCostsProportion() != null && insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setSyOtherCostsProportion(insPlyIncome.getSyOtherCostsProportion());
+                        insPlyIncome.setSyOtherCostsPremium(algorithmAmount(syNoTaxPremium, insPlyIncomeVo.getSyOtherCostsProportion()));
+                    }
+                    if (noNoTaxPremium != null && insPlyIncomeVo.getOtherFeerate() != null && insPlyIncomeVo.getOtherFeerate().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setNoOtherCostsProportion(insPlyIncome.getOtherFeerate());
+                        insPlyIncome.setNoOtherCostsPremium(algorithmAmount(noNoTaxPremium, insPlyIncomeVo.getOtherFeerate()));
+                    }
+                }else {
+                    if (jqNoTaxPremium != null && insPlyIncomeVo.getJqSuperviseCostsProportion() != null && insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setJqSuperviseCostsPremiums(getBigDecimal(jqNoTaxPremium, insPlyIncomeVo.getJqSuperviseCostsProportion()));
+                        insPlyIncome.setJqSuperviseCostsProportion(insPlyIncomeVo.getJqSuperviseCostsProportion());
+                    }
 
-            if (syNoTaxPremium != null && insPlyIncomeVo.getSyOtherCostsProportion() != null && insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
-                insPlyIncome.setSyOtherCostsProportion(insPlyIncome.getSyOtherCostsProportion());
-                insPlyIncome.setSyOtherCostsPremium(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getSyOtherCostsProportion()));
-            }
+                    if (syNoTaxPremium != null && insPlyIncomeVo.getSySuperviseCostsProportion() != null && insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setSySuperviseCostsPremiums(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getSySuperviseCostsProportion()));
+                        insPlyIncome.setSySuperviseCostsProportion(insPlyIncomeVo.getSySuperviseCostsProportion());
+                    }
+
+                    if (noNoTaxPremium != null && insPlyIncomeVo.getNoSuperviseCostsProportion() != null && insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setNoSuperviseCostsProportion(insPlyIncome.getNoSuperviseCostsProportion());
+                        insPlyIncome.setNoSuperviseCostsPremiums(getBigDecimal(noNoTaxPremium, insPlyIncomeVo.getNoSuperviseCostsProportion()));
+                    }
+
+                    if (jqNoTaxPremium != null && insPlyIncomeVo.getJqOtherCostsProportion() != null && insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setJqOtherCostsPremium(getBigDecimal(jqNoTaxPremium, insPlyIncomeVo.getJqOtherCostsProportion()));
+                        insPlyIncome.setJqOtherCostsProportion(insPlyIncomeVo.getJqOtherCostsProportion());
+                    }
 
-            if (noNoTaxPremium != null && insPlyIncomeVo.getOtherFeerate() != null && insPlyIncomeVo.getOtherFeerate().compareTo(BigDecimal.ZERO) != 0) {
-                insPlyIncome.setNoOtherCostsProportion(insPlyIncome.getOtherFeerate());
-                insPlyIncome.setNoOtherCostsPremium(getBigDecimal(noNoTaxPremium, insPlyIncomeVo.getOtherFeerate()));
+                    if (syNoTaxPremium != null && insPlyIncomeVo.getSyOtherCostsProportion() != null && insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setSyOtherCostsProportion(insPlyIncome.getSyOtherCostsProportion());
+                        insPlyIncome.setSyOtherCostsPremium(getBigDecimal(syNoTaxPremium, insPlyIncomeVo.getSyOtherCostsProportion()));
+                    }
+
+                    if (noNoTaxPremium != null && insPlyIncomeVo.getOtherFeerate() != null && insPlyIncomeVo.getOtherFeerate().compareTo(BigDecimal.ZERO) != 0) {
+                        insPlyIncome.setNoOtherCostsProportion(insPlyIncome.getOtherFeerate());
+                        insPlyIncome.setNoOtherCostsPremium(getBigDecimal(noNoTaxPremium, insPlyIncomeVo.getOtherFeerate()));
+                    }
+
+                }
             }
 
+
             if ("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "0".equals(insPlyIncomeVo.getIsNotCar())) {  //保险  手续费 =不含税保费* 手续费比例
                 insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(), insPlyIncome.getSySuperviseCostsPremiums(), null)); // 手续费
                 insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(), insPlyIncome.getSySuperviseCostsProportion(), null));//手续费比例