摄像头截图更新

This commit is contained in:
wuweida 2022-07-12 15:47:50 +08:00
parent 780e172c77
commit 32db797ebc
4 changed files with 39 additions and 17 deletions

View File

@ -301,13 +301,8 @@ public class Controller {
@ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"),
@ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer")
})
public Result selectNLAll(Integer page,Integer pageSize,String labelCode){
public Result selectNLAll(Integer page,Integer pageSize){
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize);
if (labelCode != null && labelCode != ""){
List<CameraChannelNLDto> dtos = cameraChannelMapper.selectByLabel(page, pageSize);
Result success = Result.success(dtos);
return success;
}
Result success = Result.success(selectNLAll);
return success;
}

View File

@ -56,9 +56,8 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Param("gpsY") Double gpsY,
@Param("gpsY1") Double gpsY1);
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
List<CameraChannelNLDto> selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("SELECT * FROM t_camera_channel WHERE channel_code > '183_37028312581314000628' ORDER BY channel_code DESC" )
List<CameraChannel> selectCameraChannel();
}

View File

@ -292,6 +292,42 @@ public class MonitorService {
}
}
public void CameraScreenshot () {
try {
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);
}
});
log.info("[monitor-capture]: end capture");
}catch (Exception exception){
exception.printStackTrace();
}
}
/**
* 海水浴场人群图片算法识别
*/

View File

@ -32,12 +32,4 @@
limit #{page},#{pageSize}
</select>
<select id="selectByLabel" resultType="com.hisense.monitormanage.dto.CameraChannelNLDto">
SELECT a.label_name,d.* from t_label a JOIN (select b.label_code,c.* from t_camera_channel c
JOIN t_channel_mtm_label b on c.channel_code = b.channel_code where b.label_code != '') d
on d.label_code = a.label_code
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</select>
</mapper>