| | |
| | | return getDataTable(spstatCaseService.getListBypower(spStatCaseReq)); |
| | | } |
| | | |
| | | /** |
| | | * 导出案例统计 |
| | | */ |
| | | @ApiOperation("导出案例统计") |
| | | @Log(title = "案例统计", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SpStatCaseReq spStatCaseReq) { |
| | | List<SpStatCase> list = spstatCaseService.getListBypower(spStatCaseReq); |
| | | ExcelUtil<SpStatCase> util = new ExcelUtil<SpStatCase>(SpStatCase.class); |
| | | return util.exportExcel(list, "案例统计数据"); |
| | | } |
| | | |
| | | /** |
| | | * 导出案例统计(按业务组) |
| | | */ |
| | | @ApiOperation("导出案例统计(按业务组)") |
| | | @Log(title = "案例统计", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/exportDept") |
| | | public AjaxResult exportDept(SpStatCaseReq spStatCaseReq) { |
| | | List<SpStatCase> list = spstatCaseService.getListBypower(spStatCaseReq); |
| | | Map<String, SpStatCaseDept> grouped = new LinkedHashMap<String, SpStatCaseDept>(); |
| | | for (SpStatCase row : list) { |
| | | String key = StringUtils.isNotEmpty(row.getDeptid()) ? row.getDeptid() : row.getDeptname(); |
| | | if (key == null) { |
| | | key = ""; |
| | | } |
| | | SpStatCaseDept dept = grouped.get(key); |
| | | if (dept == null) { |
| | | dept = new SpStatCaseDept(); |
| | | dept.setDeptname(row.getDeptname() == null ? "未分组" : row.getDeptname()); |
| | | dept.setCaseTotal(0); |
| | | dept.setTerminationTotal(0); |
| | | grouped.put(key, dept); |
| | | } |
| | | dept.setCaseTotal(dept.getCaseTotal() + toInt(row.getWorkflowsum())); |
| | | dept.setTerminationTotal(dept.getTerminationTotal() + toInt(row.getTerminationcase())); |
| | | } |
| | | List<SpStatCaseDept> result = new ArrayList<SpStatCaseDept>(grouped.values()); |
| | | ExcelUtil<SpStatCaseDept> util = new ExcelUtil<SpStatCaseDept>(SpStatCaseDept.class); |
| | | return util.exportExcel(result, "案例统计(按业务组)"); |
| | | } |
| | | |
| | | private int toInt(String value) { |
| | | if (StringUtils.isEmpty(value)) { |
| | | return 0; |
| | | } |
| | | try { |
| | | return Integer.parseInt(value.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |