Bladeren bron

2.2 上线版本 新增了一个sheet 3G简网投诉情况

lifuquan 11 maanden geleden
bovenliggende
commit
876664dfa8

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


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


BIN
doc/部署环境/字段梳理.xlsx


+ 52 - 0
doc/需求文档/20240408/20240408.md

@@ -0,0 +1,52 @@
+# 20240408
+
+```sql
+select day_id1, count(1)
+from tsl_data.complaint_details_fix_ywd_day cdfyd 
+where month_id = '202404' and day_id = '06'
+and duty_reason_id_day in ('移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', '移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简')
+group by day_id1 
+
+select day_id1, count(1)
+from tsl_data.complaint_details_fix_ywd_day cdfyd 
+where month_id = '202403' and day_id = '31'
+and duty_reason_id_day in ('移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', '移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简')
+group by day_id1 
+
+SELECT acct_date, count(1)
+FROM tsl_data.mobile_complaint_day mcd 
+where month_id = '202403' and day_id = '31'
+and duty_reason_id_day in ('移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', '移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简')
+group by acct_date   
+
+SELECT acct_date, count(1)
+FROM tsl_data.mobile_complaint_day mcd 
+where month_id = '202403' and day_id = '31'
+and duty_reason_id_day in ('移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能')
+group by acct_date
+order by acct_date 
+
+SELECT acct_date, count(1)
+FROM tsl_data.mobile_complaint_day mcd 
+where month_id = '202403' and day_id = '31'
+and duty_reason_id_day in ('移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', '移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简')
+group by acct_date
+order by acct_date 
+
+
+select *
+from tsl_data.mobile_complaint_day mcd 
+where sheet_no in ('TS202403011513473716')
+
+select count(1)
+FROM tsl_data.mobile_complaint_day mcd 
+where month_id = '202403' and day_id = '31'
+order by acct_date 
+
+select acct_date, count(1)
+FROM tsl_data.mobile_complaint_day mcd 
+where month_id = '202403' and day_id = '31'
+and duty_reason_id_day = '移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能'
+group by acct_date
+order by acct_date 
+```

+ 1 - 1
pom.xml

@@ -13,7 +13,7 @@
 
     <groupId>com.nokia</groupId>
     <artifactId>tsl-data</artifactId>
-    <version>2.1</version>
+    <version>2.2</version>
 
     <packaging>jar</packaging>
 

+ 173 - 104
src/main/java/com/nokia/tsl_data/dao/MobileComplaintMapper.java

@@ -7,108 +7,177 @@ import java.util.Map;
 
 @Mapper
 public interface MobileComplaintMapper {
-    /**
-     * 统计某天入库工单数量
-     */
-    @Select("select count(1) from tsl_data.mobile_complaint_day " +
-            "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)")
-    int selectCompCountForDay(String day);
-
-    /**
-     * 超时工单统计
-     */
-    @Select("with t1 as (select compl_area_local, is_timeout from tsl_data.mobile_complaint_day " +
-            " where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)), " +
-            "t2 as (select '全省' as compl_area_local, count(1) as total_num from t1), " +
-            "t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), " +
-            "t4 as (select * from t2 union select * from t3), " +
-            "t5 as (select compl_area_local from t1 where is_timeout = '是'), " +
-            "t7 as (select '全省' as compl_area_local, count(1) as timeout_num from t5), " +
-            "t8 as (select compl_area_local, count(1) as timeout_num from t5 group by compl_area_local), " +
-            "t9 as (select * from t7 union select * from t8) " +
-            "select t4.compl_area_local, t4.total_num, t9.timeout_num, t9.timeout_num / t4.total_num::float8 as timeout_ratio "
-            +
-            "from t4, t9 where t4.compl_area_local = t9.compl_area_local")
-    List<Map<String, Object>> selectTimeoutTsCountForDay(String day);
-
-    /**
-     * 处理时长统计
-     */
-    @Select("with t1 as (select compl_area_local, " +
-            "case when proce_time != '' then (extract('epoch' from to_timestamp( proce_time, 'YYYY-MM-DD HH24:MI:SS'))"
-            +
-            "          - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) / 3600" +
-            "     when is_online_complete = '是' then 0" +
-            "     else (extract('epoch' from to_timestamp(end_time, 'YYYY-MM-DD HH24:MI:SS'))" +
-            "          - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) / 3600 " +
-            "     end as duration from tsl_data.mobile_complaint_day " +
-            "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)) " +
-            "select compl_area_local, avg(duration)::float8 as avg_duration from t1 group by compl_area_local")
-    List<Map<String, Object>> selectTsDurationForDay(String day);
-
-    /**
-     * 重复工单
-     */
-    @Select("with t1 as (select compl_area_local, busi_no from tsl_data.mobile_complaint_day " +
-            " where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)), " +
-            "t2 as (select distinct * from t1), " +
-            "t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), " +
-            "t4 as (select compl_area_local, count(1) as distinct_num from t2 group by compl_area_local), " +
-            "t5 as (select t3.compl_area_local, t3.total_num, t3.total_num - t4.distinct_num::float8 as repeat_num, " +
-            "       (t3.total_num - t4.distinct_num) / t3.total_num::float8 as repeat_ratio from T3, t4 " +
-            "       where t3.compl_area_local = t4.compl_area_local) " +
-            "select '全省' as compl_area_local, sum(total_num) as total_num, sum(repeat_num) as repeat_num, " +
-            "sum(repeat_num) / sum(total_num)::float8 as repeat_ratio from t5 union select * from t5 ")
-    List<Map<String, Object>> selectRepeatTsCountForDay(String day);
-
-    /**
-     * 投诉清单按日按地市计数
-     */
-    @Select("select compl_area_local, substring(acct_date from 7 for 2) as day_id, count(1) as num " +
-            " from tsl_data.mobile_complaint_day where month_id = substring(#{day} from 1 for 6) " +
-            " and day_id = substring(#{day} from 7 for 2) group by compl_area_local, substring(acct_date from 7 for 2) "
-            +
-            " order by compl_area_local, substring(acct_date from 7 for 2)")
-    List<Map<String, Object>> selectCityTslForMonth(String day);
-
-    /**
-     * 投诉清单全省计数
-     */
-    @Select("select substring(acct_date from 7 for 2) as day_id, count(1) as num " +
-            "from tsl_data.mobile_complaint_day where month_id = substring(#{day} from 1 for 6) " +
-            "and day_id = substring(#{day} from 7 for 2) group by substring(acct_date from 7 for 2) " +
-            "order by substring(acct_date from 7 for 2)")
-    List<Map<String, Object>> selectAllTslForMonth(String day);
-
-    /**
-     * 投诉清单地市总数
-     */
-    @Select("select compl_area_local, count(1) as num from tsl_data.mobile_complaint_day " +
-            "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2) " +
-            " group by compl_area_local order by compl_area_local")
-    List<Map<String, Object>> selectCityAllForMonth(String day);
-
-    /**
-     * 投诉清单按月计算总数
-     */
-    @Select("select count(1) as num from tsl_data.mobile_complaint_day hdmc " +
-            "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)")
-    int selectAllForMonth(String day);
-
-    @Delete("delete from tsl_data.mobile_complaint_day where month_id = #{month_id}  and day_id = #{day_id} ")
-    int deleteMobileComplaintForMonthIdAndDayId(@Param("month_id") String monthId, @Param("day_id") String dayId);
-
-    /**
-     * 删除某天的管理端投诉清单
-     */
-    default int deleteMobileCompForDay(String day) {
-        return deleteMobileComplaintForMonthIdAndDayId(day.substring(0, 6), day.substring(6));
-    }
-
-    @Select("select count(1) from tsl_data.mobile_complaint_day where month_id = #{month_id}  and day_id = #{day_id} ")
-    int countForDay(@Param("month_id") String monthId, @Param("day_id") String dayId);
-
-    default int countForDay(String day) {
-        return countForDay(day.substring(0, 6), day.substring(6));
-    }
+        /**
+         * 统计某天入库工单数量
+         */
+        @Select("select count(1) from tsl_data.mobile_complaint_day " +
+                        "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)")
+        int selectCompCountForDay(String day);
+
+        /**
+         * 超时工单统计
+         */
+        @Select("with t1 as (select compl_area_local, is_timeout from tsl_data.mobile_complaint_day " +
+                        " where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)), "
+                        +
+                        "t2 as (select '全省' as compl_area_local, count(1) as total_num from t1), " +
+                        "t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), " +
+                        "t4 as (select * from t2 union select * from t3), " +
+                        "t5 as (select compl_area_local from t1 where is_timeout = '是'), " +
+                        "t7 as (select '全省' as compl_area_local, count(1) as timeout_num from t5), " +
+                        "t8 as (select compl_area_local, count(1) as timeout_num from t5 group by compl_area_local), " +
+                        "t9 as (select * from t7 union select * from t8) " +
+                        "select t4.compl_area_local, t4.total_num, t9.timeout_num, t9.timeout_num / t4.total_num::float8 as timeout_ratio "
+                        +
+                        "from t4, t9 where t4.compl_area_local = t9.compl_area_local")
+        List<Map<String, Object>> selectTimeoutTsCountForDay(String day);
+
+        /**
+         * 处理时长统计
+         */
+        @Select("with t1 as (select compl_area_local, " +
+                        "case when proce_time != '' then (extract('epoch' from to_timestamp( proce_time, 'YYYY-MM-DD HH24:MI:SS'))"
+                        +
+                        "          - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) / 3600" +
+                        "     when is_online_complete = '是' then 0" +
+                        "     else (extract('epoch' from to_timestamp(end_time, 'YYYY-MM-DD HH24:MI:SS'))" +
+                        "          - extract('epoch' from to_timestamp(accept_time, 'YYYY-MM-DD HH24:MI:SS'))) / 3600 "
+                        +
+                        "     end as duration from tsl_data.mobile_complaint_day " +
+                        "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)) "
+                        +
+                        "select compl_area_local, avg(duration)::float8 as avg_duration from t1 group by compl_area_local")
+        List<Map<String, Object>> selectTsDurationForDay(String day);
+
+        /**
+         * 重复工单
+         */
+        @Select("with t1 as (select compl_area_local, busi_no from tsl_data.mobile_complaint_day " +
+                        " where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)), "
+                        +
+                        "t2 as (select distinct * from t1), " +
+                        "t3 as (select compl_area_local, count(1) as total_num from t1 group by compl_area_local), " +
+                        "t4 as (select compl_area_local, count(1) as distinct_num from t2 group by compl_area_local), "
+                        +
+                        "t5 as (select t3.compl_area_local, t3.total_num, t3.total_num - t4.distinct_num::float8 as repeat_num, "
+                        +
+                        "       (t3.total_num - t4.distinct_num) / t3.total_num::float8 as repeat_ratio from T3, t4 " +
+                        "       where t3.compl_area_local = t4.compl_area_local) " +
+                        "select '全省' as compl_area_local, sum(total_num) as total_num, sum(repeat_num) as repeat_num, "
+                        +
+                        "sum(repeat_num) / sum(total_num)::float8 as repeat_ratio from t5 union select * from t5 ")
+        List<Map<String, Object>> selectRepeatTsCountForDay(String day);
+
+        /**
+         * 投诉清单按日按地市计数
+         */
+        @Select("select compl_area_local, substring(acct_date from 7 for 2) as day_id, count(1) as num " +
+                        " from tsl_data.mobile_complaint_day where month_id = substring(#{day} from 1 for 6) " +
+                        " and day_id = substring(#{day} from 7 for 2) group by compl_area_local, substring(acct_date from 7 for 2) "
+                        +
+                        " order by compl_area_local, substring(acct_date from 7 for 2)")
+        List<Map<String, Object>> selectCityTslForMonth(String day);
+
+        /**
+         * 投诉清单全省计数
+         */
+        @Select("select substring(acct_date from 7 for 2) as day_id, count(1) as num " +
+                        "from tsl_data.mobile_complaint_day where month_id = substring(#{day} from 1 for 6) " +
+                        "and day_id = substring(#{day} from 7 for 2) group by substring(acct_date from 7 for 2) " +
+                        "order by substring(acct_date from 7 for 2)")
+        List<Map<String, Object>> selectAllTslForMonth(String day);
+
+        /**
+         * 投诉清单地市总数
+         */
+        @Select("select compl_area_local, count(1) as num from tsl_data.mobile_complaint_day " +
+                        "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2) " +
+                        " group by compl_area_local order by compl_area_local")
+        List<Map<String, Object>> selectCityAllForMonth(String day);
+
+        /**
+         * 投诉清单按月计算总数
+         */
+        @Select("select count(1) as num from tsl_data.mobile_complaint_day hdmc " +
+                        "where month_id = substring(#{day} from 1 for 6) and day_id = substring(#{day} from 7 for 2)")
+        int selectAllForMonth(String day);
+
+        @Delete("delete from tsl_data.mobile_complaint_day where month_id = #{month_id}  and day_id = #{day_id} ")
+        int deleteMobileComplaintForMonthIdAndDayId(@Param("month_id") String monthId, @Param("day_id") String dayId);
+
+        /**
+         * 删除某天的管理端投诉清单
+         */
+        default int deleteMobileCompForDay(String day) {
+                return deleteMobileComplaintForMonthIdAndDayId(day.substring(0, 6), day.substring(6));
+        }
+
+        @Select("select count(1) from tsl_data.mobile_complaint_day where month_id = #{month_id}  and day_id = #{day_id} ")
+        int countForDay(@Param("month_id") String monthId, @Param("day_id") String dayId);
+
+        default int countForDay(String day) {
+                return countForDay(day.substring(0, 6), day.substring(6));
+        }
+
+        // 3G简网投诉情况
+        // 移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能
+        // 移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简
+        // 日定责问题分类 DUTY_REASON_ID_DAY
+        // 地市按日统计 20240409 新增
+        @Select("select compl_area_local, substring(acct_date from 7 for 2) as day_id, count(1) as num " +
+                        "from tsl_data.mobile_complaint_day " +
+                        "where month_id = #{month_id} and day_id = #{day_id} " +
+                        "and duty_reason_id_day in ( " +
+                        "'移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', " +
+                        "'移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简') " +
+                        "group by compl_area_local, substring(acct_date from 7 for 2) " +
+                        "order by compl_area_local, substring(acct_date from 7 for 2)")
+        List<Map<String, Object>> selectCity3GjwForMonth(@Param("month_id") String monthId,
+                        @Param("day_id") String dayId);
+
+        default List<Map<String, Object>> selectCity3GjwForMonth(String day) {
+                return selectCity3GjwForMonth(day.substring(0, 6), day.substring(6));
+        }
+
+        // 全省按日统计 20240409 新增
+        @Select("select substring(acct_date from 7 for 2) as day_id, count(1) as num " +
+                        "from tsl_data.mobile_complaint_day " +
+                        "where month_id = #{month_id} and day_id = #{day_id} " +
+                        "and duty_reason_id_day in ( " +
+                        "'移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', " +
+                        "'移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简') " +
+                        "group by substring(acct_date from 7 for 2) " +
+                        "order by substring(acct_date from 7 for 2)")
+        List<Map<String, Object>> selectAll3GjwGroupByDayForMonth(@Param("month_id") String monthId,
+                        @Param("day_id") String dayId);
+
+        default List<Map<String, Object>> selectAll3GjwGroupByDayForMonth(String day) {
+                return selectAll3GjwGroupByDayForMonth(day.substring(0, 6), day.substring(6));
+        }
+
+        @Select("select compl_area_local, count(1) as num " +
+                        "from tsl_data.mobile_complaint_day " +
+                        "where month_id = #{month_id} and day_id = #{day_id} " +
+                        "and duty_reason_id_day in ( " +
+                        "'移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', " +
+                        "'移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简') " +
+                        "group by compl_area_local " +
+                        "order by compl_area_local ")
+        List<Map<String, Object>> selectCityAll3GjwForMonth(@Param("month_id") String monthId,
+                        @Param("day_id") String dayId);
+
+        default List<Map<String, Object>> selectCityAll3GjwForMonth(String day) {
+                return selectCityAll3GjwForMonth(day.substring(0, 6), day.substring(6));
+        }
+
+        @Select("select count(1)  from tsl_data.mobile_complaint_day " +
+                        "where month_id = #{month_id} and day_id = #{day_id} " +
+                        "and duty_reason_id_day in ( " +
+                        "'移网质量>>网络覆盖>>Vo-LTE>>未开通/不支撑Vo-LTE功能', " +
+                        "'移网质量>>网络覆盖>>2/3G网络精简>>2/3G网络精简')")
+        int selectAll3GjwForMonth(@Param("month_id") String monthId, @Param("day_id") String dayId);
+
+        default int selectAll3GjwForMonth(String day) {
+                return selectAll3GjwForMonth(day.substring(0, 6), day.substring(6));
+        }
 }

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

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.nokia.tsl_data.dao.ManagementDetailMapper;
+import com.nokia.tsl_data.dao.MobileComplaintMapper;
 import com.nokia.tsl_data.dao.SysDataDictionaryRepository;
 import com.nokia.tsl_data.dao.TargetTsRatioMapper;
 import com.nokia.tsl_data.exception.LackOfDataRuntimeException;
@@ -25,6 +26,8 @@ public class ManagementDetailService {
     @Autowired
     private ManagementDetailMapper managementDetailMapper;
     @Autowired
+    private MobileComplaintMapper mobileComplaintMapper;
+    @Autowired
     private SysDataDictionaryRepository sysDataDictionaryRepository;
     @Autowired
     private TargetTsRatioMapper targetTsRatioRepository;
@@ -117,8 +120,8 @@ public class ManagementDetailService {
             list.add(ycwtl);
         }
         // 5. 期望万投率
-        List<Map<String,Object>>  targetTsRatios = targetTsRatioRepository.findByMonthId(day.substring(0, 6));
-        for (Map<String,Object> targetTsRatio : targetTsRatios) {
+        List<Map<String, Object>> targetTsRatios = targetTsRatioRepository.findByMonthId(day.substring(0, 6));
+        for (Map<String, Object> targetTsRatio : targetTsRatios) {
             result.get(targetTsRatio.get("city_name").toString()).add(targetTsRatio.get("management_target_ratio"));
         }
         // 6. 与目标差距
@@ -195,4 +198,52 @@ public class ManagementDetailService {
         return result;
     }
 
+    // 3G简网投诉情况 数据获取
+    // 20240409 新增
+    public Map<String, List<Object>> getSheet3GjwData(String day) {
+        // 1. 初始化存储
+        Map<String, List<Object>> result = new HashMap<>();
+        // dayIndex 决定每个List需要初始化多少元素
+        // (确实存在某一个某个地市数量为0的情况,这种情况数据库取到的可能没值,通过初始化可以避免缺失)
+        int dayIndex = Integer.parseInt(day.substring(6, 8));
+        // 初始化每个地市(按固定顺序)每天的工单量
+        for (String area : sysDataDictionaryRepository.findAllCityName()) {
+            List<Object> list = new ArrayList<>();
+            for (int i = 0; i < dayIndex; i++) {
+                list.add(0);
+            }
+            result.put(area, list);
+        }
+        // 初始化全省每天工作量
+        List<Object> list0 = new ArrayList<>();
+        for (int i = 0; i < dayIndex; i++) {
+            list0.add(0);
+        }
+        result.put("全省", list0);
+        // 2. 读取数据库数据(工单数量)并写入结果
+        // 各地市每日投诉量
+        List<Map<String, Object>> cityTslForMonth = mobileComplaintMapper.selectCity3GjwForMonth(day);
+        for (Map<String, Object> map : cityTslForMonth) {
+            int dayId = Integer.parseInt(map.get("day_id").toString());
+            // 注意这里用的是赋值而不是add
+            result.get(map.get("compl_area_local").toString()).set(dayId - 1, map.get("num"));
+        }
+        List<Map<String, Object>> allTslForMonth = mobileComplaintMapper.selectAll3GjwGroupByDayForMonth(day);
+        // 全省每日投诉量
+        for (Map<String, Object> map : allTslForMonth) {
+            int dayId = Integer.parseInt(map.get("day_id").toString());
+            result.get("全省").set(dayId - 1, map.get("num"));
+        }
+        // 各地市投诉总数
+        List<Map<String, Object>> cityAllForMonth = mobileComplaintMapper.selectCityAll3GjwForMonth(day);
+        // 各地市投诉总量
+        for (Map<String, Object> map : cityAllForMonth) {
+            result.get(map.get("compl_area_local").toString()).add(map.get("num"));
+        }
+        // 全省总量
+        int total = mobileComplaintMapper.selectAll3GjwForMonth(day);
+        result.get("全省").add(total);
+        return result;
+    }
+
 }

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

@@ -205,6 +205,14 @@ public class ReportServiceV3 {
                 ImageIO.write(screenShot, "png",
                         Paths.get(file.getParentFile().getAbsolutePath(), "管理端-移网感知类-" + day + ".png").toFile());
             }
+            // 截图 3G简网
+            sheet = workbook.getSheet("3G简网投诉情况");
+            if (sheet != null) {
+                area = "A1:" + CellRect.getColumnName(dayOfMonth + 2) + "15";
+                screenShot = PoiUtil.screenShot(sheet, area, "微软雅黑");
+                ImageIO.write(screenShot, "png",
+                        Paths.get(file.getParentFile().getAbsolutePath(), "3G简网投诉情况" + day + ".png").toFile());
+            }
             // 截图 服请
             sheet = workbook.getSheet("移网感知服务请求率");
             if (sheet != null) {
@@ -257,6 +265,9 @@ public class ReportServiceV3 {
         managementDetailService.checkStatDayCount(day);
         writeSheet1(workbookWrapper, day);
         log.info("帐期 {} 管理端-移网感知类 sheet写入成功", day);
+        // 1.1.2 写入 3G简网投诉情况 20240409 新增
+        writeSheet3Gjw(workbookWrapper, day);
+        log.info("帐期 {} 3G简网投诉情况 sheet写入成功", day);
         // 1.2 写入 服请情况
         cemMobileExperienceListService.checkStatDayCount(day);
         writeSheetServiceRequest(workbookWrapper, day);
@@ -721,7 +732,8 @@ public class ReportServiceV3 {
         // 设置sheet的列宽
         sheet.setColumnWidth(0, 1600);
         for (int i = 1; i <= dayOfMonth; i++) {
-            sheet.setColumnWidth(i, 1100);
+            // 20240408 从1100修改为1300 满足4位数时正常显示的宽度
+            sheet.setColumnWidth(i, 1300);
         }
         sheet.setColumnWidth(dayOfMonth + 1, 1700);
         sheet.setColumnWidth(dayOfMonth + 2, 2100);
@@ -859,6 +871,89 @@ public class ReportServiceV3 {
         }
     }
 
+    /**
+     * 3G简网投诉情况
+     */
+    private void writeSheet3Gjw(XSSFWorkbookWrapper workbookWrapper, String day) {
+        String sheetName = "3G简网投诉情况";
+        // 获取数据
+        Map<String, List<Object>> sheetData = managementDetailService.getSheet3GjwData(day);
+        // 计算天数
+        LocalDate date = LocalDate.parse(day, DateTimeFormatter.ofPattern("yyyyMMdd"));
+        int dayOfMonth = date.getDayOfMonth();
+        int monthOfYear = date.getMonthValue();
+        Sheet sheet = workbookWrapper.getWorkbook().createSheet(sheetName);
+        Row row;
+        Cell cell;
+        // 第一行 标题栏
+        cell = sheet.createRow(0).createCell(0);
+        cell.setCellValue(day.substring(0, 4) + "年" + monthOfYear
+                + "客服投诉清单各地市3G简网投诉情况(" + sheetName + ")");
+        cell.setCellStyle(workbookWrapper.getCellStyle4());
+        PoiUtil.addMergedRegion(sheet, 0, 0, 0, dayOfMonth + 2);
+        // 第二行 列名
+        row = sheet.createRow(1);
+        cell = row.createCell(0);
+        cell.setCellValue("地市");
+        cell.setCellStyle(workbookWrapper.getCellStyle1());
+        for (int i = 1; i <= dayOfMonth; i++) {
+            cell = row.createCell(i);
+            cell.setCellValue(i + "日");
+            cell.setCellStyle(workbookWrapper.getCellStyle1());
+        }
+        cell = row.createCell(dayOfMonth + 1);
+        cell.setCellValue("投诉总量");
+        cell.setCellStyle(workbookWrapper.getCellStyle1());
+        cell = row.createCell(dayOfMonth + 2);
+        cell.setCellValue("地市");
+        cell.setCellStyle(workbookWrapper.getCellStyle1());
+        int rowNum = 2;
+        int cellNum = 0;
+        // 写入各地市数据
+        for (String area : sysDataDictionaryRepository.findAllCityName()) {
+            row = sheet.createRow(rowNum++);
+            // 写入A列的地市
+            cell = row.createCell(cellNum++);
+            cell.setCellValue(area);
+            cell.setCellStyle(workbookWrapper.getCellStyle1());
+            for (Object obj : sheetData.get(area)) {
+                cell = row.createCell(cellNum++);
+                cell.setCellValue(Double.parseDouble(obj.toString()));
+                cell.setCellStyle(workbookWrapper.getCellStyle1());
+            }
+            // 写入最后一列的地市
+            cell = row.createCell(cellNum);
+            cell.setCellValue(area);
+            cell.setCellStyle(workbookWrapper.getCellStyle1());
+            // cellNum复位
+            cellNum = 0;
+        }
+        // 写入全省数据
+        row = sheet.createRow(rowNum);
+        // 写入A列的地市
+        cell = row.createCell(cellNum++);
+        cell.setCellValue("全省");
+        cell.setCellStyle(workbookWrapper.getCellStyle1());
+        for (Object obj : sheetData.get("全省")) {
+            cell = row.createCell(cellNum++);
+            cell.setCellValue(Double.parseDouble(obj.toString()));
+            cell.setCellStyle(workbookWrapper.getCellStyle1());
+        }
+        // 写入最后一列的地市
+        cell = row.createCell(cellNum);
+        cell.setCellValue("全省");
+        cell.setCellStyle(workbookWrapper.getCellStyle1());
+        // 添加条件格式B15-V15
+        PoiUtil.setConditionalFormattingGreenToRed(sheet, rowNum, rowNum, 1, dayOfMonth);
+        // 设置sheet的列宽
+        sheet.setColumnWidth(0, 1600);
+        for (int i = 1; i <= dayOfMonth; i++) {
+            // 20240408 从1100修改为1300 满足4位数时正常显示的宽度
+            sheet.setColumnWidth(i, 1300);
+        }
+        sheet.setColumnWidth(dayOfMonth + 1, 1700);
+    }
+
     /**
      * 获取一个 XSSFWorkbook 并初始化几个需要的格式
      */

+ 3 - 12
src/test/java/com/nokia/tsl_data/TslDataApplicationTest.java

@@ -5,7 +5,6 @@ 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.dao.WorkFlowDao;
 import com.nokia.tsl_data.service.TaskService;
 import com.nokia.tsl_data.service.UserCountService;
 import com.nokia.tsl_data.util.TextUtil;
@@ -18,7 +17,7 @@ class TslDataApplicationTest {
 
     @Test
     void test() {
-        taskService.generateReportV3("20240325");
+        taskService.generateReportV3("20240331");
     }
 
     @Autowired
@@ -27,20 +26,12 @@ class TslDataApplicationTest {
     @Test
     void test2() {
         String path = "D:/abc.txt";
-        List<String> lines = TextUtil.readLines(path, "utf-8");
+        List<String> lines = TextUtil.readLines(path, "gbk");
         lines.forEach(line -> {
             String[] split = line.split("\t");
             System.out.println(split[0] + "==" + split[2]);
-            userCountService.updateManagementUserCount("202403", split[0], Double.parseDouble(split[2]));
+            userCountService.updateManagementUserCount("202404", split[0], Double.parseDouble(split[2]));
         });
     }
 
-    @Autowired
-    private WorkFlowDao workFlowDao;
-
-    @Test
-    void test3() {
-        workFlowDao.selectTsDurationForDayV2("2024-03-13 00:00:00", "2024-03-13 13:00:00");
-    }
-
 }