瀏覽代碼

更新2025年目标值

lifuquan 1 月之前
父節點
當前提交
eeba45a7af

二進制
doc/客户安排的更新/20250205-更新2025年目标/投诉服请目标更新.xlsx


+ 0 - 13
doc/数据订阅/客户提供/abc.txt

@@ -1,13 +0,0 @@
-保定	22.7	22.2	19.7	21.0	21.2	21.0	21.0	26.7	20.5	16.5	15.3	18.1
-沧州	20.0	17.4	18.2	21.5	25.6	21.5	21.5	19.3	16.8	15.3	13.7	16.1
-承德	34.5	18.0	21.6	24.5	24.0	24.5	24.5	25.4	19.7	17.0	15.9	21.0
-邯郸	22.8	16.2	17.9	17.9	18.0	17.9	17.9	17.4	16.3	13.6	13.1	20.1
-衡水	17.4	14.7	15.0	17.0	16.4	17.0	17.0	17.4	13.3	11.2	10.0	13.2
-廊坊	20.5	16.9	19.5	20.5	21.5	20.5	20.5	22.3	17.7	15.2	14.1	16.3
-秦皇岛	23.3	16.8	21.0	20.4	20.6	20.4	20.4	20.1	18.3	15.8	16.9	23.2
-石家庄	23.6	23.0	24.7	25.7	23.1	25.7	25.7	24.6	21.7	17.7	17.6	21.8
-唐山	25.3	19.5	21.4	19.8	20.8	19.8	19.8	22.0	19.7	16.8	15.6	20.2
-邢台	20.4	14.6	15.6	16.0	18.2	16.0	16.0	17.4	16.0	13.5	13.0	17.8
-雄安	15.5	14.3	14.9	17.5	18.2	17.5	17.5	16.8	12.9	10.8	10.8	13.9
-张家口	20.3	14.4	16.2	18.9	19.9	18.9	18.9	19.7	15.9	13.2	12.0	15.3
-全省	22.5	21.1	21.9	22.6	22.8	22.6	22.6	22.4	19.1	16.1	15.2	19.5

二進制
doc/数据订阅/客户提供/各区县_增加区县编码-12月.xlsx


二進制
doc/数据订阅/能力商店/河北客户体验管理系统移网网络体验明细日信息/河北客户体验管理系统移网网络体验明细日信息_HE_D_CEM_MOBILE_EXPERIENCE_LIST.xlsx


+ 3 - 3
doc/部署环境/手动入库数据.md

@@ -6,7 +6,7 @@
 POST http://192.168.31.83:10010/tsl/task/send HTTP/1.1
 Content-Type:application/json
 
-20241130
+20241210
 ```
 
 > 注意:文件缺失时不需要手动入库和生成报表,当前已经加入了等待,检查的机制。发送的逻辑后续需要修改一下。
@@ -17,14 +17,14 @@ Content-Type:application/json
 POST http://192.168.10.7:22222/tsl_data/report/generate/v3 HTTP/1.1
 Content-Type:application/json
 
-20241110
+20250123
 ```
 
 ```http
 POST http://192.168.10.7:22222/tsl_data/task/redo HTTP/1.1
 Content-Type:application/json
 
-20241130
+20241205
 ```
 
 curl -X POST http://127.0.0.1:22222/tsl_data/report/generate/v3 -H "Content-Type: application/json" -d '"20241031"'

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

@@ -94,4 +94,20 @@ public interface ManagementDetailMapper {
                         " select '全省' as compl_area_local, sum(total_num) as total_num, sum(repeat_num) as repeat_num, \n"
                         + " sum(repeat_num) / sum(total_num)::float8 as repeat_ratio from t5 union select * from t5 ")
         List<Map<String, Object>> selectRepeatTsCountForDay(String day);
+
+        /**
+         * 20241204 修改
+         * 使用同一个账期的数据,提取重复工单数据
+         */
+        @Select("with t1 as (select compl_area_local, busi_no from tsl_data.management_detail md  \n" + //
+                        " where stat_day_id = #{statDayId} and acct_date <= #{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"
+                        + " 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" + //
+                        " select '全省' as compl_area_local, sum(total_num) as total_num, sum(repeat_num) as repeat_num, \n"
+                        + " sum(repeat_num) / sum(total_num)::float8 as repeat_ratio from t5 union select * from t5 ")
+        List<Map<String, Object>> selectRepeatTsCountForDayAndStatDayId(@Param("day") String day, @Param("statDayId") String statDayId);
 }

+ 7 - 1
src/main/java/com/nokia/tsl_data/dao/TargetTsRatioMapper.java

@@ -3,6 +3,7 @@ package com.nokia.tsl_data.dao;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -17,9 +18,14 @@ public interface TargetTsRatioMapper {
         @Update("UPDATE tsl_data.target_ts_ratio\n" + //
                         " SET management_target_ratio = #{target} \n" + //
                         " WHERE month_id = #{monthId} and city_name = #{city} ")
-        void updateManagementTargetRatio(@Param("monthId") String monthId,
+        int updateManagementTargetRatio(@Param("monthId") String monthId,
                         @Param("city") String city, @Param("target") double target);
 
+        @Insert("INSERT INTO tsl_data.target_ts_ratio (month_id, city_name, management_target_ratio)\n" + //
+                        " VALUES (#{monthId}, #{city}, #{target})")
+        int insertManagementTargetRatio(@Param("monthId") String monthId, @Param("city") String city,
+                        @Param("target") double target);
+
         @Update("UPDATE tsl_data.target_ts_ratio\n" + //
                         " SET service_request_target_ratio = #{target} \n" + //
                         " WHERE month_id = #{monthId} and city_name = #{city} ")

+ 0 - 2
src/main/java/com/nokia/tsl_data/scheduling/service/TaskScheduleService.java

@@ -99,14 +99,12 @@ public class TaskScheduleService {
      */
     @Scheduled(cron = "0 0/10 * * * *")
     public void cronUpdate() {
-        log.debug("开始调度周期更新任务状态...");
         tasksSchedulingMap.forEach((task, future) -> {
             if (future.isDone()) {
                 log.debug(" {} 任务已完成...", task);
                 tasksSchedulingMap.remove(task);
             }
         });
-        log.debug("周期更新任务状态已完成...");
     }
 
     /**

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

@@ -165,7 +165,8 @@ public class ManagementDetailService {
         List<Map<String, Object>> preDayData = dayData;
         if (!day.endsWith("01")) {
             String preDay = String.valueOf(Integer.parseInt(day) - 1);
-            preDayData = managementDetailMapper.selectRepeatTsCountForDay(preDay);
+            // 20241204修改,采用同一账期数据提取
+            preDayData = managementDetailMapper.selectRepeatTsCountForDayAndStatDayId(preDay, day);
         }
         // 转化格式方便读取
         Map<String, Map<String, Object>> dayMap = new HashMap<>();

+ 1 - 1
src/main/java/com/nokia/tsl_data/service/TaskService.java

@@ -42,7 +42,7 @@ public class TaskService {
     /**
      * 每日定时任务 每天中午1点半执行入库任务
      */
-    @Scheduled(cron = "0 30 13 * * *")
+    @Scheduled(cron = "0 30 15 * * *")
     public void dailyWarehouseTask() {
         // 这里的时间要向前一天
         String day = DateFormatUtil.ofPattern("yyyyMMdd").format(Instant.now().plus(-1L, ChronoUnit.DAYS));

+ 13 - 11
src/test/java/com/nokia/tsl_data/TslDataApplicationTest.java

@@ -23,7 +23,7 @@ class TslDataApplicationTest {
 
     @Test
     void test1() {
-        taskService.runTaskForDay("20241031");
+        taskService.runTaskForDay("20241205");
     }
 
     @Autowired
@@ -36,7 +36,7 @@ class TslDataApplicationTest {
         lines.forEach(line -> {
             String[] split = line.split("\t");
             System.out.println(split[0] + "==" + split[2]);
-            userCountService.updateManagementUserCount("202411", split[0], Double.parseDouble(split[2]));
+            userCountService.updateManagementUserCount("202501", split[0], Double.parseDouble(split[2]));
         });
     }
 
@@ -45,35 +45,37 @@ class TslDataApplicationTest {
 
     @Test
     void test3() {
-        String path = "D:/abc.txt";
+        String path = "/data/abc.txt";
         List<String> lines = TextUtil.readLines(path, "utf8");
         lines.forEach(line -> {
             String[] split = line.split("\t");
             for (int i = 1; i < split.length; i++) {
                 String city = split[0];
-                String month = i < 5 ? "20240" + (i + 5) : "2024" + (i + 5);
+                String month = i < 10 ? "20250" + i : "2025" + i;
                 Double target = Double.parseDouble(split[i]);
                 System.out.println("地市: " + city + "  月分: " + month + "  率值: " + target);
-                targetTsRatioMapper.updateManagementTargetRatio(month, city, target);
+                int r = targetTsRatioMapper.updateManagementTargetRatio(month, city, target);
+                if (r == 1) {
+                    System.out.println("更新成功");
+                } else {
+                    targetTsRatioMapper.insertManagementTargetRatio(month, city, target);
+                }
             }
         });
     }
 
     @Test
     void test4() {
-        String path = "D:/data/abc.txt";
+        String path = "/data/abc.txt";
         List<String> lines = TextUtil.readLines(path, "utf8");
         lines.forEach(line -> {
             String[] split = line.split("\t");
             for (int i = 1; i < split.length; i++) {
                 String city = split[0];
-                String month = i < 10 ? "20240" + i : "2024" + i;
+                String month = i < 10 ? "20250" + i : "2025" + i;
                 Double target = Double.parseDouble(split[i]);
                 System.out.println("地市: " + city + "  月分: " + month + "  率值: " + target);
-                if (i >= 7) {
-                    targetTsRatioMapper.updateServiceRequestTargetRatio(month, city, target);
-                }
-                // targetTsRatioMapper.updateManagementTargetRatio(month, city, target);
+                targetTsRatioMapper.updateServiceRequestTargetRatio(month, city, target);
             }
         });
     }