积水点添加统计分析接口

摄像头抓图接口
This commit is contained in:
wuweida 2022-07-12 18:05:16 +08:00
parent 32db797ebc
commit 535d38ce4a
7 changed files with 129 additions and 28 deletions

View File

@ -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<WaterPoint> waterPoints = waterPointMapper.selectWaterPoint();
List<WaterPointDto> waterPoints = waterPointMapper.selectWaterPoint();
Result success = Result.success(waterPoints);
return success;
}
@GetMapping("selectReportOrigin")
public Result selectReportOrigin(String reportOrigin){
List<WaterPointDto> 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<WaterPointDtos> waterCameras = waterPointMapper.selectCountWater();
Result success = Result.success(waterCameras);
return success;
}
@GetMapping("selectCountWaters")
public Result selectCountWaters(){
List<WaterPointDtos> waterCameras = waterPointMapper.selectCountWaters();
Result success = Result.success(waterCameras);
return success;
}
@GetMapping("selectCountLevel")
public Result selectCountLevel(){
List<WaterPointDtos> waterCameras = waterPointMapper.selectCountLevel();
Result success = Result.success(waterCameras);
return success;
}
}

View File

@ -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无积水
}

View File

@ -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;
}

View File

@ -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;//现场情况说明
}

View File

@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
List<CameraChannelNLDto> 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<CameraChannel> selectCameraChannel();
}

View File

@ -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<WaterPoint> {
@Select("select * from water_point where audit_flag = '2' and disp_flag in (0,1)")
List<WaterPoint> 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<WaterPointDto> selectWaterPoint();
@Select("select * from water_point where audit_flag = '2' and disp_flag in (0,1) and report_origin = #{reportOrigin}")
List<WaterPointDto> 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<WaterCameraDto> 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<WaterPointDtos> 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<WaterPointDtos> 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<WaterPointDtos> selectCountLevel();
}

View File

@ -297,31 +297,40 @@ public class MonitorService {
log.info("[monitor-capture]: start capture");
List<CameraChannel> 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<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());
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<CameraChannel> 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){