1
0

4 Commits 514f6ed092 ... d2242f105a

Autor SHA1 Mensagem Data
  huangtf d2242f105a Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex 7 meses atrás
  huangtf d4e30ea5ae 中期支付证书变更 7 meses atrás
  huangtf 0d5571b828 Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex 7 meses atrás
  huangtf b6e10c36a2 变更 7 meses atrás

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

@@ -49,4 +49,7 @@ public class ChangeToken {
     @ApiModelProperty(value = "变更令申请金额")
     private BigDecimal totalChangeMoney;
 
+    @ApiModelProperty(value = "章节号")
+    private String chapterNumber;
+
 }

+ 11 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/InterimPaymentCertificate.java

@@ -57,6 +57,17 @@ public class InterimPaymentCertificate implements  DataModel{
     private Boolean isSummary=false;
 
 
+    /**本期末支付金额*/
+    @JSONField(name = "key_12",label="本期末变更金额",ordinal = 10)
+    private String currentPeriodEndChangeMoney;
+    /**上期末支付金额*/
+    @JSONField(name = "key_13",label="上期末变更金额",ordinal = 11)
+    private String previousPeriodEndChangeMoney;
+    /**本期支付金额*/
+    @JSONField(name = "key_14",label="本期变更金额",ordinal = 12)
+    private String currentPeriodChangeMoney;
+
+
     public InterimPaymentCertificate(String chapterSeq) {
         this.chapterSeq = chapterSeq;
     }

+ 2 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterInfo.java

@@ -31,5 +31,6 @@ public class MeterInfo {
     List<Material> materialsAll;
     /**合同段所有开工预付款信息*/
     List<StartPayForm> startPayFormAll;
-
+    /*变更令,按照计量清单*/
+    List<ChangeToken> changeTokenList;
 }

+ 1 - 25
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java

@@ -90,8 +90,7 @@ public class ExecutorInit extends FormulaExecutor {
 
         //变更令部分
         List<ChangeToken> changeTokenList = changeTokenFc.apply(tec.getContractId());
-
-        //List<ChangeToken> changeTokenList1 = getFilteredChangeTokens(changeTokenList,tec.periodInfo,0);
+        tec.meterInfo.setChangeTokenList(changeTokenList) ;
 
         /*每页内容都一样*/
         tec.getRepeatKeys().addAll(periodMap.keySet());
@@ -115,27 +114,4 @@ public class ExecutorInit extends FormulaExecutor {
         });
     }
 
-
-    public  List<ChangeToken> getFilteredChangeTokens(List<ChangeToken> changeTokenList, MeterPeriodInfo periodInfo, int type) {
-        switch (type) {
-            case 0:
-                return changeTokenList.stream()
-                        .filter(token -> (periodInfo.getStartDate().isBefore(token.getChangeApprovalDate())
-                                && !periodInfo.getEndDate().isBefore(token.getChangeApprovalDate())))
-                        .collect(Collectors.toList());
-            case 1:
-                return changeTokenList.stream()
-                        .filter(token -> token.getChangeApprovalDate().isBefore(periodInfo.getStartDate()))
-                        .collect(Collectors.toList());
-            case 2:
-                return changeTokenList.stream()
-                        .filter(token -> !token.getChangeApprovalDate().isAfter(periodInfo.getStartDate()))
-                        .collect(Collectors.toList());
-            default:
-                throw new IllegalArgumentException("Unsupported type: " + type);
-        }
-    }
-
-
-
 }

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

@@ -107,6 +107,40 @@ public class ExecutorMeter extends FormulaExecutor {
         return line;
     }
 
+    /**
+     * type=0 返回本期
+     *  periodInfo.startDate   <  changeApprovalDate <= periodInfo.endDate  的changeTokenList
+     *
+     * type=1 返回上期末
+     *  changeApprovalDate < periodInfo.startDate 的changeTokenList
+     *
+     * type=2 返回本期末
+     * changeApprovalDate <= periodInfo.startDate  的changeTokenList
+     * @param changeTokenList
+     * @param periodInfo
+     * @param type
+     * @return
+     */
+    public  List<ChangeToken> getFilteredChangeTokens(List<ChangeToken> changeTokenList, MeterPeriodInfo periodInfo, int type) {
+        switch (type) {
+            case 0:
+                return changeTokenList.stream()
+                        .filter(token -> (periodInfo.getStartDate().isBefore(token.getChangeApprovalDate())
+                                && !periodInfo.getEndDate().isBefore(token.getChangeApprovalDate())))
+                        .collect(Collectors.toList());
+            case 1:
+                return changeTokenList.stream()
+                        .filter(token -> token.getChangeApprovalDate().isBefore(periodInfo.getStartDate()))
+                        .collect(Collectors.toList());
+            case 2:
+                return changeTokenList.stream()
+                        .filter(token -> !token.getChangeApprovalDate().isAfter(periodInfo.getEndDate()))
+                        .collect(Collectors.toList());
+            default:
+                throw new IllegalArgumentException("Unsupported type: " + type);
+        }
+    }
+
     @Override
     public void handle() {
         this.elementWriter=new MeterElementWriter();
@@ -404,6 +438,13 @@ public class ExecutorMeter extends FormulaExecutor {
                 }
             }
 
+            /* 本期变更 */
+            List<ChangeToken> changeTokenList0 = getFilteredChangeTokens(tec.meterInfo.getChangeTokenList(),tec.periodInfo,0);
+            /* 上期末变更 */
+            List<ChangeToken> changeTokenList1 = getFilteredChangeTokens(tec.meterInfo.getChangeTokenList(),tec.periodInfo,1);
+            /* 本期末变更 */
+            List<ChangeToken> changeTokenList2 = getFilteredChangeTokens(tec.meterInfo.getChangeTokenList(),tec.periodInfo,2);
+
             Map<String,InterimPaymentCertificate> paymentCertificateMap = new LinkedHashMap<>();
              if(Func.isNotEmpty(paymentList)){
                  /*之前的计量期数据*/
@@ -434,6 +475,14 @@ public class ExecutorMeter extends FormulaExecutor {
                          ipc.setRevisedAmount(bmMoney[1].toString());
                          ipc.setPreviousPeriodEndPay(StringUtils.handleNullZero(previousMoney.get(cm.getKey()),tec.getScale()));
                          ipc.setCurrentPeriodPay(StringUtils.handleNull(currentMoney.get(cm.getKey())));
+
+                         ipc.setCurrentPeriodChangeMoney(StringUtils.handleNullZero(sumChangeMoneyForChapter(changeTokenList0,ch)
+                                 ,tec.getPayRadicScale()));
+                         ipc.setPreviousPeriodEndChangeMoney(StringUtils.handleNullZero(sumChangeMoneyForChapter(changeTokenList1,ch)
+                                 ,tec.getPayRadicScale()));
+                         ipc.setCurrentPeriodEndChangeMoney(StringUtils.handleNullZero(sumChangeMoneyForChapter(changeTokenList2,ch)
+                                 ,tec.getPayRadicScale()));
+
                          /*由已知求未知*/
                          ipc.calculate();
                          //dataList.add(ipc);
@@ -490,6 +539,31 @@ public class ExecutorMeter extends FormulaExecutor {
             }
         }
 
+        /**
+         * Sums the changeMoney for all ChangeTokens with the specified chapter number.
+         *
+         * @param changeTokens List of ChangeToken objects to be evaluated.
+         * @param chapterNumber The chapter number to filter the ChangeTokens.
+         * @return The sum of changeMoney for all ChangeTokens with the specified chapter number.
+         */
+        public  BigDecimal sumChangeMoneyForChapter(List<ChangeToken> changeTokens, String chapterNumber) {
+            if (changeTokens == null || changeTokens.isEmpty()) {
+                return BigDecimal.ZERO;
+            }
+
+            BigDecimal sum = BigDecimal.ZERO;
+            for (ChangeToken token : changeTokens) {
+                if (token.getChapterNumber() != null && token.getChapterNumber().equals(chapterNumber)) {
+                    BigDecimal changeMoney = token.getChangeMoney();
+                    if (changeMoney != null) {
+                        sum = sum.add(changeMoney);
+                    }
+                }
+            }
+
+            return sum;
+        }
+
 
     }
 

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaDao.java

@@ -33,8 +33,8 @@ public interface IFormulaDao {
     Function<Long,List<MeterApply>>  getMeterApplyFc();
     /**获取清表映射地址*/
     Function<List<String>, List<Map<String,Object>>>  getTableExcelInfoFc();
-
+    /**获取变更令*/
     Function<Long, List<ChangeTokenForm>> getChangeTokenFormFc();
-
+    /**获取变更令,按照每条清单*/
     Function<Long, List<ChangeToken>> getChangeTokenFc();
 }

+ 3 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java

@@ -185,8 +185,9 @@ public class FormulaDaoImpl implements IFormulaDao {
     @Override
     public Function<Long, List<ChangeToken>> getChangeTokenFc() {
         return  contractId->{
-            String sql="SELECT sctf.change_number, sctf.business_date, sctf.change_money as total_change_money, sctf.change_approval_date, scti.id, scti.change_token_id, scti.form_number, scti.change_money FROM s_change_token_form sctf " +
-                    "INNER JOIN s_change_token_inventory scti ON sctf.id = scti.change_token_id WHERE sctf.is_deleted = 0 AND sctf.approve_status = 2 AND scti.is_deleted = 0 AND sctf.contract_id =  "+contractId + " order by scti.change_token_id";
+            String sql="SELECT sctf.change_number, sctf.business_date, sctf.change_money as total_change_money, sctf.change_approval_date, scti.id, scti.change_token_id, scti.form_number, scti.change_money ,scif.chapter_number FROM s_change_token_form sctf " +
+                    "INNER JOIN s_change_token_inventory scti ON sctf.id = scti.change_token_id " +
+                    "INNER JOIN s_contract_inventory_form scif ON scti.contract_form_id = scif.id WHERE sctf.is_deleted = 0 AND sctf.approve_status = 2 AND scti.is_deleted = 0 AND sctf.contract_id =  "+contractId + " order by scti.change_token_id";
             return getEntityList(sql,ChangeToken.class);
         };
     }