|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.framework.web.service.ConfigService;
|
|
import com.ruoyi.framework.web.service.ConfigService;
|
|
|
|
+import com.ruoyi.monitorInterface.inserctpests.service.PlantDiseasesAndInsectPestsService;
|
|
import com.ruoyi.monitorInterface.sennor.service.SennorService;
|
|
import com.ruoyi.monitorInterface.sennor.service.SennorService;
|
|
import org.apache.commons.lang3.time.FastDateFormat;
|
|
import org.apache.commons.lang3.time.FastDateFormat;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -31,6 +32,9 @@ public class StaticScheduleTask {
|
|
private SennorService sennorService;
|
|
private SennorService sennorService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private PlantDiseasesAndInsectPestsService plantDiseasesAndInsectPestsService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
private ConfigService configService;
|
|
private ConfigService configService;
|
|
|
|
|
|
//添加定时任务 每三分钟执行
|
|
//添加定时任务 每三分钟执行
|
|
@@ -46,6 +50,19 @@ public class StaticScheduleTask {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //添加定时任务 每五分钟执行
|
|
|
|
+ @Scheduled(cron = "0 */5 * * * ?")
|
|
|
|
+ private void configureTask() {
|
|
|
|
+
|
|
|
|
+ logger.info("执行定时任务=>{}", DateUtils.dateTimeNow());
|
|
|
|
+ String types = configService.getKey("sennorDeviceType");
|
|
|
|
+ JSONArray jsonArray = plantDiseasesAndInsectPestsService.getDevideCodeMapByType(types);
|
|
|
|
+ for (Object object : jsonArray){
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(object.toString());
|
|
|
|
+ plantDiseasesAndInsectPestsService.plantDiseasesAndInsectPestsMessageReceiver(jsonObject.getString("device_code"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 比较两个日期大小
|
|
* 比较两个日期大小
|