新增图片告警

dev
liuguijing 2 years ago
parent c0af8cca0c
commit 0d666e0f28

@ -0,0 +1,59 @@
package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
@Data
public class TerminalImgAlarmsAndPhotoDto implements Serializable {
private BigInteger id;
private Integer termId;
private Integer channelId;
private Integer presetId;
private BigInteger photoOrgId;
private BigInteger alarmTime;
private Integer label;
private String name;
private String enname;
private Float prob;
private Float x;
private Float y;
private Float width;
private Float height;
private Integer isread;
private Integer mediaType;
private Integer photowidth;
private Integer photoheight;
private Integer fileSize;
private BigInteger photoTime;
private BigInteger recvTime;
private String path;
private String thumb;
private static final long serialVersionUID = 1L;
}

@ -73,6 +73,44 @@ public class TerminalPhotoListModel implements Serializable {
@ApiModelProperty(value = "拍照类型", example = "123456")
private Integer mediaType;
@ApiModelProperty(value = "是否有告警", example = "0---无告警 1---有告警")
private Integer isAlarm;
@ApiModelProperty(value = "告警列表", example = "123456")
private List<AlarmItemBean> alarmlist;
}
@Data
public static class AlarmItemBean {
@ApiModelProperty(value = "告警名称", example = "123456")
private String name;
@ApiModelProperty(value = "告警中文", example = "123456")
private String enname;
@ApiModelProperty(value = "可信度", example = "123456")
private Float prob;
@ApiModelProperty(value = " 识别框横坐标", example = "123456")
private Float x;
@ApiModelProperty(value = " 识别框纵坐标", example = "123456")
private Float y;
@ApiModelProperty(value = "识别框宽度", example = "123456")
private Float width;
@ApiModelProperty(value = "识别框高度", example = "123456")
private Float height;
@ApiModelProperty(value = "图片宽度", example = "123456")
private Integer photoWidth;
@ApiModelProperty(value = "图片高度", example = "123456")
private Integer photoHeight;
}
}

@ -76,5 +76,45 @@ public class TerminalPhotoSelectListModel implements Serializable {
@ApiModelProperty(value = "视频缩略图", example = "123456")
private String thumb;
@ApiModelProperty(value = "是否有告警", example = "0---无告警 1---有告警")
private Integer isAlarm;
@ApiModelProperty(value = "告警列表", example = "123456")
private List<TerminalPhotoListModel.AlarmItemBean> alarmlist;
}
@Data
public static class AlarmItemBean {
@ApiModelProperty(value = "告警名称", example = "123456")
private String name;
@ApiModelProperty(value = "告警中文", example = "123456")
private String enname;
@ApiModelProperty(value = "可信度", example = "123456")
private Float prob;
@ApiModelProperty(value = " 识别框横坐标", example = "123456")
private Float x;
@ApiModelProperty(value = " 识别框纵坐标", example = "123456")
private Float y;
@ApiModelProperty(value = "识别框宽度", example = "123456")
private Float width;
@ApiModelProperty(value = "识别框高度", example = "123456")
private Float height;
@ApiModelProperty(value = "图片宽度", example = "123456")
private Integer photoWidth;
@ApiModelProperty(value = "图片高度", example = "123456")
private Integer photoHeight;
}
}

@ -79,5 +79,44 @@ public class TerminalPhotosModel implements Serializable {
@ApiModelProperty(value = "视频缩略图", example = "123456")
private String thumb;
@ApiModelProperty(value = "是否有告警", example = "0---无告警 1---有告警")
private Integer isAlarm;
@ApiModelProperty(value = "告警列表", example = "123456")
private List<TerminalPhotoListModel.AlarmItemBean> alarmlist;
}
@Data
public static class AlarmItemBean {
@ApiModelProperty(value = "告警名称", example = "123456")
private String name;
@ApiModelProperty(value = "告警中文", example = "123456")
private String enname;
@ApiModelProperty(value = "可信度", example = "123456")
private Float prob;
@ApiModelProperty(value = " 识别框横坐标", example = "123456")
private Float x;
@ApiModelProperty(value = " 识别框纵坐标", example = "123456")
private Float y;
@ApiModelProperty(value = "识别框宽度", example = "123456")
private Float width;
@ApiModelProperty(value = "识别框高度", example = "123456")
private Float height;
@ApiModelProperty(value = "图片宽度", example = "123456")
private Integer photoWidth;
@ApiModelProperty(value = "图片高度", example = "123456")
private Integer photoHeight;
}
}

@ -5,11 +5,14 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TerminalImgAlarmsDto;
import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalChannels;
import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.model.TerminalPhotoListModel;
import com.shxy.xymanager_common.model.TerminalPhotoSelectListModel;
import com.shxy.xymanager_common.model.TerminalPhotosModel;
import com.shxy.xymanager_common.util.MyDateUtils;
@ -130,7 +133,7 @@ public class TerminalUtils {
* @param photoList
* @return
*/
public static List<TerminalPhotosModel.PhotosBean> setPhotoList(String requestIp, List<TerminalChannelMapper> list, Map<Integer, LineAndDyNameDto> lineMap, Map<String, TerminalChannelMapper> termchannelMapMap, Map<Integer, Terminals> terminalMap, Map<Integer, TerminalChannels> termchannelMap, Map<Integer, TowerDto> towerMap, List<TerminalPhoto> photoList) {
public static List<TerminalPhotosModel.PhotosBean> setPhotoList(String requestIp, List<TerminalChannelMapper> list, Map<Integer, LineAndDyNameDto> lineMap, Map<String, TerminalChannelMapper> termchannelMapMap, Map<Integer, Terminals> terminalMap, Map<Integer, TerminalChannels> termchannelMap, Map<Integer, TowerDto> towerMap, List<TerminalPhoto> photoList,List<TerminalImgAlarmsDto> imgarlarmsList) {
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
for (TerminalChannelMapper item : list) {
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
@ -199,6 +202,41 @@ public class TerminalUtils {
photosBean.setOrginalid(terminalPhoto.getOrginalId());
photosBean.setPresetId(terminalPhoto.getPresetId());
}
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
if (imgarlarmsList != null && imgarlarmsList.size() > 0) {
Integer termId1 = terminalPhoto.getTermId();
BigInteger orginalid = terminalPhoto.getOrginalId();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null){
if(photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(terminalPhoto.getWidth());
alarmItemBean.setPhotoHeight(terminalPhoto.getHeight());
photoalarmlist.add(alarmItemBean);
}
}
}
if (photoalarmlist == null || photoalarmlist.size() == 0) {
photosBean.setIsAlarm(CommonStatus.DELETE.value());
} else {
photosBean.setIsAlarm(CommonStatus.EFFECTIVE.value());
}
photosBean.setAlarmlist(photoalarmlist);
} else {
photosBean.setIsAlarm(CommonStatus.DELETE.value());
photosBean.setAlarmlist(photoalarmlist);
}
break;
}
}
@ -221,9 +259,10 @@ public class TerminalUtils {
* @param termchannelMap
* @param towerMap
* @param photoList
* @param imgarlarmsList
* @return
*/
public static List<TerminalPhotosModel.PhotosBean> setTowerPhotoList(String requestIp, List<TerminalChannelMapper> list, Map<Integer, LineAndDyNameDto> lineMap, Map<String, TerminalChannelMapper> termchannelMapMap, Map<Integer, Terminals> terminalMap, Map<Integer, TerminalChannels> termchannelMap, Map<Integer, TowerDto> towerMap, List<TerminalPhoto> photoList) {
public static List<TerminalPhotosModel.PhotosBean> setTowerPhotoList(String requestIp, List<TerminalChannelMapper> list, Map<Integer, LineAndDyNameDto> lineMap, Map<String, TerminalChannelMapper> termchannelMapMap, Map<Integer, Terminals> terminalMap, Map<Integer, TerminalChannels> termchannelMap, Map<Integer, TowerDto> towerMap, List<TerminalPhoto> photoList, List<TerminalImgAlarmsDto> imgarlarmsList) {
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
for (TerminalChannelMapper item : list) {
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
@ -295,6 +334,40 @@ public class TerminalUtils {
photosBean.setPath(photoPath);
photosBean.setOrginalid(terminalPhoto.getOrginalId());
photosBean.setPresetId(terminalPhoto.getPresetId());
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
if (imgarlarmsList != null && imgarlarmsList.size() > 0) {
Integer termId1 = terminalPhoto.getTermId();
BigInteger orginalid = terminalPhoto.getOrginalId();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null){
if(photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(terminalPhoto.getWidth());
alarmItemBean.setPhotoHeight(terminalPhoto.getHeight());
photoalarmlist.add(alarmItemBean);
}
}
}
if (photoalarmlist == null || photoalarmlist.size() == 0) {
photosBean.setIsAlarm(CommonStatus.DELETE.value());
} else {
photosBean.setIsAlarm(CommonStatus.EFFECTIVE.value());
}
photosBean.setAlarmlist(photoalarmlist);
} else {
photosBean.setIsAlarm(CommonStatus.DELETE.value());
photosBean.setAlarmlist(photoalarmlist);
}
}
break;
}
@ -308,7 +381,7 @@ public class TerminalUtils {
}
public static List<TerminalPhotoSelectListModel.PhotoBean> fdsa(String requestIp, List<TerminalPhoto> list, Map<Integer, Terminals> terminalMap, Map<Integer, LineAndDyNameDto> lineMap, Map<Integer, TowerDto> towerMap, Map<Integer, TerminalChannels> termchannelMap, Map<String, TerminalChannelMapper> termchannelMapMap) {
public static List<TerminalPhotoSelectListModel.PhotoBean> fdsa(String requestIp, List<TerminalPhoto> list, Map<Integer, Terminals> terminalMap, Map<Integer, LineAndDyNameDto> lineMap, Map<Integer, TowerDto> towerMap, Map<Integer, TerminalChannels> termchannelMap, Map<String, TerminalChannelMapper> termchannelMapMap, List<TerminalImgAlarmsDto> imgarlarmsList) {
List<TerminalPhotoSelectListModel.PhotoBean> beans = new ArrayList<>();
for (TerminalPhoto item : list) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
@ -358,8 +431,43 @@ public class TerminalUtils {
photoBean.setPhotoTime(MyDateUtils.date(phototime));
long rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photoBean.setRecvTime(MyDateUtils.date(rectime));
beans.add(photoBean);
}
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
if (imgarlarmsList != null && imgarlarmsList.size() > 0) {
Integer termId1 = item.getTermId();
BigInteger orginalid = item.getOrginalId();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
Integer termId = dto.getTermId();
if (photoOrgId!= null && orginalid!=null && termId1!=null && termId!=null) {
if (photoOrgId.intValue() == orginalid.intValue() && termId1.intValue() == termId.intValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(item.getWidth());
alarmItemBean.setPhotoHeight(item.getHeight());
photoalarmlist.add(alarmItemBean);
}
}
}
if (photoalarmlist == null || photoalarmlist.size() == 0) {
photoBean.setIsAlarm(CommonStatus.DELETE.value());
} else {
photoBean.setIsAlarm(CommonStatus.EFFECTIVE.value());
}
photoBean.setAlarmlist(photoalarmlist);
} else {
photoBean.setIsAlarm(CommonStatus.DELETE.value());
photoBean.setAlarmlist(photoalarmlist);
}
beans.add(photoBean);
}
}
return beans;

@ -32,4 +32,8 @@ public interface TerminalChannelMapperDao {
int updateByPrimaryKeySelective(TerminalChannelMapper record);
int updateByPrimaryKey(TerminalChannelMapper record);
// terminal_img_alarms a left join terminal_img_alarm_details b on a.id = b.alarm_id,
// left join terminal_photos c on a.photo_org_id = c.orginal_id and a.term_id = c.term_id
}

@ -4,6 +4,7 @@ import com.shxy.xymanager_common.dto.GroupAlarmType;
import com.shxy.xymanager_common.dto.TerminalImgAlarmsDto;
import com.shxy.xymanager_common.entity.TerminalImgAlarmParams;
import com.shxy.xymanager_common.entity.TerminalImgAlarms;
import com.shxy.xymanager_common.entity.TerminalPhoto;
import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
@ -22,7 +23,9 @@ public interface TerminalImgAlarmsDao {
List<GroupAlarmType> groupAlarmsDetails(@Param("labellist") List<TerminalImgAlarmParams> labellist, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalImgAlarmsDto> selectAlarmsDetails(@Param("terminalidlist") List<Integer> termidlist, @Param("channel") Integer channel,@Param("labellist") List<TerminalImgAlarmParams> labellist, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalImgAlarmsDto> selectAlarmsDetails(@Param("terminalidlist") List<Integer> termidlist, @Param("channel") Integer channel, @Param("labellist") List<TerminalImgAlarmParams> labellist, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalImgAlarmsDto> selectAlarmsByTermidAndPhotoId(@Param("termlist")List<TerminalPhoto> list, @Param("labellist") List<TerminalImgAlarmParams> labellist);
int updateByPrimaryKeySelective(TerminalImgAlarms record);

@ -30,6 +30,32 @@
<result column="isread" jdbcType="INTEGER" property="isread"/>
</resultMap>
<resultMap id="AlarmsAndDetailsAndPhotoMap" type="com.shxy.xymanager_common.dto.TerminalImgAlarmsAndPhotoDto">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="TINYINT" property="channelId"/>
<result column="preset_id" jdbcType="TINYINT" property="presetId"/>
<result column="photo_org_id" jdbcType="BIGINT" property="photoOrgId"/>
<result column="alarm_time" jdbcType="BIGINT" property="alarmTime"/>
<result column="label" jdbcType="INTEGER" property="label"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="en_name" jdbcType="VARCHAR" property="enname"/>
<result column="prob" jdbcType="REAL" property="prob"/>
<result column="x" jdbcType="REAL" property="x"/>
<result column="y" jdbcType="REAL" property="y"/>
<result column="width" jdbcType="REAL" property="width"/>
<result column="height" jdbcType="REAL" property="height"/>
<result column="isread" jdbcType="INTEGER" property="isread"/>
<result column="media_type" jdbcType="INTEGER" property="mediaType"/>
<result column="width" jdbcType="INTEGER" property="photowidth"/>
<result column="height" jdbcType="INTEGER" property="photoheight"/>
<result column="file_size" jdbcType="INTEGER" property="fileSize"/>
<result column="photo_time" jdbcType="BIGINT" property="photoTime"/>
<result column="recv_time" jdbcType="BIGINT" property="recvTime"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="thumb" jdbcType="VARCHAR" property="thumb"/>
</resultMap>
<resultMap id="GroupAlarmsMap" type="com.shxy.xymanager_common.dto.GroupAlarmType">
<result column="num" jdbcType="BIGINT" property="num"/>
<result column="label" jdbcType="INTEGER" property="label"/>
@ -94,6 +120,52 @@
order by a.alarm_time desc
</select>
<select id="selectAlarmsByTermidAndPhotoId" resultMap="AlarmsAndDetailsMap">
select
b.id as id,
a.term_id as term_id,
a.channel_id as channel_id,
a.preset_id as preset_id,
a.photo_org_id as photo_org_id,
a.alarm_time as alarm_time,
b.label as label,
b.name as name,
b.en_name as en_name,
b.prob as prob,
b.x as x,
b.y as y,
b.width as width,
b.height as height,
b.isread as isread
from
terminal_img_alarms a left join terminal_img_alarm_details b on a.id = b.alarm_id
where true
<if test="termlist != null and termlist.size > 0">
and (
<foreach collection="termlist" item="item" index="index" separator="or" open="(" close=")">
<if test="item.orginalId != null and item.termId != null">
( a.term_id = #{item.termId} and a.photo_org_id = #{item.orginalId} )
</if>
</foreach>
)
</if>
<if test="labellist != null and labellist.size > 0">
and (
<foreach collection="labellist" item="item" index="index" separator="or">
(
<if test="item.label != null">
b.label = #{item.label}
</if>
<if test="item.prob != null">
and b.prob >= #{item.prob}
</if>
)
</foreach>
)
</if>
</select>
<select id="countAlarmsDetails" resultType="java.lang.Long">
select
count(*)

@ -16,6 +16,7 @@ import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
import com.shxy.xymanager_common.vo.LastTowerVo;
import com.shxy.xymanager_dao.dao.DyLevelDao;
import com.shxy.xymanager_dao.dao.TerminalChannelMapperDao;
import com.shxy.xymanager_dao.dao.TerminalImgAlarmsDao;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.DyLevelService;
@ -44,6 +45,9 @@ public class DyLevelServiceImpl implements DyLevelService {
@Autowired
TerminalPhotoDao terminalPhotoDao;
@Autowired
TerminalImgAlarmsDao terminalImgAlarmsDao;
@Autowired
CacheService cacheService;
@ -207,7 +211,25 @@ public class DyLevelServiceImpl implements DyLevelService {
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
beans = TerminalUtils.setTowerPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList);
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
List idlist = new ArrayList<>();
for (TerminalPhoto tp:photoList) {
if (tp.getOrginalId()!=null) {
idlist.add(tp.getOrginalId());
}
}
if (idlist.size() > 0) {
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(photoList, labellist);
}
beans = TerminalUtils.setTowerPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList,imgarlarmsList);
}
model.setList(beans);

@ -2,14 +2,10 @@ package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.*;
@ -24,7 +20,6 @@ import com.shxy.xymanager_common.util.xinyin.ProcessExecUtils;
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.interaction.Cma;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalPhotoService;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
@ -33,9 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.*;
/**
@ -48,6 +41,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired
TerminalPhotoDao terminalPhotoDao;
@Autowired
TerminalImgAlarmsDao terminalImgAlarmsDao;
@Autowired
TerminalsDao terminalsDao;
@ -95,7 +91,25 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
channelid = null;
}
List<TerminalPhoto> list = new ArrayList<>();
list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), channelid, BigInteger.valueOf(start), BigInteger.valueOf(end));
Integer terminalid = vo.getTerminalid();
list = terminalPhotoDao.selectPhotoList(terminalid, channelid, BigInteger.valueOf(start), BigInteger.valueOf(end));
List idlist = new ArrayList<>();
for (TerminalPhoto tp:list) {
if (tp.getOrginalId()!=null) {
idlist.add(tp.getOrginalId());
}
}
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
if (idlist.size() > 0) {
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
}
boolean empty = CollectionUtil.isEmpty(list);
model.setTime(vo.getTime());
model.setNum(list.size());
@ -111,10 +125,14 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
Integer termId = item.getTermId();
Integer channelId = item.getChannelId();
BigInteger orginalId = item.getOrginalId();
Integer width = item.getWidth();
Integer height = item.getHeight();
photoBean.setChannelId(channelId);
photoBean.setFileSize(item.getFileSize());
photoBean.setHeight(item.getHeight());
photoBean.setHeight(height);
photoBean.setMediaType(item.getMediaType());
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, item.getPath());
photoBean.setPath(photoPath);
@ -140,12 +158,37 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
photoBean.setId(item.getId());
photoBean.setTermId(termId);
photoBean.setWidth(item.getWidth());
photoBean.setWidth(width);
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime));
long rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photoBean.setRecvTime(MyDateUtils.date(rectime));
ArrayList<TerminalPhotoListModel.AlarmItemBean> photoalarmlist = new ArrayList<>();
for (TerminalImgAlarmsDto dto : imgarlarmsList) {
BigInteger photoOrgId = dto.getPhotoOrgId();
if (photoOrgId.longValue() == orginalId.longValue()) {
TerminalPhotoListModel.AlarmItemBean alarmItemBean = new TerminalPhotoListModel.AlarmItemBean();
alarmItemBean.setEnname(dto.getEnname());
alarmItemBean.setName(dto.getName());
alarmItemBean.setHeight(dto.getHeight());
alarmItemBean.setWidth(dto.getWidth());
alarmItemBean.setProb(dto.getProb());
alarmItemBean.setX(dto.getX());
alarmItemBean.setY(dto.getY());
alarmItemBean.setPhotoWidth(width);
alarmItemBean.setPhotoHeight(height);
photoalarmlist.add(alarmItemBean);
}
}
if (photoalarmlist == null || photoalarmlist.size() == 0) {
photoBean.setIsAlarm(CommonStatus.DELETE.value());
} else {
photoBean.setIsAlarm(CommonStatus.EFFECTIVE.value());
}
photoBean.setAlarmlist(photoalarmlist);
beans.add(photoBean);
}
}
@ -257,7 +300,16 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap);
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
List<TerminalImgAlarmsDto> imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap,imgarlarmsList);
model.setList(beans);
}
}
@ -478,19 +530,48 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
// long l = MyDateUtils.TimeMillSecond2Second(dateTime);
// List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(BigInteger.valueOf(l));
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(CommonStatus.EFFECTIVE.value());
ArrayList<BigInteger> photolist = new ArrayList<>();
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
if (CollectionUtil.isNotEmpty(list)) {
for (TerminalChannelMapper item : list) {
if (item.getPhotoId() !=null) {
photolist.add(item.getPhotoId());
}
}
Map<Integer, LineAndDyNameDto> lineMap = cacheService.getLineMap();
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
beans = TerminalUtils.setPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList);
List<TerminalPhoto> photoList = new ArrayList<>();
if (photolist.size()>0) {
photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
}
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
if (photoList.size()>0) {
if (CollectionUtil.isNotEmpty(list)) {
List idlist = new ArrayList<>();
for (TerminalPhoto tp:photoList) {
if (tp.getOrginalId()!=null) {
idlist.add(tp.getOrginalId());
}
}
if (idlist.size() > 0) {
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(photoList, labellist);
}
}
}
beans = TerminalUtils.setPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList,imgarlarmsList);
}
model.setList(beans);
PageInfo pageData = PageUtils.getPageData(list);
@ -585,7 +666,24 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap);
List idlist = new ArrayList<>();
for (TerminalPhoto tp:list) {
if (tp.getOrginalId()!=null) {
idlist.add(tp.getOrginalId());
}
}
List<TerminalImgAlarmsDto> imgarlarmsList = new ArrayList<>();
if (idlist.size() > 0) {
List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = cacheService.getAlarmParamMap();
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(list, labellist);
}
beans = TerminalUtils.fdsa(requestIp, list, terminalMap, lineMap, towerMap, termchannelMap, termchannelMapMap, imgarlarmsList);
model.setList(beans);
}
PageInfo pageData = PageUtils.getPageData(list);

Loading…
Cancel
Save