| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TTaskDetailService tTaskDetailService; |
| | | @Resource |
| | | private TDeptService deptService; |
| | | @Resource |
| | | private TTemplateCountService templateCountService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | @Resource |
| | |
| | | TTemplate tTemplate = templates.stream().filter(e -> e.getId().equals(record.getTemplateId())).findFirst().orElse(null); |
| | | record.setNum1(1); |
| | | if(Objects.nonNull(tTemplate)){ |
| | | TTemplateCount templateCount = templateCountService.lambdaQuery().eq(TTemplateCount::getUserId, record.getUserId()) |
| | | .eq(TTemplateCount::getTemplateId, tTemplate.getId()) |
| | | .orderByDesc(TTemplateCount::getCreateTime).last("limit 1").one(); |
| | | if (templateCount!=null){ |
| | | record.setNum1(templateCount.getTaskCount()); |
| | | } |
| | | // todo 应生成计划数 |
| | | LocalDateTime createTime = tTemplate.getCreateTime(); |
| | | // 转化为yyyy-MM-dd字符串 |
| | |
| | | record.setTemplateDate(stringBuilder.toString()); |
| | | } |
| | | } |
| | | if (record.getNum2() != 0) { |
| | | |
| | | if (record.getNum1() != 0) { |
| | | record.setNum4(new BigDecimal((double) record.getNum2() / (double) record.getNum1() * 100).setScale(2, RoundingMode.HALF_DOWN)); |
| | | } else { |
| | | record.setNum4(new BigDecimal(0)); |
| | |
| | | } |
| | | @ApiOperation(value = "任务报表导出") |
| | | @PostMapping(value = "/taskDetailsExport") |
| | | public void taskDetailsExport(@RequestBody TaskDetailsQuery query) { |
| | | public void taskDetailsExport(@RequestBody TaskDetailsQuery query,HttpServletResponse response) throws IOException { |
| | | List<TLocationType> locationTypeList = locationTypeService.list(); |
| | | List<TLocation> locations = locationService.list(); |
| | | LambdaQueryWrapper<TTask> tTaskLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | locationTypeListByProjectVOS.add(locationTypeListByProjectVO); |
| | | } |
| | | for (ProjectDeptDetailsVO re : res) { |
| | | for (ProjectDeptDetailsChildVO projectDeptDetailsChildVO : re.getProjectChild()) { |
| | | List<ProjectDeptDetailsChildVO> projectChild = re.getProjectChild(); |
| | | for (ProjectDeptDetailsChildVO projectDeptDetailsChildVO : projectChild) { |
| | | int cleanerCount = cleanerService.lambdaQuery().eq(TCleaner::getProjectId, projectDeptDetailsChildVO.getProjectId()).list().size(); |
| | | projectDeptDetailsChildVO.setCleanerCount(cleanerCount); |
| | | List<LocationTypeListByProjectVO> locationTypeListByProjectVOS1 = new ArrayList<>(); |
| | | for (LocationTypeListByProjectVO locationTypeListByProjectVO : locationTypeListByProjectVOS) { |
| | | LocationTypeListByProjectVO temp = new LocationTypeListByProjectVO(); |
| | | BeanUtils.copyProperties(locationTypeListByProjectVO, temp); |
| | | List<String> locationIds = locations.stream().filter(e -> e.getLocationType().equals(locationTypeListByProjectVO.getId())).map(TLocation::getId).collect(Collectors.toList()); |
| | | if (locationIds.isEmpty()) { |
| | | locationTypeListByProjectVO.setLocationNum(0); |
| | |
| | | List<TTask> taskList = tasks.stream().filter(e -> e.getProjectId().equals(projectDeptDetailsChildVO.getProjectId()) |
| | | && locationIds.contains(e.getLocationId())).collect(Collectors.toList()); |
| | | Integer count = taskList.size(); |
| | | temp.setLocationNum(count); |
| | | locationTypeListByProjectVO.setLocationNum(count); |
| | | int total = taskList.size(); |
| | | int num1 = 0; |
| | | int num2 = 0; |
| | |
| | | projectDeptDetailsChildVO.setNum6(num6); |
| | | projectDeptDetailsChildVO.setNum7(num7); |
| | | } |
| | | locationTypeListByProjectVOS1.add(temp); |
| | | } |
| | | projectDeptDetailsChildVO.setLocationTypeList(locationTypeListByProjectVOS1); |
| | | projectDeptDetailsChildVO.setCleanerCount(0); |
| | | |
| | | } |
| | | |
| | | } |
| | | //1.获取excel模板 |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ProjectDeptDetailsVO.class, res); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("任务记录列表.xls", "utf-8"); |
| | | response.setHeader("Content-dispodition", "attachment;filename=" + fileName); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | projectDeptDetailsChildVO.setLocationTypeList(locationTypeListByProjectVOS); |
| | | } |
| | | } |
| | | |
| | | Set<String> allTypeNames = new LinkedHashSet<>(); |
| | | for (ProjectDeptDetailsVO row : res) { |
| | | for (ProjectDeptDetailsChildVO lt : row.getProjectChild()) { |
| | | for (LocationTypeListByProjectVO locationTypeListByProjectVO : lt.getLocationTypeList()) { |
| | | allTypeNames.add(locationTypeListByProjectVO.getLocationTypeName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<ExcelExportEntity> entityList = new ArrayList<>(); |
| | | ExcelExportEntity excelExportEntity = new ExcelExportEntity("项目", "projectName", 15); |
| | | excelExportEntity.setMergeVertical(true); |
| | | entityList.add(excelExportEntity); |
| | | entityList.add(new ExcelExportEntity("片区名称", "areaName",15)); |
| | | entityList.add(new ExcelExportEntity("巡检保洁员数", "inspectorCount",15)); |
| | | |
| | | // 动态添加作业类型分类 |
| | | List<String> list = new ArrayList<>(allTypeNames); |
| | | Collections.reverse(list); |
| | | for (String typeName : list) { |
| | | ExcelExportEntity excelExportEntity1 = new ExcelExportEntity(typeName, typeName, 15); |
| | | excelExportEntity1.setGroupName("作业类型分类"); |
| | | entityList.add(excelExportEntity1); |
| | | } |
| | | |
| | | ExcelExportEntity excelExportEntity8 = new ExcelExportEntity("整改完成任务", "total", 15); |
| | | excelExportEntity8.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity8); |
| | | ExcelExportEntity excelExportEntity7 = new ExcelExportEntity("超时未执行任务", "total", 15); |
| | | excelExportEntity7.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity7); |
| | | ExcelExportEntity excelExportEntity6 = new ExcelExportEntity("审核通过任务", "total", 15); |
| | | excelExportEntity6.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity6); |
| | | ExcelExportEntity excelExportEntity5 = new ExcelExportEntity("待整改任务", "total", 15); |
| | | excelExportEntity5.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity5); |
| | | ExcelExportEntity excelExportEntity4 = new ExcelExportEntity("未执行任务", "total", 15); |
| | | excelExportEntity4.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity4); |
| | | ExcelExportEntity excelExportEntity3 = new ExcelExportEntity("清洁不合格", "total", 15); |
| | | excelExportEntity3.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity3); |
| | | ExcelExportEntity excelExportEntity2 = new ExcelExportEntity("清洁合格", "total", 15); |
| | | excelExportEntity2.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity2); |
| | | ExcelExportEntity excelExportEntity1 = new ExcelExportEntity("总数", "total", 15); |
| | | excelExportEntity1.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity1); |
| | | |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (ProjectDeptDetailsVO projectDeptDetailsVO : res) { |
| | | List<ProjectDeptDetailsChildVO> projectChild = projectDeptDetailsVO.getProjectChild(); |
| | | for (ProjectDeptDetailsChildVO row : projectChild) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("projectName", projectDeptDetailsVO.getProjectName()); |
| | | map.put("areaName", row.getProjectChildName()); |
| | | map.put("inspectorCount", row.getCleanerCount()); |
| | | // 动态作业类型 |
| | | for (LocationTypeListByProjectVO lt : row.getLocationTypeList()) { |
| | | map.put(lt.getLocationTypeName(), lt.getLocationNum()); |
| | | } |
| | | // 没有的类型补0 |
| | | for (String typeName : allTypeNames) { |
| | | map.putIfAbsent(typeName, 0); |
| | | } |
| | | map.put("total", row.getTotal()); |
| | | map.put("num1", row.getNum1()); |
| | | map.put("num2", row.getNum2()); |
| | | map.put("num3", row.getNum3()); |
| | | map.put("num4", row.getNum4()); |
| | | map.put("num5", row.getNum5()); |
| | | map.put("num6", row.getNum6()); |
| | | map.put("num7", row.getNum7()); |
| | | mapList.add(map); |
| | | } |
| | | } |
| | | |
| | | ExportParams params = new ExportParams("任务报表", "数据表"); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, entityList, mapList); |
| | | |
| | | response.setHeader("content-type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("任务情况汇总.xlsx", "UTF-8")); |
| | | workbook.write(response.getOutputStream()); |
| | | workbook.close(); |
| | | } |
| | | |
| | | @ApiOperation(value = "巡检人员报表") |
| | |
| | | patrolInspectorVO.setTotal(taskList.size()); |
| | | patrolInspectorVO.setNum1(clearStatus1.size()); |
| | | patrolInspectorVO.setNum2(clearStatus2.size()); |
| | | patrolInspectorVO.setNum3(clearStatus1.size()+clearStatus2.size()!=0? |
| | | patrolInspectorVO.setNum3(!clearStatus1.isEmpty() ? |
| | | (new BigDecimal(clearStatus1.size()).add(new BigDecimal(clearStatus2.size()))) |
| | | .divide(new BigDecimal(clearStatus1.size()), 2, RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | |
| | | patrolInspectorVO.setNum6(status3.size()); |
| | | patrolInspectorVO.setNum7(status4.size()); |
| | | patrolInspectorVO.setNum8(status5.size()); |
| | | patrolInspectorVO.setNum9(!status5.isEmpty()?new BigDecimal(status5.size()) |
| | | patrolInspectorVO.setNum9(!status5.isEmpty()||!status4.isEmpty()?new BigDecimal(status5.size()) |
| | | .divide(new BigDecimal(status4.size()).add(new BigDecimal(status5.size())),2,RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | | patrolInspectorVO.setNum10(status6.size()); |
| | | patrolInspectorVO.setNum11(!status6.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(taskList.size()),2,RoundingMode.HALF_DOWN):BigDecimal.ZERO); |
| | | patrolInspectorVO.setNum11(!taskList.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(taskList.size()),2,RoundingMode.HALF_DOWN):BigDecimal.ZERO); |
| | | List<TLeave> collect1 = leaves.stream().filter(e -> e.getLeavePerson().equals(sysUser.getUserId()+"")).collect(Collectors.toList()); |
| | | patrolInspectorVO.setNum12(collect1.size()); |
| | | res.add(patrolInspectorVO); |
| | |
| | | patrolInspectorVO.setTotal(taskList.size()); |
| | | patrolInspectorVO.setNum1(clearStatus1.size()); |
| | | patrolInspectorVO.setNum2(clearStatus2.size()); |
| | | patrolInspectorVO.setNum3(clearStatus1.size()+clearStatus2.size()!=0? |
| | | patrolInspectorVO.setNum3(!clearStatus1.isEmpty() ? |
| | | (new BigDecimal(clearStatus1.size()).add(new BigDecimal(clearStatus2.size()))) |
| | | .divide(new BigDecimal(clearStatus1.size()), 2, RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | |
| | | patrolInspectorVO.setNum6(status3.size()); |
| | | patrolInspectorVO.setNum7(status4.size()); |
| | | patrolInspectorVO.setNum8(status5.size()); |
| | | patrolInspectorVO.setNum9(!status5.isEmpty()?new BigDecimal(status5.size()) |
| | | patrolInspectorVO.setNum9(!status5.isEmpty()||!status4.isEmpty()?new BigDecimal(status5.size()) |
| | | .divide(new BigDecimal(status4.size()).add(new BigDecimal(status5.size())),2,RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | | patrolInspectorVO.setNum10(status6.size()); |
| | | patrolInspectorVO.setNum11(!status6.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(taskList.size()),2,RoundingMode.HALF_DOWN):BigDecimal.ZERO); |
| | | patrolInspectorVO.setNum11(!taskList.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(taskList.size()),2,RoundingMode.HALF_DOWN):BigDecimal.ZERO); |
| | | List<TLeave> collect1 = leaves.stream().filter(e -> e.getLeavePerson().equals(sysUser.getUserId()+"")).collect(Collectors.toList()); |
| | | patrolInspectorVO.setNum12(collect1.size()); |
| | | res.add(patrolInspectorVO); |
| | |
| | | |
| | | inspectorVO.setNum1(status1.size()); |
| | | inspectorVO.setNum2(status2.size()); |
| | | inspectorVO.setNum3(!status1.isEmpty()?new BigDecimal(status1.size()).divide(new BigDecimal(status2.size()+status1.size()),2,RoundingMode.HALF_DOWN).multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | | inspectorVO.setNum3(!status1.isEmpty()||!status2.isEmpty()?new BigDecimal(status1.size()).divide(new BigDecimal(status2.size()+status1.size()),2,RoundingMode.HALF_DOWN).multiply(new BigDecimal(100)):BigDecimal.ZERO); |
| | | inspectorVO.setNum4(status4.size()); |
| | | inspectorVO.setNum5(status5.size()); |
| | | inspectorVO.setNum6(status6.size()); |
| | | inspectorVO.setNum7(!status6.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(status5.size()+status6.size()),2,RoundingMode.HALF_DOWN).multiply(new BigDecimal(100)):new BigDecimal(0)); |
| | | inspectorVO.setNum7(!status6.isEmpty()||!status5.isEmpty()?new BigDecimal(status6.size()).divide(new BigDecimal(status5.size()+status6.size()),2,RoundingMode.HALF_DOWN).multiply(new BigDecimal(100)):new BigDecimal(0)); |
| | | res.add(inspectorVO); |
| | | } |
| | | return R.ok(res); |
| | |
| | | @ApiOperation(value = "任务报表导出模板") |
| | | @PostMapping(value = "/exportExcel") |
| | | public void exportExcel(@RequestBody TaskDetailsQuery query,HttpServletResponse response) throws Exception{ |
| | | // 动态标头名称字段 |
| | | final String headerName = "locationTypeName"; |
| | | // 动态标头值字段 |
| | | final String headerValue = "locationNum"; |
| | | List<TLocationType> locationTypeList = locationTypeService.list(); |
| | | List<TLocation> locations = locationService.list(); |
| | | LambdaQueryWrapper<TTask> tTaskLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | int cleanerCount = cleanerService.lambdaQuery().eq(TCleaner::getProjectId, projectDeptDetailsChildVO.getProjectId()).list().size(); |
| | | projectDeptDetailsChildVO.setCleanerCount(cleanerCount); |
| | | for (LocationTypeListByProjectVO locationTypeListByProjectVO : locationTypeListByProjectVOS) { |
| | | List<TaskSummaryVO> taskSummaryVOS = new ArrayList<>(); |
| | | List<String> locationIds = locations.stream().filter(e -> e.getLocationType().equals(locationTypeListByProjectVO.getId())).map(TLocation::getId).collect(Collectors.toList()); |
| | | if (locationIds.isEmpty()) { |
| | | locationTypeListByProjectVO.setLocationNum(0); |
| | |
| | | int num5 = 0; |
| | | int num6 = 0; |
| | | int num7 = 0; |
| | | TaskSummaryVO taskSummaryVO = new TaskSummaryVO(); |
| | | for (TTask tTask : taskList) { |
| | | TTaskDetail tTaskDetail = taskDetails.stream().filter(e -> e.getTaskId().equals(tTask.getId()) && e.getClearStatus() != null).findFirst().orElse(null); |
| | | if (tTaskDetail!=null){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | taskSummaryVO.setTotal(total); |
| | | taskSummaryVO.setNum1(num1); |
| | | taskSummaryVO.setNum2(num2); |
| | | taskSummaryVO.setNum3(num3); |
| | | taskSummaryVO.setNum4(num4); |
| | | taskSummaryVO.setNum5(num5); |
| | | taskSummaryVO.setNum6(num6); |
| | | taskSummaryVO.setNum7(num7); |
| | | taskSummaryVOS.add(taskSummaryVO); |
| | | projectDeptDetailsChildVO.setTotal(total); |
| | | projectDeptDetailsChildVO.setNum1(num1); |
| | | projectDeptDetailsChildVO.setNum2(num2); |
| | | projectDeptDetailsChildVO.setNum3(num3); |
| | | projectDeptDetailsChildVO.setNum4(num4); |
| | | projectDeptDetailsChildVO.setNum5(num5); |
| | | projectDeptDetailsChildVO.setNum6(num6); |
| | | projectDeptDetailsChildVO.setNum7(num7); |
| | | } |
| | | projectDeptDetailsChildVO.setTaskSummaryVOS(taskSummaryVOS); |
| | | } |
| | | projectDeptDetailsChildVO.setLocationTypeList(locationTypeListByProjectVOS); |
| | | } |
| | | } |
| | | try { |
| | | String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss")); |
| | | ExcelPoiUtils.exportExcel(response, "任务报表_"+time, "任务报表导出模板", |
| | | "sheet", res, headerName, headerValue); |
| | | } catch (Exception e) { |
| | | System.out.println("导出错误,"+e.getMessage()); |
| | | throw new RuntimeException(e.getMessage()); |
| | | |
| | | Set<String> allTypeNames = new LinkedHashSet<>(); |
| | | for (ProjectDeptDetailsVO row : res) { |
| | | for (ProjectDeptDetailsChildVO lt : row.getProjectChild()) { |
| | | for (LocationTypeListByProjectVO locationTypeListByProjectVO : lt.getLocationTypeList()) { |
| | | allTypeNames.add(locationTypeListByProjectVO.getLocationTypeName()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<ExcelExportEntity> entityList = new ArrayList<>(); |
| | | ExcelExportEntity excelExportEntity = new ExcelExportEntity("项目", "projectName", 15); |
| | | excelExportEntity.setMergeVertical(true); |
| | | entityList.add(excelExportEntity); |
| | | entityList.add(new ExcelExportEntity("片区名称", "areaName",15)); |
| | | entityList.add(new ExcelExportEntity("巡检保洁员数", "inspectorCount",15)); |
| | | |
| | | // 动态添加作业类型分类 |
| | | List<String> list = new ArrayList<>(allTypeNames); |
| | | Collections.reverse(list); |
| | | for (String typeName : list) { |
| | | ExcelExportEntity excelExportEntity1 = new ExcelExportEntity(typeName, typeName, 15); |
| | | excelExportEntity1.setGroupName("作业类型分类"); |
| | | entityList.add(excelExportEntity1); |
| | | } |
| | | |
| | | ExcelExportEntity excelExportEntity8 = new ExcelExportEntity("整改完成任务", "total", 15); |
| | | excelExportEntity8.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity8); |
| | | ExcelExportEntity excelExportEntity7 = new ExcelExportEntity("超时未执行任务", "total", 15); |
| | | excelExportEntity7.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity7); |
| | | ExcelExportEntity excelExportEntity6 = new ExcelExportEntity("审核通过任务", "total", 15); |
| | | excelExportEntity6.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity6); |
| | | ExcelExportEntity excelExportEntity5 = new ExcelExportEntity("待整改任务", "total", 15); |
| | | excelExportEntity5.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity5); |
| | | ExcelExportEntity excelExportEntity4 = new ExcelExportEntity("未执行任务", "total", 15); |
| | | excelExportEntity4.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity4); |
| | | ExcelExportEntity excelExportEntity3 = new ExcelExportEntity("清洁不合格", "total", 15); |
| | | excelExportEntity3.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity3); |
| | | ExcelExportEntity excelExportEntity2 = new ExcelExportEntity("清洁合格", "total", 15); |
| | | excelExportEntity2.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity2); |
| | | ExcelExportEntity excelExportEntity1 = new ExcelExportEntity("总数", "total", 15); |
| | | excelExportEntity1.setGroupName("任务情况汇总"); |
| | | entityList.add(excelExportEntity1); |
| | | |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (ProjectDeptDetailsVO projectDeptDetailsVO : res) { |
| | | List<ProjectDeptDetailsChildVO> projectChild = projectDeptDetailsVO.getProjectChild(); |
| | | for (ProjectDeptDetailsChildVO row : projectChild) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("projectName", projectDeptDetailsVO.getProjectName()); |
| | | map.put("areaName", row.getProjectChildName()); |
| | | map.put("inspectorCount", row.getCleanerCount()); |
| | | // 动态作业类型 |
| | | for (LocationTypeListByProjectVO lt : row.getLocationTypeList()) { |
| | | map.put(lt.getLocationTypeName(), lt.getLocationNum()); |
| | | } |
| | | // 没有的类型补0 |
| | | for (String typeName : allTypeNames) { |
| | | map.putIfAbsent(typeName, 0); |
| | | } |
| | | map.put("total", row.getTotal()); |
| | | map.put("num1", row.getNum1()); |
| | | map.put("num2", row.getNum2()); |
| | | map.put("num3", row.getNum3()); |
| | | map.put("num4", row.getNum4()); |
| | | map.put("num5", row.getNum5()); |
| | | map.put("num6", row.getNum6()); |
| | | map.put("num7", row.getNum7()); |
| | | mapList.add(map); |
| | | } |
| | | } |
| | | |
| | | ExportParams params = new ExportParams("任务报表", "数据表"); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, entityList, mapList); |
| | | |
| | | response.setHeader("content-type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("任务情况汇总.xlsx", "UTF-8")); |
| | | workbook.write(response.getOutputStream()); |
| | | workbook.close(); |
| | | |
| | | } |
| | | |
| | | } |