1
0

5 Commits d75df014c7 ... 629ba1188b

Autor SHA1 Mensagem Data
  huangtf 629ba1188b Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex 7 meses atrás
  huangtf 19d39efa83 变更令获取 7 meses atrás
  huangtf 6c719c120f Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex 7 meses atrás
  huangtf 1a9c1c3ad7 Merge branch 'master' of http://39.108.216.210:3000/zhuwei/bladex 7 meses atrás
  huangtf bbf8f5a05f 增加获取变更令 7 meses atrás

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

@@ -0,0 +1,52 @@
+package org.springblade.manager.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+@Data
+public class ChangeToken {
+
+    /**
+     * 变更令编号
+     */
+    @ApiModelProperty(value = "变更清单id")
+    private Long id;
+
+    /**
+     * 清单编号
+     */
+    @ApiModelProperty(value = "清单编号")
+    private String formNumber;
+
+    @ApiModelProperty(value = "变更令id")
+    private Long changeTokenId;
+
+    /**
+     * 变更申请金额
+     */
+    @ApiModelProperty(value = "变更清单申请金额")
+    private BigDecimal changeMoney;
+
+    @ApiModelProperty(value = "业务日期")
+    private LocalDate businessDate;
+
+
+    @ApiModelProperty(value = "变更批复日期")
+    private LocalDate changeApprovalDate;
+
+    /**
+     * 变更令编号
+     */
+    @ApiModelProperty(value = "变更令编号")
+    private String changeNumber;
+
+    /**
+     * 变更申请金额
+     */
+    @ApiModelProperty(value = "变更令申请金额")
+    private BigDecimal totalChangeMoney;
+
+}

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterPeriodInfo.java

@@ -60,5 +60,9 @@ public class MeterPeriodInfo implements  DataModel{
     /**证书id*/
     private Long reportId;
 
+    /**起始日期*/
+    private LocalDate startDate;
+    /**结束日期*/
+    private LocalDate endDate;
 
 }

+ 30 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java

@@ -15,6 +15,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * @author yangyj
@@ -33,6 +34,8 @@ public class ExecutorInit extends FormulaExecutor {
     private Function<Long, List<StartPayForm>> stayPayFormFc;
     private Function<Long, List<Material>> materialFormFc;
     private Function<Long,List<MeterPeriodInfo>> interimMeterPeriodAllFc;
+
+    private Function<Long,List<ChangeToken>> changeTokenFc;
     public static final String SZ="[ 一二三四五六七八九十]+";
 
 
@@ -84,6 +87,12 @@ public class ExecutorInit extends FormulaExecutor {
             }
         }
         LinkedHashMap<String, FormData> periodMap = FormulaUtils.toFormDataMap(tec.periodInfo);
+
+        //变更令部分
+        List<ChangeToken> changeTokenList = changeTokenFc.apply(tec.getContractId());
+
+        //List<ChangeToken> changeTokenList1 = getFilteredChangeTokens(changeTokenList,tec.periodInfo,0);
+
         /*每页内容都一样*/
         tec.getRepeatKeys().addAll(periodMap.keySet());
         tec.formDataMap.putAll(periodMap);
@@ -107,5 +116,26 @@ 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);
+        }
+    }
+
+
 
 }

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

@@ -2,6 +2,8 @@ package org.springblade.manager.service;
 
 import org.springblade.manager.formula.impl.ExecutorMeter;
 import org.springblade.manager.vo.*;
+import org.springblade.meter.entity.ChangeTokenForm;
+
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -32,5 +34,7 @@ public interface IFormulaDao {
     /**获取清表映射地址*/
     Function<List<String>, List<Map<String,Object>>>  getTableExcelInfoFc();
 
+    Function<Long, List<ChangeTokenForm>> getChangeTokenFormFc();
 
+    Function<Long, List<ChangeToken>> getChangeTokenFc();
 }

+ 20 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java

@@ -13,6 +13,7 @@ import org.springblade.manager.service.IContractInfoService;
 import org.springblade.manager.service.IFormulaDao;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.vo.*;
+import org.springblade.meter.entity.ChangeTokenForm;
 import org.springblade.meter.entity.MeterContractInfo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -120,7 +121,7 @@ public class FormulaDaoImpl implements IFormulaDao {
     @Override
     public Function<Long, List<MeterPeriodInfo>> getInterimMeterPeriodAllFc() {
           return contractId->{
-            String sql="select a.id, a.period_number periodNumber,a.sort ,b.print_date formPrintDate ,b.pay_money curTotal,b.id reportId from  s_contract_meter_period a join s_interim_pay_certificate b on a.id=b.contract_period_id where a.is_deleted=0 and  b.is_deleted=0 and b.contract_id="+contractId+" order by a.sort";
+            String sql="select a.id, a.period_number periodNumber,a.sort ,b.print_date formPrintDate ,b.pay_money curTotal,b.id reportId,b.start_date,b.end_date  from  s_contract_meter_period a join s_interim_pay_certificate b on a.id=b.contract_period_id where a.is_deleted=0 and  b.is_deleted=0 and b.contract_id="+contractId+" order by a.sort";
             return   getEntityList(sql,MeterPeriodInfo.class);
         };
     }
@@ -172,6 +173,24 @@ public class FormulaDaoImpl implements IFormulaDao {
         };
     }
 
+    @Override
+    public Function<Long, List<ChangeTokenForm>> getChangeTokenFormFc() {
+        return  contractId->{
+            String sql="select id,change_number,business_date,change_money,change_approval_date from  s_change_token_form where   is_deleted=0 and approve_status  = 2 and contract_id ="+contractId;
+            return getEntityList(sql,ChangeTokenForm.class);
+        };
+    }
+
+
+    @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";
+            return getEntityList(sql,ChangeToken.class);
+        };
+    }
+
     public <T> List<T> getEntityList(String sql, Class<T> entityClass) {
         return  jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(entityClass));
     }