2021-11-02 06:43:42 +00:00
|
|
|
package cn.palmte.work.service;
|
|
|
|
|
|
2021-11-18 08:01:09 +00:00
|
|
|
import cn.palmte.work.bean.ApproveStatusEnum;
|
2021-11-02 06:43:42 +00:00
|
|
|
import cn.palmte.work.bean.EstimateBean;
|
2021-11-18 08:01:09 +00:00
|
|
|
import cn.palmte.work.bean.ProjectConfigBean;
|
|
|
|
|
import cn.palmte.work.bean.StatusEnum;
|
2021-11-02 06:43:42 +00:00
|
|
|
import cn.palmte.work.model.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
2021-11-18 08:01:09 +00:00
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
2021-11-02 06:43:42 +00:00
|
|
|
import top.jfunc.common.utils.CollectionUtil;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 项目概算service
|
|
|
|
|
* @author xiongshiyan at 2021/10/29 , contact me with email yanshixiong@126.com or phone 15208384257
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class ProjectEstimateService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProjectEstimateIncomeRepository projectEstimateIncomeRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProjectEstimateCostRepository projectEstimateCostRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProjectEstimateCostManageRepository projectEstimateCostManageRepository;
|
2021-11-18 08:01:09 +00:00
|
|
|
@Autowired
|
|
|
|
|
private ProjectInstanceService projectInstanceService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ActTaskDefService actTaskDefService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProjectService projectService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProjectRepository projectRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysConfigService sysConfigService;
|
2021-11-02 06:43:42 +00:00
|
|
|
|
|
|
|
|
public void clearEstimate(Project project){
|
|
|
|
|
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
|
|
|
|
|
if(CollectionUtil.isNotEmpty(incomes)){
|
|
|
|
|
projectEstimateIncomeRepository.deleteInBatch(incomes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId());
|
|
|
|
|
if(CollectionUtil.isNotEmpty(costs)){
|
|
|
|
|
projectEstimateCostRepository.deleteInBatch(costs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ProjectEstimateCostManage> costManages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId());
|
|
|
|
|
if(CollectionUtil.isNotEmpty(costManages)){
|
|
|
|
|
projectEstimateCostManageRepository.deleteInBatch(costManages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveEstimate(Project project, EstimateBean estimateBean){
|
|
|
|
|
//收入记录
|
|
|
|
|
income(project, estimateBean);
|
|
|
|
|
//成本记录
|
|
|
|
|
cost(project, estimateBean);
|
|
|
|
|
//管理记录
|
|
|
|
|
costManage(project, estimateBean);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-25 03:34:38 +00:00
|
|
|
public void deleteEstimate(int projectId){
|
|
|
|
|
//删除收入记录
|
|
|
|
|
projectEstimateIncomeRepository.deleteByProjectId(projectId);
|
|
|
|
|
//删除成本记录
|
|
|
|
|
projectEstimateCostRepository.deleteByProjectId(projectId);
|
|
|
|
|
//删除管理记录
|
|
|
|
|
projectEstimateCostManageRepository.deleteByProjectId(projectId);
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-02 06:43:42 +00:00
|
|
|
private void cost(Project project, EstimateBean estimateBean) {
|
|
|
|
|
ProjectEstimateCost projectEstimateCostDevice = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostDevice.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostDevice.setFee(ProjectEstimateCost.FEE_PURCHASE);
|
|
|
|
|
projectEstimateCostDevice.setType(ProjectEstimateCost.TYPE_DEVICE);
|
|
|
|
|
projectEstimateCostDevice.setCostTaxInclude(estimateBean.getCostPurchaseDeviceTaxInclude());
|
|
|
|
|
projectEstimateCostDevice.setCostTaxExclude(estimateBean.getCostPurchaseDeviceTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostDevice);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostBuild = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostBuild.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostBuild.setFee(ProjectEstimateCost.FEE_PURCHASE);
|
|
|
|
|
projectEstimateCostBuild.setType(ProjectEstimateCost.TYPE_BUILDING);
|
|
|
|
|
projectEstimateCostBuild.setCostTaxInclude(estimateBean.getCostPurchaseBuildTaxInclude());
|
|
|
|
|
projectEstimateCostBuild.setCostTaxExclude(estimateBean.getCostPurchaseBuildTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostBuild);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostService = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostService.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostService.setFee(ProjectEstimateCost.FEE_PURCHASE);
|
|
|
|
|
projectEstimateCostService.setType(ProjectEstimateCost.TYPE_SERVICE);
|
|
|
|
|
projectEstimateCostService.setCostTaxInclude(estimateBean.getCostPurchaseServiceTaxInclude());
|
|
|
|
|
projectEstimateCostService.setCostTaxExclude(estimateBean.getCostPurchaseServiceTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostService);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostOther = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostOther.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostOther.setFee(ProjectEstimateCost.FEE_PURCHASE);
|
|
|
|
|
projectEstimateCostOther.setType(ProjectEstimateCost.TYPE_OTHER);
|
|
|
|
|
projectEstimateCostOther.setCostTaxInclude(estimateBean.getCostPurchaseOtherTaxInclude());
|
|
|
|
|
projectEstimateCostOther.setCostTaxExclude(estimateBean.getCostPurchaseOtherTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostOther);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostProject = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostProject.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostProject.setFee(ProjectEstimateCost.FEE_PROJECT_MANAGE);
|
|
|
|
|
projectEstimateCostProject.setType(ProjectEstimateCost.TYPE_PROJECT_MANAGE);
|
2021-11-03 09:26:06 +00:00
|
|
|
/*projectEstimateCostProject.setCostTaxInclude(estimateBean.getCostProjectManageTaxInclude());*/
|
2021-11-02 06:43:42 +00:00
|
|
|
projectEstimateCostProject.setCostTaxExclude(estimateBean.getCostProjectManageTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostProject);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostOtherOther = new ProjectEstimateCost();
|
|
|
|
|
projectEstimateCostOtherOther.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostOtherOther.setFee(ProjectEstimateCost.FEE_OTHER);
|
|
|
|
|
projectEstimateCostOtherOther.setType(ProjectEstimateCost.TYPE_OTHER_OTHER);
|
|
|
|
|
projectEstimateCostOtherOther.setCostTaxInclude(estimateBean.getCostOtherOtherTaxInclude());
|
|
|
|
|
projectEstimateCostOtherOther.setCostTaxExclude(estimateBean.getCostOtherOtherTaxExclude());
|
|
|
|
|
projectEstimateCostRepository.saveAndFlush(projectEstimateCostOtherOther);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void costManage(Project project, EstimateBean estimateBean) {
|
|
|
|
|
ProjectEstimateCostManage projectEstimateCostZijin = new ProjectEstimateCostManage();
|
|
|
|
|
projectEstimateCostZijin.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostZijin.setType(ProjectEstimateCostManage.TYPE_EXPROPRIATION);
|
|
|
|
|
projectEstimateCostZijin.setCostTaxExclude(estimateBean.getCostExpropriationTaxExclude());
|
|
|
|
|
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostZijin);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCostManage projectEstimateCostManage = new ProjectEstimateCostManage();
|
|
|
|
|
projectEstimateCostManage.setProjectId(project.getId());
|
|
|
|
|
projectEstimateCostManage.setType(ProjectEstimateCostManage.TYPE_COMPANY_MANAGE);
|
|
|
|
|
projectEstimateCostManage.setCostTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
|
|
|
|
|
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostManage);
|
|
|
|
|
}
|
|
|
|
|
private void income(Project project, EstimateBean estimateBean) {
|
|
|
|
|
ProjectEstimateIncome projectEstimateIncomeDevice = new ProjectEstimateIncome();
|
|
|
|
|
projectEstimateIncomeDevice.setProjectId(project.getId());
|
|
|
|
|
projectEstimateIncomeDevice.setType(ProjectEstimateIncome.TYPE_DEVICE);
|
|
|
|
|
projectEstimateIncomeDevice.setIncomeTaxInclude(estimateBean.getIncomeDeviceTaxInclude());
|
|
|
|
|
projectEstimateIncomeDevice.setIncomeTaxExclude(estimateBean.getIncomeDeviceTaxExclude());
|
|
|
|
|
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeDevice);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateIncome projectEstimateIncomeEngineer = new ProjectEstimateIncome();
|
|
|
|
|
projectEstimateIncomeEngineer.setProjectId(project.getId());
|
|
|
|
|
projectEstimateIncomeEngineer.setType(ProjectEstimateIncome.TYPE_ENGINEER);
|
|
|
|
|
projectEstimateIncomeEngineer.setIncomeTaxInclude(estimateBean.getIncomeEngineerTaxInclude());
|
|
|
|
|
projectEstimateIncomeEngineer.setIncomeTaxExclude(estimateBean.getIncomeEngineerTaxExclude());
|
|
|
|
|
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeEngineer);
|
|
|
|
|
|
|
|
|
|
ProjectEstimateIncome projectEstimateIncomeService = new ProjectEstimateIncome();
|
|
|
|
|
projectEstimateIncomeService.setProjectId(project.getId());
|
|
|
|
|
projectEstimateIncomeService.setType(ProjectEstimateIncome.TYPE_SERVICE);
|
|
|
|
|
projectEstimateIncomeService.setIncomeTaxInclude(estimateBean.getIncomeServiceTaxInclude());
|
|
|
|
|
projectEstimateIncomeService.setIncomeTaxExclude(estimateBean.getIncomeServiceTaxExclude());
|
|
|
|
|
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeService);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EstimateBean getEstimate(Project project) {
|
|
|
|
|
EstimateBean estimateBean = new EstimateBean();
|
|
|
|
|
List<ProjectEstimateIncome> incomes = projectEstimateIncomeRepository.findAllByProjectIdEquals(project.getId());
|
|
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
if(CollectionUtil.isNotEmpty(incomes)){
|
|
|
|
|
ProjectEstimateIncome projectEstimateIncomeDevice = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_DEVICE).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setIncomeDeviceTaxInclude(projectEstimateIncomeDevice.getIncomeTaxInclude());
|
|
|
|
|
estimateBean.setIncomeDeviceTaxExclude(projectEstimateIncomeDevice.getIncomeTaxExclude());
|
|
|
|
|
|
|
|
|
|
ProjectEstimateIncome projectEstimateIncomeEngineer = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_ENGINEER).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setIncomeEngineerTaxInclude(projectEstimateIncomeEngineer.getIncomeTaxInclude());
|
|
|
|
|
estimateBean.setIncomeEngineerTaxExclude(projectEstimateIncomeEngineer.getIncomeTaxExclude());
|
2021-11-02 06:43:42 +00:00
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
ProjectEstimateIncome projectEstimateIncomeService = incomes.stream().filter(d -> d.getType() == ProjectEstimateIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setIncomeServiceTaxInclude(projectEstimateIncomeService.getIncomeTaxInclude());
|
|
|
|
|
estimateBean.setIncomeServiceTaxExclude(projectEstimateIncomeService.getIncomeTaxExclude());
|
|
|
|
|
}
|
2021-11-02 06:43:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ProjectEstimateCost> costs = projectEstimateCostRepository.findAllByProjectIdEquals(project.getId());
|
|
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
if(CollectionUtil.isNotEmpty(costs)){
|
|
|
|
|
ProjectEstimateCost projectEstimateCostDevice = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_DEVICE).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostPurchaseDeviceTaxInclude(projectEstimateCostDevice.getCostTaxInclude());
|
|
|
|
|
estimateBean.setCostPurchaseDeviceTaxExclude(projectEstimateCostDevice.getCostTaxExclude());
|
2021-11-02 06:43:42 +00:00
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
ProjectEstimateCost projectEstimateCostBuild = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_BUILDING).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostPurchaseBuildTaxInclude(projectEstimateCostBuild.getCostTaxInclude());
|
|
|
|
|
estimateBean.setCostPurchaseBuildTaxExclude(projectEstimateCostBuild.getCostTaxExclude());
|
2021-11-02 06:43:42 +00:00
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
ProjectEstimateCost projectEstimateCostService = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_SERVICE).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostPurchaseServiceTaxInclude(projectEstimateCostService.getCostTaxInclude());
|
|
|
|
|
estimateBean.setCostPurchaseServiceTaxExclude(projectEstimateCostService.getCostTaxExclude());
|
2021-11-02 06:43:42 +00:00
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
ProjectEstimateCost projectEstimateCostOther = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_OTHER).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostPurchaseOtherTaxInclude(projectEstimateCostOther.getCostTaxInclude());
|
|
|
|
|
estimateBean.setCostPurchaseOtherTaxExclude(projectEstimateCostOther.getCostTaxExclude());
|
2021-11-02 06:43:42 +00:00
|
|
|
|
2021-11-05 07:05:33 +00:00
|
|
|
ProjectEstimateCost projectEstimateCostProjectManage = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_PROJECT_MANAGE).collect(Collectors.toList()).get(0);
|
2021-11-03 09:26:06 +00:00
|
|
|
/*estimateBean.setCostProjectManageTaxInclude(projectEstimateCostProjectManage.getCostTaxInclude());*/
|
2021-11-05 07:05:33 +00:00
|
|
|
estimateBean.setCostProjectManageTaxExclude(projectEstimateCostProjectManage.getCostTaxExclude());
|
|
|
|
|
|
|
|
|
|
ProjectEstimateCost projectEstimateCostOtherOther = costs.stream().filter(d -> d.getType() == ProjectEstimateCost.TYPE_OTHER_OTHER).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostOtherOtherTaxInclude(projectEstimateCostOtherOther.getCostTaxInclude());
|
|
|
|
|
estimateBean.setCostOtherOtherTaxExclude(projectEstimateCostOtherOther.getCostTaxExclude());
|
|
|
|
|
|
|
|
|
|
}
|
2021-11-02 06:43:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ProjectEstimateCostManage> manages = projectEstimateCostManageRepository.findAllByProjectIdEquals(project.getId());
|
2021-11-05 07:05:33 +00:00
|
|
|
if(CollectionUtil.isNotEmpty(manages)){
|
|
|
|
|
ProjectEstimateCostManage costManageExpropriation = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_EXPROPRIATION).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostExpropriationTaxExclude(costManageExpropriation.getCostTaxExclude());
|
|
|
|
|
ProjectEstimateCostManage costManageCompany = manages.stream().filter(d -> d.getType() == ProjectEstimateCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0);
|
|
|
|
|
estimateBean.setCostCompanyManageTaxExclude(costManageCompany.getCostTaxExclude());
|
|
|
|
|
}
|
2021-11-02 06:43:42 +00:00
|
|
|
|
|
|
|
|
return estimateBean;
|
|
|
|
|
}
|
2021-11-18 08:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增概算保存项目并发起审核
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
|
|
public Project estimateAddSaveAndApprove(Project project,
|
|
|
|
|
EstimateBean estimateBean,
|
|
|
|
|
Admin admin) throws Exception {
|
|
|
|
|
Project p = estimateAddSave(project, estimateBean, admin, ApproveStatusEnum.APPROVAL_PENDING);
|
|
|
|
|
|
|
|
|
|
projectInstanceService.startEstimateProcessInstance(p, admin);
|
|
|
|
|
|
|
|
|
|
return project;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 新增概算保存项目
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
|
|
public Project estimateAddSave(Project project,
|
|
|
|
|
EstimateBean estimateBean,
|
|
|
|
|
Admin admin,
|
|
|
|
|
ApproveStatusEnum approveStatusEnum) {
|
|
|
|
|
Project p = projectService.addProject(project, admin, approveStatusEnum);
|
|
|
|
|
saveEstimate(p, estimateBean);
|
|
|
|
|
|
|
|
|
|
return project;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 编辑概算保存项目并发起审核
|
|
|
|
|
*/
|
|
|
|
|
// @Transactional(rollbackFor = RuntimeException.class)
|
|
|
|
|
public void estimateEditSaveAndApprove(Project project,
|
|
|
|
|
Project projectInDb,
|
|
|
|
|
EstimateBean estimateBean,
|
|
|
|
|
Admin admin) throws Exception {
|
|
|
|
|
|
|
|
|
|
Integer approveStatusEstimate = projectInDb.getApproveStatusEstimate();
|
|
|
|
|
|
|
|
|
|
estimateEditSave(project, projectInDb, estimateBean, admin, ApproveStatusEnum.APPROVAL_PENDING);
|
|
|
|
|
|
2021-12-28 07:42:42 +00:00
|
|
|
estimateApprove(approveStatusEstimate, projectInDb, admin);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-28 07:47:56 +00:00
|
|
|
public void estimateApprove(Integer approveStatusEstimate, Project projectInDb, Admin admin) throws Exception {
|
2021-11-18 08:01:09 +00:00
|
|
|
if(null != approveStatusEstimate &&
|
|
|
|
|
ApproveStatusEnum.APPROVAL_UNPASS.getApproveStatus() == approveStatusEstimate){
|
|
|
|
|
//审核不通过的情况下重新编辑后就完成当前任务【此时任务节点在第一个,也就是发起审批】
|
|
|
|
|
List<String> estimateProcessInsIds = projectInstanceService.getEstimateProcessInsIds(projectInDb);
|
|
|
|
|
if(CollectionUtil.isNotEmpty(estimateProcessInsIds)){
|
|
|
|
|
actTaskDefService.completeTaskByProcInsId(estimateProcessInsIds.get(0),
|
|
|
|
|
ApproveStatusEnum.APPROVAL_PASSED.getApproveStatus(),
|
|
|
|
|
"重新修改了概算表,请审批");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//第一次或者重新发起一个流程实例【第一次或者以前的审批都已经过了】
|
|
|
|
|
projectInstanceService.startEstimateProcessInstance(projectInDb, admin);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-28 07:42:42 +00:00
|
|
|
|
2021-11-18 08:01:09 +00:00
|
|
|
/**
|
|
|
|
|
* 编辑概算保存项目
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
|
|
public Project estimateEditSave(Project project, Project projectInDb, EstimateBean estimateBean, Admin admin, ApproveStatusEnum approveStatusEnum) {
|
|
|
|
|
Project p = projectService.editProject(project, projectInDb);
|
|
|
|
|
p.setStatus(StatusEnum.ESTIMATE_ACCOUNTS.getStatus());
|
|
|
|
|
p.setStatusDesc(StatusEnum.ESTIMATE_ACCOUNTS.getStatusDesc());
|
|
|
|
|
p.setApproveStatusEstimate(approveStatusEnum.getApproveStatus());
|
|
|
|
|
p = projectRepository.saveAndFlush(p);
|
|
|
|
|
|
|
|
|
|
ProjectConfigBean projectConfigBeanConfig = sysConfigService.getProjectConfigBeanConfig();
|
|
|
|
|
project.setProjectContributionProfitRateThreshold(projectConfigBeanConfig.getProjectContributionProfitRateThreshold());
|
|
|
|
|
project.setUnderwrittenTaxRate(projectConfigBeanConfig.getUnderwrittenTaxRate());
|
|
|
|
|
|
|
|
|
|
//清空重新保存概算信息
|
|
|
|
|
clearEstimate(p);
|
|
|
|
|
saveEstimate(p, estimateBean);
|
|
|
|
|
return p;
|
|
|
|
|
}
|
2021-11-02 06:43:42 +00:00
|
|
|
}
|