Selaa lähdekoodia

v1.5 20230601

lifuquan 1 vuosi sitten
vanhempi
commit
4236018479

+ 7 - 1
README.md

@@ -1,11 +1,17 @@
 # REPORT_AUTO
 
-nohup java -jar tsl_data-1.4-exec.jar >output.log 2>&1 &
+nohup java -jar tsl_data-1.5-exec.jar >output.log 2>&1 &
 
 nohup java -jar dingtalk_auto-1.1-exec.jar >output.log 2>&1 &
 
 ## tsl_data版本说明
 
+### v1.5
+
+1. MOBILE_COMPLAINT_DETAILS数据从每日推送一天数据更新为每日推送从当月1日累计数据
+    - CEM移网质量投诉明细数据不再入库,直接从文件读取,仅入库CEM高品质2日统计
+    - 有三个sheet会用到这项数据,新增一个从文件读取数据的dao层
+
 ### v1.4
 
 1. 修复了在某个地市某天投诉量为0时导致的错误。

+ 7 - 7
doc/开发文档/部署环境/手动入库数据.md

@@ -6,7 +6,7 @@
 POST http://192.168.31.10:11111/tsl/task/send HTTP/1.1
 Content-Type:application/json
 
-20230524
+20230531
 ```
 
 > 注意:文件缺失时不需要手动入库和生成报表,当前已经加入了等待,检查的机制。发送的逻辑后续需要修改一下。
@@ -17,7 +17,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/report/generate HTTP/1.1
 Content-Type:application/json
 
-20230524
+20230531
 ```
 
 ## 数据手动入库
@@ -28,7 +28,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/warahouse HTTP/1.1
 Content-Type:application/json
 
-20230524
+20230531
 ```
 
 - report_auto.he_d_mobile_comp
@@ -37,7 +37,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/warahouse/mobilecomp HTTP/1.1
 Content-Type:application/json
 
-20230524
+20230521
 ```
 
 - report_auto.he_d_high_quality
@@ -46,7 +46,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/warahouse/highquality HTTP/1.1
 Content-Type:application/json
 
-20230522
+20230521
 ```
 
 ## 查询数据
@@ -66,7 +66,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/delete/mobilecomp HTTP/1.1
 Content-Type:application/json
 
-20230524
+20230531
 ```
 
 - report_auto.he_d_high_quality
@@ -75,5 +75,5 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/delete/highquality HTTP/1.1
 Content-Type:application/json
 
-20230522
+20230531
 ```

+ 4 - 8
doc/开发文档/部署环境接口测试.md

@@ -1,13 +1,9 @@
 # 接口测试
 
-nohup java -jar tsl_data-1.2-exec.jar >output.log 2>&1 &
+nohup java -jar tsl_data-1.5-exec.jar >output.log 2>&1 &
 
 nohup java -jar dingtalk_auto-1.1-exec.jar >output.log 2>&1 &
 
-数据源提醒机器人<https://oapi.dingtalk.com/robot/send?access_token=c517badfc292fd487d0581cdd77f5757f239a4a2116db9ad62fe5bacc49023dc>
-
-关键字: `经查:`
-
 ## 手动发送
 
 ```http
@@ -41,7 +37,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/check/srcfile HTTP/1.1
 Content-Type:application/json
 
-20230502
+20230531
 ```
 
 ## 定时任务
@@ -56,14 +52,14 @@ Content-Type:application/json
 ### 停止定时任务
 
 ```http
-POST http://127.0.0.1:29100/tsl/task/cron/stop HTTP/1.1
+POST http://192.168.10.7:29100/tsl/task/cron/stop HTTP/1.1
 Content-Type:application/json
 ```
 
 ### 启动定时任务
 
 ```http
-POST http://127.0.0.1:29100/tsl/task/cron/start HTTP/1.1
+POST http://192.168.10.7:29100/tsl/task/cron/start HTTP/1.1
 Content-Type:application/json
 ```
 

+ 1 - 1
tsl_data/pom.xml

@@ -13,7 +13,7 @@
 
     <groupId>com.nokia</groupId>
     <artifactId>tsl_data</artifactId>
-    <version>1.4</version>
+    <version>1.5</version>
 
     <packaging>jar</packaging>
 

+ 4 - 4
tsl_data/src/main/java/com/nokia/tsl_data/config/PushMessageUtilConfig.java

@@ -22,10 +22,10 @@ public class PushMessageUtilConfig {
     // 业务编码
     private String busiCode = "30000111";
 
-    // 数据源提醒机器人<https://oapi.dingtalk.com/robot/send?access_token=c517badfc292fd487d0581cdd77f5757f239a4a2116db9ad62fe5bacc49023dc>
-    // 关键字: `经查:`
-    private String accessToken = "c517badfc292fd487d0581cdd77f5757f239a4a2116db9ad62fe5bacc49023dc";
-    private String prefix = "经查:";
+    // 关键字: `CUC:` 我自己的群
+    // https://oapi.dingtalk.com/robot/send?access_token=b2f1424d6119affaacab614b184f043fcd2c73db2651bb86eff29992d66820bf
+    private String accessToken = "b2f1424d6119affaacab614b184f043fcd2c73db2651bb86eff29992d66820bf";
+    private String prefix = "CUC:";
 
     @Bean
     public PushMessageUtil pushMessageUtil(RestTemplate restTemplate) {

+ 0 - 4
tsl_data/src/main/java/com/nokia/tsl_data/config/TaskRunner.java

@@ -7,12 +7,9 @@ import org.springframework.stereotype.Component;
 
 import com.nokia.tsl_data.service.TslCronTaskService;
 
-import lombok.extern.slf4j.Slf4j;
-
 /**
  * 在项目启动时根据配置启动任务
  */
-@Slf4j
 @Component
 public class TaskRunner implements CommandLineRunner {
 
@@ -31,7 +28,6 @@ public class TaskRunner implements CommandLineRunner {
         if (isStarted) {
             cronTaskService.startCronTask();
         }
-        log.info("已启动定时任务");
     }
 
 }

+ 6 - 0
tsl_data/src/main/java/com/nokia/tsl_data/controller/TslTaskConroller.java

@@ -126,6 +126,12 @@ public class TslTaskConroller {
         }
     }
 
+    /**
+     * 检查数据源
+     * 
+     * @param day
+     * @return
+     */
     @PostMapping("/check/srcfile")
     public R checkScrFile(@RequestBody String day) {
         String check = tslWaraHouseService.check(day);

+ 88 - 0
tsl_data/src/main/java/com/nokia/tsl_data/dao/MobileCompDao.java

@@ -0,0 +1,88 @@
+package com.nokia.tsl_data.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface MobileCompDao {
+
+    /**
+     * 统计某天入库工单数量
+     * 
+     * @param day
+     * @return
+     */
+    int selectCompCountForDay(String day);
+
+    /**
+     * 超时工单统计
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectTimeoutTsCountForDay(String day);
+
+    /**
+     * 处理时长统计
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectTsDurationForDay(String day);
+
+    /**
+     * 重复工单
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectRepeatTsCountForDay(String day);
+
+    /**
+     * 投诉清单按日按地市计数
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectCityTslForMonth(String day);
+
+    /**
+     * 投诉清单全省计数
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectAllTslForMonth(String day);
+
+    /**
+     * 投诉清单地市总数
+     * 
+     * @param day
+     * @return
+     */
+    List<Map<String, Object>> selectCityAllForMonth(String day);
+
+    /**
+     * 投诉清单按月计算总数
+     * 
+     * @param day
+     * @return
+     */
+    int selectAllForMonth(String day);
+
+    /**
+     * 删除某天的管理端投诉清单
+     * 
+     * @param day 20230522
+     */
+    void deleteMobileCompForDay(String day);
+
+    /**
+     * 插入上月的平均处理时长
+     * 
+     * @param monthId
+     */
+    void insertOldTsDurationForMonth(String monthId);
+}

+ 22 - 0
tsl_data/src/main/java/com/nokia/tsl_data/dao/TslDao.java

@@ -6,15 +6,21 @@ import java.util.Map;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+/**
+ * 查询数据库的dao
+ * V1.5 所有查询CEM移网质量投诉明细表的dao废弃
+ */
 @Mapper
 public interface TslDao {
 
     /**
      * 查询某天的河北_CEM移网质量投诉明细数据量
+     * v1.5废弃
      * 
      * @param day
      * @return
      */
+    @Deprecated
     int selectCompCountForDay(String day);
 
     /**
@@ -47,6 +53,7 @@ public interface TslDao {
      * 
      * @param monthId
      */
+    @Deprecated
     void insertOldTsDurationForMonth(String monthId);
 
     /**
@@ -62,54 +69,67 @@ public interface TslDao {
      * @param day
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectTsDurationForDay(String day);
 
     /**
      * 超时工单统计
+     * v1.5废弃
      * 
      * @param monthId
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectTimeoutTsCountForDay(String day);
 
     /**
      * 重复工单数和比例按截止日期和地市查询
+     * v1.5废弃
      * 
      * @param day
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectRepeatTsCountForDay(String day);
 
     /**
      * 投诉清单按日按地市计数
+     * v1.5废弃
      * 
      * @param monthId
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectCityTslForMonth(String day);
 
     /**
      * 投诉清单全省计数
+     * v1.5废弃
      * 
      * @param monthId
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectAllTslForMonth(String day);
 
     /**
      * 投诉清单地市总数
+     * v1.5废弃
      * 
      * @param monthId
      * @return
      */
+    @Deprecated
     List<Map<String, Object>> selectCityAllForMonth(String day);
 
     /**
      * 投诉清单按月计算总数
+     * v1.5废弃
      * 
      * @param monthId
      * @return
      */
+    @Deprecated
     int selectAllForMonth(String day);
 
     /**
@@ -151,8 +171,10 @@ public interface TslDao {
 
     /**
      * 删除某天的管理端投诉清单
+     * v1.5废弃
      * 
      * @param day 20230522
      */
+    @Deprecated
     void deleteMobileCompForDay(String day);
 }

+ 5 - 0
tsl_data/src/main/java/com/nokia/tsl_data/service/TslCronTaskService.java

@@ -7,12 +7,14 @@ import org.springframework.scheduling.support.CronTrigger;
 import org.springframework.stereotype.Service;
 
 import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * 定时任务相关逻辑
  * 
  * 支持查询任务状态、启动任务、停止任务、修改任务定时表达式
  */
+@Slf4j
 @Service
 public class TslCronTaskService {
 
@@ -39,6 +41,7 @@ public class TslCronTaskService {
                 tslTaskService.cronTask();
             }, new CronTrigger(cronExpression));
             isStarted = true;
+            log.info("定时任务开启...{}", cronExpression);
         }
     }
 
@@ -52,6 +55,7 @@ public class TslCronTaskService {
                 future.cancel(false);
             }
             isStarted = false;
+            log.info("定时任务停止...");
         }
     }
 
@@ -67,6 +71,7 @@ public class TslCronTaskService {
             startCronTask();
             startCronTask();
         }
+        log.info("定时任务已修改...{}", cronExpression);
     }
 
 }

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

@@ -12,9 +12,11 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import com.nokia.tsl_data.dao.MobileCompDao;
 import com.nokia.tsl_data.dao.TslDao;
 
 import lombok.Getter;
@@ -25,7 +27,11 @@ import lombok.Getter;
 @Service
 public class TslDataService {
 
-    private final TslDao tslDao;
+    @Autowired
+    private TslDao tslDao;
+
+    @Autowired
+    private MobileCompDao mobileCompDao;
 
     @Value("${tslTask.compliance.satisfied}")
     private double satisfiedCompliance;
@@ -52,10 +58,6 @@ public class TslDataService {
         }
     };
 
-    public TslDataService(TslDao tslDao) {
-        this.tslDao = tslDao;
-    }
-
     /**
      * 客户端-投诉问题解决满意度
      * 客户端-投诉问题解决率
@@ -176,7 +178,7 @@ public class TslDataService {
      * @return
      */
     public List<List<Object>> getSheet3Data1(String day) {
-        List<Map<String, Object>> data = tslDao.selectTimeoutTsCountForDay(day);
+        List<Map<String, Object>> data = mobileCompDao.selectTimeoutTsCountForDay(day);
         Map<String, Map<String, Object>> dayMap = new HashMap<>();
         for (Map<String, Object> map : data) {
             dayMap.put((String) map.get("compl_area_local"), map);
@@ -238,10 +240,10 @@ public class TslDataService {
         List<Map<String, Object>> oldData = tslDao.selectOldTsDurationForMonth(oldMonthId);
         // 如果上月的平均处理时长数据不存在,需要插入
         if (oldData.size() == 0) {
-            tslDao.insertOldTsDurationForMonth(oldMonthId);
+            mobileCompDao.insertOldTsDurationForMonth(oldMonthId);
             oldData = tslDao.selectOldTsDurationForMonth(oldMonthId);
         }
-        List<Map<String, Object>> dayData = tslDao.selectTsDurationForDay(day);
+        List<Map<String, Object>> dayData = mobileCompDao.selectTsDurationForDay(day);
         // 转化格式方便读取
         Map<String, Map<String, Object>> dayMap = new HashMap<>();
         Map<String, Map<String, Object>> preMap = new HashMap<>();
@@ -281,11 +283,11 @@ public class TslDataService {
      */
     public List<List<Object>> getSheet2Data(String day) {
         // 从数据库
-        List<Map<String, Object>> dayData = tslDao.selectRepeatTsCountForDay(day);
+        List<Map<String, Object>> dayData = mobileCompDao.selectRepeatTsCountForDay(day);
         List<Map<String, Object>> preDayData = dayData;
         if (!day.endsWith("01")) {
             String preDay = String.valueOf(Integer.parseInt(day) - 1);
-            preDayData = tslDao.selectRepeatTsCountForDay(preDay);
+            preDayData = mobileCompDao.selectRepeatTsCountForDay(preDay);
         }
         // 转化格式方便读取
         Map<String, Map<String, Object>> dayMap = new HashMap<>();
@@ -351,10 +353,10 @@ public class TslDataService {
         // monthId
         String monthId = new SimpleDateFormat("yyyyMM").format(calendar.getTime());
 
-        List<Map<String, Object>> cityTslforMonth = tslDao.selectCityTslForMonth(day);
-        List<Map<String, Object>> allTslforMonth = tslDao.selectAllTslForMonth(day);
-        List<Map<String, Object>> cityAllforMonth = tslDao.selectCityAllForMonth(day);
-        int total = tslDao.selectAllForMonth(day);
+        List<Map<String, Object>> cityTslforMonth = mobileCompDao.selectCityTslForMonth(day);
+        List<Map<String, Object>> allTslforMonth = mobileCompDao.selectAllTslForMonth(day);
+        List<Map<String, Object>> cityAllforMonth = mobileCompDao.selectCityAllForMonth(day);
+        int total = mobileCompDao.selectAllForMonth(day);
         // 当月用户数
         List<Map<String, Object>> userCount = getUserCount(monthId);
         // 目标投诉率

+ 7 - 3
tsl_data/src/main/java/com/nokia/tsl_data/service/TslTaskService.java

@@ -14,11 +14,13 @@ import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.nokia.common.excel.entity.CellRect;
 import com.nokia.common.excel.poi.PoiUtil;
 import com.nokia.common.message.pushmessage.PushMessageUtil;
+import com.nokia.tsl_data.dao.MobileCompDao;
 import com.nokia.tsl_data.dao.TslDao;
 
 import lombok.extern.slf4j.Slf4j;
@@ -33,6 +35,8 @@ public class TslTaskService {
     private final TslReportService tslReportService;
     private final TslWaraHouseService tslWaraHouseService;
     private final TslDao tslDao;
+    @Autowired
+    private MobileCompDao mobileCompDao;
     private final PushMessageUtil pushMessageUtil;
 
     @Value("${tslTask.outputPath}")
@@ -61,8 +65,8 @@ public class TslTaskService {
         try {
             // 检查数据源
             checkSrcExsit(day);
-            // 数据入库
-            tslWaraHouseService.dataWaraHouseTask(day);
+            // 数据入库 v1.5修改修改了入库的表
+            // tslWaraHouseService.dataWaraHouseTask(day);
             // 生成xlsx
             reportGenerateTask(day);
             // 截图
@@ -111,7 +115,7 @@ public class TslTaskService {
         if (qualityCountForDay == 0) {
             throw new RuntimeException("he_d_high_quality表缺少数据");
         }
-        int compCountForDay = tslDao.selectCompCountForDay(day);
+        int compCountForDay = mobileCompDao.selectCompCountForDay(day);
         if (compCountForDay == 0) {
             throw new RuntimeException("he_d_mobile_comp表缺少数据");
         }

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

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.nokia.common.spring.SpringContextHolder;
+import com.nokia.tsl_data.dao.MobileCompDao;
 import com.nokia.tsl_data.dao.TslDao;
 
 import lombok.extern.slf4j.Slf4j;
@@ -56,10 +57,19 @@ public class TslWaraHouseService {
     @Autowired
     private TslDao tslDao;
 
+    @Autowired
+    private MobileCompDao mobileCompDao;
+
     public TslWaraHouseService(JdbcTemplate jdbcTemplate) {
         this.jdbcTemplate = jdbcTemplate;
     }
 
+    /**
+     * 检查某天(day)的数据表是否存在
+     * 
+     * @param day
+     * @return
+     */
     public String check(String day) {
         String filePath1 = MOBILE_COMP_DIR + MOBILE_COMP_PREFIX + day + ".csv";
         String filePath2 = HIGH_QUALITY_DIR + HIGH_QUALITY_PREFIX + day + ".csv";
@@ -81,6 +91,7 @@ public class TslWaraHouseService {
     /**
      * 河北_CEM移网质量投诉明细 数据入库
      * report_auto.he_d_mobile_comp
+     * v1.5 修改为入库report_auto.he_d_mobile_comp_new
      * 
      * @throws IOException
      * @throws FileNotFoundException
@@ -175,6 +186,6 @@ public class TslWaraHouseService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void deleteMobileCompForDay(String day) {
-        tslDao.deleteMobileCompForDay(day);
+        mobileCompDao.deleteMobileCompForDay(day);
     }
 }

+ 20 - 10
tsl_data/src/main/resources/application-dev.properties

@@ -1,18 +1,28 @@
 # 本地pc机数据库
+# spring.datasource.driver-class-name=org.postgresql.Driver
+# spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
+# spring.datasource.username=report_auto
+# spring.datasource.password=fantuan1985
+
+# 10.9上PG数据库
 spring.datasource.driver-class-name=org.postgresql.Driver
-spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
+spring.datasource.url=jdbc:postgresql://192.168.10.9:5432/sqmmt
 spring.datasource.username=report_auto
-spring.datasource.password=fantuan1985
+spring.datasource.password=Richr00t!
 
-# 10.9上PG数据库
-# spring.datasource.driver-class-name=org.postgresql.Driver
-# spring.datasource.url=jdbc:postgresql://192.168.10.9:5432/sqmmt
-# spring.datasource.username=report_auto
-# spring.datasource.password=Richr00t!
+# 生成文件的输出路径,末尾带/
+tslTask.outputPath=D:/src/
 
 # 测试环境路径配置--本地PC
+tslTask.source.MOBILE_COMP_SQL=insert into report_auto.he_d_mobile_comp_new (month_id,day_id,acct_date,sheet_no,is_online_complete,contact_no,busi_no,serv_content,last_deal_content,deal_depart_name,deal_opinion,serv_type,bus_type,duty_reason,accept_channel,submit_channel,compl_area_local,duty_major,product_name,sp_product_code,pre_repair_name,pre_repair_charges,fault_location,cust_level,satisfaction_in_reply,is_ok_in_reply,accept_time,end_time,proce_time,cust_area,is_cust_serv_complete,is_send_sheet_complete,is_repeat,is_upgrade,is_timeout,gis_city,process_nums,deal_depart_name_1,deal_depart_name_2,deal_depart_name_3,first_call_back_time,proce_remark,duty_major_day,duty_reason_id_day,duty_major_month,duty_reason_id_month,voice_text) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
+# 路径的配置最后一定要带上/
 tslTask.source.MOBILE_COMP_DIR=D:/src/
-tslTask.source.HIGH_QUALITY_DIR=D:/src/
+tslTask.source.MOBILE_COMP_PREFIX=HE_D_MOBILE_COMPLAINT_DETAILS_DAY_1087468015013851136_
+# 这里的字段数量和csv源文件字段数量相同
+tslTask.source.MOBILE_COMP_FIELD_NUM=47
 
-# 生成文件的输出路径,末尾带/
-tslTask.outputPath=D:/src/
+tslTask.source.HIGH_QUALITY_SQL=insert into report_auto.he_d_high_quality (month_id,day_id,acct_date,businoareaname,profes_dep,big_type_name,small_type_name,total_complaints,hotline_complaints,other_complaint,litigation_volume,satisfaction_rate,satisfaction_count,total_evaluation,complaint_satisfied,complaint_satisfied_list,complaint_satisfied_count,complaint_resolution,complaint_resolution_list,complaint_resolution_count,complaint_response,complaint_response_list,complaint_response_count,complaint,fault_satisfaction_rate,fault_satisfaction_list,fault_satisfaction_count,fault_resolution_rate,fault_resolution_list,fault_resolution_count,fault_response_rate,fault_response_list,fault_response_count) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
+# 路径的配置最后一定要带上/
+tslTask.source.HIGH_QUALITY_DIR=D:/src/
+tslTask.source.HIGH_QUALITY_PREFIX=HE_D_HIGH_QUALITY_COUNT_DAY_
+tslTask.source.HIGH_QUALITY_FIELD_NUM=33

+ 13 - 1
tsl_data/src/main/resources/application-pro.properties

@@ -2,4 +2,16 @@
 spring.datasource.driver-class-name=org.postgresql.Driver
 spring.datasource.url=jdbc:postgresql://192.168.10.9:5432/sqmmt
 spring.datasource.username=report_auto
-spring.datasource.password=Richr00t!
+spring.datasource.password=Richr00t!
+
+tslTask.source.MOBILE_COMP_SQL=insert into report_auto.he_d_mobile_comp_new (month_id,day_id,acct_date,sheet_no,is_online_complete,contact_no,busi_no,serv_content,last_deal_content,deal_depart_name,deal_opinion,serv_type,bus_type,duty_reason,accept_channel,submit_channel,compl_area_local,duty_major,product_name,sp_product_code,pre_repair_name,pre_repair_charges,fault_location,cust_level,satisfaction_in_reply,is_ok_in_reply,accept_time,end_time,proce_time,cust_area,is_cust_serv_complete,is_send_sheet_complete,is_repeat,is_upgrade,is_timeout,gis_city,process_nums,deal_depart_name_1,deal_depart_name_2,deal_depart_name_3,first_call_back_time,proce_remark,duty_major_day,duty_reason_id_day,duty_major_month,duty_reason_id_month,voice_text) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
+# 路径的配置最后一定要带上/
+tslTask.source.MOBILE_COMP_DIR=/data/nenglishangdian/mobile_complaint/
+tslTask.source.MOBILE_COMP_PREFIX=HE_D_MOBILE_COMPLAINT_DETAILS_DAY_1087468015013851136_
+tslTask.source.MOBILE_COMP_FIELD_NUM=47
+
+tslTask.source.HIGH_QUALITY_SQL=insert into report_auto.he_d_high_quality (month_id,day_id,acct_date,businoareaname,profes_dep,big_type_name,small_type_name,total_complaints,hotline_complaints,other_complaint,litigation_volume,satisfaction_rate,satisfaction_count,total_evaluation,complaint_satisfied,complaint_satisfied_list,complaint_satisfied_count,complaint_resolution,complaint_resolution_list,complaint_resolution_count,complaint_response,complaint_response_list,complaint_response_count,complaint,fault_satisfaction_rate,fault_satisfaction_list,fault_satisfaction_count,fault_resolution_rate,fault_resolution_list,fault_resolution_count,fault_response_rate,fault_response_list,fault_response_count) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
+# 路径的配置最后一定要带上/
+tslTask.source.HIGH_QUALITY_DIR=/data/nenglishangdian/HE_D_HIGH_QUALITY_COUNT_DAY/
+tslTask.source.HIGH_QUALITY_PREFIX=HE_D_HIGH_QUALITY_COUNT_DAY_
+tslTask.source.HIGH_QUALITY_FIELD_NUM=33

+ 1 - 13
tsl_data/src/main/resources/application.properties

@@ -5,18 +5,6 @@ mybatis.mapper-locations=classpath:mapper/*.xml
 
 logging.level.com.nokia=debug
 
-tslTask.source.MOBILE_COMP_SQL=insert into report_auto.he_d_mobile_comp (month_id,day_id,acct_date,sheet_no,is_online_complete,contact_no,busi_no,serv_content,last_deal_content,deal_depart_name,deal_opinion,serv_type,bus_type,duty_reason,accept_channel,submit_channel,compl_area_local,duty_major,product_name,sp_product_code,pre_repair_name,pre_repair_charges,fault_location,cust_level,satisfaction_in_reply,is_ok_in_reply,accept_time,end_time,proce_time,cust_area,is_cust_serv_complete,is_send_sheet_complete,is_repeat,is_upgrade,is_timeout,gis_city,process_nums,deal_depart_name_1,deal_depart_name_2,deal_depart_name_3,first_call_back_time,proce_remark,duty_major_day,duty_reason_id_day,duty_major_month,duty_reason_id_month,voice_text) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
-# 路径的配置最后一定要带上/
-tslTask.source.MOBILE_COMP_DIR=/data/nenglishangdian/mobile_complaint/
-tslTask.source.MOBILE_COMP_PREFIX=HE_D_MOBILE_COMPLAINT_DETAILS_DAY_1087468015013851136_
-tslTask.source.MOBILE_COMP_FIELD_NUM=47
-
-tslTask.source.HIGH_QUALITY_SQL=insert into report_auto.he_d_high_quality (month_id,day_id,acct_date,businoareaname,profes_dep,big_type_name,small_type_name,total_complaints,hotline_complaints,other_complaint,litigation_volume,satisfaction_rate,satisfaction_count,total_evaluation,complaint_satisfied,complaint_satisfied_list,complaint_satisfied_count,complaint_resolution,complaint_resolution_list,complaint_resolution_count,complaint_response,complaint_response_list,complaint_response_count,complaint,fault_satisfaction_rate,fault_satisfaction_list,fault_satisfaction_count,fault_resolution_rate,fault_resolution_list,fault_resolution_count,fault_response_rate,fault_response_list,fault_response_count) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
-# 路径的配置最后一定要带上/
-tslTask.source.HIGH_QUALITY_DIR=/data/nenglishangdian/HE_D_HIGH_QUALITY_COUNT_DAY/
-tslTask.source.HIGH_QUALITY_PREFIX=HE_D_HIGH_QUALITY_COUNT_DAY_
-tslTask.source.HIGH_QUALITY_FIELD_NUM=33
-
 # 达标值 满意率92%,解决率85%,响应率99%
 tslTask.compliance.satisfied=0.92
 tslTask.compliance.resolution=0.85
@@ -26,6 +14,6 @@ tslTask.compliance.response=0.99
 tslTask.outputPath=/data/report_auto/output/
 
 # 定时任务
-tslTask.isStarted=true
+tslTask.isStarted=false
 # 定时任务表达式每天应只执行1次,默认每天14点10分执行
 tslTask.cronExpression=0 45 13 * * *

+ 79 - 0
tsl_data/src/main/resources/mapper/MobileCompDao.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.nokia.tsl_data.dao.MobileCompDao">
+
+    <select id="selectCompCountForDay" resultType="int"> select count(1) from
+        report_auto.he_d_mobile_comp_new where month_id = substring(#{day} from 1 for 6) and day_id
+        = substring(#{day} from 7 for 2) </select>
+
+    <!-- 从现有数据获取上月处理时长(按上月最后一天处理)并插入数据表 -->
+    <insert id="insertOldTsDurationForMonth">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
+        report_auto.he_d_mobile_comp_new hdmc where month_id = #{month_id} and day_id::float8 =
+        extract('day' from to_timestamp(#{month_id}, 'YYYYMM') + interval '1 month' - interval '1
+        day')) insert into report_auto.avg_duration (month_id, city_name, avg_duration) select
+        #{month_id} as month_id, compl_area_local as city_name, avg(duration) as avg_duration from
+        t1 group by compl_area_local </insert>
+
+    <select id="selectTsDurationForDay" resultType="Map"> 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
+        report_auto.he_d_mobile_comp_new hdmc where month_id = substring(#{day} from 1 for 6) and
+        day_id = substring(#{day} from 7 for 2)) select compl_area_local, avg(duration) as
+        avg_duration from t1 group by compl_area_local </select>
+
+    <select id="selectTimeoutTsCountForDay" resultType="Map">with t1 as (select compl_area_local,
+        is_timeout from report_auto.he_d_mobile_comp_new hdmc 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</select>
+
+    <select id="selectRepeatTsCountForDay" resultType="Map"> with t1 as (select compl_area_local,
+        busi_no from report_auto.he_d_mobile_comp_new hdmc 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 </select>
+
+    <select id="selectCityTslForMonth" resultType="Map"> select compl_area_local,
+        substring(acct_date from 7 for 2) as day_id, count(1) as num from
+        report_auto.he_d_mobile_comp_new hdmc 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) </select>
+
+    <select id="selectAllTslForMonth" resultType="Map"> select substring(acct_date from 7 for 2) as
+        day_id, count(1) as num from report_auto.he_d_mobile_comp_new hdmc 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) </select>
+
+    <select id="selectCityAllForMonth" resultType="Map">select compl_area_local, count(1) as num
+        from report_auto.he_d_mobile_comp_new hdmc 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 </select>
+
+    <select id="selectAllForMonth" resultType="int">select count(1) as num from
+        report_auto.he_d_mobile_comp_new hdmc where month_id = substring(#{day} from 1 for 6) and
+        day_id = substring(#{day} from 7 for 2)</select>
+
+    <delete id="deleteMobileCompForDay" parameterType="string">delete from
+        report_auto.he_d_mobile_comp_new hdmc where month_id = substring(#{day} from 1 for 6) and
+        day_id = substring(#{day} from 7 for 2)</delete>
+</mapper>

+ 10 - 0
tsl_data/src/main/resources/mapper/TslDao.xml

@@ -3,6 +3,7 @@
 
 <mapper namespace="com.nokia.tsl_data.dao.TslDao">
 
+    <!-- V1.5废弃 -->
     <select id="selectCompCountForDay" resultType="int"> select count(1) from
         report_auto.he_d_mobile_comp where acct_date = #{day} </select>
 
@@ -28,6 +29,7 @@
     <select id="selectOldTsDurationForMonth" resultType="Map"> select city_name,avg_duration from
         report_auto.avg_duration where month_id = #{monthId} </select>
 
+    <!-- V1.5废弃 -->
     <!-- 从现有数据获取上月处理时长并插入数据表 -->
     <insert id="insertOldTsDurationForMonth">with t1 as (select compl_area_local, case when
         proce_time != '' then (extract('epoch' from to_timestamp(proce_time, 'YYYY-MM-DD
@@ -45,6 +47,7 @@
         (month_id, city_name, avg_duration) VALUES(#{map.month_id}, #{map.city_name},
         #{map.avg_duration}); </insert>
 
+    <!-- V1.5废弃 -->
     <select id="selectTsDurationForDay" resultType="Map"> 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
@@ -55,6 +58,7 @@
         &lt;= substring(#{day} from 7 for 2)) select compl_area_local, avg(duration) as avg_duration
         from t1 group by compl_area_local </select>
 
+    <!-- V1.5废弃 -->
     <select id="selectTimeoutTsCountForDay" resultType="Map">with t1 as (select compl_area_local,
         is_timeout from report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1
         for 6) and day_id &lt;= substring(#{day} from 7 for 2)), t2 as (select '全省' as
@@ -67,6 +71,7 @@
         t4.total_num::float8 as timeout_ratio from t4,t9 where t4.compl_area_local =
         t9.compl_area_local</select>
 
+    <!-- V1.5废弃 -->
     <select id="selectRepeatTsCountForDay" resultType="Map"> with t1 as (select compl_area_local,
         busi_no from report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1 for
         6) and day_id &lt;= substring(#{day} from 7 for 2)), t2 as (select distinct * from t1), t3
@@ -78,20 +83,24 @@
         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 </select>
 
+    <!-- V1.5废弃 -->
     <select id="selectCityTslForMonth" resultType="Map"> select compl_area_local, day_id, count(1)
         as num from report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1 for
         6) and day_id &lt;= substring(#{day} from 7 for 2) group by compl_area_local, day_id order
         by compl_area_local,day_id </select>
 
+    <!-- V1.5废弃 -->
     <select id="selectAllTslForMonth" resultType="Map"> select day_id, count(1) as num from
         report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1 for 6) and day_id
         &lt;= substring(#{day} from 7 for 2) group by day_id order by day_id </select>
 
+    <!-- V1.5废弃 -->
     <select id="selectCityAllForMonth" resultType="Map">select compl_area_local, count(1) as num
         from report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1 for 6) and
         day_id &lt;= substring(#{day} from 7 for 2) group by compl_area_local order by
         compl_area_local </select>
 
+    <!-- V1.5废弃 -->
     <select id="selectAllForMonth" resultType="int">select count(1) as num from
         report_auto.he_d_mobile_comp hdmc where month_id = substring(#{day} from 1 for 6) and day_id
         &lt;= substring(#{day} from 7 for 2)</select>
@@ -112,6 +121,7 @@
     <delete id="deleteHighQualityForDay" parameterType="string">delete from
         report_auto.he_d_high_quality hdhq where acct_date = #{day}</delete>
 
+    <!-- V1.5废弃 -->
     <delete id="deleteMobileCompForDay" parameterType="string">delete from
         report_auto.he_d_mobile_comp hdmc where acct_date = #{day}</delete>
 

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

@@ -1,19 +1,8 @@
 package com.nokia.tsl_data;
 
-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.TslReportService;
-
 @SpringBootTest
 public class TslDataApplicationTest {
 
-    @Autowired
-    private TslReportService service;
-
-    @Test
-    void test() {
-        service.workbookToFile("20230527", "D:/src/output.xlsx");
-    }
 }