Commit 5eabcf7d authored by 廖旭伟's avatar 廖旭伟

窗口绩效汇总导出修改

parent 9c5d95bd
......@@ -2,6 +2,10 @@ package com.mortals.xhx.module.window.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.window.model.WindowPerformSummaryEntity;
......@@ -9,9 +13,12 @@ import com.mortals.xhx.module.window.model.WindowPerformSummaryQuery;
import com.mortals.xhx.module.window.service.WindowPerformSummaryService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -65,4 +72,36 @@ public class WindowPerformSummaryController extends BaseCRUDJsonBodyMappingContr
}
}
@PostMapping({"exportExcel"})
@Override
public void exportExcel(@RequestBody WindowPerformSummaryEntity query) {
Context context = this.getContext();
String busiDesc = "导出" + this.getModuleDesc();
ArrayList properties = new ArrayList();
try {
this.doExportBefore(context, query, properties);
String name = StringUtils.trim(this.moduleDesc);
if (StringUtils.isEmpty(name)) {
name = System.currentTimeMillis() + "";
}
String fileName = name + ".xlsx";
PageInfo pageInfo = this.buildPageInfo(query);
pageInfo.setPrePageResult(-1);
this.buildPermisionSql(query);
List<WindowPerformSummaryEntity> list = this.service.find(query, pageInfo, this.getContext()).getList();
Class<WindowPerformSummaryEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
ExcelUtil<WindowPerformSummaryEntity, Long> util = new ExcelUtil(tClass);
this.doExportAfter(context, list);
byte[] data = util.exportExcel(list, properties, name);
this.doExportFileAfter(data, query, context);
this.responseStream(this.response, data, fileName);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var12) {
this.doException(this.request, "导出异常", new HashMap(), var12);
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment