From 535d38ce4ae90de37e4bcb1c06e241784c2e04a5 Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Tue, 12 Jul 2022 18:05:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E6=B0=B4=E7=82=B9=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E6=8A=93=E5=9B=BE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WaterPointController.java | 31 ++++++++++- .../monitormanage/dto/WaterPointDto.java | 34 ++++++++++++ .../monitormanage/dto/WaterPointDtos.java | 11 ++++ .../monitormanage/entity/WaterPoint.java | 4 +- .../mapper/CameraChannelMapper.java | 2 +- .../mapper/WaterPointMapper.java | 20 ++++++- .../monitormanage/service/MonitorService.java | 55 +++++++++++-------- 7 files changed, 129 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/hisense/monitormanage/dto/WaterPointDto.java create mode 100644 src/main/java/com/hisense/monitormanage/dto/WaterPointDtos.java diff --git a/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java b/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java index 6d39d40..5448e2e 100644 --- a/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java +++ b/src/main/java/com/hisense/monitormanage/controller/WaterPointController.java @@ -1,6 +1,8 @@ package com.hisense.monitormanage.controller; import com.hisense.monitormanage.dto.WaterCameraDto; +import com.hisense.monitormanage.dto.WaterPointDto; +import com.hisense.monitormanage.dto.WaterPointDtos; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.entity.WaterPoint; import com.hisense.monitormanage.mapper.WaterPointMapper; @@ -19,7 +21,14 @@ public class WaterPointController { @GetMapping("selectWaterPoint") public Result selectWaterPoint(){ - List waterPoints = waterPointMapper.selectWaterPoint(); + List waterPoints = waterPointMapper.selectWaterPoint(); + Result success = Result.success(waterPoints); + return success; + } + + @GetMapping("selectReportOrigin") + public Result selectReportOrigin(String reportOrigin){ + List waterPoints = waterPointMapper.selectReportOrigin(reportOrigin); Result success = Result.success(waterPoints); return success; } @@ -31,4 +40,24 @@ public class WaterPointController { return success; } + @GetMapping("selectCountWater") + public Result selectCountWater(){ + List waterCameras = waterPointMapper.selectCountWater(); + Result success = Result.success(waterCameras); + return success; + } + + @GetMapping("selectCountWaters") + public Result selectCountWaters(){ + List waterCameras = waterPointMapper.selectCountWaters(); + Result success = Result.success(waterCameras); + return success; + } + + @GetMapping("selectCountLevel") + public Result selectCountLevel(){ + List waterCameras = waterPointMapper.selectCountLevel(); + Result success = Result.success(waterCameras); + return success; + } } diff --git a/src/main/java/com/hisense/monitormanage/dto/WaterPointDto.java b/src/main/java/com/hisense/monitormanage/dto/WaterPointDto.java new file mode 100644 index 0000000..7c8badc --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/WaterPointDto.java @@ -0,0 +1,34 @@ +package com.hisense.monitormanage.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class WaterPointDto { + private String waterPointId; + private String waterPointName;//积水点名称 + private String districtId;//所属区域ID + private String address;//地址 + private String pointType;//积水点类型1:路段;2:桥下;3:洞内;4:小区 + private String uuid;//地址坐标ID + private BigDecimal longitude;//经度 + private BigDecimal latitude;//纬度 + private String charge;//负责人 + private String chargeTel;//负责人电话 + private String remark;//备注 + private String delFlag;//删除状态 + private String createdDate;//创建时间 + private String createdBy;//创建人ID + private String updatedDate;//更新时间 + private String updatedBy;//更新人ID + private String reportOrigin;//上报来源:auditorReport--水务集团上报;commonReport--群众上报;case--城管案例;video--视频感知 + private String isEasyPoint;//是否易积水点;0是 1否 + private String dispFlag;//0未处置 1处置中 2处置完成 + private String auditFlag;//审核状态;0未审核; 1审核不通过;2审核通过 + private String upNum;//点赞数量 + private String underNum;//点踩数量 + private String addressDesc;//详细地址描述 + private String waterPointDesc;//现场情况说明 + private String pointLevel;//积水点等级1:重度;2:中度;3:轻度;4:无积水 +} diff --git a/src/main/java/com/hisense/monitormanage/dto/WaterPointDtos.java b/src/main/java/com/hisense/monitormanage/dto/WaterPointDtos.java new file mode 100644 index 0000000..b7766e2 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/WaterPointDtos.java @@ -0,0 +1,11 @@ +package com.hisense.monitormanage.dto; + +import lombok.Data; + +@Data +public class WaterPointDtos { + private String reportOrigin; + private String ssqy; + private Integer count; + private String pointLevel; +} diff --git a/src/main/java/com/hisense/monitormanage/entity/WaterPoint.java b/src/main/java/com/hisense/monitormanage/entity/WaterPoint.java index 8355631..6e33906 100644 --- a/src/main/java/com/hisense/monitormanage/entity/WaterPoint.java +++ b/src/main/java/com/hisense/monitormanage/entity/WaterPoint.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; @Data @TableName("water_point") public class WaterPoint { - private Integer waterPointId; + private String waterPointId; private String waterPointName;//积水点名称 private String districtId;//所属区域ID private String address;//地址 @@ -30,4 +30,6 @@ public class WaterPoint { private String auditFlag;//审核状态;0未审核; 1审核不通过;2审核通过 private String upNum;//点赞数量 private String underNum;//点踩数量 + private String addressDesc;//详细地址描述 + private String waterPointDesc;//现场情况说明 } diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 98a9b7e..abf3e89 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper { List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("SELECT * FROM t_camera_channel WHERE channel_code > '183_37028312581314000628' ORDER BY channel_code DESC" ) + @Select("SELECT * FROM t_camera_channel WHERE channel_code > '404_37020348001325000037' ORDER BY channel_code DESC" ) List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java b/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java index 81511a4..e2ef358 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/WaterPointMapper.java @@ -2,6 +2,8 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.WaterCameraDto; +import com.hisense.monitormanage.dto.WaterPointDto; +import com.hisense.monitormanage.dto.WaterPointDtos; import com.hisense.monitormanage.entity.WaterPoint; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; @@ -10,9 +12,23 @@ import java.util.List; @Repository public interface WaterPointMapper extends BaseMapper { - @Select("select * from water_point where audit_flag = '2' and disp_flag in (0,1)") - List selectWaterPoint(); + @Select("select * from water_point wp LEFT JOIN water_point_report wpr ON wp.water_point_id = wpr.water_point_id WHERE wp.audit_flag = '2' and wp.disp_flag in (0,1)") + List selectWaterPoint(); + + @Select("select * from water_point where audit_flag = '2' and disp_flag in (0,1) and report_origin = #{reportOrigin}") + List selectReportOrigin(String reportOrigin); @Select("SELECT * FROM w_camera w RIGHT JOIN water_camera wc ON w.water_id = wc.water_id where wc.water_point_name = #{waterPointName}") List selectCameraByName(String waterPointName); + + @Select("select wc.ssqy,COUNT(*) as count from water_point wp JOIN water_camera wc ON wp.water_point_name = wc.water_point_name WHERE wp.audit_flag = '2' and wp.disp_flag in (0,1) GROUP BY wc.ssqy") + List selectCountWater(); + + @Select("select report_origin,COUNT(*) as count from water_point where audit_flag = '2' and disp_flag in (0,1) GROUP BY report_origin") + List selectCountWaters(); + + @Select("select wpr.point_level,COUNT(*) as count from water_point wp LEFT JOIN water_point_report wpr ON wp.water_point_id = wpr.water_point_id WHERE wp.audit_flag = '2' and wp.disp_flag in (0,1) GROUP BY wpr.point_level") + List selectCountLevel(); + + } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index 2495d6c..a81c5b1 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -297,31 +297,40 @@ public class MonitorService { log.info("[monitor-capture]: start capture"); List cameraChannels = cameraChannelMapper.selectCameraChannel(); - cameraChannels.forEach(channel -> { - String channelCode = channel.getChannelCode(); - try { - BufferedImage bufferedImage = capturecreenshot(channelCode); - String fileName = channelCode + ".jpg"; - ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName)); - String picUrl = picHost + "/images/" + fileName; - ChannelPicture picture = new ChannelPicture(); - picture.setChannelCode(channelCode); - picture.setPicUrl(picUrl); - 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()); - channel.setCheckStatus(0); + cameraChannels.forEach(channel -> { + int i = 5; + while ( i > 0){ + String channelCode = channel.getChannelCode(); + try { + BufferedImage bufferedImage = capturecreenshot(channelCode); + String fileName = channelCode + ".jpg"; + ImageIO.write(bufferedImage, "jpg", new File(fileDir + "/images/" + fileName)); + String picUrl = picHost + "/images/" + fileName; + ChannelPicture picture = new ChannelPicture(); + picture.setChannelCode(channelCode); + picture.setPicUrl(picUrl); + picture.setInsertTime(new Date()); + channelPictureMapper.insert(picture); + i=0; + }catch (Exception e){ + log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); + i--; + if (i == 0){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("channel_code",channelCode); + CameraChannel cameraChannel = cameraChannelMapper.selectOne(queryWrapper); + cameraChannel.setCheckStatus(0); + cameraChannelMapper.update(cameraChannel,queryWrapper); + } + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + interruptedException.printStackTrace(); + } + } } + }); log.info("[monitor-capture]: end capture"); }catch (Exception exception){