fourcal/src/main/java/cn/palmte/work/bean/IncomeCostBean.java

427 lines
15 KiB
Java

package cn.palmte.work.bean;
import java.math.BigDecimal;
/**
* 预算概算页面的公共属性
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public abstract class IncomeCostBean {
/**
* 设备类收入含税
*/
private BigDecimal incomeDeviceTaxInclude;
/**
* 工程类收入含税
*/
private BigDecimal incomeEngineerTaxInclude;
/**
* 服务类收入含税
*/
private BigDecimal incomeServiceTaxInclude;
/**
* 设备类收入不含税
*/
private BigDecimal incomeDeviceTaxExclude;
/**
* 工程类收入不含税
*/
private BigDecimal incomeEngineerTaxExclude;
/**
* 服务类收入不含税
*/
private BigDecimal incomeServiceTaxExclude;
/**
* 设备采购成本含税
*/
private BigDecimal costPurchaseDeviceTaxInclude;
/**
* 施工采购成本含税
*/
private BigDecimal costPurchaseBuildTaxInclude;
/**
* 服务采购成本含税
*/
private BigDecimal costPurchaseServiceTaxInclude;
/*private BigDecimal costProjectManageTaxInclude;*/
/**
* 其他采购成本含税
*/
private BigDecimal costPurchaseOtherTaxInclude;
/**
* 其他成本含税
*/
private BigDecimal costOtherOtherTaxInclude;
/**
* 设备采购成本不含税
*/
private BigDecimal costPurchaseDeviceTaxExclude;
/**
* 施工采购成本不含税
*/
private BigDecimal costPurchaseBuildTaxExclude;
/**
* 服务采购成本不含税
*/
private BigDecimal costPurchaseServiceTaxExclude;
/**
* 其他采购成本不含税
*/
private BigDecimal costPurchaseOtherTaxExclude;
/**
* 工程管理成本不含税
*/
private BigDecimal costProjectManageTaxExclude;
/**
* 其他成本不含税
*/
private BigDecimal costOtherOtherTaxExclude;
/**
* 资金占用成本不含税
*/
private BigDecimal costExpropriationTaxExclude;
/**
* 公司管理成本不含税
*/
private BigDecimal costCompanyManageTaxExclude;
public BigDecimal getIncomeDeviceTaxInclude() {
return handleSpecial(incomeDeviceTaxInclude);
}
public void setIncomeDeviceTaxInclude(BigDecimal incomeDeviceTaxInclude) {
this.incomeDeviceTaxInclude = incomeDeviceTaxInclude;
}
public BigDecimal getIncomeEngineerTaxInclude() {
return handleSpecial(incomeEngineerTaxInclude);
}
public void setIncomeEngineerTaxInclude(BigDecimal incomeEngineerTaxInclude) {
this.incomeEngineerTaxInclude = incomeEngineerTaxInclude;
}
public BigDecimal getIncomeServiceTaxInclude() {
return handleSpecial(incomeServiceTaxInclude);
}
public void setIncomeServiceTaxInclude(BigDecimal incomeServiceTaxInclude) {
this.incomeServiceTaxInclude = incomeServiceTaxInclude;
}
public BigDecimal getIncomeDeviceTaxExclude() {
return handleSpecial(incomeDeviceTaxExclude);
}
public void setIncomeDeviceTaxExclude(BigDecimal incomeDeviceTaxExclude) {
this.incomeDeviceTaxExclude = incomeDeviceTaxExclude;
}
public BigDecimal getIncomeEngineerTaxExclude() {
return handleSpecial(incomeEngineerTaxExclude);
}
public void setIncomeEngineerTaxExclude(BigDecimal incomeEngineerTaxExclude) {
this.incomeEngineerTaxExclude = incomeEngineerTaxExclude;
}
public BigDecimal getIncomeServiceTaxExclude() {
return handleSpecial(incomeServiceTaxExclude);
}
public void setIncomeServiceTaxExclude(BigDecimal incomeServiceTaxExclude) {
this.incomeServiceTaxExclude = incomeServiceTaxExclude;
}
public BigDecimal getCostPurchaseDeviceTaxInclude() {
return handleSpecial(costPurchaseDeviceTaxInclude);
}
public void setCostPurchaseDeviceTaxInclude(BigDecimal costPurchaseDeviceTaxInclude) {
this.costPurchaseDeviceTaxInclude = costPurchaseDeviceTaxInclude;
}
public BigDecimal getCostPurchaseBuildTaxInclude() {
return handleSpecial(costPurchaseBuildTaxInclude);
}
public void setCostPurchaseBuildTaxInclude(BigDecimal costPurchaseBuildTaxInclude) {
this.costPurchaseBuildTaxInclude = costPurchaseBuildTaxInclude;
}
public BigDecimal getCostPurchaseServiceTaxInclude() {
return handleSpecial(costPurchaseServiceTaxInclude);
}
public void setCostPurchaseServiceTaxInclude(BigDecimal costPurchaseServiceTaxInclude) {
this.costPurchaseServiceTaxInclude = costPurchaseServiceTaxInclude;
}
/**
* 项目管理成本含税=项目管理成本不含税
*/
public BigDecimal getCostProjectManageTaxInclude() {
return getCostProjectManageTaxExclude();
}
/*public void setCostProjectManageTaxInclude(BigDecimal costProjectManageTaxInclude) {
this.costProjectManageTaxInclude = costProjectManageTaxInclude;
}*/
public BigDecimal getCostPurchaseOtherTaxInclude() {
return handleSpecial(costPurchaseOtherTaxInclude);
}
public void setCostPurchaseOtherTaxInclude(BigDecimal costPurchaseOtherTaxInclude) {
this.costPurchaseOtherTaxInclude = costPurchaseOtherTaxInclude;
}
public BigDecimal getCostOtherOtherTaxInclude() {
return handleSpecial(costOtherOtherTaxInclude);
}
public void setCostOtherOtherTaxInclude(BigDecimal costOtherOtherTaxInclude) {
this.costOtherOtherTaxInclude = costOtherOtherTaxInclude;
}
public BigDecimal getCostPurchaseDeviceTaxExclude() {
return handleSpecial(costPurchaseDeviceTaxExclude);
}
public void setCostPurchaseDeviceTaxExclude(BigDecimal costPurchaseDeviceTaxExclude) {
this.costPurchaseDeviceTaxExclude = costPurchaseDeviceTaxExclude;
}
public BigDecimal getCostPurchaseBuildTaxExclude() {
return handleSpecial(costPurchaseBuildTaxExclude);
}
public void setCostPurchaseBuildTaxExclude(BigDecimal costPurchaseBuildTaxExclude) {
this.costPurchaseBuildTaxExclude = costPurchaseBuildTaxExclude;
}
public BigDecimal getCostPurchaseServiceTaxExclude() {
return handleSpecial(costPurchaseServiceTaxExclude);
}
public void setCostPurchaseServiceTaxExclude(BigDecimal costPurchaseServiceTaxExclude) {
this.costPurchaseServiceTaxExclude = costPurchaseServiceTaxExclude;
}
public BigDecimal getCostPurchaseOtherTaxExclude() {
return handleSpecial(costPurchaseOtherTaxExclude);
}
public void setCostPurchaseOtherTaxExclude(BigDecimal costPurchaseOtherTaxExclude) {
this.costPurchaseOtherTaxExclude = costPurchaseOtherTaxExclude;
}
public BigDecimal getCostProjectManageTaxExclude() {
return handleSpecial(costProjectManageTaxExclude);
}
public void setCostProjectManageTaxExclude(BigDecimal costProjectManageTaxExclude) {
this.costProjectManageTaxExclude = costProjectManageTaxExclude;
}
public BigDecimal getCostOtherOtherTaxExclude() {
return handleSpecial(costOtherOtherTaxExclude);
}
public void setCostOtherOtherTaxExclude(BigDecimal costOtherOtherTaxExclude) {
this.costOtherOtherTaxExclude = costOtherOtherTaxExclude;
}
public BigDecimal getCostExpropriationTaxExclude() {
return handleSpecial(costExpropriationTaxExclude);
}
public void setCostExpropriationTaxExclude(BigDecimal costExpropriationTaxExclude) {
this.costExpropriationTaxExclude = costExpropriationTaxExclude;
}
public BigDecimal getCostCompanyManageTaxExclude() {
return handleSpecial(costCompanyManageTaxExclude);
}
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
this.costCompanyManageTaxExclude = costCompanyManageTaxExclude;
}
/**
* 计算管理成本不含税
*
* @return
*/
public BigDecimal getCostManageExclude() {
BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude();
BigDecimal costCompanyManageTaxExclude = getCostCompanyManageTaxExclude();
if (null == costExpropriationTaxExclude || null == costCompanyManageTaxExclude) {
return handleSpecial(null);
}
return costExpropriationTaxExclude.add(costCompanyManageTaxExclude);
}
/**
* 计算所有的含税收入
*/
public BigDecimal getIncomeTotalTaxInclude() {
BigDecimal incomeDeviceTaxInclude = getIncomeDeviceTaxInclude();
BigDecimal incomeEngineerTaxInclude = getIncomeEngineerTaxInclude();
BigDecimal incomeServiceTaxInclude = getIncomeServiceTaxInclude();
if (null == incomeDeviceTaxInclude || null == incomeEngineerTaxInclude || null == incomeServiceTaxInclude) {
return handleSpecial(null);
}
return incomeDeviceTaxInclude.add(incomeEngineerTaxInclude)
.add(incomeServiceTaxInclude);
}
/**
* 计算所有的不含税收入
*/
public BigDecimal getIncomeTotalTaxExclude() {
BigDecimal incomeDeviceTaxExclude = getIncomeDeviceTaxExclude();
BigDecimal incomeEngineerTaxExclude = getIncomeEngineerTaxExclude();
BigDecimal incomeServiceTaxExclude = getIncomeServiceTaxExclude();
if (null == incomeDeviceTaxExclude || null == incomeEngineerTaxExclude || null == incomeServiceTaxExclude) {
return handleSpecial(null);
}
return incomeDeviceTaxExclude.add(incomeEngineerTaxExclude)
.add(incomeServiceTaxExclude);
}
/**
* 计算所有的成本含税
*/
public BigDecimal getCostTotalTaxInclude() {
BigDecimal costPurchaseDeviceTaxInclude = getCostPurchaseDeviceTaxInclude();
BigDecimal costPurchaseBuildTaxInclude = getCostPurchaseBuildTaxInclude();
BigDecimal costPurchaseServiceTaxInclude = getCostPurchaseServiceTaxInclude();
BigDecimal costPurchaseOtherTaxInclude = getCostPurchaseOtherTaxInclude();
BigDecimal costProjectManageTaxInclude = getCostProjectManageTaxInclude();
BigDecimal costOtherOtherTaxInclude = getCostOtherOtherTaxInclude();
if (null == costPurchaseDeviceTaxInclude
|| null == costPurchaseBuildTaxInclude
|| null == costPurchaseServiceTaxInclude
|| null == costPurchaseOtherTaxInclude
|| null == costProjectManageTaxInclude
|| null == costOtherOtherTaxInclude) {
return handleSpecial(null);
}
return costPurchaseDeviceTaxInclude
.add(costPurchaseBuildTaxInclude)
.add(costPurchaseServiceTaxInclude)
.add(costPurchaseOtherTaxInclude)
.add(costProjectManageTaxInclude)
.add(costOtherOtherTaxInclude);
}
/**
* 计算所有的成本不含税
*/
public BigDecimal getCostTotalTaxExclude() {
BigDecimal costPurchaseDeviceTaxExclude = getCostPurchaseDeviceTaxExclude();
BigDecimal costPurchaseBuildTaxExclude = getCostPurchaseBuildTaxExclude();
BigDecimal costPurchaseServiceTaxExclude = getCostPurchaseServiceTaxExclude();
BigDecimal costPurchaseOtherTaxExclude = getCostPurchaseOtherTaxExclude();
BigDecimal costProjectManageTaxExclude = getCostProjectManageTaxExclude();
BigDecimal costOtherOtherTaxExclude = getCostOtherOtherTaxExclude();
if (null == costPurchaseDeviceTaxExclude
|| null == costPurchaseBuildTaxExclude
|| null == costPurchaseServiceTaxExclude
|| null == costPurchaseOtherTaxExclude
|| null == costProjectManageTaxExclude
|| null == costOtherOtherTaxExclude) {
return handleSpecial(null);
}
return costPurchaseDeviceTaxExclude
.add(costPurchaseBuildTaxExclude)
.add(costPurchaseServiceTaxExclude)
.add(costPurchaseOtherTaxExclude)
.add(costProjectManageTaxExclude)
.add(costOtherOtherTaxExclude);
}
/**
* 计算项目毛利
* 收入总计(不含税)-成本总计(不含税)-财务费用总计(不含税)
*/
public BigDecimal getProjectGrossProfit() {
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
BigDecimal costTotalTaxExclude = getCostTotalTaxExclude();
BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude();
if (null == incomeTotalTaxExclude || null == costTotalTaxExclude || null == costExpropriationTaxExclude) {
return handleSpecial(null);
}
return incomeTotalTaxExclude
.subtract(costTotalTaxExclude)
.subtract(costExpropriationTaxExclude);
}
/**
* 计算项目毛利率
* 毛利(不含税)/收入总计(不含税
*/
public BigDecimal getProjectGrossProfitRate() {
BigDecimal projectGrossProfit = getProjectGrossProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == projectGrossProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
BigDecimal zero = new BigDecimal(0);
if (projectGrossProfit.compareTo(zero) == 0 || incomeTotalTaxExclude.compareTo(zero) == 0) {
return handleSpecial(null);
}
return projectGrossProfit
.multiply(new BigDecimal(100))
.divide(incomeTotalTaxExclude, 2, BigDecimal.ROUND_HALF_UP);
}
/**
* 计算项目贡献利润
* 项目毛利(不含税)-公司管理费用总计(不含税)
*/
public BigDecimal getProjectContributionProfit() {
BigDecimal projectGrossProfit = getProjectGrossProfit();
BigDecimal costCompanyManageTaxExclude = getCostCompanyManageTaxExclude();
if (null == projectGrossProfit || null == costCompanyManageTaxExclude) {
return null;
}
return projectGrossProfit.subtract(costCompanyManageTaxExclude);
}
/**
* 计算项目贡献利润率
* 贡献利润(不含税)/收入总计(不含税)
*/
public BigDecimal getProjectContributionProfitRate() {
BigDecimal projectContributionProfit = getProjectContributionProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == projectContributionProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
BigDecimal zero = new BigDecimal(0);
if (projectContributionProfit.compareTo(zero) == 0 || incomeTotalTaxExclude.compareTo(zero) == 0) {
return handleSpecial(null);
}
return projectContributionProfit
.multiply(new BigDecimal(100))
.divide(incomeTotalTaxExclude, 2, BigDecimal.ROUND_HALF_UP);
}
/**
* 对null值如何处理
*
* @param src 原值
* @return 特殊处理之后的值
*/
protected abstract BigDecimal handleSpecial(BigDecimal src);
}