excel导出所有表

master
OathK1per 2022-09-28 10:22:06 +08:00
parent 190b16b23e
commit 23fa27838b
2 changed files with 178 additions and 1 deletions

View File

@ -1105,6 +1105,43 @@ public class ProjectController extends BaseController {
}
}
/**
*
*/
@RequestMapping("/estimateMainExport")
public void estimateMainExport(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();
String[] headers0 = {"部门名称", "项目编号", "项目名称", "项目类型", "项目计划开始时间", "项目计划结束时间", "垫资模式", "合作对象", "垫资利息", "垫资峰值", "合同金额", "项目毛利", "项目毛利率", "华智产品金额", "汇智产品金额", "华三产品金额", "其他产品金额", "项目把握度", "行业场景应用", "项目解决方案", "客户名称", "最终用户名称", "价值及风险"};
String[] columns0 = {"deptName", "projectNo", "name", "typeDesc", "startDate", "endDate", "underwrittenModeStr", "collaborator", "advanceInterestAmountRound", "advancePeakAmountRound", "contractRound", "grossProfitRound", "grossProfitMarginRound", "huazhiRound", "huizhiRound", "huasanRound", "ziguangRound", "certaintyStr", "industryScenario", "resolvePlanStr", "customer", "terminalCustomer", "valueRisk"};
exportExcelUtils.exportProjectExcel(headers0, columns0, project, "yyyy-MM-dd", 0, "项目立项(概算)基本信息", outputStream);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/estimateSecondExport")
public void estimateSecondExport(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();
String[] headers1 = {"项目负责人", "预计合同签订时间", "项目计划招标时间", "是否二次合作", "直签", "主合同收款条款", "主合同具体解决方案", "计收计划"};
String[] columns1 = {"principal", "contractTime", "bidsTime", "isSecondStr", "signTypeStr", "mainContractCollectionTerms", "mainContractResolvePlan", "calculationCollection"};
exportExcelUtils.exportProjectExcel(headers1, columns1, project, "yyyy-MM-dd", 0, "项目立项(概算)其他信息", outputStream);
BudgetBean budgetBean = projectBudgetService.getBudget(project);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@ -1219,4 +1256,100 @@ public class ProjectController extends BaseController {
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/budgetExport")
public void budgetExport(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();
List<ProjectBudgetIncomeDetail> budgetIncomeDetail = projectBudgetService.getBudgetIncomeDetail(project);
Set<String> rates = new HashSet<>();
StringBuilder incomeTaxSb = new StringBuilder();
String incomeTaxRates;
for (ProjectBudgetIncomeDetail projectBudgetIncomeDetail : budgetIncomeDetail) {
if (!rates.contains(projectBudgetIncomeDetail.getTaxRate().toPlainString())) {
incomeTaxSb.append(projectBudgetIncomeDetail.getTaxRate().toPlainString()).append("%,");
rates.add(projectBudgetIncomeDetail.getTaxRate().toPlainString());
}
}
if (incomeTaxSb.lastIndexOf(",") > 0 && incomeTaxSb.lastIndexOf(",") == incomeTaxSb.length() - 1) {
incomeTaxRates = incomeTaxSb.substring(0, incomeTaxSb.length() - 1);
} else {
incomeTaxRates = incomeTaxSb.toString();
}
List<ProjectBudgetCostDetail> budgetCostDetail = projectBudgetService.getBudgetCostDetail(project);
Set<String> rates2 = new HashSet<>();
StringBuilder costTaxSb = new StringBuilder();
String costTaxRates;
for (ProjectBudgetCostDetail projectBudgetCostDetail : budgetCostDetail) {
if (!rates2.contains(projectBudgetCostDetail.getTaxRate().toPlainString())) {
costTaxSb.append(projectBudgetCostDetail.getTaxRate().toPlainString()).append("%,");
rates2.add(projectBudgetCostDetail.getTaxRate().toPlainString());
}
}
if (costTaxSb.lastIndexOf(",") > 0 && costTaxSb.lastIndexOf(",") == costTaxSb.length() - 1) {
costTaxRates = costTaxSb.substring(0, costTaxSb.length() - 1);
} else {
costTaxRates = costTaxSb.toString();
}
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
BudgetBean budgetBean = projectBudgetService.getBudget(project);
CashFlowBean cashFlowBean = projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails);
exportExcelUtils.exportBudgetExcel(budgetBean, cashFlowBean, 0, "项目预算信息", outputStream, project.getOtherName(), incomeTaxRates, costTaxRates);
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/settleExport")
public void settleExport(HttpServletResponse response, @RequestParam int id, @RequestParam String time) 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();
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
CashFlowBean cashFlowBean = projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails);
BudgetBean budgetBean = projectBudgetService.getBudget(project);
SettleBean settleBean = projectSettleService.getMonthSettle(project, time);
FormerBean formerBean = projectSettleService.getFormerSettle(project, time);
FormerBean currentBean = projectSettleService.getCurrentSettleBytime(project, time);
exportExcelUtils.exportSettleExcel(budgetBean, cashFlowBean, formerBean, settleBean, currentBean, 0, "项目结算信息" + time, outputStream, project.getOtherName());
exportExcelUtils.end(outputStream);
}
/**
*
*/
@RequestMapping("/finalExport")
public void finalExport(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();
List<ProjectBudgetPlanDetail> projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
CashFlowBean cashFlowBean = projectBudgetService.getCashFlowBean(project, projectBudgetPlanDetails);
BudgetBean budgetBean = projectBudgetService.getBudget(project);
FinalBean finalBean = projectFinalSevice.getFinal(project);
FormerBean settleBean = projectSettleService.getCurrentSettle(project, "");
exportExcelUtils.exportFinalExcel(budgetBean, cashFlowBean, settleBean, finalBean, 0, "项目决算信息", outputStream, project.getOtherName());
exportExcelUtils.end(outputStream);
}
}

View File

@ -137,7 +137,15 @@
<input name="type" id="type" type="hidden" value="${type}"/>
<input name="projectContributionProfitRateThreshold" id="projectContributionProfitRateThreshold" type="hidden" value="${project.projectContributionProfitRateThreshold}" />
<!--验证表单元素validate) begin-->
<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/estimateMainExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><input readonly style="text-align: right;width: 80px; margin-bottom: 13px;" value="部门名称"/></div>
<div class="am-u-sm-6 am-u-md-6">
@ -397,6 +405,15 @@
<div class="am-tabs-bd">
<div class="am-tab-panel am-fade am-in am-scrollable-horizontal" id="tab2">
<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/estimateSecondExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<div class="am-g am-form-group am-margin-top">
<div class="am-u-sm-4 am-u-md-2 am-text-right"><input readonly style="text-align: right;width: 100px ;margin-bottom: 12px;" value="项目负责人"/></div>
@ -1238,6 +1255,15 @@
<span class="am-text-primary"><a style="cursor: pointer" id="cost-project-manage-detail">项目管理成本表</a></span>
<span class="am-text-primary budget-plan-detail"><a style="cursor: pointer">资金计划表</a></span>-->
<div class="am-tab-panel am-fade am-in am-active am-scrollable-horizontal" id="tab35">
<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/budgetExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<#if (project.status==5 || project.status==10 || project.status==15) && project.approveStatusBudget == 1>
<div class="approve-topass"></div>
</#if>
@ -1589,6 +1615,15 @@
</div>
<br/>
<br/>
<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/settleExport?id=${project.id!}&time=${time!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<span class="am-text-lg">收入</span>
<table class="am-table am-table-bordered am-table-radius table-main am-text-nowrap" style="padding:0;">
<tbody>
@ -1952,6 +1987,15 @@
<div class="approve-nopass"></div>
</#if>
<input name="id" id="id" type="hidden" value="${project.id}" />
<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/finalExport?id=${project.id!}'">
<span class="am-icon-archive"></span> 导出
</button>
</div>
</div>
</div>
<span class="am-text-lg">收入</span>
<table class="am-table am-table-bordered am-table-radius table-main am-text-nowrap" style="padding:0;">
<tbody>