Explorar o código

修复了一些问题

“lifuquan” hai 1 ano
pai
achega
4ac007e5b0

+ 1 - 1
doc/开发环境/2023年适配/2024年适配.md

@@ -157,7 +157,7 @@ from t1 group by real_name order by real_name
 POST http://192.168.10.7:22222/tsl_data/report/generate/v3
 Content-Type: application/json
 
-20240102
+20240103
 ```
 
 ### 2. 数据入库

BIN=BIN
doc/数据订阅/能力商店/河北_CEM移网质量投诉明细/河北_CEM移网质量投诉明细_HE_D_MOBILE_COMP.xlsx


BIN=BIN
doc/数据订阅/能力商店/河北客户体验管理智能定责投诉明细月累计接口日/河北客户体验管理智能定责投诉明细月累计接口日.xlsx


+ 4 - 0
doc/需求文档/2024年适配/关于投诉工单日报表2024年适配的需求.md

@@ -48,6 +48,8 @@
 2. 处理时长 = 客服受理时间 - 客服受理时间,处理时长超过36小时为超时。
 3. 月底未回单的工单要计入下月工单--所以应该按归档时间计算工单范围
 
+处理时长,30小时是达标,30-36小时线性扣分
+
 ### 7.4 三率调整
 
 指标三:移网综合投诉评价“三率”(1.5分)
@@ -60,6 +62,8 @@
 
 如果响应:解决:满意是90%:91%:92%,那这个值就是90%*0.1+91%*0.4+92%*0.5=91.4%
 
+目标值93%,解决率≤90%不得分,90%至93%线性得分。
+
 ### 7.5 发送顺序
 
 顺序还是投诉率、三率、超时、时长

+ 2 - 2
src/main/java/com/nokia/tsl_data/config/TslDataConfig.java

@@ -1,6 +1,6 @@
 package com.nokia.tsl_data.config;
 
-import com.nokia.tsl_data.properties.CustomerRateTargetProperties;
+import com.nokia.tsl_data.properties.TargetProperties;
 import com.nokia.tsl_data.properties.DataWarehouseProperties;
 import com.nokia.tsl_data.properties.OutputProperties;
 import com.nokia.tsl_data.properties.TslDataProperties;
@@ -17,7 +17,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
 
 @Configuration
 @EnableConfigurationProperties({ TslDataProperties.class, DataWarehouseProperties.class, OutputProperties.class,
-        CustomerRateTargetProperties.class })
+        TargetProperties.class })
 public class TslDataConfig {
 
     private final int poolSize = 3;

+ 9 - 9
src/main/java/com/nokia/tsl_data/dao/ManagementDetailMapper.java

@@ -54,9 +54,9 @@ public interface ManagementDetailMapper {
          * 从 河北_CEM移网质量投诉明细 mobile_complaint_day 中同步数据
          */
         @Insert("insert into tsl_data.management_detail (origin, stat_day_id, acct_date, sheet_no," +
-                        " compl_area_local, compl_city_local) " +
+                        " compl_area_local, compl_city_local, busi_no) " +
                         "select 'mobile_complaint_day' as origin, concat(month_id, day_id) as stat_day_id," +
-                        " acct_date, sheet_no, compl_area_local, gis_city as compl_city_local " +
+                        " acct_date, sheet_no, compl_area_local, gis_city as compl_city_local, busi_no " +
                         " from tsl_data.mobile_complaint_day mcd \r\n" +
                         " where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2) ")
         int insertFromMobileComplaint(@Param("day") String day);
@@ -65,10 +65,10 @@ public interface ManagementDetailMapper {
          * 从 河北客户体验管理智能定责投诉明细月累计接口日 complaint_details_fix_ywd_day 同步数据
          */
         @Insert("insert into tsl_data.management_detail (origin, stat_day_id, acct_date, sheet_no," +
-                        " compl_area_local, compl_city_local) " +
+                        " compl_area_local, compl_city_local, busi_no) " +
                         "select 'complaint_details_fix_ywd_day' as origin, concat(month_id, day_id) as stat_day_id," +
-                        " concat(month_id1, day_id1) as acct_date, sheet_no, compl_area_local, compl_city_local " +
-                        " from tsl_data.complaint_details_fix_ywd_day cdfyd \r\n" +
+                        " concat(month_id1, day_id1) as acct_date, sheet_no, compl_area_local, compl_city_local, busi_no "
+                        + " from tsl_data.complaint_details_fix_ywd_day cdfyd \r\n" +
                         " where duty_reason_id_day = '业务使用>>基础业务使用>>移网主被叫>>手机无法主被叫'\r\n" +
                         " and month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2) ")
         int insertFromComplaintDetailsFixYwd(@Param("day") String day);
@@ -79,14 +79,14 @@ public interface ManagementDetailMapper {
         @Select("select count(1) from tsl_data.management_detail where stat_day_id = #{day} ")
         int selectCountofStatDay(@Param("day") String day);
 
-        @Delete("delete from tsl_data.management_detail where tat_day_id = #{day}")
+        @Delete("delete from tsl_data.management_detail where stat_day_id = #{day}")
         int deleteForStatDay(@Param("day") String day);
 
-        @Select("with t1 as (select compl_area_local, sheet_no from tsl_data.management_detail md  \n" + //
+        @Select("with t1 as (select compl_area_local, busi_no from tsl_data.management_detail md  \n" + //
                         " where stat_day_id = #{day}), \n" + //
                         " t2 as (select distinct * from t1), \n" + //
-                        " t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), \n" + //
-                        " t4 as (select compl_area_local, count(1) as distinct_num from t2 group by compl_area_local), \n"
+                        " t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), \n"
+                        + " t4 as (select compl_area_local, count(1) as distinct_num from t2 group by compl_area_local), \n"
                         + " t5 as (select t3.compl_area_local, t3.total_num, t3.total_num - t4.distinct_num::float8 as repeat_num, \n"
                         + " (t3.total_num - t4.distinct_num) / t3.total_num::float8 as repeat_ratio from T3, t4 \n" + //
                         " where t3.compl_area_local = t4.compl_area_local) \n" + //

+ 3 - 4
src/main/java/com/nokia/tsl_data/dao/WorkFlowBasicDataMapper.java

@@ -15,19 +15,18 @@ public interface WorkFlowBasicDataMapper {
          * 超时工单统计
          */
         @Select("with t1 as (select sdd.real_name as city,kfsn, to_timestamp(kf_file_time, 'yyyy-mm-dd hh24:mi:ss')" +
-                        " - to_timestamp(kd_accept_time, 'yyyy-mm-dd hh24:mi:ss') > interval '36hours' as is_timeout\n"
+                        " - to_timestamp(kd_accept_time, 'yyyy-mm-dd hh24:mi:ss') > make_interval(hours => #{target}) as is_timeout\n"
                         + "from tsl_data.work_flow_basic_data wfbd, tsl_data.sys_data_dictionary sdd \n" + //
                         "where kf_file_time is not null and re_is_status_id != '06678b79185349b5bf0c24490a978fbb'\n" + //
                         "and wfbd.city_id = sdd.nick_code and" +
                         " to_timestamp(kf_file_time, 'yyyy-mm-dd hh24:mi:ss') >= #{start}"
                         + " and to_timestamp(kf_file_time, 'yyyy-mm-dd hh24:mi:ss') <= #{end})," +
                         "t2 as (select '全省' as city, count(1) as total_num, count(is_timeout or null) as timeout_num, "
-                        +
-                        " count(is_timeout or null)::float8 / count(1) as timeout_ratio from t1),"
+                        + " count(is_timeout or null)::float8 / count(1) as timeout_ratio from t1),"
                         + " t3 as (select city, count(1) as total_num, count(is_timeout or null) as timeout_num, " +
                         " count(is_timeout or null)::float8 / count(1) as timeout_ratio from t1 group by city) " +
                         " select * from t2 union select* from t3")
-        List<Map<String, Object>> selectTimeoutTsCountForDay(@Param("start") Date start, @Param("end") Date end);
+        List<Map<String, Object>> selectTimeoutTsCountForDay(@Param("start") Date start, @Param("end") Date end, @Param("target") int target);
 
         /**
          * 处理时长统计

+ 0 - 15
src/main/java/com/nokia/tsl_data/properties/CustomerRateTargetProperties.java

@@ -1,15 +0,0 @@
-package com.nokia.tsl_data.properties;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@Data
-@ConfigurationProperties(prefix = "customer.rate.target")
-public class CustomerRateTargetProperties {
-    // 满意度目标
-    private double satisfiedCompliance = 0.92;
-    // 解决率目标
-    private double resolutionCompliance = 0.85;
-    // 响应率目标
-    private double responseCompliance = 0.99;
-}

+ 19 - 0
src/main/java/com/nokia/tsl_data/properties/TargetProperties.java

@@ -0,0 +1,19 @@
+package com.nokia.tsl_data.properties;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@Data
+@ConfigurationProperties(prefix = "target")
+public class TargetProperties {
+    // 满意度目标
+    private double satisfiedCompliance = 0.92d;
+    // 解决率目标
+    private double resolutionCompliance = 0.85d;
+    // 响应率目标
+    private double responseCompliance = 0.99d;
+    // 移网综合投诉评价 目标
+    private double evaluation = 0.93d;
+    // 处理时长达标值 单位是小时
+    private int duration = 30;
+}

+ 6 - 6
src/main/java/com/nokia/tsl_data/service/HighQualityCountService.java

@@ -2,7 +2,7 @@ package com.nokia.tsl_data.service;
 
 import com.nokia.tsl_data.dao.HighQualityCountMapper;
 import com.nokia.tsl_data.dao.SysDataDictionaryRepository;
-import com.nokia.tsl_data.properties.CustomerRateTargetProperties;
+import com.nokia.tsl_data.properties.TargetProperties;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,7 +24,7 @@ public class HighQualityCountService {
     @Autowired
     private SysDataDictionaryRepository sysDataDictionaryRepository;
     @Autowired
-    private CustomerRateTargetProperties customerRateTargetProperties;
+    private TargetProperties customerRateTargetProperties;
 
     public List<List<Object>> getThreeRateOfCityV3(String day) {
         List<List<Object>> result = new ArrayList<>();
@@ -44,8 +44,8 @@ public class HighQualityCountService {
             // 移网综合投诉评价“三率”=响应率*0.1+解决率*0.4+满意率*0.5
             double rate = arr[2] * 0.1 + arr[1] * 0.4 + arr[0] * 0.5;
             list.add(rate);
-            list.add(0.92d);
-            list.add(0.92d - rate);
+            list.add(customerRateTargetProperties.getEvaluation());
+            list.add(customerRateTargetProperties.getEvaluation() - rate);
         });
         // 逆序排序
         result.sort((o1, o2) -> Double.compare((double) o2.get(6), (double) o1.get(6)));
@@ -59,8 +59,8 @@ public class HighQualityCountService {
                 add(allCity[1]);
                 add(allCity[2]);
                 add(rate);
-                add(0.92d);
-                add(0.92d - rate);
+                add(customerRateTargetProperties.getEvaluation());
+                add(customerRateTargetProperties.getEvaluation() - rate);
             }
         });
         return result;

+ 2 - 2
src/main/java/com/nokia/tsl_data/service/HighQualityDataService.java

@@ -5,7 +5,7 @@ import com.nokia.tsl_data.dao.HighQualityDataRepository;
 import com.nokia.tsl_data.dao.HighQualityListDayMapper;
 import com.nokia.tsl_data.dao.SysDataDictionaryRepository;
 import com.nokia.tsl_data.entity.HighQualityData;
-import com.nokia.tsl_data.properties.CustomerRateTargetProperties;
+import com.nokia.tsl_data.properties.TargetProperties;
 import lombok.extern.slf4j.Slf4j;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +32,7 @@ public class HighQualityDataService {
     @Autowired
     private SysDataDictionaryRepository sysDataDictionaryRepository;
     @Autowired
-    private CustomerRateTargetProperties customerRateTargetProperties;
+    private TargetProperties customerRateTargetProperties;
 
     /**
      * 根据商定的算法生成数据

+ 13 - 6
src/main/java/com/nokia/tsl_data/service/ReportServiceV3.java

@@ -221,7 +221,7 @@ public class ReportServiceV3 {
                 screenShot = PoiUtil.screenShot(sheet, area, "微软雅黑");
                 ImageIO.write(screenShot, "png",
                         Paths.get(file.getParentFile().getAbsolutePath(), "超时工单概况-" + day + ".png").toFile());
-                area = "G1:J15";
+                area = "G1:K15";
                 screenShot = PoiUtil.screenShot(sheet, area, "微软雅黑");
                 ImageIO.write(screenShot, "png",
                         Paths.get(file.getParentFile().getAbsolutePath(), "投诉处理时长-" + day + ".png").toFile());
@@ -510,7 +510,7 @@ public class ReportServiceV3 {
         cell.setCellValue(String.format("平均处理时长(1-%s)", dayOfMonth));
         cell.setCellStyle(workbookWrapper.getCellStyle3());
         // 合并单元格 G1 - J1
-        rangeAddress = new CellRangeAddress(0, 0, 6, 9);
+        rangeAddress = new CellRangeAddress(0, 0, 6, 10);
         PoiUtil.addMergedRegion(sheet, rangeAddress);
         // 第二行
         row = sheet.createRow(1);
@@ -536,6 +536,9 @@ public class ReportServiceV3 {
         cell.setCellValue(String.format("%s月", monthOfYear));
         cell.setCellStyle(workbookWrapper.getCellStyle3());
         cell = row.createCell(9);
+        cell.setCellValue("达标值");
+        cell.setCellStyle(workbookWrapper.getCellStyle3());
+        cell = row.createCell(10);
         cell.setCellValue("涨幅");
         cell.setCellStyle(workbookWrapper.getCellStyle3());
         // 写入超时工单情况
@@ -579,13 +582,17 @@ public class ReportServiceV3 {
             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.setCellValue((int) list.get(3));
+            cell.setCellStyle(workbookWrapper.getCellStyle5());
+            // 涨幅
+            cell = row.createCell(10);
+            cell.setCellValue((double) list.get(4));
             cell.setCellStyle(workbookWrapper.getCellStyle5());
         }
-        // 设置条件格式J3-J14
-        PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, 9, 9);
+        // 设置条件格式K3-K14
+        PoiUtil.setConditionalFormattingGreenToRed(sheet, 2, 13, 10, 10);
         // 设置列宽 2048 2276*3 2048*3 2276*2 3612
         for (int i = 0; i < 10; i++) {
             sheet.setColumnWidth(i, 2848);

+ 2 - 2
src/main/java/com/nokia/tsl_data/service/TslDataService.java

@@ -3,7 +3,7 @@ package com.nokia.tsl_data.service;
 import com.nokia.tsl_data.dao.*;
 import com.nokia.tsl_data.entity.TargetTsRatio;
 import com.nokia.tsl_data.exception.LackOfDataRuntimeException;
-import com.nokia.tsl_data.properties.CustomerRateTargetProperties;
+import com.nokia.tsl_data.properties.TargetProperties;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,7 +34,7 @@ public class TslDataService {
     @Autowired
     private TargetTsRatioMapper targetTsRatioRepository;
     @Autowired
-    private CustomerRateTargetProperties customerRateTargetProperties;
+    private TargetProperties customerRateTargetProperties;
 
     /**
      * 客户端-投诉问题解决满意度 客户端-投诉问题解决率 客户端-投诉问题响应率

+ 11 - 4
src/main/java/com/nokia/tsl_data/service/WorkFlowService.java

@@ -8,6 +8,8 @@ import com.nokia.tsl_data.dao.WorkFlowBasicDataMapper;
 import com.nokia.tsl_data.dao.WorkFlowDao;
 import com.nokia.tsl_data.entity.TaskRecord;
 import com.nokia.tsl_data.entity.WorkFlowBasicData;
+import com.nokia.tsl_data.properties.TargetProperties;
+
 import lombok.extern.slf4j.Slf4j;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +46,8 @@ public class WorkFlowService {
     private SysDataDictionaryRepository sysDataDictionaryRepository;
     @Autowired
     private AvgDurationMapperV3 avgDurationMapperV3;
+    @Autowired
+    private TargetProperties targetProperties;
 
     private final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
             .withZone(ZoneId.of("Asia/Shanghai"));
@@ -93,7 +97,7 @@ public class WorkFlowService {
             e.printStackTrace();
             throw new RuntimeException(e.getMessage());
         }
-        List<Map<String, Object>> data = workFlowBasicDataMapper.selectTimeoutTsCountForDay(start, end);
+        List<Map<String, Object>> data = workFlowBasicDataMapper.selectTimeoutTsCountForDay(start, end, targetProperties.getDuration());
         Map<String, Map<String, Object>> dayMap = new HashMap<>();
         for (Map<String, Object> map : data) {
             dayMap.put((String) map.get("city"), map);
@@ -184,14 +188,16 @@ public class WorkFlowService {
             Map<String, Object> map = dayMap.get(area);
             if (map == null) {
                 list.add(2, 0.0);
-                list.add(3, 0.0);
+                list.add(3, targetProperties.getDuration());
+                list.add(4, 0.0);
             } else {
                 list.add(2, dayMap.get(area).get("avg_duration"));
-                list.add(3, ((double) list.get(2)) - (double) list.get(1));
+                list.add(3, targetProperties.getDuration());
+                list.add(4, ((double) list.get(2)) - (double) list.get(1));
             }
         }
         // 逆序排序
-        result.sort((o1, o2) -> Double.compare((double) o2.get(3), (double) o1.get(3)));
+        result.sort((o1, o2) -> Double.compare((double) o2.get(4), (double) o1.get(4)));
         // 全省数据
         List<Object> allCity = new ArrayList<>(4);
         result.add(allCity);
@@ -203,6 +209,7 @@ public class WorkFlowService {
             allCity.add(0.0);
         } else {
             allCity.add(dayMap.get("全省").get("avg_duration"));
+            allCity.add(targetProperties.getDuration());
             allCity.add((double) allCity.get(2) - (double) allCity.get(1));
         }
         return result;

+ 8 - 7
src/test/java/com/nokia/tsl_data/TslDataApplicationTest.java

@@ -1,11 +1,13 @@
 package com.nokia.tsl_data;
 
-import java.io.File;
+import java.util.List;
+import java.util.Map;
+
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
-import com.nokia.tsl_data.service.ReportServiceV3;
+import com.nokia.tsl_data.dao.ManagementDetailMapper;
 import com.nokia.tsl_data.service.TaskService;
 
 @SpringBootTest
@@ -16,15 +18,14 @@ class TslDataApplicationTest {
 
     @Test
     void test() {
-        taskService.generateReportV3("20240102");
+        taskService.generateReportV3("20240103");
     }
 
     @Autowired
-    private ReportServiceV3 reportServiceV3;
-
+    private ManagementDetailMapper managementDetailMapper;
     @Test
     void test1() {
-        File file = new File("/home/lfq/Documents/code/tsl-data/output/V3/20240102/投诉清单各地市投诉率20240102.xlsx");
-        reportServiceV3.messageToSend(file, "20240102");
+       List<Map<String, Object>> data = managementDetailMapper.selectRepeatTsCountForDay("20240103");
+       data.forEach(System.out::println);
     }
 }