|
@@ -26,10 +26,7 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Locale;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 投诉报表数据生成
|
|
@@ -41,17 +38,24 @@ public class TslReportService {
|
|
|
private final TslDataService tslDataService;
|
|
|
private final OutputProperties outputProperties;
|
|
|
private final HighQualityCountMapper highQualityCountMapper;
|
|
|
+ private final HighQualityCountService highQualityCountService;
|
|
|
+ private final HighQualityDataService highQualityDataService;
|
|
|
private final MobileComplaintMapper mobileComplaintMapper;
|
|
|
private final SysDataDictionaryRepository sysDataDictionaryRepository;
|
|
|
|
|
|
private XSSFWorkbook workbook = null;
|
|
|
+ private XSSFCellStyle cellStyle1 = null;
|
|
|
+ private XSSFCellStyle cellStyle2 = null;
|
|
|
+ private XSSFCellStyle cellStyle3 = null;
|
|
|
|
|
|
private static final DateFormat DAY_FORMAT = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
- public TslReportService(TslDataService tslDataService, OutputProperties outputProperties, HighQualityCountMapper highQualityCountMapper, MobileComplaintMapper mobileComplaintMapper, SysDataDictionaryRepository sysDataDictionaryRepository) {
|
|
|
+ public TslReportService(TslDataService tslDataService, OutputProperties outputProperties, HighQualityCountMapper highQualityCountMapper, HighQualityCountService highQualityCountService, HighQualityDataService highQualityDataService, MobileComplaintMapper mobileComplaintMapper, SysDataDictionaryRepository sysDataDictionaryRepository) {
|
|
|
this.tslDataService = tslDataService;
|
|
|
this.outputProperties = outputProperties;
|
|
|
this.highQualityCountMapper = highQualityCountMapper;
|
|
|
+ this.highQualityCountService = highQualityCountService;
|
|
|
+ this.highQualityDataService = highQualityDataService;
|
|
|
this.mobileComplaintMapper = mobileComplaintMapper;
|
|
|
this.sysDataDictionaryRepository = sysDataDictionaryRepository;
|
|
|
}
|
|
@@ -74,36 +78,33 @@ public class TslReportService {
|
|
|
String area = "A1:" + CellRect.getColumnName(dayOfMonth + 7) + "15";
|
|
|
screenShot = PoiUtil.screenShot(workbook.getSheet("管理端-移网质量类"), area, "微软雅黑");
|
|
|
ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-1-投诉率.png").toFile());
|
|
|
-
|
|
|
- // 新截图
|
|
|
+ // 截图2
|
|
|
String area2 = "A1:" + CellRect.getColumnName(dayOfMonth + 7) + "15";
|
|
|
screenShot = PoiUtil.screenShot(workbook.getSheet("客户端-战略考核"), area2, "微软雅黑");
|
|
|
ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-2-客户端-战略考核.png").toFile());
|
|
|
-
|
|
|
- // 截图2
|
|
|
+ // 截图3 每月1号不发送重复投诉率
|
|
|
if (!day.endsWith("01")) {
|
|
|
screenShot = PoiUtil.screenShot(workbook.getSheet("管理端-重复投诉率"), "A1:G16", "微软雅黑");
|
|
|
ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-3-重复投诉率.png").toFile());
|
|
|
}
|
|
|
-
|
|
|
- // 截图3 4
|
|
|
+ // 截图4 5
|
|
|
Sheet sheet = workbook.getSheet("投诉处理时长、超时工单概况");
|
|
|
screenShot = PoiUtil.screenShot(sheet, "A1:D15", "微软雅黑");
|
|
|
ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-4-超时工单.png").toFile());
|
|
|
screenShot = PoiUtil.screenShot(sheet, "G1:J14", "微软雅黑");
|
|
|
ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-5-处理时长.png").toFile());
|
|
|
-
|
|
|
- // 截图5
|
|
|
- screenShot = PoiUtil.screenShot(workbook.getSheet("客户端-投诉问题解决满意度"), "A1:D15", "微软雅黑");
|
|
|
- ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-6-满意率.png").toFile());
|
|
|
-
|
|
|
// 截图6
|
|
|
- screenShot = PoiUtil.screenShot(workbook.getSheet("客户端-投诉问题解决率"), "A1:D15", "微软雅黑");
|
|
|
- ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-7-解决率.png").toFile());
|
|
|
-
|
|
|
- // 截图7
|
|
|
- screenShot = PoiUtil.screenShot(workbook.getSheet("客户端-投诉问题响应率"), "A1:D15", "微软雅黑");
|
|
|
- ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-8-响应率.png").toFile());
|
|
|
+ sheet = workbook.getSheet("客户端地市三率");
|
|
|
+ screenShot = PoiUtil.screenShot(sheet, "A1:J15", "微软雅黑");
|
|
|
+ ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-6-地市三率.png").toFile());
|
|
|
+ // 截图7 8 9 区县三率
|
|
|
+ sheet = workbook.getSheet("客户端区县三率");
|
|
|
+ screenShot = PoiUtil.screenShot(sheet, "A1:F32", "微软雅黑");
|
|
|
+ ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-7-区县响应率.png").toFile());
|
|
|
+ screenShot = PoiUtil.screenShot(sheet, "A1:F32", "微软雅黑");
|
|
|
+ ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-8-区县满意度.png").toFile());
|
|
|
+ screenShot = PoiUtil.screenShot(sheet, "A1:F32", "微软雅黑");
|
|
|
+ ImageIO.write(screenShot, "png", Paths.get(outputProperties.getOutputPath(), day, day + "-9-区县解决率.png").toFile());
|
|
|
} catch (EncryptedDocumentException | IOException | ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException(e.getMessage());
|
|
@@ -137,7 +138,7 @@ public class TslReportService {
|
|
|
*/
|
|
|
private void workbookToFile(String day, File file) {
|
|
|
// 每次需要重置workbook
|
|
|
- workbook = new XSSFWorkbook();
|
|
|
+ workbook = getWorkbook();
|
|
|
// 按照顺序写入各个sheet
|
|
|
// 管理端-移网质量类
|
|
|
getSheet1(day);
|
|
@@ -148,7 +149,10 @@ public class TslReportService {
|
|
|
// 投诉处理时长、超时工单概况
|
|
|
getSheet3(day);
|
|
|
// 客户端-投诉问题解决满意度 客户端-投诉问题解决率 客户端-投诉问题响应率
|
|
|
- getSheet4_6(day);
|
|
|
+ // getSheet4_6(day);
|
|
|
+ getCityThreeRateSheet(day);
|
|
|
+ // 区县三率
|
|
|
+ getSheet7(day);
|
|
|
try (OutputStream outputStream = new FileOutputStream(file)) {
|
|
|
workbook.write(outputStream);
|
|
|
workbook.close();
|
|
@@ -160,11 +164,9 @@ public class TslReportService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 客户端-投诉问题解决满意度
|
|
|
- * 客户端-投诉问题解决率
|
|
|
- * 客户端-投诉问题响应率
|
|
|
+ * 客户端区县三率
|
|
|
*/
|
|
|
- private void getSheet4_6(String day) {
|
|
|
+ private void getSheet7(String day) {
|
|
|
// 计算时间常数
|
|
|
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
|
|
try {
|
|
@@ -173,167 +175,272 @@ public class TslReportService {
|
|
|
log.error("时间字符串解析失败--{}", day);
|
|
|
}
|
|
|
int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
- Sheet sheet4 = getWorkbook().createSheet("客户端-投诉问题解决满意度");
|
|
|
- Sheet sheet5 = getWorkbook().createSheet("客户端-投诉问题解决率");
|
|
|
- Sheet sheet6 = getWorkbook().createSheet("客户端-投诉问题响应率");
|
|
|
+ Sheet sheet7 = 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.setVerticalAlignment(VerticalAlignment.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 FFAEAAAA
|
|
|
- XSSFCellStyle cellStyle3 = baseStyle.copy();
|
|
|
- // cellStyle3.setWrapText(true);
|
|
|
- XSSFColor color = new XSSFColor();
|
|
|
- color.setARGBHex("FFAEAAAA");
|
|
|
- cellStyle3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
- cellStyle3.setFillForegroundColor(color);
|
|
|
|
|
|
- List<List<List<Object>>> sheet4_6Data = tslDataService.getSheet4_6Data(day);
|
|
|
-
|
|
|
- // 客户端-投诉问题解决满意度 第一行
|
|
|
- row = sheet4.createRow(0);
|
|
|
+ // 获取响应率数据
|
|
|
+ List<List<Object>> timelyContactRateData = highQualityDataService.generateCpTimelyContactOfRegion(day);
|
|
|
+ // 第一行 区县投诉问题响应率(1-11)
|
|
|
+ row = sheet7.createRow(0);
|
|
|
cell = row.createCell(0);
|
|
|
- cell.setCellValue(String.format("投诉问题解决满意率(1-%s)", dayOfMonth));
|
|
|
+ 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);
|
|
|
+ // 合并单元格 A1-F1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 0, 5);
|
|
|
+ addMergedRegion(sheet7, rangeAddress);
|
|
|
+ // 第二行
|
|
|
+ row = sheet7.createRow(1);
|
|
|
cell = row.createCell(0);
|
|
|
cell.setCellValue("地市");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
cell = row.createCell(1);
|
|
|
- cell.setCellValue("满意率");
|
|
|
+ cell.setCellValue("区县");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
cell = row.createCell(2);
|
|
|
- cell.setCellValue("达标值");
|
|
|
+ cell.setCellValue("响应率");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
cell = row.createCell(3);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(4);
|
|
|
cell.setCellValue("与达标值差距");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(5);
|
|
|
+ cell.setCellValue("累计未响应");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 写入数据
|
|
|
int rowNum = 2;
|
|
|
- for (List<Object> list : sheet4_6Data.get(0)) {
|
|
|
- row = sheet4.createRow(rowNum++);
|
|
|
+ for (List<Object> list : timelyContactRateData) {
|
|
|
+ row = sheet7.createRow(rowNum++);
|
|
|
// 地市
|
|
|
cell = row.createCell(0);
|
|
|
cell.setCellValue(list.get(0).toString());
|
|
|
cell.setCellStyle(cellStyle1);
|
|
|
- // 投诉问题解决满意率
|
|
|
+ // 区县
|
|
|
cell = row.createCell(1);
|
|
|
- cell.setCellValue(((double) list.get(1)));
|
|
|
- cell.setCellStyle(cellStyle2);
|
|
|
- // 达标值
|
|
|
+ cell.setCellValue(list.get(1).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 响应率
|
|
|
cell = row.createCell(2);
|
|
|
cell.setCellValue((double) list.get(2));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
- // 与达标值差距
|
|
|
+ // 达标值
|
|
|
cell = row.createCell(3);
|
|
|
- cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell.setCellValue((double)list.get(3));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
+ // 与达标值差距
|
|
|
+ cell = row.createCell(4);
|
|
|
+ cell.setCellValue((double)list.get(4));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 本月累计未响应工单数
|
|
|
+ cell = row.createCell(5);
|
|
|
+ cell.setCellValue((int)list.get(5));
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
}
|
|
|
- // 设置条件格式D3-D14
|
|
|
- rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
- setConditionalFormatting2(sheet4, rangeAddress);
|
|
|
-
|
|
|
- // 设置列宽 2048 1304 2048 2304
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
- sheet4.setColumnWidth(i, 2848);
|
|
|
- }
|
|
|
-
|
|
|
- // 设置行高 15.0 15.0...
|
|
|
- for (int i = 0; i < 15; i++) {
|
|
|
- sheet4.getRow(i).setHeightInPoints(15.0F);
|
|
|
+ // 与达标值差距设置条件格式
|
|
|
+ rangeAddress = new CellRangeAddress(2, --rowNum, 4, 4);
|
|
|
+ setConditionalFormatting2(sheet7, rangeAddress);
|
|
|
+ // 设置列宽
|
|
|
+ sheet7.setColumnWidth(0, 2848);
|
|
|
+ sheet7.setColumnWidth(1, 2848);
|
|
|
+ sheet7.setColumnWidth(2, 2848);
|
|
|
+ sheet7.setColumnWidth(3, 2848);
|
|
|
+ sheet7.setColumnWidth(4, 2848);
|
|
|
+ sheet7.setColumnWidth(5, 2848);
|
|
|
+
|
|
|
+ // 获取和写入满意度数据
|
|
|
+ List<List<Object>> satisfactionData = highQualityDataService.generateCpSatisfactionOfRegion(day);
|
|
|
+ // 第一行 区县投诉问题满意度(1-11)
|
|
|
+ row = sheet7.getRow(0);
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue(String.format("区县投诉问题满意度(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 H1-M1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 7, 12);
|
|
|
+ addMergedRegion(sheet7, rangeAddress);
|
|
|
+ // 第二行
|
|
|
+ row = sheet7.getRow(1);
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue("区县");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue("满意度");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(10);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(11);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(12);
|
|
|
+ cell.setCellValue("累计不满意");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 写入数据
|
|
|
+ rowNum = 2;
|
|
|
+ for (List<Object> list : satisfactionData) {
|
|
|
+ row = sheet7.getRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 区县
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue(list.get(1).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 响应率
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 达标值
|
|
|
+ cell = row.createCell(10);
|
|
|
+ cell.setCellValue((double)list.get(3));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 与达标值差距
|
|
|
+ cell = row.createCell(11);
|
|
|
+ cell.setCellValue((double)list.get(4));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 本月累计未响应工单数
|
|
|
+ cell = row.createCell(12);
|
|
|
+ cell.setCellValue((int)list.get(5));
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
}
|
|
|
-
|
|
|
- // 客户端-投诉问题解决率
|
|
|
- row = sheet5.createRow(0);
|
|
|
- cell = row.createCell(0);
|
|
|
- cell.setCellValue(String.format("投诉问题解决率(1-%s)", dayOfMonth));
|
|
|
+ // 与达标值差距设置条件格式
|
|
|
+ rangeAddress = new CellRangeAddress(2, --rowNum, 11, 11);
|
|
|
+ setConditionalFormatting2(sheet7, rangeAddress);
|
|
|
+ // 设置列宽
|
|
|
+ sheet7.setColumnWidth(7, 2848);
|
|
|
+ sheet7.setColumnWidth(8, 2848);
|
|
|
+ sheet7.setColumnWidth(9, 2848);
|
|
|
+ sheet7.setColumnWidth(10, 2848);
|
|
|
+ sheet7.setColumnWidth(11, 2848);
|
|
|
+ sheet7.setColumnWidth(12, 2848);
|
|
|
+
|
|
|
+ // 获取和写入解决率数据 14到19列 O-T
|
|
|
+ List<List<Object>> cpIsOkData = highQualityDataService.generateCpIsOkOfRegion(day);
|
|
|
+ // 第一行 区县投诉问题解决率(1-11)
|
|
|
+ row = sheet7.getRow(0);
|
|
|
+ cell = row.createCell(14);
|
|
|
+ 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);
|
|
|
+ // 合并单元格 O1-T1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 14, 19);
|
|
|
+ addMergedRegion(sheet7, rangeAddress);
|
|
|
+ // 第二行
|
|
|
+ row = sheet7.getRow(1);
|
|
|
+ cell = row.createCell(14);
|
|
|
cell.setCellValue("地市");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
- cell = row.createCell(1);
|
|
|
+ cell = row.createCell(15);
|
|
|
+ cell.setCellValue("区县");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(16);
|
|
|
cell.setCellValue("解决率");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
- cell = row.createCell(2);
|
|
|
+ cell = row.createCell(17);
|
|
|
cell.setCellValue("达标值");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
- cell = row.createCell(3);
|
|
|
+ cell = row.createCell(18);
|
|
|
cell.setCellValue("与达标值差距");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(19);
|
|
|
+ cell.setCellValue("累计未解决");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 写入数据
|
|
|
rowNum = 2;
|
|
|
- for (List<Object> list : sheet4_6Data.get(1)) {
|
|
|
- row = sheet5.createRow(rowNum++);
|
|
|
+ for (List<Object> list : cpIsOkData) {
|
|
|
+ row = sheet7.getRow(rowNum++);
|
|
|
// 地市
|
|
|
- cell = row.createCell(0);
|
|
|
+ cell = row.createCell(14);
|
|
|
cell.setCellValue(list.get(0).toString());
|
|
|
cell.setCellStyle(cellStyle1);
|
|
|
- // 投诉问题解决率
|
|
|
- cell = row.createCell(1);
|
|
|
- cell.setCellValue(((double) list.get(1)));
|
|
|
+ // 区县
|
|
|
+ cell = row.createCell(15);
|
|
|
+ cell.setCellValue(list.get(1).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 响应率
|
|
|
+ cell = row.createCell(16);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
// 达标值
|
|
|
- cell = row.createCell(2);
|
|
|
- cell.setCellValue((double) list.get(2));
|
|
|
+ cell = row.createCell(17);
|
|
|
+ cell.setCellValue((double)list.get(3));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
// 与达标值差距
|
|
|
- cell = row.createCell(3);
|
|
|
- cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell = row.createCell(18);
|
|
|
+ cell.setCellValue((double)list.get(4));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
+ // 本月累计未响应工单数
|
|
|
+ cell = row.createCell(19);
|
|
|
+ cell.setCellValue((int)list.get(5));
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
}
|
|
|
- // 设置条件格式D3-D14
|
|
|
- rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
- setConditionalFormatting2(sheet5, rangeAddress);
|
|
|
-
|
|
|
- // 设置列宽 2048 1304 2048 2304
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
- sheet5.setColumnWidth(i, 2848);
|
|
|
+ // 与达标值差距设置条件格式
|
|
|
+ rangeAddress = new CellRangeAddress(2, --rowNum, 18, 18);
|
|
|
+ setConditionalFormatting2(sheet7, rangeAddress);
|
|
|
+ // 设置列宽
|
|
|
+ sheet7.setColumnWidth(14, 2848);
|
|
|
+ sheet7.setColumnWidth(15, 2848);
|
|
|
+ sheet7.setColumnWidth(16, 2848);
|
|
|
+ sheet7.setColumnWidth(17, 2848);
|
|
|
+ sheet7.setColumnWidth(18, 2848);
|
|
|
+ sheet7.setColumnWidth(19, 2848);
|
|
|
+
|
|
|
+ // 设置行高
|
|
|
+ for (int i = 0; i < rowNum; i++) {
|
|
|
+ sheet7.getRow(i).setHeightInPoints(20.0F);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 设置行高 15.0 15.0...
|
|
|
- for (int i = 0; i < 15; i++) {
|
|
|
- sheet5.getRow(i).setHeightInPoints(15.0F);
|
|
|
+ private void getCityThreeRateSheet(String day) {
|
|
|
+ // 计算时间常数
|
|
|
+ Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
|
|
+ try {
|
|
|
+ calendar.setTime(DAY_FORMAT.parse(day));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ log.error("时间字符串解析失败--{}", day);
|
|
|
}
|
|
|
-
|
|
|
- // 客户端-投诉问题响应率
|
|
|
- row = sheet6.createRow(0);
|
|
|
+ int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
+ Sheet sheet = getWorkbook().createSheet("客户端地市三率");
|
|
|
+ Row row;
|
|
|
+ Cell cell;
|
|
|
+ CellRangeAddress rangeAddress;
|
|
|
+ // 获取区县三率数据
|
|
|
+ Map<String, List<Object>> dataMap = highQualityCountService.generateThreeRateOfCity(day);
|
|
|
+ // 第一行
|
|
|
+ row = sheet.createRow(0);
|
|
|
cell = row.createCell(0);
|
|
|
+ cell.setCellValue("");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue(String.format("投诉问题解决满意率(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 B1 - D1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 1, 3);
|
|
|
+ addMergedRegion(sheet, rangeAddress);
|
|
|
+ cell = row.createCell(4);
|
|
|
+ cell.setCellValue(String.format("投诉问题解决率(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 合并单元格 E1 - G1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 4, 6);
|
|
|
+ addMergedRegion(sheet, rangeAddress);
|
|
|
+ cell = row.createCell(7);
|
|
|
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);
|
|
|
+ // 合并单元格 H1 - J1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 7, 9);
|
|
|
+ addMergedRegion(sheet, rangeAddress);
|
|
|
+ // 第二行
|
|
|
+ row = sheet.createRow(1);
|
|
|
cell = row.createCell(0);
|
|
|
cell.setCellValue("地市");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
cell = row.createCell(1);
|
|
|
- cell.setCellValue("响应率");
|
|
|
+ cell.setCellValue("满意度");
|
|
|
cell.setCellStyle(cellStyle3);
|
|
|
cell = row.createCell(2);
|
|
|
cell.setCellValue("达标值");
|
|
@@ -341,38 +448,120 @@ public class TslReportService {
|
|
|
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(4);
|
|
|
+ cell.setCellValue("解决率");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(5);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue("响应率");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue("达标值");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue("与达标值差距");
|
|
|
+ cell.setCellStyle(cellStyle3);
|
|
|
+ // 数据行
|
|
|
+ int rowNum = 2;
|
|
|
+ for (String city : sysDataDictionaryRepository.findAllCityName()) {
|
|
|
+ List<Object> list = dataMap.get(city);
|
|
|
+ row = sheet.createRow(rowNum++);
|
|
|
// 地市
|
|
|
cell = row.createCell(0);
|
|
|
cell.setCellValue(list.get(0).toString());
|
|
|
cell.setCellStyle(cellStyle1);
|
|
|
- // 投诉问题解决率
|
|
|
+ // 满意度
|
|
|
cell = row.createCell(1);
|
|
|
- cell.setCellValue(((double) list.get(1)));
|
|
|
+ cell.setCellValue((double) list.get(1));
|
|
|
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.setCellValue((double) list.get(3));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 解决率
|
|
|
+ cell = row.createCell(4);
|
|
|
+ cell.setCellValue((double) list.get(4));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(5);
|
|
|
+ cell.setCellValue((double) list.get(5));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue((double) list.get(6));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 响应率
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue((double) list.get(7));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue((double) list.get(8));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue((double) list.get(9));
|
|
|
cell.setCellStyle(cellStyle2);
|
|
|
}
|
|
|
+ // 设置条件格式
|
|
|
// 设置条件格式D3-D14
|
|
|
rangeAddress = new CellRangeAddress(2, 13, 3, 3);
|
|
|
- setConditionalFormatting2(sheet6, rangeAddress);
|
|
|
+ setConditionalFormatting2(sheet, rangeAddress);
|
|
|
+ // 设置条件格式G3-G14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 6, 6);
|
|
|
+ setConditionalFormatting2(sheet, rangeAddress);
|
|
|
+ // 设置条件格式J3-J14
|
|
|
+ rangeAddress = new CellRangeAddress(2, 13, 9, 9);
|
|
|
+ setConditionalFormatting2(sheet, rangeAddress);
|
|
|
+ // 写入全省数据
|
|
|
+ List<Object> list = dataMap.get("全省");
|
|
|
+ row = sheet.createRow(rowNum);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(cellStyle1);
|
|
|
+ // 满意度
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue((double) list.get(1));
|
|
|
+ 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);
|
|
|
+ // 解决率
|
|
|
+ cell = row.createCell(4);
|
|
|
+ cell.setCellValue((double) list.get(4));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(5);
|
|
|
+ cell.setCellValue((double) list.get(5));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue((double) list.get(6));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ // 响应率
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue((double) list.get(7));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue((double) list.get(8));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue((double) list.get(9));
|
|
|
+ cell.setCellStyle(cellStyle2);
|
|
|
|
|
|
- // 设置列宽 2048 1304 2048 2304
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
- sheet6.setColumnWidth(i, 2848);
|
|
|
+ // 设置列宽
|
|
|
+ for (int i = 0; i < 9; i++) {
|
|
|
+ sheet.setColumnWidth(i, 2848);
|
|
|
}
|
|
|
|
|
|
// 设置行高 15.0 15.0...
|
|
|
for (int i = 0; i < 15; i++) {
|
|
|
- sheet6.getRow(i).setHeightInPoints(15.0F);
|
|
|
+ sheet.getRow(i).setHeightInPoints(15.0F);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1028,9 +1217,36 @@ public class TslReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化表格对象以及
|
|
|
+ */
|
|
|
private XSSFWorkbook getWorkbook() {
|
|
|
if (workbook == null) {
|
|
|
workbook = new XSSFWorkbook();
|
|
|
+ // 基本模式 微软雅黑 10号字 带全边框 水平居中
|
|
|
+ XSSFCellStyle baseStyle = getWorkbook().createCellStyle();
|
|
|
+ XSSFFont font = getWorkbook().createFont();
|
|
|
+ font.setFontName("微软雅黑");
|
|
|
+ font.setFontHeightInPoints((short) 10);
|
|
|
+ baseStyle.setFont(font);
|
|
|
+ baseStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
+ baseStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ baseStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ baseStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ // cellStyle1 基本模式 微软雅黑 10号字 带全边框 水平居中
|
|
|
+ cellStyle1 = baseStyle.copy();
|
|
|
+ // cellStyle2 百分比 2位小数
|
|
|
+ cellStyle2 = baseStyle.copy();
|
|
|
+ XSSFDataFormat dataFormat = getWorkbook().createDataFormat();
|
|
|
+ cellStyle2.setDataFormat(dataFormat.getFormat("0.00%"));
|
|
|
+ // cellStyle3 自动换行 背景色 FFAEAAAA
|
|
|
+ cellStyle3 = baseStyle.copy();
|
|
|
+ XSSFColor color = new XSSFColor();
|
|
|
+ color.setARGBHex("FFAEAAAA");
|
|
|
+ cellStyle3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ cellStyle3.setFillForegroundColor(color);
|
|
|
}
|
|
|
return this.workbook;
|
|
|
}
|
|
@@ -1048,7 +1264,7 @@ public class TslReportService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 条件格式 3色渐变
|
|
|
+ * 条件格式 3色渐变 数字小的为绿色,大的为红色
|
|
|
* 绿 FF63BE7B 黄 FFFFEB84 红 FFF8696B
|
|
|
*/
|
|
|
private void setConditionalFormatting(Sheet sheet, CellRangeAddress rangeAddress) {
|
|
@@ -1060,18 +1276,15 @@ public class TslReportService {
|
|
|
colors[0].setARGBHex("FF63BE7B");
|
|
|
colors[1].setARGBHex("FFFFEB84");
|
|
|
colors[2].setARGBHex("FFF8696B");
|
|
|
-
|
|
|
rule.getColorScaleFormatting().setColors(colors);
|
|
|
-
|
|
|
CellRangeAddress[] cellRangeAddresses = new CellRangeAddress[]{
|
|
|
rangeAddress
|
|
|
};
|
|
|
-
|
|
|
conditionalFormatting.addConditionalFormatting(cellRangeAddresses, rule);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 条件格式 3色渐变
|
|
|
+ * 条件格式 3色渐变 数字小的为红色,大的为绿色
|
|
|
* 绿 FF63BE7B 黄 FFFFEB84 红 FFF8696B
|
|
|
*/
|
|
|
private void setConditionalFormatting2(Sheet sheet, CellRangeAddress rangeAddress) {
|
|
@@ -1083,13 +1296,10 @@ public class TslReportService {
|
|
|
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);
|
|
|
}
|
|
|
}
|