|
@@ -232,6 +232,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
this.specialList.add(new MaterialSp());
|
|
|
this.specialList.add(new MaterialsArrivalSp());
|
|
|
}else if(MeterType.INTERIM.equals(tec.getMeterType())){
|
|
|
+ this.specialList.add(new MaterialInterimSp());
|
|
|
/*材料*/
|
|
|
this.specialList.add(new MaterialsArrivalSp());
|
|
|
/*中期支付证书*/
|
|
@@ -466,7 +467,11 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
public void parse() {
|
|
|
builderFormDatas(MaterialPriceDifferential.class);
|
|
|
/*本期材料*/
|
|
|
- materials=tec.meterInfo.getMaterialsAll().stream().filter(e->tec.getPeriodId().equals(e.getPeriodId())).collect(Collectors.toList());
|
|
|
+ if(MeterType.INTERIM.equals(tec.getMeterType())){
|
|
|
+ materials=tec.meterInfo.getMaterialsAll();
|
|
|
+ }else{
|
|
|
+ materials=tec.meterInfo.getMaterialsAll().stream().filter(e->tec.getPeriodId().equals(e.getPeriodId())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
if(materials.size()>0){
|
|
|
dataList.addAll(materials.stream().map(e->{
|
|
|
MaterialPriceDifferential mpd = new MaterialPriceDifferential();
|
|
@@ -480,7 +485,9 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
mpd.setAmountBase(multiFc.apply(e.getPriceBase(),e.getMeterAmount()));
|
|
|
mpd.setPriceSpread(subtractFc.apply(mpd.getPrice(),mpd.getPriceBase()));
|
|
|
mpd.setTotal(subtractFc.apply(mpd.getAmount(),mpd.getAmountBase()));
|
|
|
- mpd.setCertificate(e.getCertificate());
|
|
|
+ if(!MeterType.INTERIM.equals(tec.getMeterType())) {
|
|
|
+ mpd.setCertificate(e.getCertificate());
|
|
|
+ }
|
|
|
mpd.setMaterialArriveNumber(e.getMaterialArriveNumber());
|
|
|
return mpd;
|
|
|
}
|
|
@@ -496,6 +503,50 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
}
|
|
|
@Data
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
|
+ public class MaterialInterimSp extends BaseSpecial<MaterialPriceDifferential> implements Special{
|
|
|
+ /*永久性工程材料差价金额一览表*/
|
|
|
+ @Override
|
|
|
+ public boolean ready() {
|
|
|
+ return MeterInfo.MB_ZJ.equals(tec.getMeterInfo().getTemplate());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void parse() {
|
|
|
+ builderFormDatas(MaterialPriceDifferential.class);
|
|
|
+ /*本期材料*/
|
|
|
+ List<MaterialAdjust> materialAdjustList=tec.meterInfo.getMaterialAdjustListMap().get(MeterInfo.CUR);
|
|
|
+ if(materialAdjustList!=null&&materialAdjustList.size()>0){
|
|
|
+ /*期号*/
|
|
|
+ String qh="";
|
|
|
+ if(tec.periodInfo.getPayNumber()!=null) {
|
|
|
+ qh=tec.periodInfo.getPayNumber().split("-")[1];
|
|
|
+ }
|
|
|
+ for(MaterialAdjust mad:materialAdjustList){
|
|
|
+ MaterialPriceDifferential mpd = new MaterialPriceDifferential();
|
|
|
+ mpd.setPeriodNumber(qh);
|
|
|
+ mpd.setName(mad.getMaterialName());
|
|
|
+ mpd.setUnit(mad.getUnit());
|
|
|
+ mpd.setQuantity(mad.getAdjustTotal().toPlainString());
|
|
|
+ mpd.setPriceBase(mad.getMaterialPrice().toPlainString());
|
|
|
+ mpd.setPrice(mad.getCurrentPrice().toPlainString());
|
|
|
+ mpd.setAmount(StringUtils.number2String(multiFc.apply(mpd.getPrice(),mpd.getQuantity()),0));
|
|
|
+ mpd.setAmountBase(StringUtils.number2String(multiFc.apply(mpd.getPriceBase(),mpd.getQuantity()),0));
|
|
|
+ mpd.setPriceSpread(subtractFc.apply(mpd.getPrice(),mpd.getPriceBase()));
|
|
|
+ mpd.setTotal(StringUtils.number2String(mad.getAdjustMoney().toPlainString(),0));
|
|
|
+ mpd.setMaterialArriveNumber(tec.periodInfo.getPayNumber());
|
|
|
+ dataList.add(mpd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*每页合计*/
|
|
|
+ FormulaUtils.elementFindByKey(fdm,"key_14").ifPresent(fd->{
|
|
|
+ List< List<MaterialPriceDifferential> > list =BaseUtils.splitList(dataList,capacity);
|
|
|
+ elementWriter.write(fd,list.stream().map(l->l.stream().map(MaterialPriceDifferential::getTotal).mapToDouble(Double::parseDouble).sum()).collect(Collectors.toList()));
|
|
|
+ });
|
|
|
+ putOut(MaterialPriceDifferential.class);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Data
|
|
|
+ @EqualsAndHashCode(callSuper = true)
|
|
|
public class SupervisionCertificateSp extends BaseSpecial<SupervisionCertificate> implements Special{
|
|
|
|
|
|
private final LinkedHashMap<String,String> itemNamesMap=new LinkedHashMap<>();
|
|
@@ -811,7 +862,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
hj.setQuantity(v.stream().map(e->BaseUtils.str2BigDecimal(e.getQuantity())).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString());
|
|
|
hj.setAmount(v.stream().map(e->BaseUtils.str2BigDecimal(e.getAmount())).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString());
|
|
|
hj.setTotal(divideFc.apply(multiFc.apply(hj.getAmount(),ratio),"100"));
|
|
|
- materialSum=hj.getTotal();
|
|
|
+ materialSum=StringUtils.number2String(hj.getTotal(),0);
|
|
|
tmp.add(hj);
|
|
|
dataList.addAll(tmp);
|
|
|
});
|
|
@@ -1026,9 +1077,9 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*材料调差*/
|
|
|
if(materialAdjustMap!=null) {
|
|
|
Function<Integer, String> countFc = category -> materialAdjustMap.get(category).stream().map(MaterialAdjust::getAdjustMoney).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
|
|
|
- jgtz.setPreviousPeriodEndPay(countFc.apply(MeterInfo.PRE));
|
|
|
- jgtz.setCurrentPeriodPay(countFc.apply(MeterInfo.CUR));
|
|
|
- jgtz.setCurrentPeriodEndPay(countFc.apply(MeterInfo.END));
|
|
|
+ jgtz.setPreviousPeriodEndPay(StringUtils.number2String(countFc.apply(MeterInfo.PRE),0));
|
|
|
+ jgtz.setCurrentPeriodPay(StringUtils.number2String(countFc.apply(MeterInfo.CUR),0));
|
|
|
+ jgtz.setCurrentPeriodEndPay(StringUtils.number2String(countFc.apply(MeterInfo.END),0));
|
|
|
}
|
|
|
payItemZj.add(jgtz);
|
|
|
InterimPaymentCertificate hj = new InterimPaymentCertificate("合计",true);
|
|
@@ -1046,8 +1097,10 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
InterimPaymentCertificate startPay =new InterimPaymentCertificate("动员预付款");
|
|
|
startPay.setContractAmount(StringUtils.handleNull(tec.meterInfo.getBaseInfo().getDyTotalAmount()));
|
|
|
if(tec.meterInfo.getStartPayFormAll()!=null){
|
|
|
+ /*中期计量第一期之前的*/
|
|
|
List<StartPayForm> startPayForm = tec.getMeterInfo().getStartPayFormAll();
|
|
|
if(startPayForm.size()>0){
|
|
|
+ InterimPayCertificateItem preStart = previousMap.get("动员预付款");
|
|
|
if(StringUtils.isNotEmpty(tec.getPeriodInfo().getStartIds())) {
|
|
|
String[] startIds = tec.getPeriodInfo().getStartIds().split(",");
|
|
|
if (Arrays.stream(startIds).anyMatch(BaseUtils::isNumber)) {
|
|
@@ -1061,19 +1114,26 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
if (Func.isNotEmpty(list)) {
|
|
|
- StartPayForm relate = list.get(list.size() - 1);
|
|
|
- BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <= relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ StartPayForm relate = list.get(0);
|
|
|
+ /* BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);*/
|
|
|
BigDecimal cur = list.stream().map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
startPay.setCurrentPeriodPay(cur.toPlainString());
|
|
|
- startPay.setPreviousPeriodEndPay(pre.toPlainString());
|
|
|
+ if(preStart!=null) {
|
|
|
+ /*获取上期末支付*/
|
|
|
+ startPay.setPreviousPeriodEndPay(preStart.getPreviousPeriodEndPay());
|
|
|
+ }
|
|
|
startPay.setCurrentPeriodEndPay(addFc.apply(startPay.getCurrentPeriodPay(), startPay.getPreviousPeriodEndPay()));
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- InterimPayCertificateItem preStart = previousMap.get("动员预付款");
|
|
|
if(preStart!=null) {
|
|
|
startPay.setPreviousPeriodEndPay(preStart.getCurrentPeriodEndPay());
|
|
|
startPay.setCurrentPeriodEndPay(preStart.getCurrentPeriodEndPay());
|
|
|
+ }else{
|
|
|
+ /*不存在上期,则认为是第一期,需要根据计量期时间筛选*/
|
|
|
+ BigDecimal first = startPayForm.stream().filter(s->s.getYearMonthInt()<=tec.periodInfo.getYearMonthInt()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ startPay.setPreviousPeriodEndPay(first.toPlainString());
|
|
|
+ startPay.setCurrentPeriodEndPay(first.toPlainString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1192,23 +1252,31 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*分行合计列,合计的时候需要计入手填部分*/
|
|
|
fieldGetSet(x->!x.getIsSummary(),InterimPaymentCertificate::getInvertState);
|
|
|
InterimPaymentCertificate finalBlj = blj;
|
|
|
- dataList.stream().filter(e-> "合计".equals(e.getChapterSeq())).findFirst().ifPresent(t->{
|
|
|
- finalBlj.setCurrentPeriodPay(multiFc.apply(t.getCurrentPeriodPay(),"0.1"));
|
|
|
+ dataList.stream().filter(e-> "小计".equals(e.getChapterSeq())).findFirst().ifPresent(t->{
|
|
|
+ finalBlj.setCurrentPeriodPay(StringUtils.number2String(multiFc.apply(t.getCurrentPeriodPay(),"0.1"),0));
|
|
|
if(BaseUtils.obj2DoubleZero(t.getPreviousPeriodEndPay())>0) {
|
|
|
- finalBlj.setPreviousPeriodEndPay(multiFc.apply(t.getPreviousPeriodEndPay(), "0.1"));
|
|
|
+ finalBlj.setPreviousPeriodEndPay(StringUtils.number2String(multiFc.apply(t.getPreviousPeriodEndPay(), "0.1"),0));
|
|
|
}
|
|
|
- finalBlj.setCurrentPeriodEndPay(multiFc.apply(t.getCurrentPeriodEndPay(),"0.1"));
|
|
|
+ finalBlj.setCurrentPeriodEndPay(addFc.apply(finalBlj.getCurrentPeriodPay(),finalBlj.getPreviousPeriodEndPay()));
|
|
|
dataList.stream().filter(e-> "实际支付".equals(e.getChapterSeq())).findFirst().ifPresent(w->{
|
|
|
- w.setCurrentPeriodPay(subtractFc.apply(w.getCurrentPeriodPay(),finalBlj.getCurrentPeriodPay()));
|
|
|
+ w.setCurrentPeriodPay(StringUtils.number2String(subtractFc.apply(w.getCurrentPeriodPay(),finalBlj.getCurrentPeriodPay()),0));
|
|
|
if(BaseUtils.obj2DoubleZero(t.getPreviousPeriodEndPay())>0) {
|
|
|
- w.setPreviousPeriodEndPay(subtractFc.apply(w.getPreviousPeriodEndPay(), finalBlj.getPreviousPeriodEndPay()));
|
|
|
+ w.setPreviousPeriodEndPay(StringUtils.number2String(subtractFc.apply(w.getPreviousPeriodEndPay(), finalBlj.getPreviousPeriodEndPay()),0));
|
|
|
}
|
|
|
- w.setCurrentPeriodEndPay(subtractFc.apply(w.getCurrentPeriodEndPay(),finalBlj.getCurrentPeriodEndPay()));
|
|
|
+ w.setCurrentPeriodEndPay(StringUtils.number2String(subtractFc.apply(w.getCurrentPeriodEndPay(),finalBlj.getCurrentPeriodEndPay()),0));
|
|
|
+ });
|
|
|
+ itemList.stream().filter(item->"保留金".equals(item.getChapterSeq())).findFirst().ifPresent(w->{
|
|
|
+ w.setPreviousPeriodEndPay(finalBlj.getPreviousPeriodEndPay());
|
|
|
+ w.setCurrentPeriodPay(finalBlj.getCurrentPeriodPay());
|
|
|
+ w.setCurrentPeriodEndPay(finalBlj.getCurrentPeriodEndPay());
|
|
|
});
|
|
|
});
|
|
|
if(peerMap.size()>0) {
|
|
|
/*等合计项目计算完毕,再赋值*/
|
|
|
peerMap.forEach((sc, item) -> {
|
|
|
+ if("合计".equals(item.getChapterSeq())){
|
|
|
+ item.setContractAmount(sc.getContractAmount());
|
|
|
+ }
|
|
|
item.setPreviousPeriodEndPay(sc.getPreviousPeriodEndPay());
|
|
|
item.setCurrentPeriodPay(sc.getCurrentPeriodPay());
|
|
|
item.setCurrentPeriodEndPay(sc.getCurrentPeriodEndPay());
|
|
@@ -1217,6 +1285,9 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*排序*/
|
|
|
List<String> indexSort =dataList.stream().map(InterimPaymentCertificate::getChapterSeq).collect(Collectors.toList());
|
|
|
itemList.forEach(e->{
|
|
|
+ e.setContractAmount(StringUtils.number2String(e.getContractAmount(),0));
|
|
|
+ e.setRevisedTotal(StringUtils.number2String(e.getRevisedTotal(),0));
|
|
|
+ e.setRevisedAmount(StringUtils.number2String(e.getRevisedAmount(),0));
|
|
|
e.setCertificateId(tec.getReportId());
|
|
|
e.setSort(indexSort.indexOf(e.getChapterSeq()));
|
|
|
});
|
|
@@ -1385,7 +1456,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/**变更数量*/
|
|
|
private Integer changeTotal =0;
|
|
|
/**完成数量*/
|
|
|
- private Double completed=0D;
|
|
|
+ private BigDecimal completed=BigDecimal.ZERO;
|
|
|
/**单价*/
|
|
|
private String price;
|
|
|
/* 本次完成数量
|
|
@@ -1410,7 +1481,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
this.unit = p.getUnit();
|
|
|
this.contractTotal=p.getContractTotal();
|
|
|
this.changeTotal = p.getChangeTotal();
|
|
|
- this.completed =p.getCompleted();
|
|
|
+ this.completed =BaseUtils.str2BigDecimal(p.getCompleted());
|
|
|
this.contractMoney =new BigDecimal(p.getContractMoney());
|
|
|
this.changeMoney =new BigDecimal(p.getChangeMoney());
|
|
|
this.money=p.getMoneyAsBigDecimal();
|
|
@@ -1423,7 +1494,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
this.itemName=next.itemName;
|
|
|
}
|
|
|
/*本期完成*/
|
|
|
- this.completed =next.completed+this.completed;;
|
|
|
+ this.completed =next.completed.add(this.completed);;
|
|
|
this.money=this.money.add(next.money);
|
|
|
return this;
|
|
|
}
|
|
@@ -1432,7 +1503,7 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
public Summary merge(Summary previous){
|
|
|
if(previous!=null){
|
|
|
this.currentPeriodEndPay=this.money.add(previous.money);
|
|
|
- this.completed=this.completed+previous.completed;
|
|
|
+ this.completed=this.completed.add(previous.completed);
|
|
|
}
|
|
|
return this;
|
|
|
}
|
|
@@ -1478,12 +1549,12 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
sis.setPrice(itf.getBidPrice());
|
|
|
if(cur!=null&&cur.getContractMoney()!=null) {
|
|
|
FormulaUtils.getScale(cur.getUnit()).ifPresent(scale->{
|
|
|
- cur.setCompleted(BaseUtils.str2BigDecimal(cur.getCompleted()).setScale(scale,RoundingMode.HALF_UP).doubleValue());
|
|
|
+ cur.setCompleted(BaseUtils.str2BigDecimal(cur.getCompleted()).setScale(scale,RoundingMode.HALF_UP));
|
|
|
cur.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(cur.getPrice(),cur.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
|
|
|
if (pre != null) {
|
|
|
- pre.setCompleted(BaseUtils.str2BigDecimal(pre.getCompleted()).setScale(scale,RoundingMode.HALF_UP).doubleValue());
|
|
|
+ pre.setCompleted(BaseUtils.str2BigDecimal(pre.getCompleted()).setScale(scale,RoundingMode.HALF_UP));
|
|
|
pre.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(pre.getPrice(),pre.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
|
|
|
- end.setCompleted(BaseUtils.str2BigDecimal(addFc.apply(cur.getCompleted().toString(),pre.getCompleted().toString())).setScale(scale,RoundingMode.HALF_UP).doubleValue());
|
|
|
+ end.setCompleted(BaseUtils.str2BigDecimal(addFc.apply(cur.getCompleted().toString(),pre.getCompleted().toString())).setScale(scale,RoundingMode.HALF_UP));
|
|
|
end.setMoney(BaseUtils.str2BigDecimal(multiFc.apply(end.getPrice(),end.getCompleted().toString())).setScale(0,RoundingMode.HALF_UP));
|
|
|
}else {
|
|
|
end.setCompleted(cur.getCompleted());
|
|
@@ -1491,13 +1562,13 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
}
|
|
|
});
|
|
|
sis.setCurrentPeriodPay(cur.getMoney().toPlainString());
|
|
|
- sis.setCurrentPeriodCompleted(cur.getCompleted().toString());
|
|
|
+ sis.setCurrentPeriodCompleted(cur.getCompleted().toPlainString());
|
|
|
if (pre != null) {
|
|
|
- sis.setPreviousPeriodPay(pre.getMoney().toString());
|
|
|
- sis.setPreviousPeriodCompleted(pre.getCompleted().toString());
|
|
|
+ sis.setPreviousPeriodPay(pre.getMoney().toPlainString());
|
|
|
+ sis.setPreviousPeriodCompleted(pre.getCompleted().toPlainString());
|
|
|
}
|
|
|
- sis.setCompleted(end.getCompleted().toString());
|
|
|
- sis.setCurrentPeriodEndPay(end.getMoney().toString());
|
|
|
+ sis.setCompleted(end.getCompleted().toPlainString());
|
|
|
+ sis.setCurrentPeriodEndPay(end.getMoney().toPlainString());
|
|
|
sis.setPayRatio(ratioFc.apply(sis.getCurrentPeriodEndPay(), sis.getChangeMoney()));
|
|
|
}
|
|
|
totalList.add(sis);
|