|
@@ -22,10 +22,7 @@ import java.time.LocalDate;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
-import java.util.function.BiFunction;
|
|
|
|
-import java.util.function.BinaryOperator;
|
|
|
|
-import java.util.function.Consumer;
|
|
|
|
-import java.util.function.Function;
|
|
|
|
|
|
+import java.util.function.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.IntStream;
|
|
import java.util.stream.IntStream;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
@@ -425,16 +422,14 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
List<ChangeToken> changeTokenList2 =changeTokenListMap.get(MeterInfo.END);
|
|
List<ChangeToken> changeTokenList2 =changeTokenListMap.get(MeterInfo.END);
|
|
|
|
|
|
Map<String,InterimPaymentCertificate> paymentCertificateMap = new LinkedHashMap<>();
|
|
Map<String,InterimPaymentCertificate> paymentCertificateMap = new LinkedHashMap<>();
|
|
- List<Payment> paymentList=tec.meterInfo.getPaymentList();
|
|
|
|
- if(Func.isNotEmpty(paymentList)){
|
|
|
|
|
|
+ if(Func.isNotEmpty(tec.meterInfo.getPaymentListMap())){
|
|
|
|
+ LinkedHashMap<Integer,List<Payment>>paymentListMap = tec.meterInfo.getPaymentListMap();
|
|
/*之前的计量期数据*/
|
|
/*之前的计量期数据*/
|
|
- previous = paymentList.stream().filter(e->e.getSort()<tec.periodInfo.getSort()).collect(Collectors.toList());
|
|
|
|
|
|
+ previous = paymentListMap.get(MeterInfo.PRE);
|
|
/*当前计量期数据*/
|
|
/*当前计量期数据*/
|
|
- current = paymentList.stream().filter(e-> e.getSort().equals(tec.periodInfo.getSort())).collect(Collectors.toList());
|
|
|
|
|
|
+ current =paymentListMap.get(MeterInfo.CUR);
|
|
/*累计到本期末*/
|
|
/*累计到本期末*/
|
|
- paymentsPeriodEnd=paymentList.stream().filter(e->e.getSort()<=tec.periodInfo.getSort()).collect(Collectors.toList());
|
|
|
|
- /*往期累计,本期支付,累计支付*/
|
|
|
|
- periodCount();
|
|
|
|
|
|
+ paymentsPeriodEnd=paymentListMap.get(MeterInfo.END);
|
|
/*往期每章节的实际花费*/
|
|
/*往期每章节的实际花费*/
|
|
Map<String,BigDecimal> previousMoney= this.moneySum.apply(previous);
|
|
Map<String,BigDecimal> previousMoney= this.moneySum.apply(previous);
|
|
/*当前计量期每章节的实际花费*/
|
|
/*当前计量期每章节的实际花费*/
|
|
@@ -480,6 +475,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
List<InterimPaymentCertificate> payItemZj=new ArrayList<>();
|
|
List<InterimPaymentCertificate> payItemZj=new ArrayList<>();
|
|
if(MeterInfo.MB_ZJ.equals(tec.meterInfo.getConfig())){
|
|
if(MeterInfo.MB_ZJ.equals(tec.meterInfo.getConfig())){
|
|
InterimPaymentCertificate xj=new InterimPaymentCertificate("小计");
|
|
InterimPaymentCertificate xj=new InterimPaymentCertificate("小计");
|
|
|
|
+ xj.setIsSummary(true);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getContractAmount,xj::setContractAmount);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getContractAmount,xj::setContractAmount);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getRevisedTotal,xj::setRevisedTotal);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getRevisedTotal,xj::setRevisedTotal);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getRevisedAmount,xj::setRevisedAmount);
|
|
addGetSetConfig(xj,summaryConfigMap,InterimPaymentCertificate::getRevisedAmount,xj::setRevisedAmount);
|
|
@@ -501,6 +497,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
}
|
|
}
|
|
payItemZj.add(jgtz);
|
|
payItemZj.add(jgtz);
|
|
InterimPaymentCertificate hj = new InterimPaymentCertificate("合计");
|
|
InterimPaymentCertificate hj = new InterimPaymentCertificate("合计");
|
|
|
|
+ hj.setIsSummary(true);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getCurrentPeriodEndPay,hj::setCurrentPeriodEndPay);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getCurrentPeriodEndPay,hj::setCurrentPeriodEndPay);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getPreviousPeriodEndPay,hj::setPreviousPeriodEndPay);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getPreviousPeriodEndPay,hj::setPreviousPeriodEndPay);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getCurrentPeriodPay,hj::setCurrentPeriodPay);
|
|
addGetSetConfig(hj,summaryConfigMap,InterimPaymentCertificate::getCurrentPeriodPay,hj::setCurrentPeriodPay);
|
|
@@ -542,12 +539,14 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
});
|
|
});
|
|
dataList.addAll(payItemZj);
|
|
dataList.addAll(payItemZj);
|
|
/*分行合计列*/
|
|
/*分行合计列*/
|
|
- fieldGetSet(summaryConfigMap);
|
|
|
|
|
|
+ fieldGetSet(summaryConfigMap,x->!x.getIsSummary());
|
|
/*计算合计值*/
|
|
/*计算合计值*/
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/*数据获取end*/
|
|
/*数据获取end*/
|
|
double total=dataList.stream().map(InterimPaymentCertificate::getCurrentPeriodPay).mapToDouble(BaseUtils::obj2DoubleZero).sum();
|
|
double total=dataList.stream().map(InterimPaymentCertificate::getCurrentPeriodPay).mapToDouble(BaseUtils::obj2DoubleZero).sum();
|
|
|
|
+ /*往期累计,本期支付,累计支付*/
|
|
|
|
+ periodCount(dataList.get(dataList.size()-1));
|
|
if(total>0){
|
|
if(total>0){
|
|
FormData ft =tec.formDataMap.get(InterimPaymentCertificate.TBN+ StringPool.COLON+"key_9");
|
|
FormData ft =tec.formDataMap.get(InterimPaymentCertificate.TBN+ StringPool.COLON+"key_9");
|
|
put2FormData(ft,total);
|
|
put2FormData(ft,total);
|
|
@@ -561,8 +560,11 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
putOut();
|
|
putOut();
|
|
}
|
|
}
|
|
|
|
|
|
- public void periodCount(){
|
|
|
|
- if(paymentsPeriodEnd.size()>0){
|
|
|
|
|
|
+ public void periodCount(InterimPaymentCertificate last){
|
|
|
|
+ tec.periodInfo.setPreTotal(last.getPreviousPeriodEndPay());
|
|
|
|
+ tec.periodInfo.setCurTotal(last.getCurrentPeriodPay());
|
|
|
|
+ tec.periodInfo.setTotal(last.getCurrentPeriodEndPay());
|
|
|
|
+ /* if(paymentsPeriodEnd.size()>0){
|
|
FormData fd=tec.formDataMap.get(MeterPeriodInfo.TBN+":key_7");
|
|
FormData fd=tec.formDataMap.get(MeterPeriodInfo.TBN+":key_7");
|
|
if(fd!=null) {
|
|
if(fd!=null) {
|
|
elementWriter.write(fd, paymentsPeriodEnd.stream().mapToDouble(p -> Double.parseDouble(p.getMoney())).sum());
|
|
elementWriter.write(fd, paymentsPeriodEnd.stream().mapToDouble(p -> Double.parseDouble(p.getMoney())).sum());
|
|
@@ -579,7 +581,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
if(fd!=null) {
|
|
if(fd!=null) {
|
|
elementWriter.write(fd, previous.stream().mapToDouble(p -> Double.parseDouble(p.getMoney())).sum());
|
|
elementWriter.write(fd, previous.stream().mapToDouble(p -> Double.parseDouble(p.getMoney())).sum());
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1342,11 +1344,11 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
FormulaUtils.put2FormData(fdm, fieldDataFcMap,dataList);
|
|
FormulaUtils.put2FormData(fdm, fieldDataFcMap,dataList);
|
|
};
|
|
};
|
|
/*批量计算列表中之前的字段和,并赋值到当前字段*/
|
|
/*批量计算列表中之前的字段和,并赋值到当前字段*/
|
|
- public void fieldGetSet(Map<T,Map<Function<T,String>,Consumer<String>>> gsMap){
|
|
|
|
|
|
+ public void fieldGetSet(Map<T,Map<Function<T,String>,Consumer<String>>> gsMap, Predicate<T> p){
|
|
gsMap.forEach((b,m)->{
|
|
gsMap.forEach((b,m)->{
|
|
List<T> dl = dataList.stream().limit(dataList.indexOf(b)).collect(Collectors.toList());
|
|
List<T> dl = dataList.stream().limit(dataList.indexOf(b)).collect(Collectors.toList());
|
|
m.forEach((f,c)->{
|
|
m.forEach((f,c)->{
|
|
- c.accept(dl.stream().map(f).map(BaseUtils::str2BigDecimal).reduce(BigDecimal.ZERO,BigDecimal::add).toString());
|
|
|
|
|
|
+ c.accept(dl.stream().filter(p).map(f).map(BaseUtils::str2BigDecimal).reduce(BigDecimal.ZERO,BigDecimal::add).toString());
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|