Parcourir la source

Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex

huangtf il y a 3 mois
Parent
commit
619e074400

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

@@ -1477,6 +1477,19 @@ public class ExecutorMeter extends FormulaExecutor {
                 sis.setChangeMoney(itf.getChangeMoney());
                 sis.setPrice(itf.getBidPrice());
                 if(cur!=null&&cur.getContractMoney()!=null) {
+                    FormulaUtils.getScale(cur.getUnit()).ifPresent(scale->{
+                        cur.setCompleted(BaseUtils.str2BigDecimal(cur.getCompleted()).setScale(scale,RoundingMode.HALF_UP).doubleValue());
+                        cur.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(cur.getPrice(),cur.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
+                        if (pre != null) {
+                            pre.setCompleted(BaseUtils.str2BigDecimal(pre.getCompleted()).setScale(scale,RoundingMode.HALF_UP).doubleValue());
+                            pre.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(pre.getPrice(),pre.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
+                            end.setCompleted(BaseUtils.str2BigDecimal(addFc.apply(cur.getCompleted().toString(),pre.getCompleted().toString())).setScale(scale,RoundingMode.HALF_UP).doubleValue());
+                            end.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(end.getPrice(),end.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
+                        }else {
+                            end.setCompleted(cur.getCompleted());
+                            end.setMoney(cur.getMoney());
+                        }
+                    });
                     sis.setCurrentPeriodPay(cur.getMoney().toPlainString());
                     sis.setCurrentPeriodCompleted(cur.getCompleted().toString());
                     if (pre != null) {