Browse Source

计量相关

yangyj 8 months ago
parent
commit
8de390d357

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/InterimPaymentSummary.java

@@ -2,8 +2,10 @@ package org.springblade.manager.vo;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
+import org.springblade.common.utils.BaseUtils;
 
 import java.math.BigDecimal;
+import java.math.MathContext;
 import java.math.RoundingMode;
 
 /**
@@ -55,6 +57,7 @@ public class InterimPaymentSummary {
     public void calculate(){
         /*本期累计金额*/
         BigDecimal currentPeriodEndPayBd =new BigDecimal(currentPeriodEndPay);
+        this.previousPeriodEndPay= BaseUtils.str2BigDecimal(this.currentPeriodEndPay).subtract(BaseUtils.str2BigDecimal(this.currentPeriodPay)).toString();
         /*合同金额*/
         BigDecimal contractAmountBd =new BigDecimal(contractAmount);
         /*变更金额*/

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

@@ -425,7 +425,7 @@ public class ExecutorMeter extends FormulaExecutor {
                 summary.setCurrentPeriodPay(StringUtils.number2StringZero(bfc.apply(dataList,InterimPaymentSummary::getCurrentPeriodPay),tec.getScale()));
                 summary.setCurrentPeriodEndPay(StringUtils.number2StringZero(bfc.apply(dataList,InterimPaymentSummary::getCurrentPeriodEndPay),tec.getScale()));
                 summary.setPayRatioA(ratioFc.apply(summary.getCurrentPeriodEndPay(),summary.getContractAmount()));
-                summary.setPayRatioA(ratioFc.apply(summary.getCurrentPeriodEndPay(),summary.getRevisedAmount()));
+                summary.setPayRatioB(ratioFc.apply(summary.getCurrentPeriodEndPay(),summary.getRevisedAmount()));
                 dataList.add(summary);
                 /*内容输出*/
                 putOut();
@@ -666,6 +666,7 @@ public class ExecutorMeter extends FormulaExecutor {
             smps.setItemName(payment.getName());
             smps.setFormNumber(payment.getNumber());
             smps.setUnit(payment.getUnit());
+            smps.setPrice(payment.getPrice());
             smps.setRevisedTotal(StringUtils.handleNull(payment.getChangeTotal()));
             /*本期完成数量*/
             smps.setCurrentPeriodCompleted(StringUtils.handleNull(payment.getCompleted()));
@@ -701,17 +702,6 @@ public class ExecutorMeter extends FormulaExecutor {
                     /*根据计量单元Id和清单Id分组清单*/
                     Map<String,Payment> preMeterPaymentGroup = previous.stream().collect(Collectors.toMap(Payment::meterFormKey,p->p,(p1,p2)->p2));
                     FormulaUtils.treeNodeSort(0,top);
-                   /* current.forEach(e -> {
-                        TreeNode<MeterTree> meterTreeNode=treeNodeMap.get(e.getMeterId());
-                        if(meterTreeNode!=null){
-                            MeterTree meterUnit = meterTreeNode.getValue();
-                            List<Payment> paymentList = paymentGroup.get(meterUnit.getId());
-                            for(Payment payment:paymentList){
-                                Payment prePayment = preMeterPaymentGroup.get(meterUnit.getId().toString()+payment.getFormId());
-                                this.treeNodeCheckedCount(meterTreeNode,payment,prePayment);
-                            }
-                        }
-                    });*/
                     /*路径选中,设置节点采集数据*/
                     paymentGroup.forEach((k,v)->{
                         TreeNode<MeterTree> meterTreeNode=treeNodeMap.get(k);
@@ -726,6 +716,7 @@ public class ExecutorMeter extends FormulaExecutor {
                         int size = (int)Math.ceil(tmp.size()/(double)this.capacity);
                         /*每一章需要留一行做小计,其他要填充空白行*/
                         SubInterimMeterPaySummary summary=  new SubInterimMeterPaySummary("小计");
+                        summary.setCurrentPeriodPay(tmp.stream().filter(e->e.getCompleted()!=null).map(SubInterimMeterPaySummary::getCurrentPeriodPay).filter(BaseUtils::isNumber).map(BigDecimal::new).reduce(BigDecimal.ZERO,BigDecimal::add).toString());
                         summary.setCurrentPeriodEndPay(tmp.stream().map(SubInterimMeterPaySummary::getCurrentPeriodEndPay).filter(BaseUtils::isNumber).map(BigDecimal::new).reduce(BigDecimal.ZERO,BigDecimal::add).toString());
                         summary.setCurrentPeriodEndPay(StringUtils.number2StringZero(summary.getCurrentPeriodEndPay(),tec.getScale()));