|
@@ -86,7 +86,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
@Resource
|
|
|
private PushUserService pushUserService;
|
|
|
|
|
|
- private Map<String, String> headsMap = new LinkedHashMap<String, String>() {{
|
|
|
+ private Map<String, String> projectHeadsMap = new LinkedHashMap<String, String>() {{
|
|
|
put("projectCode", "项目编号");
|
|
|
put("projectName", "项目名称");
|
|
|
put("province", "省份");
|
|
@@ -99,6 +99,17 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
put("endDate", "结束时间");
|
|
|
}};
|
|
|
|
|
|
+ private Map<String, String> liftHeadsMap = new LinkedHashMap<String, String>() {{
|
|
|
+ put("projectName", "项目名称");
|
|
|
+ put("registrationCode", "注册代码");
|
|
|
+ put("liftType", "电梯类型");
|
|
|
+ put("devicePosition", "电梯位置");
|
|
|
+ put("liftBrand", "电梯品牌");
|
|
|
+ put("workerName", "维保工");
|
|
|
+ put("annualInspectionDate", "年检日期");
|
|
|
+ put("liftStatus", "电梯状态");
|
|
|
+ }};
|
|
|
+
|
|
|
/**
|
|
|
* @return 项目列表
|
|
|
* @description 查询项目列表
|
|
@@ -397,6 +408,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
return baseMapper.exportList(ids);
|
|
|
}
|
|
|
|
|
|
+ public List<Map<String,String>> exportLiftList(List<String> ids){
|
|
|
+ return baseMapper.exportLiftList(ids);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param request 导出项目数据列表
|
|
|
* @return RestResponse 状态码和返回消息
|
|
@@ -406,15 +421,19 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
public void export(ExportRequest request, HttpServletResponse response) {
|
|
|
List<String> ids = request.getIds();
|
|
|
List<Map<String, String>> projectList = exportList(ids);
|
|
|
- ExcelWriter writer = ExcelUtil.getWriter(true);
|
|
|
+ List<Map<String, String>> liftList = exportLiftList(ids);
|
|
|
+ ExcelWriter writer = ExcelUtil.getWriterWithSheet("项目");
|
|
|
//设置列别名
|
|
|
- headsMap.forEach(writer::addHeaderAlias);
|
|
|
- String fileName = DateUtils.generateCode() + ".xlsx";
|
|
|
+ projectHeadsMap.forEach(writer::addHeaderAlias);
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + DateUtils.generateCode() + ".xlsx");
|
|
|
try (ServletOutputStream out = response.getOutputStream()) {
|
|
|
writer.write(projectList, true);
|
|
|
writer.autoSizeColumnAll();
|
|
|
+ writer.setSheet("电梯");
|
|
|
+ liftHeadsMap.forEach(writer::addHeaderAlias);
|
|
|
+ writer.write(liftList, true);
|
|
|
+ writer.autoSizeColumnAll();
|
|
|
writer.flush(out, true);
|
|
|
writer.close();
|
|
|
} catch (IOException e) {
|