分月项目统计页面实现

master
hanbo 2021-11-17 10:42:56 +08:00
parent 01b0f0e997
commit 80e3905180
7 changed files with 381 additions and 0 deletions

View File

@ -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;
}

View File

@ -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<String, Object> model){
List<PrimaryIndicatorBean> primaryIndicatorList = statisticsService.getPrimaryIndicator();
model.put("primaryIndicatorList",primaryIndicatorList);
return "admin/month_statistics";
}
}

View File

@ -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<ProjectBudgetCostManage,Integer> {
List<ProjectBudgetCostManage> findAllByProjectIdEquals(int id);
@Query(value = "select sum(cost_tax_exclude) from project_budget_cost_manage where type = ?", nativeQuery = true)
long costTaxExcludeSum(int type);
}

View File

@ -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<ProjectBudgetCost,Integer> {
List<ProjectBudgetCost> 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);
}

View File

@ -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<ProjectBudgetIncome,Integer> {
List<ProjectBudgetIncome> 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);
}

View File

@ -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<PrimaryIndicatorBean> getPrimaryIndicator() {
List<PrimaryIndicatorBean> 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;
}
}

View File

@ -0,0 +1,144 @@
<#assign base=request.contextPath />
<#import "../common/defaultLayout.ftl" as defaultLayout>
<@defaultLayout.layout>
<div class="admin-content">
<div class="admin-content-body">
<div class="am-cf am-padding">
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目统计</strong> /
<small>分月项目统计</small></div>
</div>
<form method="post" class="am-form" id="pmsForm">
<!--选项卡tabsbegin-->
<div class="am-tabs am-margin" data-am-tabs>
<ul class="am-tabs-nav am-nav am-nav-tabs">
<li class="am-active"><a href="#tab1">主要指标</a></li>
<li><a href="#tab2">损益表</a></li>
<li><a href="#tab3">现金流量表</a></li>
</ul>
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<thead>
<tr class="am-text-nowrap">
<td>类别</td>
<td>收入--设备类</td>
<td>收入--施工类</td>
<td>收入--服务类</td>
<td>采购成本--设备类</td>
<td>采购成本--施工类</td>
<td>采购成本--服务类</td>
<td>采购成本--其他</td>
<td>成本--其他</td>
<td>成本--项目管理成本</td>
<td>财务费用--资金占用成本</td>
<td>公司管理费用</td>
</tr>
</thead>
<tbody>
<#if (primaryIndicatorList)?exists && (primaryIndicatorList?size>0)>
<#list primaryIndicatorList as list>
<tr>
<td>${list.title!}</td>
<td>${list.incomeDevice!}</td>
<td>${list.incomeEngineer!}</td>
<td>${list.incomeService!}</td>
<td>${list.costPurchaseDevice!}</td>
<td>${list.costPurchaseBuild!}</td>
<td>${list.costPurchaseService!}</td>
<td>${list.costPurchaseOther!}</td>
<td>${list.costOtherOther!}</td>
<td>${list.costProjectManage!}</td>
<td>${list.costExpropriation!}</td>
<td>${list.costCompanyManage!}</td>
</tr>
</#list>
</#if>
</tbody>
</table>
</div>
</div>
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab2">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr>
<td>/</td>
<td>营业收入</td>
<td>营业成本</td>
<td>项目管理成本</td>
<td>其他</td>
<td>财务费用</td>
<td>项目毛利</td>
<td>项目毛利率</td>
<td>公司管理费用</td>
<td>项目贡献利润</td>
<td>项目贡献利润率</td>
<td>所得税费用</td>
<td>项目净利润</td>
<td>项目净利润率</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in" id="tab3">
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
<tbody>
<tr>
<td>/</td>
<td>销售商品、提供劳务收到的现金</td>
<td>收到的税费返还</td>
<td>收到其他与经营活动有关的现金</td>
<td>购买商品、接受劳务支付的现金</td>
<td>支付的各项税费</td>
<td>支付其他与经营活动有关的现金</td>
<td>经营活动产生的现金流量净额</td>
<td>投资活动现金流入</td>
<td>投资活动现金流出</td>
<td>投资活动产生的现金流量净额</td>
<td>借款资金流入</td>
<td>还款资金流出</td>
<td>筹资活动产生的现金流量净额</td>
<td>货币资金净增加额</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--选项卡tabsend-->
<div class="am-margin">
<button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">
返回上一级
</button>
</div>
</form>
</div>
</div>
<script>
var base = "${base}";
</script>
</@defaultLayout.layout>