|
@@ -164,10 +164,151 @@ public class ReportsController {
|
|
|
|
|
|
List<DataDictionary> dataDictionaryList = dataDictionaryService.findByCatalogName("区域");
|
|
|
for(DataDictionary dataDictionary : dataDictionaryList){
|
|
|
- Integer total = incidentService.getCount(dataDictionary.getValue(),null,null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
- Integer noTimeout = incidentService.getCount(dataDictionary.getValue(),"0",false,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
- Integer timeout = incidentService.getCount(dataDictionary.getValue(),"0",true,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
- Integer unfinished = incidentService.getCount(dataDictionary.getValue(),"1",null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer total = incidentService.getCount("%"+dataDictionary.getValue()+"%",null,null,null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer noTimeout = incidentService.getCount("%"+dataDictionary.getValue()+"%",null,"0",false,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer timeout = incidentService.getCount("%"+dataDictionary.getValue()+"%",null,"0",true,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer unfinished = incidentService.getCount("%"+dataDictionary.getValue()+"%",null,"1",null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("areaName",dataDictionary.getName());
|
|
|
+ map.put("total",total);
|
|
|
+ map.put("noTimeout",noTimeout);
|
|
|
+ map.put("timeout",timeout);
|
|
|
+ map.put("unfinished",unfinished);
|
|
|
+
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="案件专班报表")
|
|
|
+ @RequestMapping(value = "reportClass",method = RequestMethod.POST)
|
|
|
+ public MessageResult reportClass(Date[] reportDate){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+ try{
|
|
|
+ mapList = reportClassData(reportDate);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(mapList);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="导出案件专班报表")
|
|
|
+ @RequestMapping(value = "reportClassXls",method = RequestMethod.POST)
|
|
|
+ public String reportClassXls(Date[] reportDate){
|
|
|
+ String downloadUrl = "";
|
|
|
+
|
|
|
+ //新建文档
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
+
|
|
|
+ //单元格样式
|
|
|
+ sheet.setDefaultColumnWidth(15);
|
|
|
+ sheet.setDefaultRowHeight((short) 400);
|
|
|
+
|
|
|
+ Font fontTitle = workbook.createFont();
|
|
|
+ fontTitle.setFontName("宋体");
|
|
|
+ fontTitle.setFontHeightInPoints((short) 11);
|
|
|
+ fontTitle.setBold(true);
|
|
|
+
|
|
|
+ CellStyle cellStyleTitle = workbook.createCellStyle();
|
|
|
+ cellStyleTitle.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleTitle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleTitle.setFont(fontTitle);
|
|
|
+
|
|
|
+ Font fontContent = workbook.createFont();
|
|
|
+ fontContent.setFontName("宋体");
|
|
|
+ fontContent.setFontHeightInPoints((short) 11);
|
|
|
+
|
|
|
+ CellStyle cellStyleContent = workbook.createCellStyle();
|
|
|
+ cellStyleContent.setBorderTop(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderBottom(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderLeft(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setBorderRight(BorderStyle.THIN);
|
|
|
+ cellStyleContent.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ cellStyleContent.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ cellStyleContent.setFont(fontContent);
|
|
|
+
|
|
|
+ //表头
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
+ String[] titles = new String[]{"所属专班","总案件数","按时办结数","超期办结数","未办结数"};
|
|
|
+ for (int i=0;i<titles.length;i++) {
|
|
|
+ Cell cell = rowTitle.createCell(i);
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
+ cell.setCellStyle(cellStyleTitle);
|
|
|
+ }
|
|
|
+
|
|
|
+ //写入数据
|
|
|
+ List<Map> mapList = reportClassData(reportDate);
|
|
|
+ for(int i=0; i<mapList.size(); i++){
|
|
|
+ Map<String,Object> map = mapList.get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i+1);
|
|
|
+ row.createCell(0);
|
|
|
+ row.createCell(1);
|
|
|
+ row.createCell(2);
|
|
|
+ row.createCell(3);
|
|
|
+ row.createCell(4);
|
|
|
+
|
|
|
+ row.getCell(0).setCellValue(map.get("areaName").toString());
|
|
|
+ row.getCell(1).setCellValue(map.get("total").toString());
|
|
|
+ row.getCell(2).setCellValue(map.get("noTimeout").toString());
|
|
|
+ row.getCell(3).setCellValue(map.get("timeout").toString());
|
|
|
+ row.getCell(4).setCellValue(map.get("unfinished").toString());
|
|
|
+
|
|
|
+ row.getCell(0).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(1).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(2).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(3).setCellStyle(cellStyleContent);
|
|
|
+ row.getCell(4).setCellStyle(cellStyleContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+ try {
|
|
|
+ workbook.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmm");
|
|
|
+ String now = sdf2.format(new Date());
|
|
|
+ String fileName = "案件专班报表.xls";
|
|
|
+ downloadUrl = OSSUtil.upload(ossConfig,"InsuranceReport",fileName,input);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return downloadUrl;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Map> reportClassData(Date[] reportDate){
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(reportDate[1]);
|
|
|
+ calendar.add(calendar.DATE,1);
|
|
|
+
|
|
|
+ List<DataDictionary> dataDictionaryList = dataDictionaryService.findByCatalogName("工作专班");
|
|
|
+ for(DataDictionary dataDictionary : dataDictionaryList){
|
|
|
+ Integer total = incidentService.getCount(null,"%"+dataDictionary.getValue()+"%",null,null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer noTimeout = incidentService.getCount(null,"%"+dataDictionary.getValue()+"%","0",false,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer timeout = incidentService.getCount(null,"%"+dataDictionary.getValue()+"%","0",true,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
+ Integer unfinished = incidentService.getCount(null,"%"+dataDictionary.getValue()+"%","1",null,sdf.format(reportDate[0]),sdf.format(calendar.getTime()));
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("areaName",dataDictionary.getName());
|