diff --git a/src/main/java/cn/palmte/work/bean/PrimaryIndicatorBean.java b/src/main/java/cn/palmte/work/bean/PrimaryIndicatorBean.java new file mode 100644 index 0000000..2a9d9a9 --- /dev/null +++ b/src/main/java/cn/palmte/work/bean/PrimaryIndicatorBean.java @@ -0,0 +1,71 @@ +package cn.palmte.work.bean; + +import lombok.Data; + +/** + * 主要指标数据 + */ +@Data +public class PrimaryIndicatorBean { + + /** + * + */ + private String title; + + /** + * 收入--设备类 + */ + private long incomeDevice; + + /** + * 收入--施工类 + */ + private long incomeEngineer; + + /** + * 收入--服务类 + */ + private long incomeService; + + /** + * 采购成本--设备类 + */ + private long costPurchaseDevice; + + /** + * 采购成本--施工类 + */ + private long costPurchaseBuild; + + /** + * 采购成本--服务类 + */ + private long costPurchaseService; + + /** + * 采购成本--其他 + */ + private long costPurchaseOther; + + /** + * 成本--其他 + */ + private long costOtherOther; + + /** + * 成本--项目管理成本 + */ + private long costProjectManage; + + /** + * 财务费用--资金占用成本 + */ + private long costExpropriation; + + /** + * 公司管理费用 + */ + private long costCompanyManage; + +} diff --git a/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java b/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java new file mode 100644 index 0000000..e944b78 --- /dev/null +++ b/src/main/java/cn/palmte/work/controller/backend/StatisticsController.java @@ -0,0 +1,26 @@ +package cn.palmte.work.controller.backend; + +import cn.palmte.work.bean.PrimaryIndicatorBean; +import cn.palmte.work.service.StatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping("/statistics") +public class StatisticsController extends BaseController{ + + @Autowired + private StatisticsService statisticsService; + + @RequestMapping("/month") + public String month(Map model){ + List primaryIndicatorList = statisticsService.getPrimaryIndicator(); + model.put("primaryIndicatorList",primaryIndicatorList); + return "admin/month_statistics"; + } + +} diff --git a/src/main/java/cn/palmte/work/model/ProjectBudgetCostManageRepository.java b/src/main/java/cn/palmte/work/model/ProjectBudgetCostManageRepository.java index 3940fe5..305e1f9 100644 --- a/src/main/java/cn/palmte/work/model/ProjectBudgetCostManageRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectBudgetCostManageRepository.java @@ -1,9 +1,14 @@ package cn.palmte.work.model; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import java.util.List; public interface ProjectBudgetCostManageRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + @Query(value = "select sum(cost_tax_exclude) from project_budget_cost_manage where type = ?", nativeQuery = true) + long costTaxExcludeSum(int type); + } diff --git a/src/main/java/cn/palmte/work/model/ProjectBudgetCostRepository.java b/src/main/java/cn/palmte/work/model/ProjectBudgetCostRepository.java index 5609bf1..35c14d4 100644 --- a/src/main/java/cn/palmte/work/model/ProjectBudgetCostRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectBudgetCostRepository.java @@ -1,9 +1,17 @@ package cn.palmte.work.model; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import java.util.List; public interface ProjectBudgetCostRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + @Query(value = "select sum(cost_tax_include) from project_budget_cost where type = ?", nativeQuery = true) + long costTaxIncludeSum(int type); + + @Query(value = "select sum(cost_tax_exclude) from project_budget_cost where type = ?", nativeQuery = true) + long costTaxExcludeSum(int type); + } diff --git a/src/main/java/cn/palmte/work/model/ProjectBudgetIncomeRepository.java b/src/main/java/cn/palmte/work/model/ProjectBudgetIncomeRepository.java index 67eea29..0842139 100644 --- a/src/main/java/cn/palmte/work/model/ProjectBudgetIncomeRepository.java +++ b/src/main/java/cn/palmte/work/model/ProjectBudgetIncomeRepository.java @@ -1,9 +1,18 @@ package cn.palmte.work.model; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import java.util.List; public interface ProjectBudgetIncomeRepository extends JpaRepository { List findAllByProjectIdEquals(int id); + + @Query(value = "select sum(income_tax_include) from project_budget_income where type = ?", nativeQuery = true) + long incomeTaxIncludeSum(int type); + + @Query(value = "select sum(income_tax_exclude) from project_budget_income where type = ?", nativeQuery = true) + long incomeTaxExcludeSum(int type); + + } diff --git a/src/main/java/cn/palmte/work/service/StatisticsService.java b/src/main/java/cn/palmte/work/service/StatisticsService.java new file mode 100644 index 0000000..56a5ca2 --- /dev/null +++ b/src/main/java/cn/palmte/work/service/StatisticsService.java @@ -0,0 +1,118 @@ +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; + } + +} diff --git a/src/main/resources/templates/admin/month_statistics.ftl b/src/main/resources/templates/admin/month_statistics.ftl new file mode 100644 index 0000000..af19732 --- /dev/null +++ b/src/main/resources/templates/admin/month_statistics.ftl @@ -0,0 +1,144 @@ +<#assign base=request.contextPath /> +<#import "../common/defaultLayout.ftl" as defaultLayout> +<@defaultLayout.layout> +
+
+
+
项目统计 / + 分月项目统计
+
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + <#if (primaryIndicatorList)?exists && (primaryIndicatorList?size>0)> + <#list primaryIndicatorList as list> + + + + + + + + + + + + + + + + + +
类别收入--设备类收入--施工类收入--服务类采购成本--设备类采购成本--施工类采购成本--服务类采购成本--其他成本--其他成本--项目管理成本财务费用--资金占用成本公司管理费用
${list.title!}${list.incomeDevice!}${list.incomeEngineer!}${list.incomeService!}${list.costPurchaseDevice!}${list.costPurchaseBuild!}${list.costPurchaseService!}${list.costPurchaseOther!}${list.costOtherOther!}${list.costProjectManage!}${list.costExpropriation!}${list.costCompanyManage!}
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
/营业收入营业成本项目管理成本其他财务费用项目毛利项目毛利率公司管理费用项目贡献利润项目贡献利润率所得税费用项目净利润项目净利润率
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
/销售商品、提供劳务收到的现金收到的税费返还收到其他与经营活动有关的现金购买商品、接受劳务支付的现金支付的各项税费支付其他与经营活动有关的现金经营活动产生的现金流量净额投资活动现金流入投资活动现金流出投资活动产生的现金流量净额借款资金流入还款资金流出筹资活动产生的现金流量净额货币资金净增加额
+
+
+
+ + +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + +