package cn.palmte.work.service; import cn.palmte.work.bean.PrimaryIndicatorBean; import cn.palmte.work.model.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class StatisticsService { @Autowired private ProjectBudgetCostRepository projectBudgetCostRepository; @Autowired private ProjectBudgetIncomeRepository projectBudgetIncomeRepository; @Autowired private ProjectBudgetCostManageRepository projectBudgetCostManageRepository; /** * 分月项目统计 获取主要指标数据 * * @return */ public List getPrimaryIndicator() { List list = new ArrayList<>(); PrimaryIndicatorBean include = new PrimaryIndicatorBean(); include.setTitle("预算金额(含税)"); //收入数据 long deviceIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_DEVICE); long engineerIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_ENGINEER); long serviceIncomeTaxIncludeSum = projectBudgetIncomeRepository.incomeTaxIncludeSum(ProjectBudgetIncome.TYPE_SERVICE); include.setIncomeDevice(deviceIncomeTaxIncludeSum); include.setIncomeEngineer(engineerIncomeTaxIncludeSum); include.setIncomeService(serviceIncomeTaxIncludeSum); //成本 long deviceCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_DEVICE); long buildingCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_BUILDING); long serviceCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_SERVICE); long otherCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_OTHER); long projectManageCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_PROJECT_MANAGE); long otherOtherCostTaxIncludeSum = projectBudgetCostRepository.costTaxIncludeSum(ProjectBudgetCost.TYPE_OTHER_OTHER); include.setCostPurchaseDevice(deviceCostTaxIncludeSum); include.setCostPurchaseBuild(buildingCostTaxIncludeSum); include.setCostPurchaseService(serviceCostTaxIncludeSum); include.setCostPurchaseOther(otherCostTaxIncludeSum); include.setCostProjectManage(projectManageCostTaxIncludeSum); include.setCostOtherOther(otherOtherCostTaxIncludeSum); list.add(include); PrimaryIndicatorBean exclude = new PrimaryIndicatorBean(); exclude.setTitle("预算金额(不含税)"); //收入数据 long deviceIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_DEVICE); long engineerIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_ENGINEER); long serviceIncomeTaxExcludeSum = projectBudgetIncomeRepository.incomeTaxExcludeSum(ProjectBudgetIncome.TYPE_SERVICE); exclude.setIncomeDevice(deviceIncomeTaxExcludeSum); exclude.setIncomeEngineer(engineerIncomeTaxExcludeSum); exclude.setIncomeService(serviceIncomeTaxExcludeSum); //成本 long deviceCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_DEVICE); long buildingCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_BUILDING); long serviceCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_SERVICE); long otherCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_OTHER); long projectManageCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_PROJECT_MANAGE); long otherOtherCostTaxExcludeSum = projectBudgetCostRepository.costTaxExcludeSum(ProjectBudgetCost.TYPE_OTHER_OTHER); exclude.setCostPurchaseDevice(deviceCostTaxExcludeSum); exclude.setCostPurchaseBuild(buildingCostTaxExcludeSum); exclude.setCostPurchaseService(serviceCostTaxExcludeSum); exclude.setCostPurchaseOther(otherCostTaxExcludeSum); exclude.setCostProjectManage(projectManageCostTaxExcludeSum); exclude.setCostOtherOther(otherOtherCostTaxExcludeSum); //管理 long expropriationSum = projectBudgetCostManageRepository.costTaxExcludeSum(ProjectBudgetCostManage.TYPE_EXPROPRIATION); long companyManageSum = projectBudgetCostManageRepository.costTaxExcludeSum(ProjectBudgetCostManage.TYPE_COMPANY_MANAGE); exclude.setCostExpropriation(expropriationSum); exclude.setCostCompanyManage(companyManageSum); list.add(exclude); return list; } /** * 分月项目统计 获取损益表数据 * * @return */ public List getIncomeStatement() { return null; } /** * 分月项目统计 获取现金流量表数据 * * @return */ public List getCashFlow() { return null; } }