cr 5 дней назад
Родитель
Сommit
9b96d888d1

+ 11 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/RebateIncentiveAdvPay.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import org.springblade.common.utils.BaseUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 
 /**
  * @author yangyj
@@ -39,13 +40,21 @@ public class RebateIncentiveAdvPay implements  DataModel{
     public void calc(String contractAmount,String dyTotalAmount,String currentPeriodEndPay){
         double contractAmountD=BaseUtils.obj2DoubleZero(contractAmount);
         //2025/7/23  修改逻辑 将最后算出来的值需要减去上期末的扣回动员预付款 currentPeriodEndPay
-        double x=((2*(BaseUtils.obj2DoubleZero(subtotal) -0.3*contractAmountD)*BaseUtils.obj2DoubleZero(dyTotalAmount))/contractAmountD)-BaseUtils.obj2DoubleZero(currentPeriodEndPay);
+        double x=((2*(BaseUtils.obj2DoubleZero(subtotal) -0.3*contractAmountD)*BaseUtils.obj2DoubleZero(dyTotalAmount))/contractAmountD);
+        double y=BaseUtils.obj2DoubleZero(currentPeriodEndPay);
+        // 四舍五入后再相减
+        BigDecimal roundedX = new BigDecimal(x).setScale(0, BigDecimal.ROUND_HALF_UP);
+        BigDecimal roundedY = new BigDecimal(y).setScale(0, BigDecimal.ROUND_HALF_UP);
+        double result = roundedX.subtract(roundedY).doubleValue();
         if(x>0){
             /*扣回款本身就是负数*/
-            String s=new BigDecimal(x).setScale(5,BigDecimal.ROUND_HALF_UP).toPlainString();
+            String s=new BigDecimal(result).setScale(0,BigDecimal.ROUND_HALF_UP).toPlainString();
             this.retained =s ;
             this.currentPay=s;
         }
+        if(roundedX.compareTo(BigDecimal.ZERO)>0){
+            this.endPay=roundedX.toPlainString();
+        }
 
     }
 

+ 7 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java

@@ -1353,13 +1353,13 @@ public class ExecutorMeter extends FormulaExecutor {
                                      rebateIncentiveAdvPay.calc(baseInfo.getContractAmount().toPlainString(), dyTotalAmount,preSubTotal.getCurrentPeriodEndPay());
                                  }
                                  if (preSubTotal != null) {
-                                     // 对两个参数进行四舍五入后再计算
-                                     String currentPayRounded = BaseUtils.str2BigDecimal(rebateIncentiveAdvPay.getCurrentPay()).setScale(0, RoundingMode.HALF_UP).toPlainString();
-                                     String previousPayRounded = BaseUtils.str2BigDecimal(preSubTotal.getCurrentPeriodEndPay()).setScale(0, RoundingMode.HALF_UP).toPlainString();
-                                     String endapply = addFc.apply(currentPayRounded, previousPayRounded);
-                                    // rebateIncentiveAdvPay.setEndPay("0");
-                                     rebateIncentiveAdvPay.setEndPay(endapply);
-                                     //rebateIncentiveAdvPay.setEndPay(rebateIncentiveAdvPay.getEndPay());
+//                                     // 对两个参数进行四舍五入后再计算
+//                                     String currentPayRounded = BaseUtils.str2BigDecimal(rebateIncentiveAdvPay.getCurrentPay()).setScale(0, RoundingMode.HALF_UP).toPlainString();
+//                                     String previousPayRounded = BaseUtils.str2BigDecimal(preSubTotal.getCurrentPeriodEndPay()).setScale(0, RoundingMode.HALF_UP).toPlainString();
+//                                     String endapply = addFc.apply(currentPayRounded, previousPayRounded);
+//                                    // rebateIncentiveAdvPay.setEndPay("0");
+//                                     rebateIncentiveAdvPay.setEndPay(endapply);
+//                                     //rebateIncentiveAdvPay.setEndPay(rebateIncentiveAdvPay.getEndPay());
                                  } else {
                                      //累计扣回开工预付款金额
                                      rebateIncentiveAdvPay.setEndPay(rebateIncentiveAdvPay.getCurrentPay());