|
@@ -43,7 +43,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/**执行链*/
|
|
|
private List<Special> specialList = new ArrayList<>();
|
|
|
/**支付章节*/
|
|
|
- private List<InventoryForm> chapters = new ArrayList<>();
|
|
|
+ /*private List<InventoryForm> chapters = new ArrayList<>();*/
|
|
|
/**上期累计支付信息*/
|
|
|
private List<Payment> previous =new ArrayList<>();
|
|
|
/**本期支付信息*/
|
|
@@ -79,15 +79,51 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*加法*/
|
|
|
private BinaryOperator<String> addFc = (a,b)-> BaseUtils.str2BigDecimal(a).add(BaseUtils.str2BigDecimal(b)).toString();
|
|
|
|
|
|
+ /*按照二级清单编号,合计合同清单{合同金额,变更金额}*/
|
|
|
+ private Function<List<InventoryForm>, Map<String, BigDecimal[]>> contractMoneySum = data -> data.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ form -> getPrefix(form.getFormNumber()),
|
|
|
+ Collectors.reducing(
|
|
|
+ new BigDecimal[]{BigDecimal.ZERO, BigDecimal.ZERO},
|
|
|
+ form -> new BigDecimal[]{
|
|
|
+ /*form.getContractMoney() != null ? new BigDecimal(form.getContractMoney()) : BigDecimal.ZERO,
|
|
|
+ form.getChangeMoney() != null ? new BigDecimal(form.getChangeMoney()) : BigDecimal.ZERO*/
|
|
|
+ BaseUtils.str2BigDecimal(form.getContractMoney()),
|
|
|
+ BaseUtils.str2BigDecimal(form.getChangeMoney())
|
|
|
+ },
|
|
|
+ (contractMoney, changeMoney) -> new BigDecimal[]{contractMoney[0].add(changeMoney[0]), contractMoney[1].add(changeMoney[1])}
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+ Function<List<Payment>, Map<String, BigDecimal>> moneySum= data-> data.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ payment -> getPrefix(payment.getNumber()),
|
|
|
+ LinkedHashMap::new,
|
|
|
+ Collectors.reducing(BigDecimal.ZERO, Payment::getMoneyAsBigDecimal, BigDecimal::add)
|
|
|
+ ));
|
|
|
+
|
|
|
+ Function<InventoryForm,String> level2Fn=inventoryForm -> {
|
|
|
+ String prefix = inventoryForm.getFormNumber();
|
|
|
+ if(inventoryForm.getFormName().contains(BTDL)){
|
|
|
+ return prefix+":"+BTDL;
|
|
|
+ }
|
|
|
+ return prefix;
|
|
|
+ };
|
|
|
+ static String BTDL="保通道路";
|
|
|
/**根据清单编号获取支付项目章节编号*/
|
|
|
public String getPrefix(String fn){
|
|
|
if(fn!=null) {
|
|
|
+ boolean hasWord = fn.contains(BTDL);
|
|
|
fn= fn.split("-")[0];
|
|
|
- for (InventoryForm itf : chapters) {
|
|
|
- String prefix = itf.getFormNumber();
|
|
|
+ for (InventoryForm itf : tec.meterInfo.getChapter()) {
|
|
|
+ /*204-1-11(保通道路)*/
|
|
|
+ String prefix = level2Fn.apply(itf);
|
|
|
if (BaseUtils.isNumber(fn)) {
|
|
|
fn = String.valueOf(100 * (Integer.parseInt(fn) / 100));
|
|
|
}
|
|
|
+ if(hasWord){
|
|
|
+ fn=fn+":"+BTDL;
|
|
|
+ }
|
|
|
if (fn.startsWith(prefix)) {
|
|
|
return prefix;
|
|
|
}
|
|
@@ -97,7 +133,14 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- Function<String,String> preFixFc= this::getPrefix;
|
|
|
+
|
|
|
+
|
|
|
+ Function<InventoryForm,String> chapterPreFixFc=inventoryForm->{
|
|
|
+ if(inventoryForm.getFormName().contains(BTDL)){
|
|
|
+ return inventoryForm.getFormNumber()+BTDL;
|
|
|
+ }
|
|
|
+ return inventoryForm.getFormNumber();
|
|
|
+ } ;
|
|
|
|
|
|
|
|
|
/*获取动态行最大行数,codeFind为相关元素码集合 */
|
|
@@ -141,10 +184,10 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*监理*/
|
|
|
this.specialList.add(new SupervisionCertificateSp());
|
|
|
}else if(MeterType.START.equals(tec.getMeterType())){
|
|
|
- /*监理中期支付证书*/
|
|
|
- this.specialList.add(new InterimPayCert());
|
|
|
/*开工预付款支付证书处理*/
|
|
|
this.specialList.add(new StayPayCalc());
|
|
|
+ /*动员预付款-中期支付证书*/
|
|
|
+ this.specialList.add(new InterimPayCertStart());
|
|
|
}
|
|
|
this.specialList.stream().filter(Special::ready).forEach(special->{
|
|
|
try{
|
|
@@ -153,10 +196,13 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
- /**把队列中的DataModel全部转换为FormData(元素)*/
|
|
|
+ /*把队列中的DataModel全部转换为FormData(元素)*/
|
|
|
tec.meterInfo.getDelay().forEach(this::dataModel2FormData);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String sumStart=null,currentStart=null;
|
|
|
+
|
|
|
@Data
|
|
|
public class StayPayCalc implements Special{
|
|
|
|
|
@@ -178,8 +224,10 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
sum= startPayForms.stream().filter(s->s.getPeriodSort()<=one.getPeriodSort()).mapToDouble(s->Double.parseDouble(s.getMeterMoney())).sum();
|
|
|
/*累计*/
|
|
|
elementWriter.write(fdm.get(AdvancePaymentCertificate.TBN+":key_3"),StringUtils.number2String(sum,2));
|
|
|
+ sumStart=StringUtils.number2String(sum,3);
|
|
|
currentD=current.stream().mapToDouble(s->Double.parseDouble(s.getMeterMoney())).sum();
|
|
|
elementWriter.write(fdm.get(AdvancePaymentCertificate.TBN+":key_2"),StringUtils.number2String(currentD,2));
|
|
|
+ currentStart=StringUtils.number2String(currentD,3);
|
|
|
/*上一期*/
|
|
|
Optional<Integer> op=startPayForms.stream().map(StartPayForm::getPeriodSort).filter(s->s<one.getPeriodSort()).max(Comparator.comparingInt(s->s));
|
|
|
if(op.isPresent()){
|
|
@@ -189,7 +237,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*监理中期支付证书*/
|
|
|
|
|
|
}
|
|
|
|
|
@@ -521,19 +568,74 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
@Data
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
|
- public class InterimPayCertJL extends BaseSpecial<InterimPaymentCertificate> implements Special{
|
|
|
+ public class InterimPayCertStart extends BaseSpecial<InterimPaymentCertificate> implements Special{
|
|
|
/*甬台温,开工预付款款,中期支付证书*/
|
|
|
@Override
|
|
|
public boolean ready() {
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
@Override
|
|
|
public void parse() {
|
|
|
-
|
|
|
+ builderFormDatas(InterimPaymentCertificate.class);
|
|
|
+ List<InventoryForm> inventoryForms = tec.meterInfo.getInventoryForms();
|
|
|
+ List<InventoryForm> chapters = tec.meterInfo.getChapter();
|
|
|
+ LinkedHashMap<Integer, List<ChangeToken>> changeTokenListMap = tec.meterInfo.getChangeTokenListMap();
|
|
|
+ /* 本期变更 */
|
|
|
+ List<ChangeToken> changeTokenList0 = changeTokenListMap.get(MeterInfo.CUR);
|
|
|
+ /* 上期末变更 */
|
|
|
+ List<ChangeToken> changeTokenList1 = changeTokenListMap.get(MeterInfo.PRE);
|
|
|
+ /* 本期末变更 */
|
|
|
+ List<ChangeToken> changeTokenList2 = changeTokenListMap.get(MeterInfo.END);
|
|
|
+ /*合同金额*/
|
|
|
+ Map<String, BigDecimal[]> contractMoney = contractMoneySum.apply(inventoryForms);
|
|
|
+ LinkedHashMap<String, InventoryForm> dictMap = chapters.stream().collect(Collectors.toMap(e->chapterPreFixFc.apply(e),e -> e, (v1, v2) -> v1,LinkedHashMap::new));
|
|
|
+ dictMap.forEach((k,v)->{
|
|
|
+ BigDecimal[] sum = contractMoney.get(k);
|
|
|
+ String ch = v.getFormNumber();
|
|
|
+ if("ZLJE".equals(ch)){
|
|
|
+ ch="";
|
|
|
+ }
|
|
|
+ InterimPaymentCertificate ipc = new InterimPaymentCertificate(ch + (BaseUtils.isNumber(ch) ? "章" : ""));
|
|
|
+ ipc.setFormName(v.getFormName());
|
|
|
+ if(sum!=null){
|
|
|
+ ipc.setContractAmount(sum[0].toString());
|
|
|
+ ipc.setRevisedAmount(sum[1].toString());
|
|
|
+ }
|
|
|
+ dataList.add(ipc);
|
|
|
+ });
|
|
|
+ Map<InterimPaymentCertificate, Map<Function<InterimPaymentCertificate, String>, Consumer<String>>> summaryConfigMap = new HashMap<>();
|
|
|
+ InterimPaymentCertificate xj = new InterimPaymentCertificate("小计", true);
|
|
|
+ addGetSetConfig(xj, summaryConfigMap, InterimPaymentCertificate::getContractAmount, xj::setContractAmount);
|
|
|
+ addGetSetConfig(xj, summaryConfigMap, InterimPaymentCertificate::getRevisedAmount, xj::setRevisedAmount);
|
|
|
+ dataList.add(xj);
|
|
|
+ InterimPaymentCertificate jgtz = new InterimPaymentCertificate("价格调整");
|
|
|
+ LinkedHashMap<Integer, List<MaterialAdjust>> materialAdjustMap = tec.meterInfo.getMaterialAdjustListMap();
|
|
|
+ dataList.add(jgtz);
|
|
|
+ InterimPaymentCertificate hj = new InterimPaymentCertificate("合计", true);
|
|
|
+ dataList.add(hj);
|
|
|
+ dataList.add(new InterimPaymentCertificate("索赔金额", MINUS_ONE));
|
|
|
+ dataList.add(new InterimPaymentCertificate("违约罚金", MINUS_ONE));
|
|
|
+ dataList.add(new InterimPaymentCertificate("迟付款利息"));
|
|
|
+ InterimPaymentCertificate dyyfk = new InterimPaymentCertificate("动员预付款");
|
|
|
+ dyyfk.setCurrentPeriodPay(currentStart);
|
|
|
+ dyyfk.setCurrentPeriodEndPay(sumStart);
|
|
|
+ dataList.add(dyyfk);
|
|
|
+ dataList.add(new InterimPaymentCertificate("扣回动员预付款"));
|
|
|
+ dataList.add(new InterimPaymentCertificate("材料设备垫付款"));
|
|
|
+ dataList.add(new InterimPaymentCertificate("扣回材料设备垫付款"));
|
|
|
+ dataList.add(new InterimPaymentCertificate("保留金"));
|
|
|
+ InterimPaymentCertificate sjzf = new InterimPaymentCertificate("实际支付");
|
|
|
+ addGetSetConfig(sjzf, summaryConfigMap, InterimPaymentCertificate::getCurrentPeriodEndPay, sjzf::setCurrentPeriodEndPay);
|
|
|
+ /*addGetSetConfig(sjzf, summaryConfigMap, InterimPaymentCertificate::getPreviousPeriodEndPay, sjzf::setPreviousPeriodEndPay);*/
|
|
|
+ addGetSetConfig(sjzf, summaryConfigMap, InterimPaymentCertificate::getCurrentPeriodPay, sjzf::setCurrentPeriodPay);
|
|
|
+ dataList.add(sjzf);
|
|
|
+ /*分行合计列,合计的时候需要计入手填部分*/
|
|
|
+ fieldGetSet(summaryConfigMap,x->!x.getIsSummary(),InterimPaymentCertificate::getInvertState);
|
|
|
+ putOut();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Data
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
|
public class InterimPayCert extends BaseSpecial<InterimPaymentCertificate> implements Special{
|
|
@@ -543,28 +645,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private Function<List<InventoryForm>, Map<String, BigDecimal[]>> contractMoneySum = data -> data.stream()
|
|
|
- .collect(Collectors.groupingBy(
|
|
|
- form -> getPrefix(form.getFormNumber()),
|
|
|
- Collectors.reducing(
|
|
|
- new BigDecimal[]{BigDecimal.ZERO, BigDecimal.ZERO},
|
|
|
- form -> new BigDecimal[]{
|
|
|
- form.getContractMoney() != null ? new BigDecimal(form.getContractMoney()) : BigDecimal.ZERO,
|
|
|
- form.getChangeMoney() != null ? new BigDecimal(form.getChangeMoney()) : BigDecimal.ZERO
|
|
|
- },
|
|
|
- (total1, total2) -> new BigDecimal[]{total1[0].add(total2[0]), total1[1].add(total2[1])}
|
|
|
- )
|
|
|
- ));
|
|
|
-
|
|
|
-
|
|
|
- private Function<List<Payment>, Map<String, BigDecimal>> moneySum= data-> data.stream()
|
|
|
- .collect(Collectors.groupingBy(
|
|
|
- payment -> getPrefix(payment.getNumber()),
|
|
|
- LinkedHashMap::new,
|
|
|
- Collectors.reducing(BigDecimal.ZERO, Payment::getMoneyAsBigDecimal, BigDecimal::add)
|
|
|
- ));
|
|
|
-
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public void parse() {
|
|
@@ -572,7 +652,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*数据获取start*/
|
|
|
/*合同计量清单*/
|
|
|
List<InventoryForm> inventoryForms = tec.meterInfo.getInventoryForms();
|
|
|
- InventoryForm root = null;
|
|
|
+ /* InventoryForm root = null;
|
|
|
for(InventoryForm itf:inventoryForms){
|
|
|
if(itf.getParentId()==0){
|
|
|
root = itf;
|
|
@@ -584,8 +664,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
if(itf.getParentId().equals(root.getId())){
|
|
|
chapters.add(itf);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ }*/
|
|
|
+ List<InventoryForm> chapters = tec.meterInfo.getChapter();
|
|
|
LinkedHashMap<Integer,List<ChangeToken>> changeTokenListMap= tec.meterInfo.getChangeTokenListMap();
|
|
|
/* 本期变更 */
|
|
|
List<ChangeToken> changeTokenList0 = changeTokenListMap.get(MeterInfo.CUR);
|
|
@@ -604,11 +684,11 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*累计到本期末*/
|
|
|
paymentsPeriodEnd=paymentListMap.get(MeterInfo.END);
|
|
|
/*往期每章节的实际花费*/
|
|
|
- Map<String,BigDecimal> previousMoney= this.moneySum.apply(previous);
|
|
|
+ Map<String,BigDecimal> previousMoney= moneySum.apply(previous);
|
|
|
/*当前计量期每章节的实际花费*/
|
|
|
- Map<String,BigDecimal> currentMoney= this.moneySum.apply(current);
|
|
|
+ Map<String,BigDecimal> currentMoney= moneySum.apply(current);
|
|
|
/*合同金额*/
|
|
|
- Map<String,BigDecimal[]> contractMoney = this.contractMoneySum.apply(inventoryForms);
|
|
|
+ Map<String,BigDecimal[]> contractMoney = contractMoneySum.apply(inventoryForms);
|
|
|
Map<String,InventoryForm> dictMap= chapters.stream().collect(Collectors.toMap(InventoryForm::getFormNumber, e->e,(v1,v2)->v1));
|
|
|
for(Map.Entry<String,BigDecimal[]> cm:contractMoney.entrySet()){
|
|
|
if(Func.isEmpty(cm.getKey()))continue;
|
|
@@ -643,7 +723,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*合同段支付项*/
|
|
|
List<MidPayItem> midPayItemList=tec.meterInfo.getMidPayItemList();
|
|
|
Map<InterimPaymentCertificate,Map<Function<InterimPaymentCertificate,String>,Consumer<String>>> summaryConfigMap = new HashMap<>();
|
|
|
- /* Map<Function<InterimPaymentCertificate,String>,Consumer<String>> getSetMap = new HashMap<>();*/
|
|
|
Map<Long,LinkedHashMap<String,InterimPayCertificateItem>>interimPayCertificateItemGroup=tec.meterInfo.getInterimPayCertificateItemGroup();
|
|
|
LinkedHashMap<String,InterimPayCertificateItem> previousMap = new LinkedHashMap<>();
|
|
|
if(tec.meterInfo.getPreviousPeriodInfo()!=null){
|
|
@@ -1593,7 +1672,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
m.forEach((f, c) -> {
|
|
|
/* c.accept(dl.stream().filter(p).map(f).map(BaseUtils::str2BigDecimal).reduce(BigDecimal.ZERO, BigDecimal::add).toString());*/
|
|
|
/*扣款项需要根据符号状态sign转成负数,依靠invert实现*/
|
|
|
- c.accept(dl.stream().filter(p).map(e-> invert.apply(sign.apply(e),BaseUtils.str2BigDecimal(f.apply(e)))).reduce(BigDecimal.ZERO, BigDecimal::add).toString());
|
|
|
+ String value =dl.stream().filter(p).map(e-> invert.apply(sign.apply(e),BaseUtils.str2BigDecimal(f.apply(e)))).reduce(BigDecimal.ZERO, BigDecimal::add).toString();
|
|
|
+ c.accept(value);
|
|
|
});
|
|
|
});
|
|
|
}
|