处理页面空值问题

master
hanbo 2021-11-25 11:00:07 +08:00
parent 8fe0d90af6
commit 3a15edaff7
5 changed files with 113 additions and 14 deletions

View File

@ -137,6 +137,10 @@ public class FinalBean {
BigDecimal incomeTotal = getIncomeTotal(); BigDecimal incomeTotal = getIncomeTotal();
BigDecimal costTotal = getCostTotal(); BigDecimal costTotal = getCostTotal();
BigDecimal costExpropriationFinalTotal = getCostExpropriationFinalTotal(); BigDecimal costExpropriationFinalTotal = getCostExpropriationFinalTotal();
if (null == incomeTotal || null == costTotal || null == costExpropriationFinalTotal) {
return null;
}
return incomeTotal.subtract(costTotal).subtract(costExpropriationFinalTotal); return incomeTotal.subtract(costTotal).subtract(costExpropriationFinalTotal);
} }
@ -165,6 +169,10 @@ public class FinalBean {
public BigDecimal getContributionMarginFinalTotal() { public BigDecimal getContributionMarginFinalTotal() {
BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal(); BigDecimal grossProfitFinalTotal = getGrossProfitFinalTotal();
BigDecimal costCompanyManageFinalTotal = getCostCompanyManageFinalTotal(); BigDecimal costCompanyManageFinalTotal = getCostCompanyManageFinalTotal();
if (null == grossProfitFinalTotal || null == costCompanyManageFinalTotal) {
return null;
}
return grossProfitFinalTotal.subtract(costCompanyManageFinalTotal); return grossProfitFinalTotal.subtract(costCompanyManageFinalTotal);
} }
@ -193,6 +201,9 @@ public class FinalBean {
public BigDecimal getNetMarginFinalTotal() { public BigDecimal getNetMarginFinalTotal() {
BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal(); BigDecimal contributionMarginFinalTotal = getContributionMarginFinalTotal();
BigDecimal costIncomeTaxFinalTotal = getCostIncomeTaxFinalTotal(); BigDecimal costIncomeTaxFinalTotal = getCostIncomeTaxFinalTotal();
if (null == contributionMarginFinalTotal || null == costIncomeTaxFinalTotal) {
return null;
}
return contributionMarginFinalTotal.subtract(costIncomeTaxFinalTotal); return contributionMarginFinalTotal.subtract(costIncomeTaxFinalTotal);
} }
@ -254,6 +265,11 @@ public class FinalBean {
BigDecimal taxCost = getTaxCost(); BigDecimal taxCost = getTaxCost();
BigDecimal earnestMoneyCost = getEarnestMoneyCost(); BigDecimal earnestMoneyCost = getEarnestMoneyCost();
if (null == saleIncomeCash || null == taxReturn || null == earnestMoneyIncome ||
null == purchaseCost || null == taxCost || null == earnestMoneyCost) {
return null;
}
return saleIncomeCash return saleIncomeCash
.add(taxReturn) .add(taxReturn)
.add(earnestMoneyIncome) .add(earnestMoneyIncome)
@ -295,6 +311,10 @@ public class FinalBean {
public BigDecimal getFinancingCapitalCashflow() { public BigDecimal getFinancingCapitalCashflow() {
BigDecimal financingCapitalInflow = getFinancingCapitalInflow(); BigDecimal financingCapitalInflow = getFinancingCapitalInflow();
BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow(); BigDecimal financingCapitalOutflow = getFinancingCapitalOutflow();
if (null == financingCapitalInflow || null == financingCapitalOutflow) {
return null;
}
return financingCapitalInflow.subtract(financingCapitalOutflow); return financingCapitalInflow.subtract(financingCapitalOutflow);
} }
@ -312,6 +332,10 @@ public class FinalBean {
BigDecimal netCashFlow = getNetCashFlow(); BigDecimal netCashFlow = getNetCashFlow();
BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities(); BigDecimal netCashFromInvestingActivities = getNetCashFromInvestingActivities();
BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow(); BigDecimal financingCapitalCashflow = getFinancingCapitalCashflow();
if (null == netCashFlow || null == netCashFromInvestingActivities || null == financingCapitalCashflow) {
return null;
}
return netCashFlow return netCashFlow
.add(netCashFromInvestingActivities) .add(netCashFromInvestingActivities)
.add(financingCapitalCashflow); .add(financingCapitalCashflow);
@ -323,6 +347,7 @@ public class FinalBean {
/** /**
* *
*
* @return * @return
*/ */
public BigDecimal getCashFluxTotal() { public BigDecimal getCashFluxTotal() {

View File

@ -101,6 +101,67 @@ public class FormerBean extends IncomeCostBean{
*/ */
private BigDecimal cashFlowTotal; private BigDecimal cashFlowTotal;
/**
*
*/
private BigDecimal grossProfitProfitMargin;
public BigDecimal getGrossProfitProfitMargin() {
// 100 * grossProfit() / getIncomeTotalTaxExclude()
BigDecimal grossProfit = getGrossProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == grossProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return grossProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
}
public void setGrossProfitProfitMargin(BigDecimal grossProfitProfitMargin) {
this.grossProfitProfitMargin = grossProfitProfitMargin;
}
/**
*
*/
private BigDecimal contributionProfitProfitMargin;
public BigDecimal getContributionProfitProfitMargin() {
//100 * contributionProfit() / getIncomeTotalTaxExclude()
BigDecimal contributionProfit = getContributionProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == contributionProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return contributionProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
}
public void setContributionProfitProfitMargin(BigDecimal contributionProfitProfitMargin) {
this.contributionProfitProfitMargin = contributionProfitProfitMargin;
}
/**
*
*/
private BigDecimal netProfitProfitMargin;
public BigDecimal getNetProfitProfitMargin() {
//100 * netProfit() / getIncomeTotalTaxExclude()
BigDecimal netProfit = getNetProfit();
BigDecimal incomeTotalTaxExclude = getIncomeTotalTaxExclude();
if (null == netProfit || null == incomeTotalTaxExclude) {
return handleSpecial(null);
}
return netProfit.divide(incomeTotalTaxExclude).multiply(new BigDecimal(100));
}
public void setNetProfitProfitMargin(BigDecimal netProfitProfitMargin) {
this.netProfitProfitMargin = netProfitProfitMargin;
}
public BigDecimal getCostIncomeTax() { public BigDecimal getCostIncomeTax() {
return costIncomeTax; return costIncomeTax;
} }

View File

@ -337,17 +337,18 @@ public class ProjectController extends BaseController {
public String approve(@RequestParam("id") int id, @RequestParam String listFrom, Map<String, Object> model) { public String approve(@RequestParam("id") int id, @RequestParam String listFrom, Map<String, Object> model) {
String time = "2021-11"; String time = "2021-11";
Project project = projectService.getProject(id); Project project = projectService.getProject(id);
EstimateBean estimateBean = projectEstimateService.getEstimate(project);
model.put("estimateBean", estimateBean); //项目信息
model.put("adminId", InterfaceUtil.getAdminId()); model.put("adminId", InterfaceUtil.getAdminId());
model.put("project", project); model.put("project", project);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
model.put("time", time);
model.put("listFrom", listFrom); model.put("listFrom", listFrom);
//概算信息
EstimateBean estimateBean = projectEstimateService.getEstimate(project);
model.put("estimateBean", estimateBean);
//预算信息
BudgetBean budgetBean = projectBudgetService.getBudget(project); BudgetBean budgetBean = projectBudgetService.getBudget(project);
//预算主页面数据
model.put("budgetBean", budgetBean); model.put("budgetBean", budgetBean);
//收入明细 //收入明细
model.put("incomeDetails", projectBudgetService.getBudgetIncomeDetail(project)); model.put("incomeDetails", projectBudgetService.getBudgetIncomeDetail(project));
@ -364,11 +365,23 @@ public class ProjectController extends BaseController {
model.put("underwrittenPlanStatistic", projectBudgetService.getProjectUnderwrittenPlanStatisticBean(projectBudgetPlanDetails)); model.put("underwrittenPlanStatistic", projectBudgetService.getProjectUnderwrittenPlanStatisticBean(projectBudgetPlanDetails));
//现金表 //现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails)); model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//结算信息
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
model.put("time", time);
//决算信息
model.put("finalBean", projectFinalSevice.getFinal(project)); model.put("finalBean", projectFinalSevice.getFinal(project));
//freemarker可以利用的静态方法 //freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils")); model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
//审核记录
List<ProjectTaskRecord> list = projectTaskRecordService.list(id); List<ProjectTaskRecord> list = projectTaskRecordService.list(id);
model.put("taskRecords", list); model.put("taskRecords", list);
return "admin/project_approve"; return "admin/project_approve";
} }

View File

@ -854,7 +854,7 @@
<td><input name="grossProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.grossProfit,'0')}" required readonly title="项目毛利上月结算总额"></td> <td><input name="grossProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.grossProfit,'0')}" required readonly title="项目毛利上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" value="${Utils.format(monthBean.grossProfit,'0')}" readonly required title="项目毛利本月结算金额"></td> <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="grossProfit" value="${Utils.format(monthBean.grossProfit,'0')}" readonly required title="项目毛利本月结算金额"></td>
<td><input type="number" name="grossProfitSettleTotal" value="${Utils.format(currentBean.grossProfit,'0')}" readonly title="项目毛利结算总额"></td> <td><input type="number" name="grossProfitSettleTotal" value="${Utils.format(currentBean.grossProfit,'0')}" readonly title="项目毛利结算总额"></td>
<td><input name="grossProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.grossProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目毛利利润率"></td> <td><input name="grossProfitProfitMargin" type="number" value="${Utils.format(currentBean.getGrossProfitProfitMargin(),'0')}" readonly title="项目毛利利润率"></td>
</tr> </tr>
<tr> <tr>
<td>项目贡献利润</td> <td>项目贡献利润</td>
@ -863,7 +863,7 @@
<td><input name="contributionProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.contributionProfit,'0')}" required readonly title="项目贡献利润上月结算总额"></td> <td><input name="contributionProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.contributionProfit,'0')}" required readonly title="项目贡献利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" value="${Utils.format(monthBean.contributionProfit,'0')}" required readonly title="项目贡献利润本月结算金额"></td> <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="contributionProfit" value="${Utils.format(monthBean.contributionProfit,'0')}" required readonly title="项目贡献利润本月结算金额"></td>
<td><input type="number" name="contributionProfitSettleTotal" value="${Utils.format(currentBean.contributionProfit,'0')}" readonly title="项目贡献利润结算总额"></td> <td><input type="number" name="contributionProfitSettleTotal" value="${Utils.format(currentBean.contributionProfit,'0')}" readonly title="项目贡献利润结算总额"></td>
<td><input name="contributionProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.contributionProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目贡献利润利润率"></td> <td><input name="contributionProfitProfitMargin" type="number" value="${Utils.format(currentBean.getContributionProfitProfitMargin(),'0')}" readonly title="项目贡献利润利润率"></td>
</tr> </tr>
<tr> <tr>
<td>项目净利润</td> <td>项目净利润</td>
@ -872,7 +872,7 @@
<td><input name="netProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.netProfit,'0')}" required readonly title="项目净利润上月结算总额"></td> <td><input name="netProfitFormerSettleTotal" type="number" value="${Utils.format(formerBean.netProfit,'0')}" required readonly title="项目净利润上月结算总额"></td>
<td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" value="${Utils.format(monthBean.netProfit,'0')}" required readonly title="项目净利润本月结算金额"></td> <td><input type="number" min="0.00" max="99999999.99" step="0.01" name="netProfit" value="${Utils.format(monthBean.netProfit,'0')}" required readonly title="项目净利润本月结算金额"></td>
<td><input type="number" name="netProfitSettleTotal" value="${Utils.format(currentBean.netProfit,'0')}" readonly title="项目净利润结算总额"></td> <td><input type="number" name="netProfitSettleTotal" value="${Utils.format(currentBean.netProfit,'0')}" readonly title="项目净利润结算总额"></td>
<td><input name="netProfitProfitMargin" type="number" value="${Utils.format(100 * currentBean.netProfit / currentBean.getIncomeTotalTaxExclude(),'0')}" readonly title="项目净利润利润率"></td> <td><input name="netProfitProfitMargin" type="number" value="${Utils.format(currentBean.getNetProfitProfitMargin(),'0')}" readonly title="项目净利润利润率"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -181,7 +181,7 @@
<#list pager.list as list> <#list pager.list as list>
<tr> <tr>
<td>${list.id!}</td> <td>${list.id!}</td>
<td>${list.name!}</td> <td><a style="cursor: pointer;text-decoration:none" onclick="location.href='${base}/project/approve?listFrom=list&id=${list.id}'">${list.name!}</a></td>
<td>${list.typeDesc!}</td> <td>${list.typeDesc!}</td>
<td>${list.statusDesc!}</td> <td>${list.statusDesc!}</td>
<td>${list.approveStatusDesc!}</td> <td>${list.approveStatusDesc!}</td>
@ -193,15 +193,15 @@
<td> <td>
<div class="am-btn-toolbar"> <div class="am-btn-toolbar">
<div class="am-btn-group am-btn-group-xs"> <div class="am-btn-group am-btn-group-xs">
<button type="button" <#--<button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary" class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/approve?listFrom=list&id=${list.id}'"><span onclick="location.href='${base}/project/approve?listFrom=list&id=${list.id}'"><span
class="am-icon-pencil-square-o"></span>查看 class="am-icon-pencil-square-o"></span>查看
</button> </button>-->
<button type="button" <button type="button"
class="am-btn am-btn-default am-btn-xs am-text-secondary" class="am-btn am-btn-default am-btn-xs am-text-secondary"
onclick="location.href='${base}/project/approve?listFrom=listApprove&id=${list.id}'"><span onclick="location.href='${base}/project/approve?listFrom=list&id=${list.id}'"><span
class="am-icon-pencil-square-o"></span>审核 class="am-icon-pencil-square-o"></span>审核
</button> </button>