|
|
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -80,7 +81,7 @@ public class YbqScheduler {
|
|
|
log.info("【开始执行】同步预测数据任务,当前时间: {}", startDate);
|
|
|
for (YbqTypeConst ybqTypeConst : ybqTypeConsts) {
|
|
|
try {
|
|
|
- log.debug("正在处理设备类型: {}", ybqTypeConst.getMessage());
|
|
|
+ log.info("正在处理设备类型: {}", ybqTypeConst.getMessage());
|
|
|
// 同步赤霉病设备预测数据
|
|
|
List<IotDevice> iotDevices = getDevListByServiceName(ybqTypeConst.getServiceName());
|
|
|
for (IotDevice iotDevice : iotDevices) {
|
|
|
@@ -153,7 +154,7 @@ public class YbqScheduler {
|
|
|
//预测value
|
|
|
jsonObject.put("computeValue", value);
|
|
|
iIotDeviceService.updateIotDeviceExtInfo(devBid, jsonObject.toString());
|
|
|
- log.debug("设备ID={} 的预测数据处理成功,computeDate={}, value={}", iotDevice.getDevBid(), computeDate, value);
|
|
|
+ log.info("设备ID={} 的预测数据处理成功,computeDate={}, value={}", iotDevice.getDevBid(), computeDate, value);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理设备ID={} 的预测数据时出错: ", iotDevice.getDevBid(), e);
|
|
|
@@ -178,8 +179,10 @@ public class YbqScheduler {
|
|
|
* 延迟10分钟再拉取
|
|
|
* 我们:从10分开始,每一个小时拉取一次
|
|
|
*/
|
|
|
- @Scheduled(cron = "0 10/59 0/1 * * ? ")
|
|
|
+ //@Scheduled(cron = "0 10/59 0/1 * * ? ")
|
|
|
+ @Scheduled(cron = "0 0/2 0/1 * * ?")
|
|
|
public void synReportData() {
|
|
|
+ synPredictedData();
|
|
|
String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(new Date(), -20));
|
|
|
String endTime = DateUtils.dateTimeNow();
|
|
|
log.info("【开始】同步上报数据任务执行于 {}", endTime);
|
|
|
@@ -270,7 +273,7 @@ public class YbqScheduler {
|
|
|
try {
|
|
|
|
|
|
|
|
|
- String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(new Date(), -600 * 20));
|
|
|
+ String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addDays(new Date(), -30*3));
|
|
|
String endTime = DateUtils.dateTimeNow();
|
|
|
|
|
|
//预测数据的时间,20200101格式
|
|
|
@@ -315,7 +318,8 @@ public class YbqScheduler {
|
|
|
*/
|
|
|
public List<IotDevice> getDevListByServiceName(String serviceName) {
|
|
|
log.debug("开始根据服务名称 [{}] 查询设备", serviceName);
|
|
|
- List<IotDevice> iotDevices = iIotDeviceService.selectAllDeviceByDeviceServiceName(serviceName);
|
|
|
+ List<String> devTypeBidList = Arrays.asList(serviceName);
|
|
|
+ List<IotDevice> iotDevices = iIotDeviceService.selectIotDeviceByDevtypeBidList(devTypeBidList);
|
|
|
log.debug("根据服务名称 [{}] 查询到 {} 台设备", serviceName, iotDevices.size());
|
|
|
return iotDevices;
|
|
|
}
|