diff --git a/src/main/java/cn/palmte/work/bean/SettleBean.java b/src/main/java/cn/palmte/work/bean/SettleBean.java index 9c30c55..10939a2 100644 --- a/src/main/java/cn/palmte/work/bean/SettleBean.java +++ b/src/main/java/cn/palmte/work/bean/SettleBean.java @@ -11,16 +11,28 @@ public class SettleBean { */ private BigDecimal incomeDevice; + private BigDecimal budgetIncomeDevice; + + private BigDecimal estimateIncomeDevice; + /** * 工程类决算总额 */ private BigDecimal incomeEngineer; + private BigDecimal budgetIncomeEngineer; + + private BigDecimal estimateIncomeEngineer; + /** * 服务类决算总额 */ private BigDecimal incomeService; + private BigDecimal budgetIncomeService; + + private BigDecimal estimateIncomeService; + /** * 获取所有收入总额 * @@ -36,6 +48,26 @@ public class SettleBean { return incomeDevice.add(incomeEngineer).add(incomeService); } + public BigDecimal getBudgetIncomeTotal() { + BigDecimal incomeDevice = getBudgetIncomeDevice(); + BigDecimal incomeEngineer = getBudgetIncomeEngineer(); + BigDecimal incomeService = getBudgetIncomeService(); + if (null == incomeDevice || null == incomeEngineer || null == incomeService) { + return new BigDecimal(0); + } + return incomeDevice.add(incomeEngineer).add(incomeService); + } + + public BigDecimal getEstimateIncomeTotal() { + BigDecimal incomeDevice = getEstimateIncomeDevice(); + BigDecimal incomeEngineer = getEstimateIncomeEngineer(); + BigDecimal incomeService = getEstimateIncomeService(); + if (null == incomeDevice || null == incomeEngineer || null == incomeService) { + return new BigDecimal(0); + } + return incomeDevice.add(incomeEngineer).add(incomeService); + } + //========================成本表================================ @@ -44,31 +76,55 @@ public class SettleBean { */ private BigDecimal costPurchaseDevice; + private BigDecimal budgetCostPurchaseDevice; + + private BigDecimal estimateCostPurchaseDevice; + /** *施工采购成本决算总额 */ private BigDecimal costPurchaseBuild; + private BigDecimal budgetCostPurchaseBuild; + + private BigDecimal estimateCostPurchaseBuild; + /** *服务采购成本决算总额 */ private BigDecimal costPurchaseService; + private BigDecimal budgetCostPurchaseService; + + private BigDecimal estimateCostPurchaseService; + /** *其他采购成本决算总额 */ private BigDecimal costPurchaseOther; + private BigDecimal budgetCostPurchaseOther; + + private BigDecimal estimateCostPurchaseOther; + /** * 项目管理成本决算总额 */ private BigDecimal costProjectManage; + private BigDecimal budgetCostProjectManage; + + private BigDecimal estimateCostProjectManage; + /** * 其他成本决算总额 */ private BigDecimal costOther; + private BigDecimal budgetCostOther; + + private BigDecimal estimateCostOther; + /** * 获取所有成本总额 @@ -92,6 +148,40 @@ public class SettleBean { .add(costPurchaseOther).add(costProjectManage).add(costOther); } + public BigDecimal getBudgetCostTotal() { + BigDecimal costPurchaseDevice = getBudgetCostPurchaseDevice(); + BigDecimal costPurchaseBuild = getBudgetCostPurchaseBuild(); + BigDecimal costPurchaseService = getBudgetCostPurchaseService(); + BigDecimal costPurchaseOther = getBudgetCostPurchaseOther(); + BigDecimal costProjectManage = getBudgetCostProjectManage(); + BigDecimal costOther = getBudgetCostOther(); + + if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService + || null == costPurchaseOther || null == costProjectManage || null == costOther) { + return new BigDecimal(0); + } + + return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService) + .add(costPurchaseOther).add(costProjectManage).add(costOther); + } + + public BigDecimal getEstimateCostTotal() { + BigDecimal costPurchaseDevice = getEstimateCostPurchaseDevice(); + BigDecimal costPurchaseBuild = getEstimateCostPurchaseBuild(); + BigDecimal costPurchaseService = getEstimateCostPurchaseService(); + BigDecimal costPurchaseOther = getEstimateCostPurchaseOther(); + BigDecimal costProjectManage = getEstimateCostProjectManage(); + BigDecimal costOther = getEstimateCostOther(); + + if (null == costPurchaseDevice || null == costPurchaseBuild || null == costPurchaseService + || null == costPurchaseOther || null == costProjectManage || null == costOther) { + return new BigDecimal(0); + } + + return costPurchaseDevice.add(costPurchaseBuild).add(costPurchaseService) + .add(costPurchaseOther).add(costProjectManage).add(costOther); + } + /** * 获取所有成本总额 * @@ -119,11 +209,19 @@ public class SettleBean { */ private BigDecimal costExpropriation; + private BigDecimal estimateCostExpropriation; + + private BigDecimal budgetCostExpropriation; + /** * 公司管理费用决算总额 */ private BigDecimal costCompanyManage; + private BigDecimal estimateCostCompanyManage; + + private BigDecimal budgetCostCompanyManage; + /** * 所得税费用决算总额 */ @@ -141,6 +239,27 @@ public class SettleBean { return costExpropriation.add(costCompanyManage).add(costIncomeTax); } + public BigDecimal getEstimateCostManageTotal() { + BigDecimal costExpropriation = getEstimateCostExpropriation(); + BigDecimal costCompanyManage = getEstimateCostCompanyManage(); + + if (null == costExpropriation || null == costCompanyManage ) { + return new BigDecimal(0); + } + + return costExpropriation.add(costCompanyManage); + } + + public BigDecimal getBudgetCostManageTotal() { + BigDecimal costExpropriation = getBudgetCostExpropriation(); + BigDecimal costCompanyManage = getBudgetCostCompanyManage(); + + if (null == costExpropriation || null == costCompanyManage ) { + return new BigDecimal(0); + } + + return costExpropriation.add(costCompanyManage); + } //========================利润率计算表================================ @@ -149,6 +268,10 @@ public class SettleBean { */ private BigDecimal grossProfit; + private BigDecimal estimateGrossProfit; + + private BigDecimal budgetGrossProfit; + /** * 项目毛利利润率 */ @@ -159,6 +282,10 @@ public class SettleBean { */ private BigDecimal contributionProfit; + private BigDecimal estimateContributionProfit; + + private BigDecimal budgetContributionProfit; + /** * 项目贡献利润利润率 */ @@ -180,6 +307,8 @@ public class SettleBean { * a销售商品、提供劳务收到的现金 * */ private BigDecimal saleIncomeCash; + + private BigDecimal budgetSaleIncomeCash; /** * b收到的税费返还 * */ @@ -188,10 +317,14 @@ public class SettleBean { * c其他与经营活动有关的现金【保证金收入】 */ private BigDecimal earnestMoneyIncome; + + private BigDecimal budgetEarnestMoneyIncome; /** * d购买商品、接受劳务支付的现金【设备支出+工程支出】 */ private BigDecimal purchaseCost; + + private BigDecimal budgetPurchaseCost; /** * e支付的各项税费 */ @@ -200,11 +333,15 @@ public class SettleBean { *f支付其他与经营活动有关的现金 */ private BigDecimal earnestMoneyCost; + + private BigDecimal budgetEarnestMoneyCost; /** * g经营活动产生的现金流量净额 * g=a+c+b-d-f-e */ private BigDecimal netCashFlow; + + private BigDecimal budgetNetCashFlow; /** * h投资活动现金流入 */ @@ -221,21 +358,29 @@ public class SettleBean { * k融资资金流入【垫资计划】 */ private BigDecimal financingCapitalInflow; + + private BigDecimal budgetFinancingCapitalInflow; /** * l融资资金流出【还款计划】 */ private BigDecimal financingCapitalOutflow; + + private BigDecimal budgetFinancingCapitalOutflow; /** *m筹资活动产生的现金流量净额 * m=k-l */ private BigDecimal financingCapitalCashflow; + + private BigDecimal budgetFinancingCapitalCashflow; /** * n货币资金净增加额 * n=g+j+m */ private BigDecimal netIncreaseMonetaryFunds; + private BigDecimal budgetNetIncreaseMonetaryFunds; + /** * 获取所有现金流量总额 * @return @@ -537,4 +682,284 @@ public class SettleBean { public void setProjectName(String projectName) { this.projectName = projectName; } + + public BigDecimal getBudgetIncomeDevice() { + return budgetIncomeDevice; + } + + public void setBudgetIncomeDevice(BigDecimal budgetIncomeDevice) { + this.budgetIncomeDevice = budgetIncomeDevice; + } + + public BigDecimal getEstimateIncomeDevice() { + return estimateIncomeDevice; + } + + public void setEstimateIncomeDevice(BigDecimal estimateIncomeDevice) { + this.estimateIncomeDevice = estimateIncomeDevice; + } + + public BigDecimal getBudgetIncomeEngineer() { + return budgetIncomeEngineer; + } + + public void setBudgetIncomeEngineer(BigDecimal budgetIncomeEngineer) { + this.budgetIncomeEngineer = budgetIncomeEngineer; + } + + public BigDecimal getEstimateIncomeEngineer() { + return estimateIncomeEngineer; + } + + public void setEstimateIncomeEngineer(BigDecimal estimateIncomeEngineer) { + this.estimateIncomeEngineer = estimateIncomeEngineer; + } + + public BigDecimal getBudgetIncomeService() { + return budgetIncomeService; + } + + public void setBudgetIncomeService(BigDecimal budgetIncomeService) { + this.budgetIncomeService = budgetIncomeService; + } + + public BigDecimal getEstimateIncomeService() { + return estimateIncomeService; + } + + public void setEstimateIncomeService(BigDecimal estimateIncomeService) { + this.estimateIncomeService = estimateIncomeService; + } + + public BigDecimal getBudgetCostPurchaseDevice() { + return budgetCostPurchaseDevice; + } + + public void setBudgetCostPurchaseDevice(BigDecimal budgetCostPurchaseDevice) { + this.budgetCostPurchaseDevice = budgetCostPurchaseDevice; + } + + public BigDecimal getEstimateCostPurchaseDevice() { + return estimateCostPurchaseDevice; + } + + public void setEstimateCostPurchaseDevice(BigDecimal estimateCostPurchaseDevice) { + this.estimateCostPurchaseDevice = estimateCostPurchaseDevice; + } + + public BigDecimal getBudgetCostPurchaseBuild() { + return budgetCostPurchaseBuild; + } + + public void setBudgetCostPurchaseBuild(BigDecimal budgetCostPurchaseBuild) { + this.budgetCostPurchaseBuild = budgetCostPurchaseBuild; + } + + public BigDecimal getEstimateCostPurchaseBuild() { + return estimateCostPurchaseBuild; + } + + public void setEstimateCostPurchaseBuild(BigDecimal estimateCostPurchaseBuild) { + this.estimateCostPurchaseBuild = estimateCostPurchaseBuild; + } + + public BigDecimal getBudgetCostPurchaseService() { + return budgetCostPurchaseService; + } + + public void setBudgetCostPurchaseService(BigDecimal budgetCostPurchaseService) { + this.budgetCostPurchaseService = budgetCostPurchaseService; + } + + public BigDecimal getEstimateCostPurchaseService() { + return estimateCostPurchaseService; + } + + public void setEstimateCostPurchaseService(BigDecimal estimateCostPurchaseService) { + this.estimateCostPurchaseService = estimateCostPurchaseService; + } + + public BigDecimal getBudgetCostPurchaseOther() { + return budgetCostPurchaseOther; + } + + public void setBudgetCostPurchaseOther(BigDecimal budgetCostPurchaseOther) { + this.budgetCostPurchaseOther = budgetCostPurchaseOther; + } + + public BigDecimal getEstimateCostPurchaseOther() { + return estimateCostPurchaseOther; + } + + public void setEstimateCostPurchaseOther(BigDecimal estimateCostPurchaseOther) { + this.estimateCostPurchaseOther = estimateCostPurchaseOther; + } + + public BigDecimal getBudgetCostProjectManage() { + return budgetCostProjectManage; + } + + public void setBudgetCostProjectManage(BigDecimal budgetCostProjectManage) { + this.budgetCostProjectManage = budgetCostProjectManage; + } + + public BigDecimal getEstimateCostProjectManage() { + return estimateCostProjectManage; + } + + public void setEstimateCostProjectManage(BigDecimal estimateCostProjectManage) { + this.estimateCostProjectManage = estimateCostProjectManage; + } + + public BigDecimal getBudgetCostOther() { + return budgetCostOther; + } + + public void setBudgetCostOther(BigDecimal budgetCostOther) { + this.budgetCostOther = budgetCostOther; + } + + public BigDecimal getEstimateCostOther() { + return estimateCostOther; + } + + public void setEstimateCostOther(BigDecimal estimateCostOther) { + this.estimateCostOther = estimateCostOther; + } + + public BigDecimal getEstimateCostExpropriation() { + return estimateCostExpropriation; + } + + public void setEstimateCostExpropriation(BigDecimal estimateCostExpropriation) { + this.estimateCostExpropriation = estimateCostExpropriation; + } + + public BigDecimal getBudgetCostExpropriation() { + return budgetCostExpropriation; + } + + public void setBudgetCostExpropriation(BigDecimal budgetCostExpropriation) { + this.budgetCostExpropriation = budgetCostExpropriation; + } + + public BigDecimal getEstimateCostCompanyManage() { + return estimateCostCompanyManage; + } + + public void setEstimateCostCompanyManage(BigDecimal estimateCostCompanyManage) { + this.estimateCostCompanyManage = estimateCostCompanyManage; + } + + public BigDecimal getBudgetCostCompanyManage() { + return budgetCostCompanyManage; + } + + public void setBudgetCostCompanyManage(BigDecimal budgetCostCompanyManage) { + this.budgetCostCompanyManage = budgetCostCompanyManage; + } + + public BigDecimal getEstimateGrossProfit() { + return estimateGrossProfit; + } + + public void setEstimateGrossProfit(BigDecimal estimateGrossProfit) { + this.estimateGrossProfit = estimateGrossProfit; + } + + public BigDecimal getBudgetGrossProfit() { + return budgetGrossProfit; + } + + public void setBudgetGrossProfit(BigDecimal budgetGrossProfit) { + this.budgetGrossProfit = budgetGrossProfit; + } + + public BigDecimal getEstimateContributionProfit() { + return estimateContributionProfit; + } + + public void setEstimateContributionProfit(BigDecimal estimateContributionProfit) { + this.estimateContributionProfit = estimateContributionProfit; + } + + public BigDecimal getBudgetContributionProfit() { + return budgetContributionProfit; + } + + public void setBudgetContributionProfit(BigDecimal budgetContributionProfit) { + this.budgetContributionProfit = budgetContributionProfit; + } + + public BigDecimal getBudgetSaleIncomeCash() { + return budgetSaleIncomeCash; + } + + public void setBudgetSaleIncomeCash(BigDecimal budgetSaleIncomeCash) { + this.budgetSaleIncomeCash = budgetSaleIncomeCash; + } + + public BigDecimal getBudgetEarnestMoneyIncome() { + return budgetEarnestMoneyIncome; + } + + public void setBudgetEarnestMoneyIncome(BigDecimal budgetEarnestMoneyIncome) { + this.budgetEarnestMoneyIncome = budgetEarnestMoneyIncome; + } + + public BigDecimal getBudgetPurchaseCost() { + return budgetPurchaseCost; + } + + public void setBudgetPurchaseCost(BigDecimal budgetPurchaseCost) { + this.budgetPurchaseCost = budgetPurchaseCost; + } + + public BigDecimal getBudgetEarnestMoneyCost() { + return budgetEarnestMoneyCost; + } + + public void setBudgetEarnestMoneyCost(BigDecimal budgetEarnestMoneyCost) { + this.budgetEarnestMoneyCost = budgetEarnestMoneyCost; + } + + public BigDecimal getBudgetNetCashFlow() { + return budgetNetCashFlow; + } + + public void setBudgetNetCashFlow(BigDecimal budgetNetCashFlow) { + this.budgetNetCashFlow = budgetNetCashFlow; + } + + public BigDecimal getBudgetFinancingCapitalInflow() { + return budgetFinancingCapitalInflow; + } + + public void setBudgetFinancingCapitalInflow(BigDecimal budgetFinancingCapitalInflow) { + this.budgetFinancingCapitalInflow = budgetFinancingCapitalInflow; + } + + public BigDecimal getBudgetFinancingCapitalOutflow() { + return budgetFinancingCapitalOutflow; + } + + public void setBudgetFinancingCapitalOutflow(BigDecimal budgetFinancingCapitalOutflow) { + this.budgetFinancingCapitalOutflow = budgetFinancingCapitalOutflow; + } + + public BigDecimal getBudgetFinancingCapitalCashflow() { + return budgetFinancingCapitalCashflow; + } + + public void setBudgetFinancingCapitalCashflow(BigDecimal budgetFinancingCapitalCashflow) { + this.budgetFinancingCapitalCashflow = budgetFinancingCapitalCashflow; + } + + public BigDecimal getBudgetNetIncreaseMonetaryFunds() { + return budgetNetIncreaseMonetaryFunds; + } + + public void setBudgetNetIncreaseMonetaryFunds(BigDecimal budgetNetIncreaseMonetaryFunds) { + this.budgetNetIncreaseMonetaryFunds = budgetNetIncreaseMonetaryFunds; + } } diff --git a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java index 5467d2b..8930f67 100644 --- a/src/main/java/cn/palmte/work/controller/backend/ProjectController.java +++ b/src/main/java/cn/palmte/work/controller/backend/ProjectController.java @@ -393,8 +393,8 @@ public class ProjectController extends BaseController { time = searchInfo.get("time"); } model.put("formerBean", projectSettleService.getFormerSettle(project, time)); - model.put("monthBean", projectSettleService.getMonthSettle(project, time)); - model.put("currentBean", projectSettleService.getCurrentSettle(project, time)); + model.put("monthBean", projectSettleService.getMonthSettleByTime(project, time)); + model.put("currentBean", projectSettleService.getCurrentSettleBytime(project, time)); //决算信息 model.put("finalBean", projectFinalSevice.getFinal(project)); diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleCashFlowRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleCashFlowRepository.java index 5b163d3..60e8706 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleCashFlowRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleCashFlowRepository.java @@ -17,6 +17,9 @@ public interface ProjectSettleCashFlowRepository extends JpaRepository findAllByProjectIdBefore(int id, String time); + @Query(value = "select * from project_settle_cash_flow where project_id = ?1 and time <= ?2", nativeQuery = true) + List findAllByProjectIdAndTimeBeforeAndEquals(int id, String time); + List findAllByProjectId(int id); List findAllByTime(String time); diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleCostManageRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleCostManageRepository.java index 74e1afb..68c2554 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleCostManageRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleCostManageRepository.java @@ -17,6 +17,9 @@ public interface ProjectSettleCostManageRepository extends JpaRepository findAllByProjectIdBefore(int id, String time); + @Query(value = "select * from project_settle_cost_manage where project_id = ?1 and time <= ?2", nativeQuery = true) + List findAllByProjectIdAndTimeBeforeAndEquals(int id, String time); + @Query(value = "select sum(cost_tax_exclude) from project_settle_cost_manage where project_id = ? and type = ?", nativeQuery = true) BigDecimal costTaxExcludeSum(int projectId, int type); diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleCostRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleCostRepository.java index 9191bca..b5bdc2f 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleCostRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleCostRepository.java @@ -17,6 +17,9 @@ public interface ProjectSettleCostRepository extends JpaRepository findAllByProjectIdBefore(int id, String time); + @Query(value = "select * from project_settle_cost where project_id = ?1 and time <= ?2", nativeQuery = true) + List findAllByProjectIdAndTimeBeforeAndEquals(int id, String time); + @Query(value = "select sum(cost_tax_exclude) from project_settle_cost where project_id = ? and type = ?", nativeQuery = true) BigDecimal costTaxExcludeSum(int projectId, int type); diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java index 4a2dc73..0aa8d5f 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleIncomeRepository.java @@ -17,6 +17,9 @@ public interface ProjectSettleIncomeRepository extends JpaRepository findAllByProjectIdBefore(int id, String time); + @Query(value = "select * from project_settle_income where project_id = ?1 and time <= ?2", nativeQuery = true) + List findAllByProjectIdAndTimeBeforeAndEquals(int id, String time); + @Query(value = "select sum(income_tax_exclude) from project_settle_income where project_id = ? and type = ?", nativeQuery = true) BigDecimal incomeTaxExcludeSum(int projectId, int type); diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleProfitMarginRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleProfitMarginRepository.java index ca5a72a..9dae9ee 100644 --- a/src/main/java/cn/palmte/work/model/ProjectSettleProfitMarginRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectSettleProfitMarginRepository.java @@ -16,6 +16,9 @@ public interface ProjectSettleProfitMarginRepository extends JpaRepository findAllByProjectIdBefore(int id, String time); + @Query(value = "select * from project_settle_profit_margin where project_id = ?1 and time <= ?2", nativeQuery = true) + List findAllByProjectIdAndTimeBeforeAndEquals(int id, String time); + List findAllByProjectId(int id); List findAllByTime(String time); diff --git a/src/main/java/cn/palmte/work/service/ProjectSettleService.java b/src/main/java/cn/palmte/work/service/ProjectSettleService.java index a51b5a7..a87c581 100644 --- a/src/main/java/cn/palmte/work/service/ProjectSettleService.java +++ b/src/main/java/cn/palmte/work/service/ProjectSettleService.java @@ -606,6 +606,148 @@ public class ProjectSettleService { return settleBean; } + public SettleBean getMonthSettleByTime(Project project, String time) { + SettleBean settleBean = new SettleBean(); + List 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()); + settleBean.setBudgetIncomeDevice(projectSettleIncomeDevice.getBudget()); + settleBean.setEstimateIncomeDevice(projectSettleIncomeDevice.getEstimate()); + + ProjectSettleIncome projectSettleIncomeEngineer = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_ENGINEER).collect(Collectors.toList()).get(0); + settleBean.setIncomeEngineer(projectSettleIncomeEngineer.getIncomeTaxExclude()); + settleBean.setBudgetIncomeEngineer(projectSettleIncomeEngineer.getBudget()); + settleBean.setEstimateIncomeEngineer(projectSettleIncomeEngineer.getEstimate()); + + ProjectSettleIncome projectSettleIncomeService = incomes.stream().filter(d -> d.getType() == ProjectSettleIncome.TYPE_SERVICE).collect(Collectors.toList()).get(0); + settleBean.setIncomeService(projectSettleIncomeService.getIncomeTaxExclude()); + settleBean.setBudgetIncomeService(projectSettleIncomeService.getBudget()); + settleBean.setEstimateIncomeService(projectSettleIncomeService.getEstimate()); + } + + List 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()); + settleBean.setBudgetCostPurchaseDevice(projectSettleCostDevice.getBudget()); + settleBean.setEstimateCostPurchaseDevice(projectSettleCostDevice.getEstimate()); + + ProjectSettleCost projectSettleCostBuild = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_BUILDING).collect(Collectors.toList()).get(0); + settleBean.setCostPurchaseBuild(projectSettleCostBuild.getCostTaxExclude()); + settleBean.setBudgetCostPurchaseBuild(projectSettleCostBuild.getBudget()); + settleBean.setEstimateCostPurchaseBuild(projectSettleCostBuild.getEstimate()); + + ProjectSettleCost projectSettleCostService = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_SERVICE).collect(Collectors.toList()).get(0); + settleBean.setCostPurchaseService(projectSettleCostService.getCostTaxExclude()); + settleBean.setBudgetCostPurchaseService(projectSettleCostService.getBudget()); + settleBean.setEstimateCostPurchaseService(projectSettleCostService.getEstimate()); + + ProjectSettleCost projectSettleCostOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER).collect(Collectors.toList()).get(0); + settleBean.setCostPurchaseOther(projectSettleCostOther.getCostTaxExclude()); + settleBean.setBudgetCostPurchaseOther(projectSettleCostOther.getBudget()); + settleBean.setEstimateCostPurchaseOther(projectSettleCostOther.getEstimate()); + + ProjectSettleCost projectSettleCostProjectManage = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_PROJECT_MANAGE).collect(Collectors.toList()).get(0); + settleBean.setCostProjectManage(projectSettleCostProjectManage.getCostTaxExclude()); + settleBean.setBudgetCostProjectManage(projectSettleCostProjectManage.getBudget()); + settleBean.setEstimateCostProjectManage(projectSettleCostProjectManage.getEstimate()); + + ProjectSettleCost projectSettleCostOtherOther = costs.stream().filter(d -> d.getType() == ProjectSettleCost.TYPE_OTHER_OTHER).collect(Collectors.toList()).get(0); + settleBean.setCostOther(projectSettleCostOtherOther.getCostTaxExclude()); + settleBean.setBudgetCostOther(projectSettleCostOtherOther.getBudget()); + settleBean.setEstimateCostOther(projectSettleCostOtherOther.getEstimate()); + } + + List 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()); + settleBean.setEstimateCostExpropriation(costManageExpropriation.getEstimate()); + settleBean.setBudgetCostExpropriation(costManageExpropriation.getBudget()); + + ProjectSettleCostManage costManageCompany = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_COMPANY_MANAGE).collect(Collectors.toList()).get(0); + settleBean.setCostCompanyManage(costManageCompany.getCostTaxExclude()); + settleBean.setEstimateCostCompanyManage(costManageCompany.getEstimate()); + settleBean.setBudgetCostCompanyManage(costManageCompany.getBudget()); + + ProjectSettleCostManage costIncomeTax = costManages.stream().filter(d -> d.getType() == ProjectSettleCostManage.TYPE_INCOME_TAX).collect(Collectors.toList()).get(0); + settleBean.setCostIncomeTax(costIncomeTax.getCostTaxExclude()); + } + + List 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()); + settleBean.setEstimateGrossProfit(grossProfit.getEstimate()); + settleBean.setBudgetGrossProfit(grossProfit.getBudget()); + + ProjectSettleProfitMargin contributionProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_CONTRIBUTION_PROFIT).collect(Collectors.toList()).get(0); + settleBean.setContributionProfit(contributionProfit.getAmount()); + settleBean.setEstimateContributionProfit(contributionProfit.getEstimate()); + settleBean.setBudgetContributionProfit(contributionProfit.getBudget()); + + ProjectSettleProfitMargin netProfit = profitMargins.stream().filter(d -> d.getType() == ProjectSettleProfitMargin.TYPE_NET_PROFIT).collect(Collectors.toList()).get(0); + settleBean.setNetProfit(netProfit.getAmount()); + } + + List 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()); + settleBean.setBudgetSaleIncomeCash(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()); + settleBean.setBudgetEarnestMoneyIncome(earnestMoneyIncome.getBudget()); + + ProjectSettleCashFlow purchaseCost = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.PURCHASE_COST).collect(Collectors.toList()).get(0); + settleBean.setPurchaseCost(purchaseCost.getAmount()); + settleBean.setBudgetPurchaseCost(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()); + settleBean.setBudgetEarnestMoneyCost(earnestMoneyCost.getBudget()); + + ProjectSettleCashFlow netCashFlow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_CASH_FLOW).collect(Collectors.toList()).get(0); + settleBean.setNetCashFlow(netCashFlow.getAmount()); + settleBean.setBudgetNetCashFlow(netCashFlow.getBudget()); + + 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()); + settleBean.setBudgetFinancingCapitalInflow(financingCapitalInflow.getBudget()); + + ProjectSettleCashFlow financingCapitalOutflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_OUTFLOW).collect(Collectors.toList()).get(0); + settleBean.setFinancingCapitalOutflow(financingCapitalOutflow.getAmount()); + settleBean.setBudgetFinancingCapitalOutflow(financingCapitalOutflow.getBudget()); + + ProjectSettleCashFlow financingCapitalCashflow = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.FINANCING_CAPITAL_CASHFLOW).collect(Collectors.toList()).get(0); + settleBean.setFinancingCapitalCashflow(financingCapitalCashflow.getAmount()); + settleBean.setBudgetFinancingCapitalCashflow(financingCapitalCashflow.getBudget()); + + ProjectSettleCashFlow netIncreaseMonetaryFunds = cashFlows.stream().filter(d -> d.getType() == ProjectSettleCashFlow.NET_INCREASE_MONETARY_FUNDS).collect(Collectors.toList()).get(0); + settleBean.setNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds.getAmount()); + settleBean.setBudgetNetIncreaseMonetaryFunds(netIncreaseMonetaryFunds.getBudget()); + } + + return settleBean; + } + public FormerBean getCurrentSettle(Project project, String time) { FormerBean settleBean = new FormerBean(); List incomes = projectSettleIncomeRepository.findAllByProjectId(project.getId()); @@ -737,4 +879,29 @@ public class ProjectSettleService { } return settleBean; } + + public FormerBean getCurrentSettleBytime(Project project, String time) { + FormerBean settleBean = new FormerBean(); + List incomes = projectSettleIncomeRepository.findAllByProjectIdAndTimeBeforeAndEquals(project.getId(),time); + + getIncomeFormerSettle(settleBean, incomes); + + List costs = projectSettleCostRepository.findAllByProjectIdAndTimeBeforeAndEquals(project.getId(),time); + + getCostFormerSettle(settleBean, costs); + + List manages = projectSettleCostManageRepository.findAllByProjectIdAndTimeBeforeAndEquals(project.getId(),time); + + getCostManageFormerSettle(settleBean, manages); + + List profits = projectSettleProfitMarginRepository.findAllByProjectIdAndTimeBeforeAndEquals(project.getId(),time); + + getProfitFormerSettle(settleBean, profits); + + List cashFlows = projectSettleCashFlowRepository.findAllByProjectIdAndTimeBeforeAndEquals(project.getId(),time); + + getCashFlowFormerSettle(settleBean, cashFlows); + + return settleBean; + } } diff --git a/src/main/resources/templates/admin/project_approve.ftl b/src/main/resources/templates/admin/project_approve.ftl index 02ef2c3..e1008e1 100644 --- a/src/main/resources/templates/admin/project_approve.ftl +++ b/src/main/resources/templates/admin/project_approve.ftl @@ -228,14 +228,14 @@
-
*华智产品金额
+
华智产品金额
${Utils.format(project.huazhiProductAmount)}
-
*紫光其他产品金额
+
紫光其他产品金额
${Utils.format(project.ziguangOtherAmount)}
@@ -665,8 +665,8 @@ 收入 设备类 - - + + @@ -674,8 +674,8 @@ 收入 工程类 - - + + @@ -683,8 +683,8 @@ 收入 服务类 - - + + @@ -692,8 +692,8 @@ 合计 - - + + @@ -717,8 +717,8 @@ 成本 采购成本 设备 - - + + @@ -727,8 +727,8 @@ 成本 采购成本 施工 - - + + @@ -737,8 +737,8 @@ 成本 采购成本 服务 - - + + @@ -747,8 +747,8 @@ 成本 采购成本 其他 - - + + @@ -757,8 +757,8 @@ 成本 项目管理成本 项目管理成本 - - + + @@ -767,8 +767,8 @@ 成本 其他 其他 - - + + @@ -777,8 +777,8 @@ 合计 - - + + @@ -800,8 +800,8 @@ 财务费用 资金占用成本 - - + + @@ -809,8 +809,8 @@ 公司管理费用 - - + + @@ -827,8 +827,8 @@ 合计 - - + + @@ -850,8 +850,8 @@ 项目毛利 - - + + @@ -859,8 +859,8 @@ 项目贡献利润 - - + + @@ -890,7 +890,7 @@ 销售商品、提供劳务收到的现金 - + @@ -904,14 +904,14 @@ 收到其他与经营活动有关的现金 - + 购买商品、接受劳务支付的现金 - + @@ -925,14 +925,14 @@ 支付其他与经营活动有关的现金 - + 经营活动产生的现金流量净额 - + @@ -960,28 +960,28 @@ 融资资金流入 - + 还款资金流出 - + 筹资活动产生的现金流量净额 - + 货币资金净增加额 - +