Browse Source

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

huangtf 8 tháng trước cách đây
mục cha
commit
e8fda52999

+ 6 - 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;
 
 /**
@@ -28,6 +30,9 @@ public class InterimPaymentSummary {
     /**变更后的金额*/
     @JSONField(name = "key_4",label="变更后的金额",ordinal = 4)
     private String revisedAmount;
+    /**上期累计支付*/
+    @JSONField(name = "key_11",label="至上期累计支付",ordinal = 5)
+    private String previousPeriodEndPay;
     /**本次批准支付金额*/
     @JSONField(name = "key_5",label="本次批准支付金额",ordinal = 5)
     private String currentPeriodPay;
@@ -52,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);
         /*变更金额*/

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

@@ -345,10 +345,10 @@ public class ExecutorMeter extends FormulaExecutor {
                        if(Func.isEmpty(cm.getKey()))continue;
                      InventoryForm inventoryForm=dictMap.get(cm.getKey());
                      if(inventoryForm!=null) {
-                         InterimPaymentCertificate ipc = new InterimPaymentCertificate(inventoryForm.getFormName());
                          /*中期支付汇总的章次*/
                          String ch = inventoryForm.getFormNumber();
-                         ipc.setChapterSeq(ch + (BaseUtils.isNumber(ch) ? "章" : ""));
+                         InterimPaymentCertificate ipc = new InterimPaymentCertificate(ch + (BaseUtils.isNumber(ch) ? "章" : ""));
+                         ipc.setChapterSeq(ipc.getItemName());
                          BigDecimal[] bmMoney = cm.getValue();
                          ipc.setContractAmount(bmMoney[0].toString());
                          ipc.setRevisedAmount(bmMoney[1].toString());
@@ -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();
@@ -470,7 +470,7 @@ public class ExecutorMeter extends FormulaExecutor {
             /**支付金额*/
             private BigDecimal money=BigDecimal.ZERO;
             /**本次支付金额*/
-            private BigDecimal currentPeriodPay=BigDecimal.ZERO;
+           /* private BigDecimal currentPeriodPay=BigDecimal.ZERO;*/
             /**累计支付B金额*/
             private BigDecimal currentPeriodEndPay=BigDecimal.ZERO;
 
@@ -503,8 +503,7 @@ public class ExecutorMeter extends FormulaExecutor {
             /*当前期合并往期计算累计值*/
             public Summary merge(Summary previous){
                  if(previous!=null){
-                     this.currentPeriodPay=this.money;
-                     this.currentPeriodEndPay=this.currentPeriodPay.add(previous.money);
+                     this.currentPeriodEndPay=this.money.add(previous.money);
                      this.completed=this.completed+previous.completed;
                  }
                 return this;
@@ -539,7 +538,9 @@ public class ExecutorMeter extends FormulaExecutor {
             List<SubprojectInterimPaymentSummary> totalList = new ArrayList<>();
             List<String> numbers=  paymentsPeriodEnd.stream().map(Payment::getNumber).distinct().collect(Collectors.toList());
             numbers.forEach(number->{
+                /*往期汇总*/
                 Summary pre =preSummary.get(number);
+                /*本期汇总*/
                 Summary cur = currentSummary.get(number);
                 SubprojectInterimPaymentSummary sis = new SubprojectInterimPaymentSummary();
                 Summary main =cur;
@@ -553,7 +554,6 @@ public class ExecutorMeter extends FormulaExecutor {
                 sis.setChangeMoney(main.getChangeMoney().toString());
                 if(cur!=null){
                     sis.setCurrentPeriodCompleted(cur.getCompleted().toString());
-                    sis.setCurrentPeriodPay(cur.getCurrentPeriodPay().toString());
                 }
                 if(pre!=null){
                     sis.setPreviousPeriodPay(pre.getMoney().toString());
@@ -561,9 +561,12 @@ public class ExecutorMeter extends FormulaExecutor {
                 }
                 if(cur!=null&&pre!=null){
                     main.merge(pre);
+                }else{
+                    /*如果只有其中一项,则不需要合并金额*/
+                    main.setCurrentPeriodEndPay(main.getMoney());
                 }
                 sis.setCompleted(main.getCompleted().toString());
-                sis.setCurrentPeriodPay(main.getCurrentPeriodPay().toString());
+                sis.setCurrentPeriodPay(main.getMoney().toString());
                 sis.setCurrentPeriodEndPay(main.getCurrentPeriodEndPay().toString());
                 sis.setPayRatio(ratioFc.apply(sis.getCurrentPeriodEndPay(),sis.getChangeMoney()));
                 totalList.add(sis);
@@ -663,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()));
@@ -698,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);
@@ -723,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()));