Răsfoiți Sursa

材料的小数位

huangtf 8 luni în urmă
părinte
comite
d4997cdff8

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

@@ -222,10 +222,15 @@ public class ExecutorMeter extends FormulaExecutor {
                 for(Material m:materials){
                     m.setIndex(n++);
                     m.setRatio(StringUtils.number2StringZero(baseInfo.getDeductRatio(),tec.getPayRadicScale())+"%");
-                    m.setAdvancePayment(StringUtils.number2StringZero(Double.parseDouble(m.getSum())*baseInfo.getDeductRatio(),2));
                 }
                 this.total=StringUtils.number2StringZero(materials.stream().mapToDouble(m->Double.parseDouble(m.getSum())).sum(),tec.getScale());
                 this.totalAdvance=StringUtils.number2StringZero(materials.stream().mapToDouble(m->Double.parseDouble(m.getAdvancePayment())).sum(),tec.getScale());
+
+                //避免取整影响到total,totalAdvance
+                for(Material m:materials){
+                    m.setAdvancePayment(StringUtils.number2StringZero(Double.parseDouble(m.getSum())*baseInfo.getDeductRatio(),tec.getScale()));
+                    m.setSum(StringUtils.number2StringZero(m.getSum(),tec.getScale()));
+                }
                 /*合计*/
                 Material summary= new Material();
                 summary.setMaterialName("合计");