|
@@ -18,6 +18,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
@@ -27,6 +28,7 @@ import java.util.function.Consumer;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.IntStream;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @author yangyj
|
|
@@ -37,7 +39,7 @@ import java.util.stream.IntStream;
|
|
|
@Data
|
|
|
public class ExecutorMeter extends FormulaExecutor {
|
|
|
/* private Function<Long, List<Material>> materialFormFc;*/
|
|
|
- private Function<Long, List<Payment>> paymentListFc;
|
|
|
+ /* private Function<Long, List<Payment>> paymentListFc;*/
|
|
|
/* private Function<Long, List<MidPayItem>> midPayItemListFc;*/
|
|
|
private Function<Long, List<InventoryForm>> inventoryFormFc;
|
|
|
private Function<Long, List<MeterApply>> meterApplyFc;
|
|
@@ -139,6 +141,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
this.specialList.add(new StayPayCalc());
|
|
|
}
|
|
|
this.specialList.stream().filter(Special::ready).forEach(Special::parse);
|
|
|
+ /**把队列中的DataModel全部转换为FormData(元素)*/
|
|
|
+ tec.meterInfo.getDelay().forEach(this::dataModel2FormData);
|
|
|
}
|
|
|
|
|
|
@Data
|
|
@@ -395,7 +399,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
builderFormDatas(InterimPaymentCertificate.class);
|
|
|
/*数据获取start*/
|
|
|
/*支付数据*/
|
|
|
- List<Payment> paymentList=paymentListFc.apply(tec.getContractId());
|
|
|
+ //List<Payment> paymentList=paymentListFc.apply(tec.getContractId());
|
|
|
/*合同计量清单*/
|
|
|
List<InventoryForm> inventoryForms = inventoryFormFc.apply(tec.getContractId());
|
|
|
InventoryForm root = null;
|
|
@@ -412,15 +416,16 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- LinkedHashMap<String,List<ChangeToken>> changeTokenListMap= tec.meterInfo.getChangeTokenListMap();
|
|
|
+ LinkedHashMap<Integer,List<ChangeToken>> changeTokenListMap= tec.meterInfo.getChangeTokenListMap();
|
|
|
/* 本期变更 */
|
|
|
- List<ChangeToken> changeTokenList0 = changeTokenListMap.get("CUR");
|
|
|
+ List<ChangeToken> changeTokenList0 = changeTokenListMap.get(MeterInfo.CUR);
|
|
|
/* 上期末变更 */
|
|
|
- List<ChangeToken> changeTokenList1 =changeTokenListMap.get("PRE");
|
|
|
+ List<ChangeToken> changeTokenList1 =changeTokenListMap.get(MeterInfo.PRE);
|
|
|
/* 本期末变更 */
|
|
|
- List<ChangeToken> changeTokenList2 =changeTokenListMap.get("END");
|
|
|
+ List<ChangeToken> changeTokenList2 =changeTokenListMap.get(MeterInfo.END);
|
|
|
|
|
|
Map<String,InterimPaymentCertificate> paymentCertificateMap = new LinkedHashMap<>();
|
|
|
+ List<Payment> paymentList=tec.meterInfo.getPaymentList();
|
|
|
if(Func.isNotEmpty(paymentList)){
|
|
|
/*之前的计量期数据*/
|
|
|
previous = paymentList.stream().filter(e->e.getSort()<tec.periodInfo.getSort()).collect(Collectors.toList());
|
|
@@ -958,6 +963,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
});
|
|
|
/* 实际完成,累计完成、按月完成*/
|
|
|
List<List<List<Payment>>> all =totalList.stream().map(ConstructionSchedule::getMonthlyCompletion).collect(Collectors.toList());
|
|
|
+ /*每页重复出现*/
|
|
|
FormulaUtils.beRelyFrom(tec.getFormDataMap(),ConstructionSchedule.TBN,"key_22,key_23,key_24").forEach(e->e.setRepeat(true));
|
|
|
/*每月合计进度*/
|
|
|
try {
|
|
@@ -979,7 +985,26 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
/* 合同概要*/
|
|
|
FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_24").ifPresent(t->{
|
|
|
- elementWriter.write(t,"开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()+" 合同完成日期:"+baseInfo.getEndDatePlan()+" 合同期限$4天 时间延长$5天 修改后合同期限"+ CustomFunction.daysPassed(baseInfo.getStartDate(),baseInfo.getEndDate()) +"天(即至"+baseInfo.getEndDate()+")\n 合同总价"+baseInfo.getContractAmount().divide(new BigDecimal(10000),2,RoundingMode.HALF_UP)+"万元、暂定金$9万元、工程量清单金额$10万元、BG估计最终金额$11万元");
|
|
|
+ /*合同时长*/
|
|
|
+ String contractDay=CustomFunction.join(CustomFunction.daysPassed(baseInfo.getStartDatePlan(),baseInfo.getEndDatePlan()),"").toString();
|
|
|
+ /*总时长*/
|
|
|
+ String totalDay=CustomFunction.join(CustomFunction.daysPassed(baseInfo.getStartDate(),baseInfo.getEndDate()),"").toString();
|
|
|
+ /*延长时间*/
|
|
|
+ int extended=BaseUtils.obj2IntegerZero(contractDay)-BaseUtils.obj2IntegerZero(totalDay);
|
|
|
+ /*已过去*/
|
|
|
+ String passDay=CustomFunction.join(CustomFunction.daysPassed(baseInfo.getStartDate(), LocalDate.now()),"").toString();
|
|
|
+ BigDecimal provisionalSum=tec.meterInfo.getMeterTreeList().stream().filter(e->e.getNodeCode().equals("D")).map(e->BaseUtils.str2BigDecimal(e.getAmount())).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ baseInfo.setProvisionalSum(StringUtils.number2String(provisionalSum,2));
|
|
|
+ BigDecimal changeTokenTotal=tec.meterInfo.getChangeTokenListMap().values().stream().flatMap(Collection::stream).map(ChangeToken::getTotalChangeMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
+ double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getContractAmount())+BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
|
|
|
+ String brief="开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()
|
|
|
+ +" 合同完成日期:"+baseInfo.getEndDatePlan()+" 合同期限"+contractDay+"天 时间延长"+extended+"天 修改后合同期限"+ totalDay
|
|
|
+ +"天(即至"+baseInfo.getEndDate()+")"
|
|
|
+ + "\n 合同总价"+baseInfo.getContractAmount().divide(new BigDecimal(10000),2,RoundingMode.HALF_UP)+"万元、暂定金"
|
|
|
+ +CustomFunction.xN(baseInfo.getProvisionalSum(),0.0001)+"万元、工程量清单金额"
|
|
|
+ +CustomFunction.xN(baseInfo.getBOQAmount(),0.0001)+"万元、工程量变更("+CustomFunction.xN(changeTokenTotal,0.0001)+")万元、估计最终金额"+StringUtils.number2String(totalMoney,2)+"万元,时间已过"
|
|
|
+ +passDay+"天,占合同工期"+StringUtils.number2String(ratioFc.apply(passDay,totalDay),2)+"%";
|
|
|
+ elementWriter.write(t,brief);
|
|
|
});
|
|
|
|
|
|
/*内容输出*/
|
|
@@ -1188,6 +1213,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
double sum=dataList.stream().map(InterimMeterPaySummary::getMoney).filter(StringUtils::isNumber).mapToDouble(Double::parseDouble).sum();
|
|
|
summary.setMoney(StringUtils.number2StringZero(sum,tec.getScale()));
|
|
|
dataList.add(summary);
|
|
|
+ /*计量汇总表数量(浙江)*/
|
|
|
FormulaUtils.elementFindByCode(tec.getFormDataMap(),MeterPeriodInfo.TBN+":key_10").ifPresent(fd->{
|
|
|
elementWriter.write(fd,BaseUtils.sliceNumber(dataList.size(),capacity));
|
|
|
});
|
|
@@ -1289,8 +1315,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
FormData pageFd = fdm.get(FormulaUtils.getPageCode(clazz));
|
|
|
if(pageFd!=null) {
|
|
|
int total = totalPage();
|
|
|
- /*页面不重复*/
|
|
|
- /*tec.getFormDataMap().values().stream().filter(e->e.executable()&& pageFd.getCode().equals(e.getFormula().getRely())).forEach(e->e.setRepeat(false));*/
|
|
|
String pageTmp = "第$1页 共" + total + "页";
|
|
|
pageFd.setValues(IntStream.rangeClosed(1, total).boxed().map(i -> new ElementData(pageTmp.replace("$1", i.toString()))).collect(Collectors.toList()));
|
|
|
}
|