定时任务修改

This commit is contained in:
wuweida 2022-05-25 13:38:31 +08:00
parent e2e75fec3f
commit c9f838b5ab
1 changed files with 19 additions and 16 deletions

View File

@ -328,12 +328,12 @@ public class MonitorService {
exception.printStackTrace();
}
}
@Scheduled(cron = "0 20 11 * * ? ")
@Scheduled(cron = "0 20 9 * * ? ")
public void screenShot6() {
try {
log.info("[monitor-capture]: start capture1");
List<Booth> labels = boothMapper.selectBooth("11:20");
List<Booth> labels = boothMapper.selectBooth("9:20");
labels.forEach(label -> {
String channelCode = label.getChannelCode();
try {
@ -463,16 +463,16 @@ public class MonitorService {
ChannelPicture picture = new ChannelPicture();
picture.setChannelCode(channelCode);
picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/
if (channelCode == null){
picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);
/*if (channelCode == null){
channelPictureMapper.insert(picture);
}else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper);
}
}*/
}catch (Exception e){
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
@ -543,16 +543,16 @@ public class MonitorService {
ChannelPicture picture = new ChannelPicture();
picture.setChannelCode(channelCode);
picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/
if (channelCode == null){
picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);
/*if (channelCode == null){
channelPictureMapper.insert(picture);
}else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper);
}
}*/
}catch (Exception e){
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
@ -585,16 +585,16 @@ public class MonitorService {
ChannelPicture picture = new ChannelPicture();
picture.setChannelCode(channelCode);
picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/
if (channelCode == null){
picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);
/*if (channelCode == null){
channelPictureMapper.insert(picture);
}else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper);
}
}*/
}catch (Exception e){
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
@ -791,9 +791,9 @@ public class MonitorService {
//获取当前时间和前一天的UTC时间
Map<String,Object> condition = new HashMap<>();
ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC);
ZonedDateTime startUTC = endUTC.minusDays(30);
ZonedDateTime startUTC = endUTC.minusDays(100);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
condition.put("checkStatus",0);
condition.put("checkStatus",1);
condition.put("startTime",startUTC);
condition.put("endTime",endUTC);
//组装查询条件经过验证pageSize设置过大也没效果最大512
@ -814,6 +814,9 @@ public class MonitorService {
HttpEntity<Map<String,Object>> request = new HttpEntity<>(map,headers);
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class );
JSONObject entityBody = responseEntity.getBody();
if (entityBody.get("i18n") != null && entityBody.get("i18n").toString() == "error"){
log.info("{}程序异常{}",entityBody.get("message").toString());
}
List<Map> results = (List<Map>) entityBody.get("results");
if(!results.isEmpty()){
list.addAll(results);