Browse Source

2-7百分比 两位小数

yangyj 2 tháng trước cách đây
mục cha
commit
6d326f69f1

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

@@ -1652,7 +1652,11 @@ public class ExecutorMeter extends FormulaExecutor {
                     }
                     sis.setCompleted(end.getCompleted().toPlainString());
                     sis.setCurrentPeriodEndPay(end.getMoney().toPlainString());
-                    sis.setPayRatio(ratioFc.apply(sis.getCurrentPeriodEndPay(), sis.getChangeMoney())+"%");
+                    BigDecimal percent= BaseUtils.str2BigDecimal(ratioFc.apply(sis.getCurrentPeriodEndPay(), sis.getChangeMoney()));
+                    if(BigDecimal.ZERO.compareTo(percent)>0) {
+                        /*百分比大于零才显示*/
+                        sis.setPayRatio(percent.setScale(2,RoundingMode.HALF_UP).stripTrailingZeros().toPlainString()+"%");
+                    }
                 }
                 totalList.add(sis);
             });