|
@@ -2,6 +2,7 @@ package org.springblade.manager.formula.impl;
|
|
|
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.annotation.JSONField;
|
|
|
+import com.itextpdf.text.Chapter;
|
|
|
import com.mixsmart.utils.CustomFunction;
|
|
|
import com.mixsmart.utils.FormulaUtils;
|
|
|
import com.mixsmart.utils.StringUtils;
|
|
@@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
|
import org.springblade.manager.dto.FormEndPayDTO;
|
|
|
+import org.springblade.manager.entity.ChapterEndPay;
|
|
|
import org.springblade.manager.utils.PeriodContractUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
@@ -1043,6 +1045,29 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
@Override
|
|
|
public void parse() {
|
|
|
+ FormEndPayDTO dto = PeriodContractUtil.get();
|
|
|
+ //本期期数ID
|
|
|
+ Long periodId=dto.getPeriodId();
|
|
|
+ //合同段ID
|
|
|
+ Long contractId=dto.getContractId();
|
|
|
+ //项目ID
|
|
|
+ Long projectId=dto.getProjectId();
|
|
|
+ //上期期数ID
|
|
|
+ Long prePeriodId = null;
|
|
|
+ List<ContractMeterPeriod> contractMeterPeriodList =FormEndPayUtil.selectList(contractId);
|
|
|
+ if(contractMeterPeriodList.size()>0){
|
|
|
+ OptionalInt index=IntStream.range(0, contractMeterPeriodList.size())
|
|
|
+ .filter(i -> contractMeterPeriodList.get(i).getId().equals(periodId))
|
|
|
+ .findFirst();
|
|
|
+ //i大于0 说明需要有上期
|
|
|
+ if(index.isPresent()){
|
|
|
+ int j = index.getAsInt();
|
|
|
+ if(j>0){
|
|
|
+ prePeriodId=contractMeterPeriodList.get(j-1).getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Long finalPrePeriodId = prePeriodId;
|
|
|
builderFormDatas(InterimPaymentCertificate.class);
|
|
|
/*数据获取start*/
|
|
|
/*合同计量清单*/
|
|
@@ -1085,8 +1110,19 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
ipc.setContractAmount(bmMoney[0].toString());
|
|
|
ipc.setRevisedAmount(bmMoney[1].toString());
|
|
|
ipc.setPreviousPeriodEndPay(StringUtils.handleNullZero(previousMoney.get(cm.getKey()),tec.getScale()));
|
|
|
+ String k=cm.getKey();
|
|
|
+ if(finalPrePeriodId!=null){
|
|
|
+ if(BaseUtils.isNumber(cm.getKey())){
|
|
|
+ k=k+"章";
|
|
|
+ }
|
|
|
+ ChapterEndPay chapterEndPay= FormEndPayUtil.selectChapterEndPay(finalPrePeriodId, contractId, k);
|
|
|
+ if(ObjectUtil.isNotEmpty(chapterEndPay)){
|
|
|
+ if(null!=chapterEndPay.getCurrentPeriodEndPay()){
|
|
|
+ ipc.setPreviousPeriodEndPay(chapterEndPay.getCurrentPeriodEndPay().toPlainString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ipc.setCurrentPeriodPay(StringUtils.handleNull(currentMoney.get(cm.getKey())));
|
|
|
-
|
|
|
ipc.setCurrentPeriodChangeMoney(StringUtils.handleNullZero(sumChangeMoneyForChapter(changeTokenList0,ch)
|
|
|
,tec.getPayRadicScale()));
|
|
|
ipc.setPreviousPeriodEndChangeMoney(StringUtils.handleNullZero(sumChangeMoneyForChapter(changeTokenList1,ch)
|
|
@@ -1640,9 +1676,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
|
|
|
public Summary(Payment p) {
|
|
|
this.formNumber=p.getNumber();
|
|
|
- if(p.getNumber().equals("405-4")){
|
|
|
- System.out.println("111");
|
|
|
- }
|
|
|
this.itemName=p.getName();
|
|
|
this.unit = p.getUnit();
|
|
|
this.contractTotal=BaseUtils.str2BigDecimal(p.getContractTotal());
|
|
@@ -1699,7 +1732,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
Long contractId=dto.getContractId();
|
|
|
//项目ID
|
|
|
Long projectId=dto.getProjectId();
|
|
|
- PeriodContractUtil.clear();
|
|
|
//上期期数ID
|
|
|
Long prePeriodId = null;
|
|
|
List<ContractMeterPeriod> list =FormEndPayUtil.selectList(contractId);
|
|
@@ -1872,6 +1904,33 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
if(m>1) {
|
|
|
/*本章小结*/
|
|
|
subtotal(new SubprojectInterimPaymentSummary("章合计"),tmp,v,tec.getScale());
|
|
|
+ //把每章的到本期末合计金额存入数据库
|
|
|
+ if(BaseUtils.isNumber(k)){
|
|
|
+ k=k+"章";
|
|
|
+ }
|
|
|
+ ChapterEndPay chapterEndPay = FormEndPayUtil.selectChapterEndPay(periodId, contractId, k);
|
|
|
+ SubprojectInterimPaymentSummary sm = tmp.get(tmp.size() - 1);
|
|
|
+ BigDecimal money=BigDecimal.ZERO;
|
|
|
+ if(null!=sm.getCurrentPeriodEndPay()){
|
|
|
+ money=new BigDecimal(sm.getCurrentPeriodEndPay());
|
|
|
+ }
|
|
|
+ if(money.compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ if(ObjectUtil.isNotEmpty(chapterEndPay)){
|
|
|
+ if(!chapterEndPay.getCurrentPeriodEndPay().equals(money)){
|
|
|
+ chapterEndPay.setCurrentPeriodEndPay(money);
|
|
|
+ FormEndPayUtil.updateChapterEndPay(chapterEndPay);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ chapterEndPay=new ChapterEndPay();
|
|
|
+ chapterEndPay.setId(SnowFlakeUtil.getId());
|
|
|
+ chapterEndPay.setProjectId(projectId);
|
|
|
+ chapterEndPay.setPeriodId(periodId);
|
|
|
+ chapterEndPay.setContractId(contractId);
|
|
|
+ chapterEndPay.setFormNumber(k);
|
|
|
+ chapterEndPay.setCurrentPeriodEndPay(money);
|
|
|
+ FormEndPayUtil.insertChapterEndPay(chapterEndPay);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if(m>2){
|
|
|
/*所有章合计*/
|