|
@@ -60,6 +60,7 @@ public class TslReportService {
|
|
|
getSheet1(day);
|
|
|
getSheet2(day);
|
|
|
getSheet3(day);
|
|
|
+ getSheet4_6(day);
|
|
|
try (OutputStream outputStream = new FileOutputStream(path)) {
|
|
|
workbook.write(outputStream);
|
|
|
workbook.close();
|
|
@@ -69,6 +70,194 @@ public class TslReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 客户端-投诉问题解决满意度
|
|
|
+ * 客户端-投诉问题解决率
|
|
|
+ * 客户端-投诉问题响应率
|
|
|
+ *
|
|
|
+ * @param day
|
|
|
+ */
|
|
|
+ private void getSheet4_6(String day) {
|
|
|
+ // 计算时间常数
|
|
|
+ Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
|
|
+ try {
|
|
|
+ calendar.setTime(DAY_FORMAT.parse(day));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ log.error("时间字符串解析失败--{}", day);
|
|
|
+ }
|
|
|
+ int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
+ Sheet sheet4 = getWorkbook().createSheet("客户端-投诉问题解决满意度");
|
|
|
+ Sheet sheet5 = getWorkbook().createSheet("客户端-投诉问题解决率");
|
|
|
+ Sheet sheet6 = getWorkbook().createSheet("客户端-投诉问题响应率");
|
|
|
+ Row row;
|
|
|
+ Cell cell;
|
|
|
+ CellRangeAddress rangeAddress;
|
|
|
+ XSSFDataFormat dataFormat = getWorkbook().createDataFormat();
|
|
|
+ XSSFFont font = getWorkbook().createFont();
|
|
|
+ font.setFontName("等线");
|
|
|
+ font.setFontHeightInPoints((short) 10);
|
|
|
+ // 基本模式 等线 10号字 带全边框 水平居中
|
|
|
+ XSSFCellStyle baseStyle = getWorkbook().createCellStyle();
|
|
|
+ baseStyle.setFont(font);
|
|
|
+ baseStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ baseStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ // 样式1 与base相同
|
|
|
+ XSSFCellStyle cellStyle1 = baseStyle.copy();
|
|
|
+ // 样式2 百分比 2位小数
|
|
|
+ XSSFCellStyle cellStyle2 = baseStyle.copy();
|
|
|
+ cellStyle2.setDataFormat(dataFormat.getFormat("0.00%"));
|
|
|
+ // 样式3 自动换行 背景色FFE7E6E6
|
|
|
+ XSSFCellStyle cellStyle3 = baseStyle.copy();
|
|
|
+ cellStyle3.setWrapText(true);
|
|
|
+ XSSFColor color = new XSSFColor();
|
|
|
+ color.setARGBHex("FFE7E6E6");
|
|
|
+ cellStyle3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ cellStyle3.setFillForegroundColor(color);
|
|
|
+
|
|
|
+ List<List<List<Object>>> sheet4_6Data = tslDataService.getSheet4_6Data(day);
|
|
|
+
|
|
|
+ // 客户端-投诉问题解决满意度 第一行
|
|
|
+ row = sheet4.createRow(0);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(String.format("投诉问题解决满意率(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 A1 - D1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 0, 3);
|
|
|
+ addMergedRegion(sheet4, rangeAddress);
|
|
|
+ // 客户端-投诉问题解决满意度 第二行
|
|
|
+ row = sheet4.createRow(1);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue("投诉问题解决满意率");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ int rowNum = 2;
|
|
|
+ for (List<Object> list : sheet4_6Data.get(0)) {
|
|
|
+ row = sheet4.createRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 投诉问题解决满意率
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue(((BigDecimal) list.get(1)).doubleValue());
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 达标值
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 与达标值差距
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ }
|
|
|
+ // 设置条件格式D3-D14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
+ setConditionalFormatting2(sheet4, rangeAddress);
|
|
|
+
|
|
|
+ // 客户端-投诉问题解决率
|
|
|
+ row = sheet5.createRow(0);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(String.format("投诉问题解决率(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 A1 - D1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 0, 3);
|
|
|
+ addMergedRegion(sheet5, rangeAddress);
|
|
|
+ // 客户端-投诉问题解决率 第二行
|
|
|
+ row = sheet5.createRow(1);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue("投诉问题解决率");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ rowNum = 2;
|
|
|
+ for (List<Object> list : sheet4_6Data.get(1)) {
|
|
|
+ row = sheet5.createRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 投诉问题解决率
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue(((BigDecimal) list.get(1)).doubleValue());
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 达标值
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 与达标值差距
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ }
|
|
|
+ // 设置条件格式D3-D14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
+ setConditionalFormatting2(sheet5, rangeAddress);
|
|
|
+
|
|
|
+ // 客户端-投诉问题响应率
|
|
|
+ row = sheet6.createRow(0);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(String.format("投诉问题相应率(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 A1 - D1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 0, 3);
|
|
|
+ addMergedRegion(sheet6, rangeAddress);
|
|
|
+ // 客户端-投诉问题相应率 第二行
|
|
|
+ row = sheet6.createRow(1);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue("投诉问题相应率");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ rowNum = 2;
|
|
|
+ for (List<Object> list : sheet4_6Data.get(2)) {
|
|
|
+ row = sheet6.createRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 投诉问题解决率
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue(((BigDecimal) list.get(1)).doubleValue());
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 达标值
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 与达标值差距
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ }
|
|
|
+ // 设置条件格式D3-D14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
+ setConditionalFormatting2(sheet6, rangeAddress);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 投诉处理时长、超时工单概况
|
|
|
*
|
|
@@ -160,6 +349,58 @@ public class TslReportService {
|
|
|
cell.setCellValue("涨幅");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
|
|
|
+ // 写入超时工单情况
|
|
|
+ List<List<Object>> sheet3Data1 = tslDataService.getSheet3Data1(day);
|
|
|
+ int rowNum = 2;
|
|
|
+ for (List<Object> list : sheet3Data1) {
|
|
|
+ row = sheet.createRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 工单数
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue((long) list.get(1));
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 超时工单数
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue((long) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 超时工单占比
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue(((BigDecimal) list.get(3)).doubleValue());
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ }
|
|
|
+ // 设置条件格式D3-D14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
+ setConditionalFormatting(sheet, rangeAddress);
|
|
|
+
|
|
|
+ // 写入平均处理时长
|
|
|
+ List<List<Object>> sheet3Data2 = tslDataService.getSheet3Data2(day);
|
|
|
+ rowNum = 2;
|
|
|
+ for (List<Object> list : sheet3Data2) {
|
|
|
+ row = sheet.getRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 上月
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue((double) list.get(1));
|
|
|
+ cell.setCellStyle(cellStyle4);
|
|
|
+ // 当月
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle4);
|
|
|
+ // 涨幅
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue((double) list.get(3));
|
|
|
+ cell.setCellStyle(cellStyle4);
|
|
|
+ }
|
|
|
+ // 设置条件格式J3-J14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 9, 9);
|
|
|
+ setConditionalFormatting(sheet, rangeAddress);
|
|
|
+
|
|
|
// 设置列宽 2048 2276*3 2048*3 2276*2 3612
|
|
|
sheet.setColumnWidth(0, 2048);
|
|
|
sheet.setColumnWidth(1, 2276);
|
|
@@ -581,4 +822,29 @@ public class TslReportService {
|
|
|
|
|
|
conditionalFormatting.addConditionalFormatting(cellRangeAddresses, rule);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 条件格式 3色渐变
|
|
|
+ * 绿 FF63BE7B 黄 FFFFEB84 红 FFF8696B
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private void setConditionalFormatting2(Sheet sheet, CellRangeAddress rangeAddress) {
|
|
|
+ SheetConditionalFormatting conditionalFormatting = sheet.getSheetConditionalFormatting();
|
|
|
+ ConditionalFormattingRule rule = conditionalFormatting.createConditionalFormattingColorScaleRule();
|
|
|
+ XSSFColor[] colors = new XSSFColor[] {
|
|
|
+ new XSSFColor(), new XSSFColor(), new XSSFColor()
|
|
|
+ };
|
|
|
+ colors[0].setARGBHex("FFF8696B");
|
|
|
+ colors[1].setARGBHex("FFFFEB84");
|
|
|
+ colors[2].setARGBHex("FF63BE7B");
|
|
|
+
|
|
|
+ rule.getColorScaleFormatting().setColors(colors);
|
|
|
+
|
|
|
+ CellRangeAddress[] cellRangeAddresses = new CellRangeAddress[] {
|
|
|
+ rangeAddress
|
|
|
+ };
|
|
|
+
|
|
|
+ conditionalFormatting.addConditionalFormatting(cellRangeAddresses, rule);
|
|
|
+ }
|
|
|
}
|