|
@@ -36,6 +36,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
private Function<Long, MeterPeriodInfo> interimMeterPeriodFc;
|
|
|
private Function<Long, List<Payment>> paymentListFc;
|
|
|
private Function<Long, List<InventoryForm>> inventoryFormFc;
|
|
|
+ private Function<Long, List<MeterApply>> meterApplyFc;
|
|
|
public ExecutorSpecial(TableElementConverter tec) {
|
|
|
super(tec);
|
|
|
}
|
|
@@ -82,6 +83,16 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
return fdm;
|
|
|
}
|
|
|
|
|
|
+ public Integer getLineSize(List<String> codeFind){
|
|
|
+ int line=10;
|
|
|
+ Optional<FormData> formDataOp= tec.getFormDataList().stream().filter(e-> BaseUtils.inChain(codeFind,e.getCode())).findAny();
|
|
|
+ if(formDataOp.isPresent()){
|
|
|
+ FormData target = formDataOp.get();
|
|
|
+ line= target.getCoordsList().size();
|
|
|
+ }
|
|
|
+ return line;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void handle() {
|
|
|
if(MeterType.MATERIAL.equals(tec.getMeterType())){
|
|
@@ -442,6 +453,8 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
@Override
|
|
|
public void parse() {
|
|
|
LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new SubprojectInterimPaymentSummary());
|
|
|
+ /*获取实际输出行数*/
|
|
|
+ this.capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
Map<String,Function<List<SubprojectInterimPaymentSummary>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(SubprojectInterimPaymentSummary.class);
|
|
|
tec.getFormDataMap().putAll(fdm);
|
|
|
Map<String,Summary> currentSummary = toSummary(current);
|
|
@@ -467,14 +480,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
}
|
|
|
dataList.add(sis);
|
|
|
}
|
|
|
- List<String> codeFind = new ArrayList<>(fdm.keySet());
|
|
|
- /*获取实际输出行数*/
|
|
|
- Optional<FormData> formDataOp= tec.getFormDataList().stream().filter(e-> BaseUtils.inChain(codeFind,e.getCode())).findAny();
|
|
|
List<SubprojectInterimPaymentSummary> outPutList= new ArrayList<>();
|
|
|
- if(formDataOp.isPresent()){
|
|
|
- FormData target = formDataOp.get();
|
|
|
- capacity=target.getCoordsList().size();
|
|
|
- }
|
|
|
LinkedHashMap<String,List<SubprojectInterimPaymentSummary>> chapterGroup= dataList.stream().collect(Collectors.groupingBy(e->getPrefix(e.getFormNumber()),LinkedHashMap::new,Collectors.toList()));
|
|
|
AtomicInteger loop = new AtomicInteger(chapterGroup.size());
|
|
|
chapterGroup.forEach((k,v)->{
|
|
@@ -532,6 +538,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
@Data
|
|
|
public class SubIMeterPay implements Special{
|
|
|
+ private Integer capacity=10;
|
|
|
|
|
|
@Override
|
|
|
public boolean ready() {
|
|
@@ -558,6 +565,8 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
/*根据每一期的s_middle_meter_apply,s_inventory_form_apply 获取对应的计量清单,然后根据清单Id配合s_inventory_form_meter查找计量单元信息*/
|
|
|
/*s_change_token_inventory每个清单关联的变更令,s_change_token_meter每个计量单元关联的变更令*/
|
|
|
LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new SubInterimMeterPaySummary());
|
|
|
+ /*获取实际输出行数*/
|
|
|
+ this.capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
Map<String,Function<List<SubInterimMeterPaySummary>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(SubInterimMeterPaySummary.class);
|
|
|
tec.getFormDataMap().putAll(fdm);
|
|
|
try {
|
|
@@ -580,10 +589,20 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ /*分组列表,每一组都是一个章节*/
|
|
|
List<List<SubInterimMeterPaySummary>> pageData =traversal(top);
|
|
|
List<SubInterimMeterPaySummary> dataList= pageData.stream().flatMap(list->{
|
|
|
List<SubInterimMeterPaySummary> tmp =new ArrayList<>(list);
|
|
|
- tmp.add(new SubInterimMeterPaySummary());
|
|
|
+ int size = (int)Math.ceil(tmp.size()/(double)this.capacity);
|
|
|
+ /*每一章需要留一行做小计,其他要填充空白行*/
|
|
|
+ SubInterimMeterPaySummary summary= new SubInterimMeterPaySummary("小计");
|
|
|
+ summary.setCurrentPeriodEndPay(tmp.stream().map(SubInterimMeterPaySummary::getCurrentPeriodEndPay).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
+ int over = size*capacity-1-tmp.size();
|
|
|
+ if(over>0){
|
|
|
+ /*填充空白行*/
|
|
|
+ tmp.addAll(Collections.nCopies(over,new SubInterimMeterPaySummary()));
|
|
|
+ }
|
|
|
+ tmp.add(summary);
|
|
|
return tmp.stream();
|
|
|
}).collect(Collectors.toList());
|
|
|
/*内容输出*/
|
|
@@ -652,6 +671,60 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Data
|
|
|
+ public class IMeterPaySummary implements Special{
|
|
|
+ private Integer capacity=20;
|
|
|
+ @Override
|
|
|
+ public boolean ready() {
|
|
|
+ return current.size()>0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void parse() {
|
|
|
+ LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new InterimMeterPaySummary());
|
|
|
+ /*获取实际输出行数*/
|
|
|
+ this.capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
+ Map<String,Function<List<InterimMeterPaySummary>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(InterimMeterPaySummary.class);
|
|
|
+ tec.getFormDataMap().putAll(fdm);
|
|
|
+ List<InterimMeterPaySummary> dataList = new ArrayList<>();
|
|
|
+ for(Payment payment:current){
|
|
|
+ InterimMeterPaySummary imps = new InterimMeterPaySummary();
|
|
|
+ BeanUtils.copyProperties(payment,imps);
|
|
|
+ imps.setItemName(payment.getName());
|
|
|
+ imps.setFormNumber(payment.getNumber());
|
|
|
+ dataList.add(imps);
|
|
|
+ }
|
|
|
+ if(dataList.size()>0){
|
|
|
+ InterimMeterPaySummary summary = new InterimMeterPaySummary("合计");
|
|
|
+ double sum=dataList.stream().map(InterimMeterPaySummary::getMoney).filter(StringUtils::isNumber).mapToDouble(Double::parseDouble).sum();
|
|
|
+ summary.setMoney(StringUtils.number2StringZero(sum,2));
|
|
|
+ dataList.add(summary);
|
|
|
+ }
|
|
|
+ FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public class IMeter implements Special{
|
|
|
+ private Integer capacity=7;
|
|
|
+ @Override
|
|
|
+ public boolean ready() {
|
|
|
+ return current.size()>0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void parse() {
|
|
|
+ LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new InterimMeter());
|
|
|
+ /*获取实际输出行数*/
|
|
|
+ this.capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
+ Map<String,Function<List<InterimMeter>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(InterimMeter.class);
|
|
|
+ tec.getFormDataMap().putAll(fdm);
|
|
|
+ List<InterimMeter> dataList = new ArrayList<>();
|
|
|
+ FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public interface Special{
|
|
|
/**是否满足执行条件*/
|
|
|
boolean ready();
|