|
@@ -10,7 +10,6 @@ import org.springblade.core.tool.utils.StringPool;
|
|
import org.springblade.manager.dto.ElementData;
|
|
import org.springblade.manager.dto.ElementData;
|
|
import org.springblade.manager.dto.FormData;
|
|
import org.springblade.manager.dto.FormData;
|
|
import org.springblade.manager.dto.TreeNode;
|
|
import org.springblade.manager.dto.TreeNode;
|
|
-import org.springblade.manager.formula.FormulaExecutor;
|
|
|
|
import org.springblade.manager.vo.*;
|
|
import org.springblade.manager.vo.*;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
@@ -33,23 +32,21 @@ import java.util.stream.IntStream;
|
|
@Data
|
|
@Data
|
|
public class ExecutorSpecial extends FormulaExecutor {
|
|
public class ExecutorSpecial extends FormulaExecutor {
|
|
private Function<Long, List<Material>> materialFormFc;
|
|
private Function<Long, List<Material>> materialFormFc;
|
|
- private Function<Long, MeterPeriodInfo> interimMeterPeriodFc;
|
|
|
|
private Function<Long, List<Payment>> paymentListFc;
|
|
private Function<Long, List<Payment>> paymentListFc;
|
|
private Function<Long, List<InventoryForm>> inventoryFormFc;
|
|
private Function<Long, List<InventoryForm>> inventoryFormFc;
|
|
private Function<Long, List<MeterApply>> meterApplyFc;
|
|
private Function<Long, List<MeterApply>> meterApplyFc;
|
|
- public ExecutorSpecial(TableElementConverter tec) {
|
|
|
|
- super(tec);
|
|
|
|
- }
|
|
|
|
- /**章节*/
|
|
|
|
- private List<InventoryForm> chapters = new ArrayList<>();
|
|
|
|
|
|
+ /*执行链*/
|
|
private List<Special> specialList = new ArrayList<>();
|
|
private List<Special> specialList = new ArrayList<>();
|
|
|
|
+ /**支付章节*/
|
|
|
|
+ private List<InventoryForm> chapters = new ArrayList<>();
|
|
|
|
+ /**上期累计支付信息*/
|
|
private List<Payment> previous =new ArrayList<>();
|
|
private List<Payment> previous =new ArrayList<>();
|
|
|
|
+ /**本期支付信息*/
|
|
private List<Payment> current =new ArrayList<>();
|
|
private List<Payment> current =new ArrayList<>();
|
|
- /**计量期*/
|
|
|
|
- private MeterPeriodInfo periodInfo;
|
|
|
|
|
|
+
|
|
private List<InterimPaymentCertificate> interimPaymentCertificates =new ArrayList<>();
|
|
private List<InterimPaymentCertificate> interimPaymentCertificates =new ArrayList<>();
|
|
/*求百分比*/
|
|
/*求百分比*/
|
|
- BinaryOperator<String> ratioFc = (a,b)->{
|
|
|
|
|
|
+ private BinaryOperator<String> ratioFc = (a,b)->{
|
|
/*合同金额*/
|
|
/*合同金额*/
|
|
BigDecimal aBd =new BigDecimal(a);
|
|
BigDecimal aBd =new BigDecimal(a);
|
|
/*变更金额*/
|
|
/*变更金额*/
|
|
@@ -60,6 +57,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
return aBd.multiply(new BigDecimal(100)).divide(bBd, 2, RoundingMode.HALF_UP).toString();
|
|
return aBd.multiply(new BigDecimal(100)).divide(bBd, 2, RoundingMode.HALF_UP).toString();
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**根据清单编号获取支付项目章节编号*/
|
|
public String getPrefix(String fn){
|
|
public String getPrefix(String fn){
|
|
for(InventoryForm itf:chapters){
|
|
for(InventoryForm itf:chapters){
|
|
String prefix=itf.getChapter();
|
|
String prefix=itf.getChapter();
|
|
@@ -74,15 +72,10 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
return fn;
|
|
return fn;
|
|
}
|
|
}
|
|
|
|
|
|
- public Function<String,String> preFixFc= this::getPrefix;
|
|
|
|
|
|
+ Function<String,String> preFixFc= this::getPrefix;
|
|
|
|
|
|
- public <T> LinkedHashMap<String,FormData> builderFormDatas(T bean){
|
|
|
|
- LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(bean);
|
|
|
|
- Map<String,Function<List<T>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(bean.getClass());
|
|
|
|
- tec.getFormDataMap().putAll(fdm);
|
|
|
|
- return fdm;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ /*获取动态行最大行数,codeFind为相关元素码集合 */
|
|
public Integer getLineSize(List<String> codeFind){
|
|
public Integer getLineSize(List<String> codeFind){
|
|
int line=10;
|
|
int line=10;
|
|
Optional<FormData> formDataOp= tec.getFormDataList().stream().filter(e-> BaseUtils.inChain(codeFind,e.getCode())).findAny();
|
|
Optional<FormData> formDataOp= tec.getFormDataList().stream().filter(e-> BaseUtils.inChain(codeFind,e.getCode())).findAny();
|
|
@@ -100,9 +93,16 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
}else if(MeterType.INTERIM.equals(tec.getMeterType())){
|
|
}else if(MeterType.INTERIM.equals(tec.getMeterType())){
|
|
this.specialList.add(new InterimPayCert());
|
|
this.specialList.add(new InterimPayCert());
|
|
this.specialList.add(new InterimSum());
|
|
this.specialList.add(new InterimSum());
|
|
|
|
+ this.specialList.add(new SubIPaySum());
|
|
|
|
+ this.specialList.add(new SubIMeterPay());
|
|
|
|
+ this.specialList.add(new IMeterPaySummary());
|
|
|
|
+ this.specialList.add(new IMeter());
|
|
}
|
|
}
|
|
this.specialList.stream().filter(Special::ready).forEach(Special::parse);
|
|
this.specialList.stream().filter(Special::ready).forEach(Special::parse);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
@Data
|
|
@Data
|
|
public class MaterialCalc implements Special{
|
|
public class MaterialCalc implements Special{
|
|
private FormData index;
|
|
private FormData index;
|
|
@@ -244,8 +244,9 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
- public class InterimPayCert implements Special{
|
|
|
|
|
|
+ public class InterimPayCert extends BaseSpecial<InterimPaymentCertificate> implements Special{
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean ready() {
|
|
public boolean ready() {
|
|
@@ -276,16 +277,11 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void parse() {
|
|
public void parse() {
|
|
- LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new InterimPaymentCertificate());
|
|
|
|
- tec.getFormDataMap().putAll(fdm);
|
|
|
|
- Map<String,Function<List<InterimPaymentCertificate>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(InterimPaymentCertificate.class);
|
|
|
|
-
|
|
|
|
- List<InterimPaymentCertificate> dataList = new ArrayList<>();
|
|
|
|
|
|
+ builderFormDatas(InterimPaymentCertificate.class);
|
|
/*数据获取start*/
|
|
/*数据获取start*/
|
|
/*支付数据*/
|
|
/*支付数据*/
|
|
List<Payment> paymentList=paymentListFc.apply(tec.getContractId());
|
|
List<Payment> paymentList=paymentListFc.apply(tec.getContractId());
|
|
- /*计量期*/
|
|
|
|
- periodInfo=interimMeterPeriodFc.apply(tec.getPeriodId());
|
|
|
|
|
|
+
|
|
/*合同计量清单*/
|
|
/*合同计量清单*/
|
|
List<InventoryForm> inventoryForms = inventoryFormFc.apply(tec.getContractId());
|
|
List<InventoryForm> inventoryForms = inventoryFormFc.apply(tec.getContractId());
|
|
InventoryForm root = null;
|
|
InventoryForm root = null;
|
|
@@ -304,9 +300,9 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
if(Func.isNotEmpty(paymentList)){
|
|
if(Func.isNotEmpty(paymentList)){
|
|
/*之前的计量期数据*/
|
|
/*之前的计量期数据*/
|
|
- previous = paymentList.stream().filter(e->e.getSort()<periodInfo.getSort()).collect(Collectors.toList());
|
|
|
|
|
|
+ previous = paymentList.stream().filter(e->e.getSort()<tec.periodInfo.getSort()).collect(Collectors.toList());
|
|
/*当前计量期数据*/
|
|
/*当前计量期数据*/
|
|
- current = paymentList.stream().filter(e-> e.getSort().equals(periodInfo.getSort())).collect(Collectors.toList());
|
|
|
|
|
|
+ current = paymentList.stream().filter(e-> e.getSort().equals(tec.periodInfo.getSort())).collect(Collectors.toList());
|
|
/*往期每章节的实际花费*/
|
|
/*往期每章节的实际花费*/
|
|
Map<String,BigDecimal> previousMoney= this.moneySum.apply(previous);
|
|
Map<String,BigDecimal> previousMoney= this.moneySum.apply(previous);
|
|
/*当前计量期每章节的实际花费*/
|
|
/*当前计量期每章节的实际花费*/
|
|
@@ -329,14 +325,14 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
/*本期实际支付合计计算*/
|
|
/*本期实际支付合计计算*/
|
|
functionMap.put(InterimPaymentCertificate.TBN+ StringPool.COLON+"key_9",(List<InterimPaymentCertificate> list)-> Collections.singletonList(list.stream().map(InterimPaymentCertificate::getCurrentPeriodPay).mapToDouble(Double::parseDouble).sum()));
|
|
functionMap.put(InterimPaymentCertificate.TBN+ StringPool.COLON+"key_9",(List<InterimPaymentCertificate> list)-> Collections.singletonList(list.stream().map(InterimPaymentCertificate::getCurrentPeriodPay).mapToDouble(Double::parseDouble).sum()));
|
|
/*内容输出*/
|
|
/*内容输出*/
|
|
- FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
|
-
|
|
|
|
|
|
+ putOut();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
- public class InterimSum implements Special{
|
|
|
|
|
|
+ public class InterimSum extends BaseSpecial<InterimPaymentSummary> implements Special{
|
|
@Override
|
|
@Override
|
|
public boolean ready() {
|
|
public boolean ready() {
|
|
return interimPaymentCertificates.size()>0;
|
|
return interimPaymentCertificates.size()>0;
|
|
@@ -348,10 +344,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void parse() {
|
|
public void parse() {
|
|
- LinkedHashMap<String,FormData> fdm = FormulaUtils.toFormDataMap(new InterimPaymentSummary());
|
|
|
|
- Map<String,Function<List<InterimPaymentSummary>,List<Object>>> functionMap =FormulaUtils.fieldDataFcMap(InterimPaymentSummary.class);
|
|
|
|
- tec.getFormDataMap().putAll(fdm);
|
|
|
|
- List<InterimPaymentSummary> dataList=new ArrayList<>();
|
|
|
|
|
|
+ builderFormDatas(InterimPaymentSummary.class);
|
|
for(InterimPaymentCertificate ipc:interimPaymentCertificates){
|
|
for(InterimPaymentCertificate ipc:interimPaymentCertificates){
|
|
InterimPaymentSummary ips = new InterimPaymentSummary();
|
|
InterimPaymentSummary ips = new InterimPaymentSummary();
|
|
BeanUtils.copyProperties(ipc,ips);
|
|
BeanUtils.copyProperties(ipc,ips);
|
|
@@ -371,14 +364,14 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
summary.setPayRatioA(ratioFc.apply(summary.getCurrentPeriodEndPay(),summary.getRevisedAmount()));
|
|
summary.setPayRatioA(ratioFc.apply(summary.getCurrentPeriodEndPay(),summary.getRevisedAmount()));
|
|
dataList.add(summary);
|
|
dataList.add(summary);
|
|
/*内容输出*/
|
|
/*内容输出*/
|
|
- FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
|
|
|
+ putOut();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
- public class SubIPaySum implements Special{
|
|
|
|
- private Integer capacity=10;
|
|
|
|
|
|
+ public class SubIPaySum extends BaseSpecial<SubprojectInterimPaymentSummary> implements Special{
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean ready() {
|
|
public boolean ready() {
|
|
@@ -436,7 +429,6 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/*按清单编号求和*/
|
|
/*按清单编号求和*/
|
|
public Map<String,Summary> toSummary(List<Payment> payments) {
|
|
public Map<String,Summary> toSummary(List<Payment> payments) {
|
|
return payments.stream()
|
|
return payments.stream()
|
|
@@ -449,17 +441,12 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void parse() {
|
|
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);
|
|
|
|
|
|
+ builderFormDatas(SubprojectInterimPaymentSummary.class);
|
|
Map<String,Summary> currentSummary = toSummary(current);
|
|
Map<String,Summary> currentSummary = toSummary(current);
|
|
Map<String,Summary> preSummary = toSummary(previous);
|
|
Map<String,Summary> preSummary = toSummary(previous);
|
|
- List<SubprojectInterimPaymentSummary> dataList = new ArrayList<>();
|
|
|
|
|
|
+ List<SubprojectInterimPaymentSummary> totalList = new ArrayList<>();
|
|
for(Map.Entry<String,Summary> form:currentSummary.entrySet()){
|
|
for(Map.Entry<String,Summary> form:currentSummary.entrySet()){
|
|
SubprojectInterimPaymentSummary sis = new SubprojectInterimPaymentSummary();
|
|
SubprojectInterimPaymentSummary sis = new SubprojectInterimPaymentSummary();
|
|
Summary pre =preSummary.get(form.getKey());
|
|
Summary pre =preSummary.get(form.getKey());
|
|
@@ -478,10 +465,9 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
sis.setCurrentPeriodEndPay(summary.getCurrentPeriodEndPay().toString());
|
|
sis.setCurrentPeriodEndPay(summary.getCurrentPeriodEndPay().toString());
|
|
sis.setPayRatio(ratioFc.apply(sis.getCurrentPeriodEndPay(),sis.getRevisedAmount()));
|
|
sis.setPayRatio(ratioFc.apply(sis.getCurrentPeriodEndPay(),sis.getRevisedAmount()));
|
|
}
|
|
}
|
|
- dataList.add(sis);
|
|
|
|
|
|
+ totalList.add(sis);
|
|
}
|
|
}
|
|
- List<SubprojectInterimPaymentSummary> outPutList= new ArrayList<>();
|
|
|
|
- LinkedHashMap<String,List<SubprojectInterimPaymentSummary>> chapterGroup= dataList.stream().collect(Collectors.groupingBy(e->getPrefix(e.getFormNumber()),LinkedHashMap::new,Collectors.toList()));
|
|
|
|
|
|
+ LinkedHashMap<String,List<SubprojectInterimPaymentSummary>> chapterGroup= totalList.stream().collect(Collectors.groupingBy(e->getPrefix(e.getFormNumber()),LinkedHashMap::new,Collectors.toList()));
|
|
AtomicInteger loop = new AtomicInteger(chapterGroup.size());
|
|
AtomicInteger loop = new AtomicInteger(chapterGroup.size());
|
|
chapterGroup.forEach((k,v)->{
|
|
chapterGroup.forEach((k,v)->{
|
|
int extra=loop.getAndDecrement()>0?1:2;
|
|
int extra=loop.getAndDecrement()>0?1:2;
|
|
@@ -490,8 +476,6 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
/*每页小结是固定内容,需要每页保留一行*/
|
|
/*每页小结是固定内容,需要每页保留一行*/
|
|
int dataAreaSize=capacity-1;
|
|
int dataAreaSize=capacity-1;
|
|
int pageSize=(int)Math.ceil(dataLength/(double)dataAreaSize);
|
|
int pageSize=(int)Math.ceil(dataLength/(double)dataAreaSize);
|
|
- /*总长度*/
|
|
|
|
- int total = pageSize*capacity;
|
|
|
|
List<List<SubprojectInterimPaymentSummary>> ds = BaseUtils.splitList(v,capacity-1);
|
|
List<List<SubprojectInterimPaymentSummary>> ds = BaseUtils.splitList(v,capacity-1);
|
|
List<SubprojectInterimPaymentSummary> tmp = new ArrayList<>();
|
|
List<SubprojectInterimPaymentSummary> tmp = new ArrayList<>();
|
|
for(int n=0;n<pageSize;n++){
|
|
for(int n=0;n<pageSize;n++){
|
|
@@ -508,37 +492,35 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
if(placeholderSize>0){
|
|
if(placeholderSize>0){
|
|
tmp.addAll(Collections.nCopies(placeholderSize,new SubprojectInterimPaymentSummary()));
|
|
tmp.addAll(Collections.nCopies(placeholderSize,new SubprojectInterimPaymentSummary()));
|
|
}
|
|
}
|
|
- SubprojectInterimPaymentSummary last = new SubprojectInterimPaymentSummary("本页小计");
|
|
|
|
- last.calculate(currentPageData);
|
|
|
|
- tmp.add(last);
|
|
|
|
|
|
+ subtotal(new SubprojectInterimPaymentSummary("本页小计"),tmp,currentPageData);
|
|
if(m>1) {
|
|
if(m>1) {
|
|
/*本章小结*/
|
|
/*本章小结*/
|
|
- SubprojectInterimPaymentSummary lastA = new SubprojectInterimPaymentSummary();
|
|
|
|
- lastA.calculate(v);
|
|
|
|
- tmp.add(lastA);
|
|
|
|
|
|
+ subtotal(new SubprojectInterimPaymentSummary("章合计"),tmp,v);
|
|
}
|
|
}
|
|
if(m>2){
|
|
if(m>2){
|
|
/*所有章合计*/
|
|
/*所有章合计*/
|
|
- SubprojectInterimPaymentSummary lastB = new SubprojectInterimPaymentSummary();
|
|
|
|
- lastB.calculate(dataList);
|
|
|
|
- tmp.add(lastB);
|
|
|
|
|
|
+ subtotal(new SubprojectInterimPaymentSummary("所有章合计"),tmp,totalList);
|
|
}
|
|
}
|
|
- outPutList.addAll(tmp);
|
|
|
|
|
|
+ dataList.addAll(tmp);
|
|
tmp.clear();
|
|
tmp.clear();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
/*内容输出*/
|
|
/*内容输出*/
|
|
- FormulaUtils.put2FormData(fdm,functionMap,outPutList);
|
|
|
|
|
|
+ putOut();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void subtotal(SubprojectInterimPaymentSummary b, List<SubprojectInterimPaymentSummary> result ,List<SubprojectInterimPaymentSummary> data){
|
|
|
|
+ b.calculate(data);
|
|
|
|
+ result.add(b);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
- public class SubIMeterPay implements Special{
|
|
|
|
- private Integer capacity=10;
|
|
|
|
|
|
+ public class SubIMeterPay extends BaseSpecial<SubInterimMeterPaySummary> implements Special{
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean ready() {
|
|
public boolean ready() {
|
|
@@ -561,14 +543,10 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void parse() {
|
|
public void parse() {
|
|
|
|
+ builderFormDatas(SubInterimMeterPaySummary.class);
|
|
/*按照计量单元和单元内的清单顺序排序显示计量清单,并且把计量单元的层级一并显示*/
|
|
/*按照计量单元和单元内的清单顺序排序显示计量清单,并且把计量单元的层级一并显示*/
|
|
/*根据每一期的s_middle_meter_apply,s_inventory_form_apply 获取对应的计量清单,然后根据清单Id配合s_inventory_form_meter查找计量单元信息*/
|
|
/*根据每一期的s_middle_meter_apply,s_inventory_form_apply 获取对应的计量清单,然后根据清单Id配合s_inventory_form_meter查找计量单元信息*/
|
|
/*s_change_token_inventory每个清单关联的变更令,s_change_token_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 {
|
|
try {
|
|
Map<Long, TreeNode<MeterTree>> treeNodeMap = tec.getMeterTreeMap().get();
|
|
Map<Long, TreeNode<MeterTree>> treeNodeMap = tec.getMeterTreeMap().get();
|
|
Optional<TreeNode<MeterTree>> optionalTreeNode= treeNodeMap.values().stream().filter(TreeNode::isTop).findAny();
|
|
Optional<TreeNode<MeterTree>> optionalTreeNode= treeNodeMap.values().stream().filter(TreeNode::isTop).findAny();
|
|
@@ -591,7 +569,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
});
|
|
});
|
|
/*分组列表,每一组都是一个章节*/
|
|
/*分组列表,每一组都是一个章节*/
|
|
List<List<SubInterimMeterPaySummary>> pageData =traversal(top);
|
|
List<List<SubInterimMeterPaySummary>> pageData =traversal(top);
|
|
- List<SubInterimMeterPaySummary> dataList= pageData.stream().flatMap(list->{
|
|
|
|
|
|
+ dataList= pageData.stream().flatMap(list->{
|
|
List<SubInterimMeterPaySummary> tmp =new ArrayList<>(list);
|
|
List<SubInterimMeterPaySummary> tmp =new ArrayList<>(list);
|
|
int size = (int)Math.ceil(tmp.size()/(double)this.capacity);
|
|
int size = (int)Math.ceil(tmp.size()/(double)this.capacity);
|
|
/*每一章需要留一行做小计,其他要填充空白行*/
|
|
/*每一章需要留一行做小计,其他要填充空白行*/
|
|
@@ -606,7 +584,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
return tmp.stream();
|
|
return tmp.stream();
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
/*内容输出*/
|
|
/*内容输出*/
|
|
- FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
|
|
|
+ putOut();
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -671,9 +649,10 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
@Data
|
|
@Data
|
|
- public class IMeterPaySummary implements Special{
|
|
|
|
- private Integer capacity=20;
|
|
|
|
|
|
+ public class IMeterPaySummary extends BaseSpecial<InterimMeterPaySummary> implements Special{
|
|
|
|
+ /*private Integer capacity=20;*/
|
|
@Override
|
|
@Override
|
|
public boolean ready() {
|
|
public boolean ready() {
|
|
return current.size()>0;
|
|
return current.size()>0;
|
|
@@ -681,12 +660,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void parse() {
|
|
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<>();
|
|
|
|
|
|
+ builderFormDatas(InterimMeterPaySummary.class);
|
|
for(Payment payment:current){
|
|
for(Payment payment:current){
|
|
InterimMeterPaySummary imps = new InterimMeterPaySummary();
|
|
InterimMeterPaySummary imps = new InterimMeterPaySummary();
|
|
BeanUtils.copyProperties(payment,imps);
|
|
BeanUtils.copyProperties(payment,imps);
|
|
@@ -700,7 +674,7 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
summary.setMoney(StringUtils.number2StringZero(sum,2));
|
|
summary.setMoney(StringUtils.number2StringZero(sum,2));
|
|
dataList.add(summary);
|
|
dataList.add(summary);
|
|
}
|
|
}
|
|
- FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
|
|
|
+ putOut();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -751,11 +725,44 @@ public class ExecutorSpecial extends FormulaExecutor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- public interface Special{
|
|
|
|
|
|
+ @Data
|
|
|
|
+ class BaseSpecial<T>{
|
|
|
|
+ /*数据模型包含的元素*/
|
|
|
|
+ public LinkedHashMap<String,FormData> fdm;
|
|
|
|
+ /*元素内容输出对应的映射函数*/
|
|
|
|
+ public Map<String,Function<List<T>,List<Object>>> functionMap;
|
|
|
|
+ /*获取实际输出行数*/
|
|
|
|
+ public Integer capacity;
|
|
|
|
+ /*输出值*/
|
|
|
|
+ List<T> dataList;
|
|
|
|
+ /*用实例去构建带有初始化数据的元素*/
|
|
|
|
+ public void builderFormDatas(T bean){
|
|
|
|
+ fdm = FormulaUtils.toFormDataMap(bean);
|
|
|
|
+ functionMap =FormulaUtils.fieldDataFcMap(bean.getClass());
|
|
|
|
+ capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
|
+ tec.getFormDataMap().putAll(fdm);
|
|
|
|
+ dataList=new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ /*用元类class 创建空元素*/
|
|
|
|
+ public void builderFormDatas(Class<T> clazz){
|
|
|
|
+ fdm = FormulaUtils.toFormDataMap(clazz);
|
|
|
|
+ functionMap =FormulaUtils.fieldDataFcMap(clazz);
|
|
|
|
+ capacity=getLineSize(new ArrayList<>(fdm.keySet()));
|
|
|
|
+ tec.getFormDataMap().putAll(fdm);
|
|
|
|
+ dataList=new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ /*写入对应的元素*/
|
|
|
|
+ public void putOut(){
|
|
|
|
+ FormulaUtils.put2FormData(fdm,functionMap,dataList);
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ interface Special{
|
|
/**是否满足执行条件*/
|
|
/**是否满足执行条件*/
|
|
boolean ready();
|
|
boolean ready();
|
|
/**解析数据*/
|
|
/**解析数据*/
|
|
void parse();
|
|
void parse();
|
|
}
|
|
}
|
|
|
|
+ public ExecutorSpecial(TableElementConverter tec) {
|
|
|
|
+ super(tec);
|
|
|
|
+ }
|
|
}
|
|
}
|