|
|
|
@ -3,7 +3,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.date.DateTime;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
@ -22,7 +21,11 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 110数据保存定时任务
|
|
|
|
@ -50,26 +53,30 @@ public class AlarmQuartz {
|
|
|
|
|
@Async
|
|
|
|
|
@Scheduled(cron = "0 */1 * * * ? ")
|
|
|
|
|
public void savaData() {
|
|
|
|
|
// 获取token
|
|
|
|
|
String token = alarmService.getToken();
|
|
|
|
|
QuartzLog quartzLog = new QuartzLog();
|
|
|
|
|
quartzLog.setInterfaceName(1);
|
|
|
|
|
quartzLog.setCreateTime(LocalDateTime.now());
|
|
|
|
|
if (StrUtil.isNotEmpty(token)) {
|
|
|
|
|
// 查询所有id
|
|
|
|
|
List<String> idList = findId(token);
|
|
|
|
|
// 根据id查询数据保存
|
|
|
|
|
addList(idList, token);
|
|
|
|
|
// 110算法接口
|
|
|
|
|
if (CollectionUtil.isNotEmpty(idList)) {
|
|
|
|
|
emergencyAlgorithm();
|
|
|
|
|
try {
|
|
|
|
|
// 获取token
|
|
|
|
|
String token = alarmService.getToken();
|
|
|
|
|
if (StrUtil.isNotEmpty(token)) {
|
|
|
|
|
// 查询所有id
|
|
|
|
|
List<String> idList = findId(token);
|
|
|
|
|
// 根据id查询数据保存
|
|
|
|
|
addList(idList, token);
|
|
|
|
|
// 110算法接口
|
|
|
|
|
if (CollectionUtil.isNotEmpty(idList)) {
|
|
|
|
|
emergencyAlgorithm();
|
|
|
|
|
}
|
|
|
|
|
quartzLog.setStatus(1);
|
|
|
|
|
} else {
|
|
|
|
|
quartzLog.setStatus(2);
|
|
|
|
|
log.error("============110算法接口获取token失败=============");
|
|
|
|
|
}
|
|
|
|
|
quartzLog.setStatus(1);
|
|
|
|
|
quartzLogService.save(quartzLog);
|
|
|
|
|
} else {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
quartzLog.setStatus(2);
|
|
|
|
|
} finally {
|
|
|
|
|
quartzLogService.save(quartzLog);
|
|
|
|
|
log.error("============110算法接口获取token失败=============");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|