|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.yingji.quartz;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
@ -49,6 +50,7 @@ public class AlarmQuartz {
|
|
|
|
|
public void savaData() {
|
|
|
|
|
// 获取token
|
|
|
|
|
String token = alarmService.getToken();
|
|
|
|
|
if (StrUtil.isNotEmpty(token)) {
|
|
|
|
|
// 查询所有id
|
|
|
|
|
List<String> idList = findId(token);
|
|
|
|
|
// 根据id查询数据保存
|
|
|
|
@ -57,6 +59,9 @@ public class AlarmQuartz {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(idList)) {
|
|
|
|
|
emergencyAlgorithm();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.error("============110算法接口获取token失败=============");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -101,7 +106,7 @@ public class AlarmQuartz {
|
|
|
|
|
alarmRequest.setValue(x);
|
|
|
|
|
// 查询数据
|
|
|
|
|
Alarm alarm = alarmService.findDataList(alarmRequest, token);
|
|
|
|
|
if (alarm != null) {
|
|
|
|
|
if (BeanUtil.isNotEmpty(alarm)) {
|
|
|
|
|
alarm.setSourceId(x);
|
|
|
|
|
list.add(alarm);
|
|
|
|
|
successNum++;
|
|
|
|
@ -110,14 +115,20 @@ public class AlarmQuartz {
|
|
|
|
|
int randomNumber = random.nextInt(101) + 100;
|
|
|
|
|
Thread.sleep(randomNumber);
|
|
|
|
|
} else {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
alarmService.saveAll(list);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.info("==========================" + e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
alarmService.saveAll(list);
|
|
|
|
|
}
|
|
|
|
|
log.info("成功条数==========================" + successNum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -156,7 +167,8 @@ public class AlarmQuartz {
|
|
|
|
|
if (data == null) {
|
|
|
|
|
return idList;
|
|
|
|
|
}
|
|
|
|
|
sourceService.addList(data);
|
|
|
|
|
// todo 注释保存id
|
|
|
|
|
// sourceService.addList(data);
|
|
|
|
|
idList.addAll(data);
|
|
|
|
|
size += data.size();
|
|
|
|
|
if (data.size() == pageSize) {
|
|
|
|
|