概算页面和预算页面不同的处理方式

master
xxssyyyyssxx 2021-11-06 14:03:05 +08:00
parent c7f54029c9
commit bb538620b0
3 changed files with 88 additions and 31 deletions

View File

@ -1,8 +1,17 @@
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 class BudgetBean extends IncomeCostBean{
/**
* null0
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return null == src ? new BigDecimal(0) : src;
}
}

View File

@ -1,8 +1,17 @@
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 class EstimateBean extends IncomeCostBean{
/**
*
*/
@Override
protected BigDecimal handleSpecial(BigDecimal src) {
return src;
}
}

View File

@ -6,7 +6,7 @@ import java.math.BigDecimal;
*
* @author xiongshiyan at 2021/11/1 , contact me with email yanshixiong@126.com or phone 15208384257
*/
public class IncomeCostBean {
public abstract class IncomeCostBean {
/**
*
*/
@ -88,7 +88,7 @@ public class IncomeCostBean {
private BigDecimal costCompanyManageTaxExclude;
public BigDecimal getIncomeDeviceTaxInclude() {
return incomeDeviceTaxInclude;
return handleSpecial(incomeDeviceTaxInclude);
}
public void setIncomeDeviceTaxInclude(BigDecimal incomeDeviceTaxInclude) {
@ -96,7 +96,7 @@ public class IncomeCostBean {
}
public BigDecimal getIncomeEngineerTaxInclude() {
return incomeEngineerTaxInclude;
return handleSpecial(incomeEngineerTaxInclude);
}
public void setIncomeEngineerTaxInclude(BigDecimal incomeEngineerTaxInclude) {
@ -104,7 +104,7 @@ public class IncomeCostBean {
}
public BigDecimal getIncomeServiceTaxInclude() {
return incomeServiceTaxInclude;
return handleSpecial(incomeServiceTaxInclude);
}
public void setIncomeServiceTaxInclude(BigDecimal incomeServiceTaxInclude) {
@ -112,7 +112,7 @@ public class IncomeCostBean {
}
public BigDecimal getIncomeDeviceTaxExclude() {
return incomeDeviceTaxExclude;
return handleSpecial(incomeDeviceTaxExclude);
}
public void setIncomeDeviceTaxExclude(BigDecimal incomeDeviceTaxExclude) {
@ -120,7 +120,7 @@ public class IncomeCostBean {
}
public BigDecimal getIncomeEngineerTaxExclude() {
return incomeEngineerTaxExclude;
return handleSpecial(incomeEngineerTaxExclude);
}
public void setIncomeEngineerTaxExclude(BigDecimal incomeEngineerTaxExclude) {
@ -128,7 +128,7 @@ public class IncomeCostBean {
}
public BigDecimal getIncomeServiceTaxExclude() {
return incomeServiceTaxExclude;
return handleSpecial(incomeServiceTaxExclude);
}
public void setIncomeServiceTaxExclude(BigDecimal incomeServiceTaxExclude) {
@ -136,7 +136,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseDeviceTaxInclude() {
return costPurchaseDeviceTaxInclude;
return handleSpecial(costPurchaseDeviceTaxInclude);
}
public void setCostPurchaseDeviceTaxInclude(BigDecimal costPurchaseDeviceTaxInclude) {
@ -144,7 +144,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseBuildTaxInclude() {
return costPurchaseBuildTaxInclude;
return handleSpecial(costPurchaseBuildTaxInclude);
}
public void setCostPurchaseBuildTaxInclude(BigDecimal costPurchaseBuildTaxInclude) {
@ -152,7 +152,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseServiceTaxInclude() {
return costPurchaseServiceTaxInclude;
return handleSpecial(costPurchaseServiceTaxInclude);
}
public void setCostPurchaseServiceTaxInclude(BigDecimal costPurchaseServiceTaxInclude) {
@ -169,14 +169,14 @@ public class IncomeCostBean {
}*/
public BigDecimal getCostPurchaseOtherTaxInclude() {
return costPurchaseOtherTaxInclude;
return handleSpecial(costPurchaseOtherTaxInclude);
}
public void setCostPurchaseOtherTaxInclude(BigDecimal costPurchaseOtherTaxInclude) {
this.costPurchaseOtherTaxInclude = costPurchaseOtherTaxInclude;
}
public BigDecimal getCostOtherOtherTaxInclude() {
return costOtherOtherTaxInclude;
return handleSpecial(costOtherOtherTaxInclude);
}
public void setCostOtherOtherTaxInclude(BigDecimal costOtherOtherTaxInclude) {
@ -184,7 +184,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseDeviceTaxExclude() {
return costPurchaseDeviceTaxExclude;
return handleSpecial(costPurchaseDeviceTaxExclude);
}
public void setCostPurchaseDeviceTaxExclude(BigDecimal costPurchaseDeviceTaxExclude) {
@ -192,7 +192,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseBuildTaxExclude() {
return costPurchaseBuildTaxExclude;
return handleSpecial(costPurchaseBuildTaxExclude);
}
public void setCostPurchaseBuildTaxExclude(BigDecimal costPurchaseBuildTaxExclude) {
@ -200,7 +200,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseServiceTaxExclude() {
return costPurchaseServiceTaxExclude;
return handleSpecial(costPurchaseServiceTaxExclude);
}
public void setCostPurchaseServiceTaxExclude(BigDecimal costPurchaseServiceTaxExclude) {
@ -208,7 +208,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostPurchaseOtherTaxExclude() {
return costPurchaseOtherTaxExclude;
return handleSpecial(costPurchaseOtherTaxExclude);
}
public void setCostPurchaseOtherTaxExclude(BigDecimal costPurchaseOtherTaxExclude) {
@ -216,7 +216,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostProjectManageTaxExclude() {
return costProjectManageTaxExclude;
return handleSpecial(costProjectManageTaxExclude);
}
public void setCostProjectManageTaxExclude(BigDecimal costProjectManageTaxExclude) {
@ -224,7 +224,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostOtherOtherTaxExclude() {
return costOtherOtherTaxExclude;
return handleSpecial(costOtherOtherTaxExclude);
}
public void setCostOtherOtherTaxExclude(BigDecimal costOtherOtherTaxExclude) {
@ -233,7 +233,7 @@ public class IncomeCostBean {
public BigDecimal getCostExpropriationTaxExclude() {
return costExpropriationTaxExclude;
return handleSpecial(costExpropriationTaxExclude);
}
public void setCostExpropriationTaxExclude(BigDecimal costExpropriationTaxExclude) {
@ -241,7 +241,7 @@ public class IncomeCostBean {
}
public BigDecimal getCostCompanyManageTaxExclude() {
return costCompanyManageTaxExclude;
return handleSpecial(costCompanyManageTaxExclude);
}
public void setCostCompanyManageTaxExclude(BigDecimal costCompanyManageTaxExclude) {
@ -253,8 +253,11 @@ public class IncomeCostBean {
*
*/
public BigDecimal getIncomeTotalTaxInclude() {
BigDecimal incomeDeviceTaxInclude = getIncomeDeviceTaxInclude();
BigDecimal incomeEngineerTaxInclude = getIncomeEngineerTaxInclude();
BigDecimal incomeServiceTaxInclude = getIncomeServiceTaxInclude();
if(null == incomeDeviceTaxInclude || null == incomeEngineerTaxInclude || null == incomeServiceTaxInclude){
return null;
return handleSpecial(null);
}
return incomeDeviceTaxInclude.add(incomeEngineerTaxInclude)
.add(incomeServiceTaxInclude);
@ -264,8 +267,11 @@ public class IncomeCostBean {
*
*/
public BigDecimal getIncomeTotalTaxExclude() {
if(null == incomeDeviceTaxExclude || null == incomeEngineerTaxExclude || null ==incomeServiceTaxExclude){
return null;
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);
@ -275,13 +281,18 @@ public class IncomeCostBean {
*
*/
public BigDecimal getCostTotalTaxInclude() {
BigDecimal costPurchaseDeviceTaxInclude = getCostPurchaseDeviceTaxInclude();
BigDecimal costPurchaseBuildTaxInclude = getCostPurchaseBuildTaxInclude();
BigDecimal costPurchaseServiceTaxInclude = getCostPurchaseServiceTaxInclude();
BigDecimal costPurchaseOtherTaxInclude = getCostPurchaseOtherTaxInclude();
BigDecimal costOtherOtherTaxInclude = getCostOtherOtherTaxInclude();
if(null == costPurchaseDeviceTaxInclude
|| null == costPurchaseBuildTaxInclude
|| null == costPurchaseServiceTaxInclude
|| null == costPurchaseOtherTaxInclude
/*|| null == costProjectManageTaxInclude*/
|| null == costOtherOtherTaxInclude){
return null;
return handleSpecial(null);
}
return costPurchaseDeviceTaxInclude
.add(costPurchaseBuildTaxInclude)
@ -295,13 +306,19 @@ public class IncomeCostBean {
*
*/
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 null;
return handleSpecial(null);
}
return costPurchaseDeviceTaxExclude.add(costPurchaseBuildTaxExclude)
.add(costPurchaseServiceTaxExclude)
@ -319,9 +336,11 @@ public class IncomeCostBean {
BigDecimal costTotalTaxExclude = getCostTotalTaxExclude();
BigDecimal costExpropriationTaxExclude = getCostExpropriationTaxExclude();
if(null == incomeTotalTaxExclude || null == costTotalTaxExclude || null == costExpropriationTaxExclude){
return null;
return handleSpecial(null);
}
return incomeTotalTaxExclude.subtract(costTotalTaxExclude).subtract(costExpropriationTaxExclude);
return incomeTotalTaxExclude
.subtract(costTotalTaxExclude)
.subtract(costExpropriationTaxExclude);
}
/**
@ -332,9 +351,15 @@ public class IncomeCostBean {
BigDecimal projectGrossProfit = getProjectGrossProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if(null == projectGrossProfit || null == incomeTotalTaxExclude){
return null;
return handleSpecial(null);
}
return projectGrossProfit.multiply(new BigDecimal(100)).divide(incomeTotalTaxExclude,2,BigDecimal.ROUND_HALF_UP);
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);
}
/**
@ -357,8 +382,22 @@ public class IncomeCostBean {
BigDecimal projectContributionProfit = getProjectContributionProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if(null == projectContributionProfit || null == incomeTotalTaxExclude){
return null;
return handleSpecial(null);
}
return projectContributionProfit.multiply(new BigDecimal(100)).divide(incomeTotalTaxExclude, 2,BigDecimal.ROUND_HALF_UP);
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);
}