excel导出明细表

master
OathK1per 2022-09-27 17:28:43 +08:00
parent 824928d9b3
commit 190b16b23e
2 changed files with 160 additions and 0 deletions

View File

@ -1104,4 +1104,119 @@ public class ProjectController extends BaseController {
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
}
}
/**
*
*/
@RequestMapping("/incomeExport")
public void incomeExport(HttpServletResponse response, @RequestParam int id) throws Exception{
Project project = projectService.findById(id);
response.setHeader("Content-Disposition", "attachment;filename=".concat(new String((Utils.generateExcelName(project.getName() + "-收入明细表")).getBytes(), StandardCharsets.ISO_8859_1)));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/vnd.ms-excel");
ServletOutputStream outputStream = response.getOutputStream();
ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//收入明细
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
Integer incomeTotalAmount = projectBudgetService.getBudgetIncomeAmount(project);
String[] headers2 = {"序号", "类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)"};
String[] columns2 = {"tempId", "type", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax"};
exportExcelUtils.exportIncomeDetailExcel(headers2, columns2, project, budgetBean, budgetIncomeDetail, incomeTotalAmount, "yyyy-MM-dd", 0, "收入明细表", outputStream);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/incomePlanExport")
public void incomePlanExport(HttpServletResponse response, @RequestParam int id) throws Exception{
Project project = projectService.findById(id);
response.setHeader("Content-Disposition", "attachment;filename=".concat(new String((Utils.generateExcelName(project.getName() + "-收入计划表")).getBytes(), StandardCharsets.ISO_8859_1)));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/vnd.ms-excel");
ServletOutputStream outputStream = response.getOutputStream();
ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//收入计划
List<ProjectBudgetIncomePlanDetail> budgetIncomePlanDetail = projectBudgetService.getBudgetIncomePlanDetail(project);
BigDecimal incomePlanTotalReceiveAmount = projectBudgetService.getBudgetIncomePlanReceiveAmount(project);
String[] headers6 = {"序号", "收款节点", "收款时间", "收款金额(元)"};
String[] columns6 = {"tempId", "receivePoint", "receiveTime", "receiveAmount"};
exportExcelUtils.exportIncomePlanDetailExcel(headers6, columns6, project, budgetBean, budgetIncomePlanDetail, incomePlanTotalReceiveAmount, "yyyy-MM-dd", 0, "收入计划表", outputStream);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/costExport")
public void costExport(HttpServletResponse response, @RequestParam int id) throws Exception{
Project project = projectService.findById(id);
response.setHeader("Content-Disposition", "attachment;filename=".concat(new String((Utils.generateExcelName(project.getName() + "-采购成本明细表")).getBytes(), StandardCharsets.ISO_8859_1)));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/vnd.ms-excel");
ServletOutputStream outputStream = response.getOutputStream();
ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//成本明细
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
Integer costTotalAmount = projectBudgetService.getBudgetCostAmount(project);
BigDecimal costUnderwrittenAmountTotal = projectBudgetService.getBudgetCostUnderwrittenAmountTotal(project);
BigDecimal costPayAmountTotal = projectBudgetService.getBudgetCostPayAmountTotal(project);
List<ProcurementType> procurementTypes = procurementTypeService.allProcurementTypeList();
Map<Integer, String> procurementMap = procurementTypes.stream().collect(Collectors.toMap(ProcurementType::getId, ProcurementType::getName));
String[] headers3 = {"序号", "大类", "类别", "名称", "单位", "数量", "单价", "税率(%)", "含税总金额(元)", "不含税金额(元)", "税金(元)", "签约方", "是否垫资", "预估垫资金额(元)", "支出时间", "支出金额(元)", "付款方式", "备注"};
String[] columns3 = {"tempId", "type", "category", "name", "unit", "amount", "price", "taxRate", "totalTaxInclude", "totalTaxExclude", "totalTax", "contractParty", "isUnderwritten", "underwrittenAmount", "payTime", "payAmount", "payWay", "remark"};
exportExcelUtils.exportCostDetailExcel(headers3, columns3, project, budgetBean, budgetCostDetail, costTotalAmount, costUnderwrittenAmountTotal, costPayAmountTotal, procurementMap, "yyyy-MM-dd", 0, "采购成本明细表", outputStream);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/costManageExport")
public void costManageExport(HttpServletResponse response, @RequestParam int id) throws Exception{
Project project = projectService.findById(id);
response.setHeader("Content-Disposition", "attachment;filename=".concat(new String((Utils.generateExcelName(project.getName() + "-项目管理成本表")).getBytes(), StandardCharsets.ISO_8859_1)));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/vnd.ms-excel");
ServletOutputStream outputStream = response.getOutputStream();
ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//项目管理成本明细
List<ProjectBudgetCostProjectManageDetail> budgetCostProjectManageDetail = projectBudgetService.getBudgetCostProjectManageDetail(project);
Integer costProjectManageTotalAmount = projectBudgetService.getBudgetCostProjectManageAmount(project);
BigDecimal managePayAmountTotal = projectBudgetService.getBudgetCostProjectManagePayAmount(project);
String[] headers4 = {"序号", "财务费用类别", "业务项目", "项目明细", "单位", "数量", "单价", "总金额(元)", "支出时间", "支出金额(元)", "预估计算方法", "预估依据", "备注"};
String[] columns4 = {"tempId", "type", "name", "detail", "unit", "amount", "price", "total", "payTime", "payAmount", "predictMethod", "predictWhy", "remark"};
exportExcelUtils.exportCostManageDetailExcel(headers4, columns4, project, budgetBean, budgetCostProjectManageDetail, costProjectManageTotalAmount, managePayAmountTotal, "yyyy-MM-dd", 0, "项目管理成本表", outputStream);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/budgetPlanExport")
public void budgetPlanExport(HttpServletResponse response, @RequestParam int id) throws Exception{
Project project = projectService.findById(id);
response.setHeader("Content-Disposition", "attachment;filename=".concat(new String((Utils.generateExcelName(project.getName() + "-资金计划表")).getBytes(), StandardCharsets.ISO_8859_1)));
response.setHeader("Connection", "close");
response.setHeader("Content-Type", "application/vnd.ms-excel");
ServletOutputStream outputStream = response.getOutputStream();
ExportExcelUtils exportExcelUtils = new ExportExcelUtils();
BudgetBean budgetBean = projectBudgetService.getBudget(project);
//资金计划明细
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
ProjectBudgetPlanDetail projectBudgetPlanDetailTotal = projectBudgetService.getProjectBudgetPlanDetailTotal(project, projectBudgetPlanDetails);
String[] headers5 = {"月份", "设备支出", "工程支出(含服务+施工+其他)", "经营性开支", "保证金支出", "支出合计", "销售收款", "保证金收款", "收款合计", "资金余额", "资金利息", "垫资计划", "还款计划"};
String[] row5 = {"month", "deviceCost", "engineerCost", "projectManageCost", "earnestMoneyCost", "totalCost", "saleIncome", "earnestMoneyIncome", "totalIncome", "fundBalance", "capitalInterest", "underwrittenPlan", "repaymentPlan"};
exportExcelUtils.exportPlanDetailExcel(headers5, row5, project, budgetBean, projectBudgetPlanDetails, projectBudgetPlanDetailTotal, "yyyy-MM-dd", 0, "资金计划表", outputStream);
exportExcelUtils.end(outputStream);
}
}

View File

@ -663,6 +663,15 @@
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in am-scrollable-horizontal" id="tab31">
<#--<span class="am-text-lg">收入明细表</span>-->
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/project/incomeExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<table class="am-table am-table-bordered am-table-radius table-main am-text-nowrap"
style="padding:0;"
id="incomeTable">
@ -756,6 +765,15 @@
</div>
<div class="am-tab-panel am-fade am-in am-scrollable-horizontal" id="tab36">
<#--<span class="am-text-lg">收入明细表</span>-->
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/project/incomePlanExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<table class="am-table am-table-bordered am-table-radius table-main am-text-nowrap"
style="padding:0;"
id="incomePlanTable">
@ -789,6 +807,15 @@
</div>
<div class="am-tab-panel am-fade am-in" id="tab32">
<#--<span class="am-text-lg">采购成本明细表</span>-->
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/project/costExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<table class="am-table am-table-bordered am-table-radius table-main"
style="padding:0;"
id="costTable">
@ -933,6 +960,15 @@
</div>
<div class="am-tab-panel am-fade am-in" id="tab33">
<#--<span class="am-text-lg">项目管理成本表</span>-->
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/project/costManageExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<table class="am-table am-table-bordered am-table-radius table-main"
style="padding:0;"
id="costProjectManageTable">
@ -1048,6 +1084,15 @@
</div>
<div class="am-tab-panel am-fade am-in" id="tab34">
<#--<span class="am-text-lg">资金计划表</span>-->
<div class="am-u-sm-12 am-u-md-12" style="padding:0 1.6rem 1.6rem 1rem;margin:0;">
<div class="am-btn-toolbar" style="padding-left:.5rem;">
<div class="am-btn-group am-btn-group-xs">
<button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/project/budgetPlanExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<table class="am-table table-main" style="display: block;border-collapse: collapse;width: 1700px;overflow-x: scroll;padding:0;"
id="budgetPlanDetailTable">
<thead style="display: inline-block;overflow-x: scroll;width: 200px;">