项目提交审核之后再保存预算列表和导出金额

master
OathK1per 2023-02-09 18:43:26 +08:00
parent 0616069aea
commit 7c9f0d8f66
2 changed files with 26 additions and 19 deletions

View File

@ -872,6 +872,8 @@ public class ProjectBudgetService {
budgetEditSave(project, projectInDb, budgetBean, admin, ApproveStatusEnum.APPROVAL_PENDING, projectBudget);
saveProjectExtend(projectInDb);
budgetApprove(approveStatusBudget, projectInDb, admin);
}
@ -926,7 +928,6 @@ public class ProjectBudgetService {
clearBudgetDetail(p);
saveBudgetDetail(p);
saveProjectExtend(p);
return p;
}
@ -959,15 +960,20 @@ public class ProjectBudgetService {
extend.setAdvancePeakAmount(bean.getAmount());
BudgetBean budgetBean = projectBudgetService.getBudget(p);
extend.setGrossProfit(budgetBean.getProjectGrossProfit());
BigDecimal grossProfit = budgetBean.getProjectGrossProfit();
if (grossProfit != null) {
extend.setGrossProfit(grossProfit);
extend.setGrossProfitMargin(budgetBean.getProjectGrossProfitRate());
}
List<ProjectBudgetIncomeDetail> projectBudgetIncomeDetails = projectBudgetIncomeDetailRepository.findAllByProjectIdEquals(p.getId());
if (projectBudgetIncomeDetails.size() > 0) {
BigDecimal contractAmount = projectBudgetIncomeDetails.stream().map(ProjectBudgetIncomeDetail::getTotalTaxInclude).reduce(new BigDecimal(0), BigDecimal::add);
extend.setContractAmount(contractAmount);
}
List<ProjectBudgetCostDetail> projectBudgetCostDetails = projectBudgetCostDetailRepository.findAllByProjectIdEquals(p.getId());
if (projectBudgetCostDetails.size() > 0) {
ProcurementType huizhiType = procurementTypeRepository.findByName("汇智产品");
BigDecimal huizhi = projectBudgetCostDetails.stream().filter(a -> a.getCategory() == huizhiType.getId()).map(ProjectBudgetCostDetail::getTotalTaxInclude).reduce(new BigDecimal(0), BigDecimal::add);
extend.setHuizhiProductAmount(huizhi);
@ -979,6 +985,7 @@ public class ProjectBudgetService {
extend.setHuasanProductAmount(huasan);
BigDecimal other = projectBudgetCostDetails.stream().filter(a -> a.getCategory() != huizhiType.getId() && a.getCategory() != huazhiType.getId() && a.getCategory() != huasanType.getId()).map(ProjectBudgetCostDetail::getTotalTaxInclude).reduce(new BigDecimal(0), BigDecimal::add);
extend.setZiguangOtherAmount(other);
}
projectExtendRepository.save(extend);
}

View File

@ -282,7 +282,7 @@ public class ProjectEstimateService {
Project p = projectService.addProject(project, admin, approveStatusEnum);
saveEstimate(p, estimateBean);
saveProjectExtend(p);
// saveProjectExtend(p);
return p;
}
/**
@ -400,7 +400,7 @@ public class ProjectEstimateService {
clearEstimate(p);
saveEstimate(p, estimateBean);
saveProjectExtend(p);
// saveProjectExtend(p);
return p;
}