lifuquan 1 жил өмнө
parent
commit
23566e5cc9

+ 5 - 1
README.md

@@ -1,11 +1,15 @@
 # REPORT_AUTO
 
-nohup java -jar tsl_data-1.3-exec.jar >output.log 2>&1 &
+nohup java -jar tsl_data-1.4-exec.jar >output.log 2>&1 &
 
 nohup java -jar dingtalk_auto-1.1-exec.jar >output.log 2>&1 &
 
 ## tsl_data版本说明
 
+### v1.4
+
+1. 修复了在某个地市某天投诉量为0时导致的错误。
+
 ### V1.3
 
 1. 新增了手动删除管理端和客户端数据的接口

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

@@ -1,5 +1,25 @@
 # 手动入库数据
 
+## 手动发送
+
+```http
+POST http://192.168.31.10:11111/tsl/task/send HTTP/1.1
+Content-Type:application/json
+
+20230524
+```
+
+> 注意:文件缺失时不需要手动入库和生成报表,当前已经加入了等待,检查的机制。发送的逻辑后续需要修改一下。
+
+## 手动生成报表
+
+```http
+POST http://192.168.10.7:29100/tsl/task/report/generate HTTP/1.1
+Content-Type:application/json
+
+20230524
+```
+
 ## 数据手动入库
 
 - 两个表一起
@@ -8,7 +28,7 @@
 POST http://192.168.10.7:29100/tsl/task/warahouse HTTP/1.1
 Content-Type:application/json
 
-20230522
+20230524
 ```
 
 - report_auto.he_d_mobile_comp
@@ -17,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
 
-20230520
+20230524
 ```
 
 - report_auto.he_d_high_quality
@@ -35,7 +55,7 @@ Content-Type:application/json
 POST http://192.168.10.7:29100/tsl/task/check/srcfile HTTP/1.1
 Content-Type:application/json
 
-20230502
+20230524
 ```
 
 ## 删除数据
@@ -46,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
 
-20230520
+20230524
 ```
 
 - report_auto.he_d_high_quality

+ 1 - 1
tsl_data/pom.xml

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

+ 18 - 0
tsl_data/src/main/java/com/nokia/tsl_data/config/SpringContextHolderConfig.java

@@ -0,0 +1,18 @@
+package com.nokia.tsl_data.config;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.nokia.common.spring.SpringContextHolder;
+
+@Configuration
+public class SpringContextHolderConfig {
+    
+    @Bean
+    public SpringContextHolder springContextHolder(ApplicationContext applicationContext) {
+        SpringContextHolder springContextHolder = new SpringContextHolder();
+        springContextHolder.setApplicationContext(applicationContext);
+        return springContextHolder;
+    }
+}

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

@@ -335,7 +335,7 @@ public class TslDataService {
     /**
      * 管理端-移网质量类
      * 
-     * @param day
+     * @param day 20230527
      * @return
      */
     public Map<String, List<Object>> getSheet1Data(String day) {
@@ -360,15 +360,22 @@ public class TslDataService {
         // 目标投诉率
         List<Map<String, Object>> targetTsRatio = tslDao.selectTargetTsRatioForMonth(monthId);
 
+        int dayIndex = Integer.parseInt(day.substring(6, 8));
         Map<String, List<Object>> result = new HashMap<>();
         for (String area : areas) {
-            result.put(area, new ArrayList<>());
+            List<Object> list = new ArrayList<>();
+            // 需要初始化一下
+            for (int i = 0; i < dayIndex; i++) {
+                list.add(0);
+            }
+            result.put(area, list);
         }
         result.put("全省", new ArrayList<>());
 
         // 各地市每日投诉量
         for (Map<String, Object> map : cityTslforMonth) {
-            result.get(map.get("compl_area_local")).add(map.get("num"));
+            int dayId = Integer.parseInt(map.get("day_id").toString());
+            result.get(map.get("compl_area_local")).set(dayId - 1, map.get("num"));
         }
         // 全省每日投诉量
         for (Map<String, Object> map : allTslforMonth) {

+ 4 - 3
tsl_data/src/main/java/com/nokia/tsl_data/service/TslWaraHouseService.java

@@ -13,13 +13,13 @@ import java.util.List;
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVParser;
 import org.apache.commons.csv.CSVRecord;
-import org.springframework.aop.framework.AopContext;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.nokia.common.spring.SpringContextHolder;
 import com.nokia.tsl_data.dao.TslDao;
 
 import lombok.extern.slf4j.Slf4j;
@@ -151,8 +151,9 @@ public class TslWaraHouseService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void dataWaraHouseTask(String day) throws FileNotFoundException, IOException {
-        ((TslWaraHouseService) AopContext.currentProxy()).waraHouseHighQuality(day);
-        ((TslWaraHouseService) AopContext.currentProxy()).waraHouseMobileComp(day);
+        TslWaraHouseService service = SpringContextHolder.getBean(TslWaraHouseService.class);
+        service.waraHouseHighQuality(day);
+        service.waraHouseMobileComp(day);
     }
 
     /**

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

@@ -1,8 +1,19 @@
 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");
+    }
 }