|
|
@@ -1005,10 +1005,6 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
change.setContractInventoryAmount(inventory.getContractMoney()+"");
|
|
|
/*到本期末变更后(单价)*/
|
|
|
change.setAfterChangePeriodPrice(inventory.getChangePrice()+"");
|
|
|
- /*到本期末变更后(工程量)*/
|
|
|
- change.setAfterChangePeriodUnit(inventory.getChangeTotal()+"");
|
|
|
- /*到本期末变更后(金额)*/
|
|
|
- change.setAfterChangePeriodAmount(inventory.getChangeMoney()+"");
|
|
|
//统计本期变更(数量) 将所有的变更数量加起来
|
|
|
BigDecimal totalChangeUnit = ChangeTokenInventoryList.stream()
|
|
|
.map(ChangeTokenInventory::getChangeTotal)
|
|
|
@@ -1068,14 +1064,48 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
/*到本期末变更累计金额*/
|
|
|
BigDecimal prechangeMoney = new BigDecimal(StringUtils.isEmpty(preChangeForm.getChangeMoney())?"0":preChangeForm.getChangeMoney());
|
|
|
change.setChangeEndPeriodAmount((prechangeMoney.add(totalChangeAmount)).stripTrailingZeros().toPlainString());
|
|
|
- }else {
|
|
|
- change.setChangeEndPeriodUnit(totalChangeUnit.stripTrailingZeros().toPlainString());
|
|
|
- change.setChangeEndPeriodAmount(totalChangeAmount.stripTrailingZeros().toPlainString());
|
|
|
+ } else {
|
|
|
+ ChangeInventoryForm ChangeForm = null;
|
|
|
+ // 上期没有变更情况,就看之前期
|
|
|
+ boolean found = false;
|
|
|
+ // 倒序遍历,从后往前找到prePeriodId,然后继续往前
|
|
|
+ for (int i = contractMeterPeriodList.size() - 1; i >= 0; i--) {
|
|
|
+ ContractMeterPeriod contractMeterPeriod = contractMeterPeriodList.get(i);
|
|
|
+ if (!found && contractMeterPeriod.getId().equals(prePeriodId)) {
|
|
|
+ found = true;
|
|
|
+ continue; // 跳过prePeriodId本身,开始处理前面的
|
|
|
+ }
|
|
|
+ if (found) {
|
|
|
+ // 在这里处理prePeriodId之前的元素
|
|
|
+ ChangeForm= InventoryUCUtil.getChangeForm(tec.getContractId(), contractMeterPeriod.getId(), entry.getKey());
|
|
|
+ //找到之前期的变更情况
|
|
|
+ if(ChangeForm!=null){
|
|
|
+ //上一期的到本期末变更数量+本期变更数量
|
|
|
+ /*到本期末变更累计数量*/
|
|
|
+ BigDecimal prechangeTotal = new BigDecimal(StringUtils.isEmpty(ChangeForm.getChangeTotal())?"0":ChangeForm.getChangeTotal());
|
|
|
+ change.setChangeEndPeriodUnit((prechangeTotal.add(totalChangeUnit)).stripTrailingZeros().toPlainString());
|
|
|
+ //上一期的到本期末变更金额+本期变更金额
|
|
|
+ /*到本期末变更累计金额*/
|
|
|
+ BigDecimal prechangeMoney = new BigDecimal(StringUtils.isEmpty(ChangeForm.getChangeMoney())?"0":ChangeForm.getChangeMoney());
|
|
|
+ change.setChangeEndPeriodAmount((prechangeMoney.add(totalChangeAmount)).stripTrailingZeros().toPlainString());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 没有找到之前期的变更情况 就用本期的数据
|
|
|
+ if(ChangeForm==null){
|
|
|
+ change.setChangeEndPeriodUnit(totalChangeUnit.stripTrailingZeros().toPlainString());
|
|
|
+ change.setChangeEndPeriodAmount(totalChangeAmount.stripTrailingZeros().toPlainString());
|
|
|
+ }
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
change.setChangeEndPeriodUnit(totalChangeUnit.stripTrailingZeros().toPlainString());
|
|
|
change.setChangeEndPeriodAmount(totalChangeAmount.stripTrailingZeros().toPlainString());
|
|
|
}
|
|
|
+ /*到本期末变更后(工程量)*/
|
|
|
+ change.setAfterChangePeriodUnit(new BigDecimal(StringUtils.isEmpty(change.getChangeEndPeriodUnit())?"0":change.getChangeEndPeriodUnit()).add(new BigDecimal(StringUtils.isEmpty(change.getChangePeriodUnit())?"0":change.getChangePeriodUnit())).stripTrailingZeros().toPlainString());
|
|
|
+ /*到本期末变更后(金额)*/
|
|
|
+ change.setAfterChangePeriodAmount(new BigDecimal(StringUtils.isEmpty(change.getChangeEndPeriodAmount())?"0":change.getChangeEndPeriodAmount()).add(new BigDecimal(StringUtils.isEmpty(change.getChangePeriodAmount())?"0":change.getChangePeriodAmount())).stripTrailingZeros().toPlainString());
|
|
|
dataList.add(change);
|
|
|
}
|
|
|
if(!dataList.isEmpty()){
|
|
|
@@ -2244,8 +2274,8 @@ public class ExecutorMeter extends FormulaExecutor {
|
|
|
.map(BaseUtils::str2BigDecimal)
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
.setScale(0, RoundingMode.HALF_UP); // 四舍五入保留整数
|
|
|
- String changeMoneyAllWan = changeMoneyAll.divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_UP).toPlainString();
|
|
|
- cs.setChangeMoneyAll(changeMoneyAllWan);
|
|
|
+ //String changeMoneyAllWan = changeMoneyAll.divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_UP).toPlainString();
|
|
|
+ cs.setChangeMoneyAll(changeMoneyAll+"");
|
|
|
dataList.add(cs);
|
|
|
});
|
|
|
/*每月合计进度*/
|