导出增加字段

master
OathK1per 2022-07-22 17:36:35 +08:00
parent 094017d0d7
commit e7a93593e0
3 changed files with 38 additions and 5 deletions

View File

@ -110,8 +110,8 @@ public class ProjectController extends BaseController {
public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException { public void export(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords); Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream"); downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream");
String[] headers = {"项目名称", "项目类型", "项目状态", "审核状态", "当前审核人", "项目创建者", "部门名称", "项目开始时间", "项目结束时间", "最后更新时间"}; String[] headers = {"项目编号", "项目名称", "项目类型", "项目合同金额", "华智产品金额", "其他产品金额", "项目状态", "审核状态", "当前审核人", "项目创建者", "部门名称", "项目开始时间", "项目结束时间", "最后更新时间"};
String[] exportColumns = {"name", "typeDesc", "statusDesc", "approveStatusDesc", "approveName", "creatorName", "deptName", "startDateYM", "endDateYM", "lastUpdateTime"}; String[] exportColumns = {"projectNo", "name", "typeDesc", "contractRound", "huazhiRound", "ziguangRound", "statusDesc", "approveStatusDesc", "approveName", "creatorName", "deptName", "startDateYM", "endDateYM", "lastUpdateTime"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000, ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> projectService.list(searchInfo, pN, pS).getList()); httpServletResponse.getOutputStream(), (pN, pS) -> projectService.list(searchInfo, pN, pS).getList());
} }
@ -380,8 +380,8 @@ public class ProjectController extends BaseController {
public void exportApprove(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException { public void exportApprove(@RequestParam(value = "keywords", required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
Map<String, String> searchInfo = getSearchInfo(keywords); Map<String, String> searchInfo = getSearchInfo(keywords);
downloadHeader(httpServletResponse, Utils.generateExcelName("待我审核项目报表"), "application/octet-stream"); downloadHeader(httpServletResponse, Utils.generateExcelName("待我审核项目报表"), "application/octet-stream");
String[] headers = {"项目名称", "项目类型", "项目状态", "审核状态", "当前审核人", "项目创建者", "部门名称", "项目开始时间", "项目结束时间", "最后更新时间"}; String[] headers = {"项目编号", "项目名称", "项目类型", "项目合同金额", "华智产品金额", "其他产品金额", "项目状态", "审核状态", "当前审核人", "项目创建者", "部门名称", "项目开始时间", "项目结束时间", "最后更新时间"};
String[] exportColumns = {"name", "typeDesc", "statusDesc", "approveStatusDesc", "approveName", "creatorName", "deptName", "startDate", "endDate", "lastUpdateTime"}; String[] exportColumns = {"projectNo", "name", "typeDesc", "contractRound", "huazhiRound", "ziguangRound", "statusDesc", "approveStatusDesc", "approveName", "creatorName", "deptName", "startDate", "endDate", "lastUpdateTime"};
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000, ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
httpServletResponse.getOutputStream(), (pN, pS) -> projectService.findMyApproveProjects(searchInfo, InterfaceUtil.getAdminId(), pN, pS).getList()); httpServletResponse.getOutputStream(), (pN, pS) -> projectService.findMyApproveProjects(searchInfo, InterfaceUtil.getAdminId(), pN, pS).getList());
} }

View File

@ -182,6 +182,15 @@ public class Project {
@Column(name = "plan_end_str") @Column(name = "plan_end_str")
private String planEndStr; private String planEndStr;
@Transient
private BigDecimal contractRound;
@Transient
private BigDecimal huazhiRound;
@Transient
private BigDecimal ziguangRound;
public int getId() { public int getId() {
return id; return id;
} }
@ -501,4 +510,28 @@ public class Project {
public void setPlanEndStr(String planEndStr) { public void setPlanEndStr(String planEndStr) {
this.planEndStr = planEndStr; this.planEndStr = planEndStr;
} }
public BigDecimal getContractRound() {
return contractRound;
}
public void setContractRound(BigDecimal contractRound) {
this.contractRound = contractRound;
}
public BigDecimal getHuazhiRound() {
return huazhiRound;
}
public void setHuazhiRound(BigDecimal huazhiRound) {
this.huazhiRound = huazhiRound;
}
public BigDecimal getZiguangRound() {
return ziguangRound;
}
public void setZiguangRound(BigDecimal ziguangRound) {
this.ziguangRound = ziguangRound;
}
} }

View File

@ -52,7 +52,7 @@ public class ProjectService {
"CASE p.status WHEN 0 THEN '草稿' WHEN 1 THEN '项目创建' WHEN 5 THEN '概算完成' WHEN 10 THEN '预算完成' WHEN 15 THEN '结算中' WHEN 20 THEN '决算完成' ELSE '未知' AS statusDesc," + "CASE p.status WHEN 0 THEN '草稿' WHEN 1 THEN '项目创建' WHEN 5 THEN '概算完成' WHEN 10 THEN '预算完成' WHEN 15 THEN '结算中' WHEN 20 THEN '决算完成' ELSE '未知' AS statusDesc," +
"CASE p.approve_status WHEN 0 THEN '待审核' WHEN 1 THEN '审核通过' WHEN 2 THEN '审核不通过' ELSE '未知' AS approveStatusDesc," + "CASE p.approve_status WHEN 0 THEN '待审核' WHEN 1 THEN '审核通过' WHEN 2 THEN '审核不通过' ELSE '未知' AS approveStatusDesc," +
*/ */
QueryHelper queryHelper = new QueryHelper("SELECT p.*","project","p"); QueryHelper queryHelper = new QueryHelper("SELECT p.*, Round(p.contract_amount,2) as contractRound, Round(p.huazhi_product_amount,2) as huazhiRound, Round(p.ziguang_other_amount,2) as ziguangRound","project","p");
if(StrUtil.isNotEmpty(searchInfo.get("status")) && !"-1".equals(searchInfo.get("status"))){ if(StrUtil.isNotEmpty(searchInfo.get("status")) && !"-1".equals(searchInfo.get("status"))){
queryHelper.addCondition("p.status=?", Integer.parseInt(searchInfo.get("status"))); queryHelper.addCondition("p.status=?", Integer.parseInt(searchInfo.get("status")));
} }