From c9f838b5abe92208e58b62d309a91a8c9686f7ec Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Wed, 25 May 2022 13:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/service/MonitorService.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index 6f35388..856b967 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -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 labels = boothMapper.selectBooth("11:20"); + List 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 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 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 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 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> request = new HttpEntity<>(map,headers); ResponseEntity 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 results = (List) entityBody.get("results"); if(!results.isEmpty()){ list.addAll(results);