|
@@ -2,7 +2,6 @@ package com.nokia.tsl_data.service;
|
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
-import java.io.FileNotFoundException;
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@@ -17,8 +16,6 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-
|
|
|
|
import com.nokia.common.excel.entity.CellRect;
|
|
import com.nokia.common.excel.entity.CellRect;
|
|
import com.nokia.common.excel.poi.PoiUtil;
|
|
import com.nokia.common.excel.poi.PoiUtil;
|
|
import com.nokia.common.message.pushmessage.PushMessageUtil;
|
|
import com.nokia.common.message.pushmessage.PushMessageUtil;
|
|
@@ -56,32 +53,25 @@ public class TslTaskService {
|
|
*
|
|
*
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public Runnable cronTask() {
|
|
|
|
- return new Runnable() {
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void run() {
|
|
|
|
- // 获取入参 day
|
|
|
|
- String day = new SimpleDateFormat("yyyyMMdd")
|
|
|
|
- .format(new Date(System.currentTimeMillis() - 1000L * 3600 * 24));
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- // 检查数据源
|
|
|
|
- checkSrcExsit(day);
|
|
|
|
- // 数据入库
|
|
|
|
- dataWaraHouseTask(day);
|
|
|
|
- // 生成xlsx
|
|
|
|
- reportGenerateTask(day);
|
|
|
|
- // 截图
|
|
|
|
- screenShotTask(day);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- log.error("定时任务出错--{}", e.getMessage());
|
|
|
|
- e.printStackTrace();
|
|
|
|
- pushMessageUtil.sendTextMessage("定时任务出错--" + e.getMessage());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
|
|
+ public void cronTask() {
|
|
|
|
+ // 获取入参 day
|
|
|
|
+ String day = new SimpleDateFormat("yyyyMMdd")
|
|
|
|
+ .format(new Date(System.currentTimeMillis() - 1000L * 3600 * 24));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ // 检查数据源
|
|
|
|
+ checkSrcExsit(day);
|
|
|
|
+ // 数据入库
|
|
|
|
+ tslWaraHouseService.dataWaraHouseTask(day);
|
|
|
|
+ // 生成xlsx
|
|
|
|
+ reportGenerateTask(day);
|
|
|
|
+ // 截图
|
|
|
|
+ screenShotTask(day);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("定时任务出错--{}", e.getMessage());
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ pushMessageUtil.sendTextMessage("定时任务出错--" + e.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -177,17 +167,4 @@ public class TslTaskService {
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 数据入库任务
|
|
|
|
- *
|
|
|
|
- * @param day
|
|
|
|
- * @throws IOException
|
|
|
|
- * @throws FileNotFoundException
|
|
|
|
- */
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void dataWaraHouseTask(String day) throws FileNotFoundException, IOException {
|
|
|
|
- tslWaraHouseService.waraHouseHighQuality(day);
|
|
|
|
- tslWaraHouseService.waraHouseMobileComp(day);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|