Quellcode durchsuchen

2-7百分比 两位小数

yangyj vor 2 Monaten
Ursprung
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);
             });