|
@@ -27,6 +27,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFColor;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFDataFormat;
|
|
@@ -50,10 +51,10 @@ public class ReportServiceV3 {
|
|
|
|
|
|
@Autowired
|
|
|
private SysDataDictionaryRepository sysDataDictionaryRepository;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ManagementDetailService managementDetailService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private WorkFlowService workFlowService;
|
|
|
@Autowired
|
|
|
private TslDataService tslDataService;
|
|
|
|
|
@@ -121,7 +122,10 @@ public class ReportServiceV3 {
|
|
|
writeSheet1(workbookWrapper, day);
|
|
|
log.info("帐期 {} 管理端-移网感知类 sheet写入成功", day);
|
|
|
// 1.2 写入 服请情况
|
|
|
- // 1.3 写入 重复投诉 超时工单情况
|
|
|
+ // 1.3 写入 投诉处理时长、超时工单概况
|
|
|
+ // TODO
|
|
|
+ writeSheet3(workbookWrapper, day);
|
|
|
+ log.info("帐期 {} 投诉处理时长、超时工单概况 sheet写入成功", day);
|
|
|
// 1.4 写入三率
|
|
|
tslDataService.checkStatDayCount(day);
|
|
|
writeSheet4_6(workbookWrapper, day);
|
|
@@ -316,6 +320,123 @@ public class ReportServiceV3 {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 投诉处理时长、超时工单概况
|
|
|
+ */
|
|
|
+ private void writeSheet3(XSSFWorkbookWrapper workbookWrapper, 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);
|
|
|
+ // 修正,MONTH是从0开始
|
|
|
+ int monthOfYear = calendar.get(Calendar.MONTH) + 1;
|
|
|
+ int preMonthOfYear = monthOfYear > 1 ? monthOfYear - 1 : 12;
|
|
|
+ Sheet sheet = workbookWrapper.getWorkbook().createSheet("投诉处理时长、超时工单概况");
|
|
|
+ Row row;
|
|
|
+ Cell cell;
|
|
|
+ CellRangeAddress rangeAddress;
|
|
|
+ // 第一行
|
|
|
+ row = sheet.createRow(0);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue(String.format("超时工单情况(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ // 合并单元格 A1 - D1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 0, 3);
|
|
|
+ PoiUtil.addMergedRegion(sheet, rangeAddress);
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue(String.format("平均处理时长(1-%s)", dayOfMonth));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ // 合并单元格 G1 - J1
|
|
|
+ rangeAddress = new CellRangeAddress(0, 0, 6, 9);
|
|
|
+ PoiUtil.addMergedRegion(sheet, rangeAddress);
|
|
|
+ // 第二行
|
|
|
+ row = sheet.createRow(1);
|
|
|
+ cell = row.createCell(0);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue("工单数");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue("超时工单数");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue("超时工单占比");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue("地市");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue(String.format("%s月", preMonthOfYear));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue(String.format("%s月", monthOfYear));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue("涨幅");
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle3());
|
|
|
+ // 写入超时工单情况
|
|
|
+ List<List<Object>> sheet3Data1 = workFlowService.getTimeoutCountInfo(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(workbookWrapper.getCellStyle1());
|
|
|
+ // 工单数
|
|
|
+ cell = row.createCell(1);
|
|
|
+ cell.setCellValue((long) list.get(1));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle1());
|
|
|
+ // 超时工单数
|
|
|
+ cell = row.createCell(2);
|
|
|
+ cell.setCellValue((long) list.get(2));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle1());
|
|
|
+ // 超时工单占比
|
|
|
+ cell = row.createCell(3);
|
|
|
+ cell.setCellValue(((double) list.get(3)));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle2());
|
|
|
+ }
|
|
|
+ // 设置条件格式D3-D14
|
|
|
+ PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, 3, 3);
|
|
|
+ // 写入平均处理时长
|
|
|
+ List<List<Object>> sheet3Data2 = workFlowService.getCostTimeInfo(day);
|
|
|
+ rowNum = 2;
|
|
|
+ for (List<Object> list : sheet3Data2) {
|
|
|
+ row = sheet.getRow(rowNum++);
|
|
|
+ // 地市
|
|
|
+ cell = row.createCell(6);
|
|
|
+ cell.setCellValue(list.get(0).toString());
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle1());
|
|
|
+ // 上月
|
|
|
+ cell = row.createCell(7);
|
|
|
+ cell.setCellValue((double) list.get(1));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle5());
|
|
|
+ // 当月
|
|
|
+ cell = row.createCell(8);
|
|
|
+ cell.setCellValue((double) list.get(2));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle5());
|
|
|
+ // 涨幅
|
|
|
+ cell = row.createCell(9);
|
|
|
+ cell.setCellValue((double) list.get(3));
|
|
|
+ cell.setCellStyle(workbookWrapper.getCellStyle5());
|
|
|
+ }
|
|
|
+ // 设置条件格式J3-J14
|
|
|
+ PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, 9, 9);
|
|
|
+ // 设置列宽 2048 2276*3 2048*3 2276*2 3612
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ sheet.setColumnWidth(i, 2848);
|
|
|
+ }
|
|
|
+ // 设置行高 14.25 25.5 14.25...
|
|
|
+ for (int i = 0; i < 15; i++) {
|
|
|
+ sheet.getRow(i).setHeightInPoints(15.0F);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 管理端-移网感知类 2024年适配需求
|
|
|
*/
|
|
@@ -334,7 +455,6 @@ public class ReportServiceV3 {
|
|
|
cell.setCellValue(day.substring(0, 4) + "年客服投诉清单各地市投诉率情况(" + sheetName + ")");
|
|
|
cell.setCellStyle(workbookWrapper.getCellStyle4());
|
|
|
PoiUtil.addMergedRegion(sheet, 0, 0, 0, dayOfMonth + 7);
|
|
|
-
|
|
|
// 第二行 列名
|
|
|
row = sheet.createRow(1);
|
|
|
cell = row.createCell(0);
|
|
@@ -366,7 +486,6 @@ public class ReportServiceV3 {
|
|
|
cell = row.createCell(dayOfMonth + 7);
|
|
|
cell.setCellValue("地市");
|
|
|
cell.setCellStyle(workbookWrapper.getCellStyle1());
|
|
|
-
|
|
|
int rowNum = 2;
|
|
|
int cellNum = 0;
|
|
|
// 写入各地市数据
|
|
@@ -403,7 +522,6 @@ public class ReportServiceV3 {
|
|
|
cell = row.createCell(cellNum);
|
|
|
cell.setCellValue("全省");
|
|
|
cell.setCellStyle(workbookWrapper.getCellStyle1());
|
|
|
-
|
|
|
// 3-15行(2-14)dayOfMonth+2 - dayOfMonth+6是浮点数,设置为显示小数点后2位
|
|
|
for (int i = 2; i <= 14; i++) {
|
|
|
row = sheet.getRow(i);
|
|
@@ -412,7 +530,6 @@ public class ReportServiceV3 {
|
|
|
cell.setCellStyle(workbookWrapper.getCellStyle5());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 添加条件格式B15-V15
|
|
|
PoiUtil.setConditionalFormattingGreenToRed(sheet, rowNum, rowNum, 1, dayOfMonth);
|
|
|
// 添加条件格式(dayOfMonth+3)(3-14)
|
|
@@ -421,7 +538,6 @@ public class ReportServiceV3 {
|
|
|
PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, dayOfMonth + 4, dayOfMonth + 4);
|
|
|
// 添加条件格式AB3-AB14
|
|
|
PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, dayOfMonth + 6, dayOfMonth + 6);
|
|
|
-
|
|
|
// 设置sheet的列宽
|
|
|
sheet.setColumnWidth(0, 1600);
|
|
|
for (int i = 1; i <= dayOfMonth; i++) {
|