项目新增概算信息

master
xxssyyyyssxx 2021-11-01 20:07:02 +08:00
parent db2007c4c7
commit afc2e5cd49
10 changed files with 426 additions and 51 deletions

View File

@ -9,12 +9,10 @@ public class EstimateBean {
private BigDecimal incomeDeviceTaxInclude;
private BigDecimal incomeEngineerTaxInclude;
private BigDecimal incomeServiceTaxInclude;
private BigDecimal incomeTotalTaxInclude;
private BigDecimal incomeDeviceTaxExclude;
private BigDecimal incomeEngineerTaxExclude;
private BigDecimal incomeServiceTaxExclude;
private BigDecimal incomeTotalTaxExclude;
private BigDecimal costPurchaseDeviceTaxInclude;
private BigDecimal costPurchaseBuildTaxInclude;
@ -22,7 +20,6 @@ public class EstimateBean {
private BigDecimal costProjectManageTaxInclude;
private BigDecimal costPurchaseOtherTaxInclude;
private BigDecimal costOtherOtherTaxInclude;
private BigDecimal costTotalTaxInclude;
private BigDecimal costPurchaseDeviceTaxExclude;
private BigDecimal costPurchaseBuildTaxExclude;
@ -30,16 +27,10 @@ public class EstimateBean {
private BigDecimal costPurchaseOtherTaxExclude;
private BigDecimal costProjectManageTaxExclude;
private BigDecimal costOtherOtherTaxExclude;
private BigDecimal costTotalTaxExclude;
private BigDecimal costExpropriationTaxExclude;
private BigDecimal costCompanyManageTaxExclude;
private BigDecimal projectGrossProfit;
private BigDecimal projectGrossProfitRate;
private BigDecimal projectContributionProfit;
private BigDecimal projectContributionProfitRate;
public BigDecimal getIncomeDeviceTaxInclude() {
return incomeDeviceTaxInclude;
}
@ -65,11 +56,8 @@ public class EstimateBean {
}
public BigDecimal getIncomeTotalTaxInclude() {
return incomeTotalTaxInclude;
}
public void setIncomeTotalTaxInclude(BigDecimal incomeTotalTaxInclude) {
this.incomeTotalTaxInclude = incomeTotalTaxInclude;
return incomeDeviceTaxInclude.add(incomeEngineerTaxInclude)
.add(incomeServiceTaxInclude);
}
public BigDecimal getIncomeDeviceTaxExclude() {
@ -97,11 +85,8 @@ public class EstimateBean {
}
public BigDecimal getIncomeTotalTaxExclude() {
return incomeTotalTaxExclude;
}
public void setIncomeTotalTaxExclude(BigDecimal incomeTotalTaxExclude) {
this.incomeTotalTaxExclude = incomeTotalTaxExclude;
return incomeDeviceTaxExclude.add(incomeEngineerTaxExclude)
.add(incomeServiceTaxExclude);
}
public BigDecimal getCostPurchaseDeviceTaxInclude() {
@ -153,11 +138,12 @@ public class EstimateBean {
}
public BigDecimal getCostTotalTaxInclude() {
return costTotalTaxInclude;
}
public void setCostTotalTaxInclude(BigDecimal costTotalTaxInclude) {
this.costTotalTaxInclude = costTotalTaxInclude;
return costPurchaseDeviceTaxInclude
.add(costPurchaseBuildTaxInclude)
.add(costPurchaseServiceTaxInclude)
.add(costPurchaseOtherTaxInclude)
.add(costProjectManageTaxInclude)
.add(costOtherOtherTaxInclude);
}
public BigDecimal getCostPurchaseDeviceTaxExclude() {
@ -209,12 +195,13 @@ public class EstimateBean {
}
public BigDecimal getCostTotalTaxExclude() {
return costTotalTaxExclude;
return costPurchaseDeviceTaxExclude.add(costPurchaseBuildTaxExclude)
.add(costPurchaseServiceTaxExclude)
.add(costPurchaseOtherTaxExclude)
.add(costProjectManageTaxExclude)
.add(costOtherOtherTaxExclude);
}
public void setCostTotalTaxExclude(BigDecimal costTotalTaxExclude) {
this.costTotalTaxExclude = costTotalTaxExclude;
}
public BigDecimal getCostExpropriationTaxExclude() {
return costExpropriationTaxExclude;
@ -233,34 +220,19 @@ public class EstimateBean {
}
public BigDecimal getProjectGrossProfit() {
return projectGrossProfit;
return getIncomeTotalTaxExclude().subtract(getCostTotalTaxExclude()).subtract(getCostExpropriationTaxExclude());
}
public void setProjectGrossProfit(BigDecimal projectGrossProfit) {
this.projectGrossProfit = projectGrossProfit;
}
public BigDecimal getProjectGrossProfitRate() {
return projectGrossProfitRate;
}
public void setProjectGrossProfitRate(BigDecimal projectGrossProfitRate) {
this.projectGrossProfitRate = projectGrossProfitRate;
return getProjectGrossProfit().multiply(new BigDecimal(100)).divide(getIncomeTotalTaxExclude(),2,BigDecimal.ROUND_HALF_UP);
}
public BigDecimal getProjectContributionProfit() {
return projectContributionProfit;
}
public void setProjectContributionProfit(BigDecimal projectContributionProfit) {
this.projectContributionProfit = projectContributionProfit;
return getProjectGrossProfit().subtract(getCostCompanyManageTaxExclude());
}
public BigDecimal getProjectContributionProfitRate() {
return projectContributionProfitRate;
}
public void setProjectContributionProfitRate(BigDecimal projectContributionProfitRate) {
this.projectContributionProfitRate = projectContributionProfitRate;
return getProjectContributionProfit().multiply(new BigDecimal(100)).divide(getIncomeTotalTaxExclude(), 2,BigDecimal.ROUND_HALF_UP);
}
}

View File

@ -0,0 +1,80 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_estimate_cost")
public class ProjectEstimateCost {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int fee;
private int type;
@Column(name = "cost_tax_include")
private BigDecimal costTaxInclude;
@Column(name = "cost_tax_exclude")
private BigDecimal costTaxExclude;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getFee() {
return fee;
}
public void setFee(int fee) {
this.fee = fee;
}
public BigDecimal getCostTaxInclude() {
return costTaxInclude;
}
public void setCostTaxInclude(BigDecimal costTaxInclude) {
this.costTaxInclude = costTaxInclude;
}
public BigDecimal getCostTaxExclude() {
return costTaxExclude;
}
public void setCostTaxExclude(BigDecimal costTaxExclude) {
this.costTaxExclude = costTaxExclude;
}
}

View File

@ -0,0 +1,61 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_estimate_cost_manage")
public class ProjectEstimateCostManage {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
@Column(name = "income_tax_exclude")
private BigDecimal incomeTaxExclude;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public BigDecimal getIncomeTaxExclude() {
return incomeTaxExclude;
}
public void setIncomeTaxExclude(BigDecimal incomeTaxExclude) {
this.incomeTaxExclude = incomeTaxExclude;
}
}

View File

@ -0,0 +1,6 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectEstimateCostManageRepository extends JpaRepository<ProjectEstimateCostManage,Integer> {
}

View File

@ -0,0 +1,6 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectEstimateCostRepository extends JpaRepository<ProjectEstimateCost,Integer> {
}

View File

@ -0,0 +1,71 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_estimate_income")
public class ProjectEstimateIncome {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
@Column(name = "income_tax_include")
private BigDecimal incomeTaxInclude;
@Column(name = "income_tax_exclude")
private BigDecimal incomeTaxExclude;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public BigDecimal getIncomeTaxInclude() {
return incomeTaxInclude;
}
public void setIncomeTaxInclude(BigDecimal incomeTaxInclude) {
this.incomeTaxInclude = incomeTaxInclude;
}
public BigDecimal getIncomeTaxExclude() {
return incomeTaxExclude;
}
public void setIncomeTaxExclude(BigDecimal incomeTaxExclude) {
this.incomeTaxExclude = incomeTaxExclude;
}
}

View File

@ -0,0 +1,6 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectEstimateIncomeRepository extends JpaRepository<ProjectEstimateIncome,Integer> {
}

View File

@ -0,0 +1,71 @@
package cn.palmte.work.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
/**
*
*/
@Entity
@Table(name = "project_estimate_profit")
public class ProjectEstimateProfit {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
private Integer id;
@Column(name = "project_id")
private int projectId;
private int type;
@Column(name = "income_tax_exclude")
private BigDecimal incomeTaxExclude;
@Column(name = "profit_rate")
private BigDecimal profitRate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public BigDecimal getIncomeTaxExclude() {
return incomeTaxExclude;
}
public void setIncomeTaxExclude(BigDecimal incomeTaxExclude) {
this.incomeTaxExclude = incomeTaxExclude;
}
public BigDecimal getProfitRate() {
return profitRate;
}
public void setProfitRate(BigDecimal profitRate) {
this.profitRate = profitRate;
}
}

View File

@ -0,0 +1,6 @@
package cn.palmte.work.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectEstimateProfitRepository extends JpaRepository<ProjectEstimateProfit,Integer> {
}

View File

@ -4,9 +4,7 @@ import cn.palmte.work.bean.ApproveStatusEnum;
import cn.palmte.work.bean.EstimateBean;
import cn.palmte.work.bean.StatusEnum;
import cn.palmte.work.bean.TypeEnum;
import cn.palmte.work.model.Admin;
import cn.palmte.work.model.Project;
import cn.palmte.work.model.ProjectRepository;
import cn.palmte.work.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jfunc.common.db.QueryHelper;
@ -26,6 +24,12 @@ public class ProjectService {
private Pagination pagination;
@Autowired
private ProjectRepository projectRepository;
@Autowired
private ProjectEstimateIncomeRepository projectEstimateIncomeRepository;
@Autowired
private ProjectEstimateCostRepository projectEstimateCostRepository;
@Autowired
private ProjectEstimateCostManageRepository projectEstimateCostManageRepository;
private QueryHelper getQueryHelper(Map<String, String> searchInfo, int pageNumber, int pageSize) {
@ -101,7 +105,99 @@ public class ProjectService {
project = projectRepository.saveAndFlush(project);
//收入记录
income(project, estimateBean);
//成本记录
cost(project, estimateBean);
//管理记录
costManage(project, estimateBean);
return project;
}
private void cost(Project project, EstimateBean estimateBean) {
ProjectEstimateCost projectEstimateCostDevice = new ProjectEstimateCost();
projectEstimateCostDevice.setProjectId(project.getId());
projectEstimateCostDevice.setFee(1);
projectEstimateCostDevice.setType(1);
projectEstimateCostDevice.setCostTaxInclude(estimateBean.getCostPurchaseDeviceTaxInclude());
projectEstimateCostDevice.setCostTaxExclude(estimateBean.getCostPurchaseDeviceTaxExclude());
projectEstimateCostRepository.saveAndFlush(projectEstimateCostDevice);
ProjectEstimateCost projectEstimateCostBuild = new ProjectEstimateCost();
projectEstimateCostBuild.setProjectId(project.getId());
projectEstimateCostBuild.setFee(1);
projectEstimateCostBuild.setType(2);
projectEstimateCostBuild.setCostTaxInclude(estimateBean.getCostPurchaseBuildTaxInclude());
projectEstimateCostBuild.setCostTaxExclude(estimateBean.getCostPurchaseBuildTaxExclude());
projectEstimateCostRepository.saveAndFlush(projectEstimateCostBuild);
ProjectEstimateCost projectEstimateCostService = new ProjectEstimateCost();
projectEstimateCostService.setProjectId(project.getId());
projectEstimateCostService.setFee(1);
projectEstimateCostService.setType(3);
projectEstimateCostService.setCostTaxInclude(estimateBean.getCostPurchaseServiceTaxInclude());
projectEstimateCostService.setCostTaxExclude(estimateBean.getCostPurchaseServiceTaxExclude());
projectEstimateCostRepository.saveAndFlush(projectEstimateCostService);
ProjectEstimateCost projectEstimateCostOther = new ProjectEstimateCost();
projectEstimateCostOther.setProjectId(project.getId());
projectEstimateCostOther.setFee(1);
projectEstimateCostOther.setType(4);
projectEstimateCostOther.setCostTaxInclude(estimateBean.getCostPurchaseOtherTaxInclude());
projectEstimateCostOther.setCostTaxExclude(estimateBean.getCostPurchaseOtherTaxExclude());
projectEstimateCostRepository.saveAndFlush(projectEstimateCostOther);
ProjectEstimateCost projectEstimateCostProject = new ProjectEstimateCost();
projectEstimateCostProject.setProjectId(project.getId());
projectEstimateCostProject.setFee(2);
projectEstimateCostProject.setType(5);
projectEstimateCostProject.setCostTaxInclude(estimateBean.getCostProjectManageTaxInclude());
projectEstimateCostProject.setCostTaxExclude(estimateBean.getCostProjectManageTaxExclude());
projectEstimateCostRepository.saveAndFlush(projectEstimateCostProject);
ProjectEstimateCost projectEstimateCostOtherOther = new ProjectEstimateCost();
projectEstimateCostOtherOther.setProjectId(project.getId());
projectEstimateCostOtherOther.setFee(3);
projectEstimateCostOtherOther.setType(6);
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(1);
projectEstimateCostZijin.setIncomeTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostZijin);
ProjectEstimateCostManage projectEstimateCostManage = new ProjectEstimateCostManage();
projectEstimateCostManage.setProjectId(project.getId());
projectEstimateCostManage.setType(2);
projectEstimateCostManage.setIncomeTaxExclude(estimateBean.getCostCompanyManageTaxExclude());
projectEstimateCostManageRepository.saveAndFlush(projectEstimateCostManage);
}
private void income(Project project, EstimateBean estimateBean) {
ProjectEstimateIncome projectEstimateIncomeDevice = new ProjectEstimateIncome();
projectEstimateIncomeDevice.setProjectId(project.getId());
projectEstimateIncomeDevice.setType(1);
projectEstimateIncomeDevice.setIncomeTaxInclude(estimateBean.getIncomeDeviceTaxInclude());
projectEstimateIncomeDevice.setIncomeTaxExclude(estimateBean.getIncomeDeviceTaxExclude());
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeDevice);
ProjectEstimateIncome projectEstimateIncomeEngineer = new ProjectEstimateIncome();
projectEstimateIncomeEngineer.setProjectId(project.getId());
projectEstimateIncomeEngineer.setType(2);
projectEstimateIncomeEngineer.setIncomeTaxInclude(estimateBean.getIncomeEngineerTaxInclude());
projectEstimateIncomeEngineer.setIncomeTaxExclude(estimateBean.getIncomeEngineerTaxExclude());
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeEngineer);
ProjectEstimateIncome projectEstimateIncomeService = new ProjectEstimateIncome();
projectEstimateIncomeService.setProjectId(project.getId());
projectEstimateIncomeService.setType(3);
projectEstimateIncomeService.setIncomeTaxInclude(estimateBean.getIncomeServiceTaxInclude());
projectEstimateIncomeService.setIncomeTaxExclude(estimateBean.getIncomeServiceTaxExclude());
projectEstimateIncomeRepository.saveAndFlush(projectEstimateIncomeService);
}
}