去掉不必要的校验

master
OathK1per 2021-12-03 16:26:53 +08:00
parent 07978d81cb
commit b0ddfdf774
4 changed files with 151 additions and 14 deletions

View File

@ -91,14 +91,11 @@ public class ProjectSettleController extends BaseController{
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
Project project = projectService.getProject(id);
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
String time = projectSettleIncome.getTime();
model.put("time", time);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
projectSettleService.getEstimateAndBudgetAndMonthSettle(project, time, model);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
model.put("monthBean", projectSettleService.getMonthSettle(project, time));
model.put("currentBean", projectSettleService.getCurrentSettle(project, time));
List<ProjectUserTime> projectUserTimes = projectUserTimeRepository.findByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(projectUserTimes)){
@ -107,8 +104,6 @@ public class ProjectSettleController extends BaseController{
} else {
model.put("salary", new BigDecimal(0));
}
//现金表
model.put("cashFlowBean", projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails));
//freemarker可以利用的静态方法
model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils"));
return "admin/project_settle_edit";

View File

@ -11,6 +11,7 @@ import top.jfunc.common.utils.CollectionUtil;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -736,4 +737,145 @@ public class ProjectSettleService {
}
return settleBean;
}
public void getEstimateAndBudgetAndMonthSettle(Project project, String time, Map<String, Object> model) {
SettleBean settleBean = new SettleBean();
BudgetBean budgetBean = new BudgetBean();
EstimateBean estimateBean = new EstimateBean();
CashFlowBean cashFlowBean = new CashFlowBean();
List<ProjectSettleIncome> incomes = projectSettleIncomeRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(incomes)){
ProjectSettleIncome projectSettleIncomeDevice = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_DEVICE).collect(Collectors.toList()).get(0);
settleBean.setIncomeDevice(projectSettleIncomeDevice.getIncomeTaxExclude());
budgetBean.setIncomeDeviceTaxExclude(projectSettleIncomeDevice.getBudget());
estimateBean.setIncomeDeviceTaxExclude(projectSettleIncomeDevice.getEstimate());
ProjectSettleIncome projectSettleIncomeEngineer = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_ENGINEER).collect(Collectors.toList()).get(0);
settleBean.setIncomeEngineer(projectSettleIncomeEngineer.getIncomeTaxExclude());
budgetBean.setIncomeEngineerTaxExclude(projectSettleIncomeEngineer.getBudget());
estimateBean.setIncomeEngineerTaxExclude(projectSettleIncomeEngineer.getEstimate());
ProjectSettleIncome projectSettleIncomeService = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0);
settleBean.setIncomeService(projectSettleIncomeService.getIncomeTaxExclude());
budgetBean.setIncomeServiceTaxExclude(projectSettleIncomeService.getBudget());
estimateBean.setIncomeServiceTaxExclude(projectSettleIncomeService.getEstimate());
}
List<ProjectSettleCost> costs = projectSettleCostRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(costs)){
ProjectSettleCost projectSettleCostDevice = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_DEVICE).collect(Collectors.toList()).get(0);
settleBean.setCostPurchaseDevice(projectSettleCostDevice.getCostTaxExclude());
budgetBean.setCostPurchaseDeviceTaxExclude(projectSettleCostDevice.getBudget());
estimateBean.setCostPurchaseDeviceTaxExclude(projectSettleCostDevice.getEstimate());
ProjectSettleCost projectSettleCostBuild = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_BUILDING).collect(Collectors.toList()).get(0);
settleBean.setCostPurchaseBuild(projectSettleCostBuild.getCostTaxExclude());
budgetBean.setCostPurchaseBuildTaxExclude(projectSettleCostBuild.getBudget());
estimateBean.setCostPurchaseBuildTaxExclude(projectSettleCostBuild.getEstimate());
ProjectSettleCost projectSettleCostService = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_SERVICE).collect(Collectors.toList()).get(0);
settleBean.setCostPurchaseService(projectSettleCostService.getCostTaxExclude());
budgetBean.setCostPurchaseServiceTaxExclude(projectSettleCostService.getBudget());
estimateBean.setCostPurchaseServiceTaxExclude(projectSettleCostService.getEstimate());
ProjectSettleCost projectSettleCostOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER).collect(Collectors.toList()).get(0);
settleBean.setCostPurchaseOther(projectSettleCostOther.getCostTaxExclude());
budgetBean.setCostPurchaseOtherTaxExclude(projectSettleCostOther.getBudget());
estimateBean.setCostPurchaseOtherTaxExclude(projectSettleCostOther.getEstimate());
ProjectSettleCost projectSettleCostProjectManage = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_PROJECT_MANAGE).collect(Collectors.toList()).get(0);
settleBean.setCostProjectManage(projectSettleCostProjectManage.getCostTaxExclude());
budgetBean.setCostProjectManageTaxExclude(projectSettleCostProjectManage.getBudget());
estimateBean.setCostProjectManageTaxExclude(projectSettleCostProjectManage.getEstimate());
ProjectSettleCost projectSettleCostOtherOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).collect(Collectors.toList()).get(0);
settleBean.setCostOther(projectSettleCostOtherOther.getCostTaxExclude());
budgetBean.setCostOtherOtherTaxExclude(projectSettleCostOtherOther.getBudget());
estimateBean.setCostOtherOtherTaxExclude(projectSettleCostOtherOther.getEstimate());
}
List<ProjectSettleCostManage> costManages = projectSettleCostManageRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(costManages)){
ProjectSettleCostManage costManageExpropriation = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_EXPROPRIATION).collect(Collectors.toList()).get(0);
settleBean.setCostExpropriation(costManageExpropriation.getCostTaxExclude());
budgetBean.setCostExpropriationTaxExclude(costManageExpropriation.getBudget());
estimateBean.setCostExpropriationTaxExclude(costManageExpropriation.getEstimate());
ProjectSettleCostManage costManageCompany = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0);
settleBean.setCostCompanyManage(costManageCompany.getCostTaxExclude());
budgetBean.setCostCompanyManageTaxExclude(costManageCompany.getBudget());
estimateBean.setCostCompanyManageTaxExclude(costManageCompany.getEstimate());
ProjectSettleCostManage costIncomeTax = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_INCOME_TAX).collect(Collectors.toList()).get(0);
settleBean.setCostIncomeTax(costIncomeTax.getCostTaxExclude());
}
List<ProjectSettleProfitMargin> profitMargins = projectSettleProfitMarginRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(profitMargins)){
ProjectSettleProfitMargin grossProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_GROSS_PROFIT).collect(Collectors.toList()).get(0);
settleBean.setGrossProfit(grossProfit.getAmount());
ProjectSettleProfitMargin contributionProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_CONTRIBUTION_PROFIT).collect(Collectors.toList()).get(0);
settleBean.setContributionProfit(contributionProfit.getAmount());
ProjectSettleProfitMargin netProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).collect(Collectors.toList()).get(0);
settleBean.setNetProfit(netProfit.getAmount());
}
List<ProjectSettleCashFlow> cashFlows = projectSettleCashFlowRepository.findAllByProjectIdAndTime(project.getId(), time);
if(CollectionUtil.isNotEmpty(cashFlows)){
ProjectSettleCashFlow saleIncomeCash = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.SALE_INCOME_CASH).collect(Collectors.toList()).get(0);
settleBean.setSaleIncomeCash(saleIncomeCash.getAmount());
cashFlowBean.setSaleIncomeCash(saleIncomeCash.getBudget());
ProjectSettleCashFlow taxReturn = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_RETURN).collect(Collectors.toList()).get(0);
settleBean.setTaxReturn(taxReturn.getAmount());
ProjectSettleCashFlow earnestMoneyIncome = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_INCOME).collect(Collectors.toList()).get(0);
settleBean.setEarnestMoneyIncome(earnestMoneyIncome.getAmount());
cashFlowBean.setEarnestMoneyIncome(earnestMoneyIncome.getBudget());
ProjectSettleCashFlow purchaseCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.PURCHASE_COST).collect(Collectors.toList()).get(0);
settleBean.setPurchaseCost(purchaseCost.getAmount());
cashFlowBean.setPurchaseCost(purchaseCost.getBudget());
ProjectSettleCashFlow taxCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.TAX_COST).collect(Collectors.toList()).get(0);
settleBean.setTaxCost(taxCost.getAmount());
ProjectSettleCashFlow earnestMoneyCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.EARNEST_MONEY_COST).collect(Collectors.toList()).get(0);
settleBean.setEarnestMoneyCost(earnestMoneyCost.getAmount());
cashFlowBean.setEarnestMoneyCost(earnestMoneyCost.getBudget());
ProjectSettleCashFlow netCashFlow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FLOW).collect(Collectors.toList()).get(0);
settleBean.setNetCashFlow(netCashFlow.getAmount());
ProjectSettleCashFlow cashInflowFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_INFLOW_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
settleBean.setCashInflowFromInvestingActivities(cashInflowFromInvestingActivities.getAmount());
ProjectSettleCashFlow cashOutflowFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.CASH_OUTFLOW_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
settleBean.setCashOutflowFromInvestingActivities(cashOutflowFromInvestingActivities.getAmount());
ProjectSettleCashFlow netCashFromInvestingActivities = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FROM_INVESTING_ACTIVITIES).collect(Collectors.toList()).get(0);
settleBean.setNetCashFromInvestingActivities(netCashFromInvestingActivities.getAmount());
ProjectSettleCashFlow financingCapitalInflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_INFLOW).collect(Collectors.toList()).get(0);
settleBean.setFinancingCapitalInflow(financingCapitalInflow.getAmount());
cashFlowBean.setFinancingCapitalInflow(financingCapitalInflow.getBudget());
ProjectSettleCashFlow financingCapitalOutflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_OUTFLOW).collect(Collectors.toList()).get(0);
settleBean.setFinancingCapitalOutflow(financingCapitalOutflow.getAmount());
cashFlowBean.setFinancingCapitalOutflow(financingCapitalOutflow.getBudget());
ProjectSettleCashFlow financingCapitalCashflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_CASHFLOW).collect(Collectors.toList()).get(0);
settleBean.setFinancingCapitalCashflow(financingCapitalCashflow.getAmount());
ProjectSettleCashFlow netIncreaseMonetaryFunds = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).collect(Collectors.toList()).get(0);
settleBean.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds.getAmount());
}
model.put("estimateBean", estimateBean);
model.put("budgetBean", budgetBean);
model.put("monthBean", settleBean);
model.put("cashFlowBean", cashFlowBean);
}
}

View File

@ -331,7 +331,7 @@
<td>经营活动产生的现金流量净额</td>
<td><input name="netCashFlowBudget" type="number" value="${Utils.format(cashFlowBean.getNetCashFlow(),'0')}" readonly required title="预算总额"></td>
<td><input name="netCashFlowFormerSettle" type="number" value="${Utils.format(formerBean.netCashFlow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netCashFlow" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netCashFlow" readonly required title="本月结算金额"></td>
<td><input name="netCashFlowSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
@ -352,7 +352,7 @@
<td>投资活动产生的现金流量净额</td>
<td>/</td>
<td><input name="netCashFromInvestingActivitiesFormerSettle" type="number" value="${Utils.format(formerBean.netCashFromInvestingActivities,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netCashFromInvestingActivities" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netCashFromInvestingActivities" readonly required title="本月结算金额"></td>
<td><input name="netCashFromInvestingActivitiesSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
@ -373,14 +373,14 @@
<td>筹资活动产生的现金流量净额</td>
<td><input name="financingCapitalCashflowBudget" type="number" value="${Utils.format(cashFlowBean.getFinancingCapitalCashflow(),'0')}" readonly required title="预算总额"></td>
<td><input name="financingCapitalCashflowFormerSettle" type="number" value="${Utils.format(formerBean.financingCapitalCashflow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="financingCapitalCashflow" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="financingCapitalCashflow" readonly required title="本月结算金额"></td>
<td><input name="financingCapitalCashflowSettle" type="number" readonly title="结算总额"></td>
</tr>
<tr>
<td>货币资金净增加额</td>
<td><input name="netIncreaseMonetaryFundsBudget" type="number" value="${Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds(),'0')}" readonly required title="预算总额"></td>
<td><input name="netIncreaseMonetaryFundsFormerSettle" type="number" value="${Utils.format(formerBean.netIncreaseMonetaryFunds,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netIncreaseMonetaryFunds" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netIncreaseMonetaryFunds" readonly required title="本月结算金额"></td>
<td><input name="netIncreaseMonetaryFundsSettle" type="number" readonly title="结算总额"></td>
</tr>
</tbody>

View File

@ -329,7 +329,7 @@
<td>经营活动产生的现金流量净额</td>
<td><input name="netCashFlowBudget" type="number" value="${Utils.format(cashFlowBean.getNetCashFlow(),'0')}" readonly required title="预算总额"></td>
<td><input name="netCashFlowFormerSettle" type="number" value="${Utils.format(formerBean.netCashFlow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netCashFlow" value="${Utils.format(monthBean.netCashFlow,'0')}" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netCashFlow" value="${Utils.format(monthBean.netCashFlow,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netCashFlowSettle" type="number" value="${Utils.format(currentBean.netCashFlow,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
@ -350,7 +350,7 @@
<td>投资活动产生的现金流量净额</td>
<td>/</td>
<td><input name="netCashFromInvestingActivitiesFormerSettle" type="number" value="${Utils.format(formerBean.netCashFromInvestingActivities,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netCashFromInvestingActivities" value="${Utils.format(monthBean.netCashFromInvestingActivities,'0')}" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netCashFromInvestingActivities" value="${Utils.format(monthBean.netCashFromInvestingActivities,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netCashFromInvestingActivitiesSettle" type="number" value="${Utils.format(currentBean.netCashFromInvestingActivities,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
@ -371,14 +371,14 @@
<td>筹资活动产生的现金流量净额</td>
<td><input name="financingCapitalCashflowBudget" type="number" value="${Utils.format(cashFlowBean.getFinancingCapitalCashflow(),'0')}" readonly required title="预算总额"></td>
<td><input name="financingCapitalCashflowFormerSettle" type="number" value="${Utils.format(formerBean.financingCapitalCashflow,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="financingCapitalCashflow" value="${Utils.format(monthBean.financingCapitalCashflow,'0')}" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="financingCapitalCashflow" value="${Utils.format(monthBean.financingCapitalCashflow,'0')}" readonly required title="本月结算金额"></td>
<td><input name="financingCapitalCashflowSettle" type="number" value="${Utils.format(currentBean.financingCapitalCashflow,'0')}" readonly title="结算总额"></td>
</tr>
<tr>
<td>货币资金净增加额</td>
<td><input name="netIncreaseMonetaryFundsBudget" type="number" value="${Utils.format(cashFlowBean.getNetIncreaseMonetaryFunds(),'0')}" readonly required title="预算总额"></td>
<td><input name="netIncreaseMonetaryFundsFormerSettle" type="number" value="${Utils.format(formerBean.netIncreaseMonetaryFunds,'0')}" required readonly title="上月结算总额"></td>
<td><input type="number" min="0.00" max="999999999.99" step="0.01" name="netIncreaseMonetaryFunds" value="${Utils.format(monthBean.netIncreaseMonetaryFunds,'0')}" readonly required title="本月结算金额"></td>
<td><input type="number" max="999999999.99" step="0.01" name="netIncreaseMonetaryFunds" value="${Utils.format(monthBean.netIncreaseMonetaryFunds,'0')}" readonly required title="本月结算金额"></td>
<td><input name="netIncreaseMonetaryFundsSettle" type="number" value="${Utils.format(currentBean.netIncreaseMonetaryFunds,'0')}" readonly title="结算总额"></td>
</tr>
</tbody>