|
|
|
@ -31,13 +31,9 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import sun.misc.Cache;
|
|
|
|
|
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 装置图片实现层
|
|
|
|
@ -106,29 +102,36 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>();
|
|
|
|
|
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
|
|
|
|
|
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
|
|
|
|
|
for (TerminalPhoto item : list) {
|
|
|
|
|
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
|
|
|
|
|
photoBean.setChannelId(item.getChannelId());
|
|
|
|
|
photoBean.setFileSize(item.getFileSize());
|
|
|
|
|
photoBean.setHeight(item.getHeight());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
if (item.getMediaType() == 0) {
|
|
|
|
|
photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
if (StringUtils.isNotBlank(item.getThumb())) {
|
|
|
|
|
photoBean.setThumb(videoaddress + item.getThumb());
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType == 0 && mediaType == 1) {
|
|
|
|
|
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
|
|
|
|
|
photoBean.setChannelId(item.getChannelId());
|
|
|
|
|
photoBean.setFileSize(item.getFileSize());
|
|
|
|
|
photoBean.setHeight(item.getHeight());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
if (mediaType == 0) {
|
|
|
|
|
photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
if (StringUtils.isNotBlank(item.getThumb())) {
|
|
|
|
|
photoBean.setThumb(videoaddress + item.getThumb());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
photoBean.setChannelName(termchannelMap.get(item.getChannelId()).getChannelName());
|
|
|
|
|
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
|
|
|
|
|
photoBean.setId(item.getId());
|
|
|
|
|
photoBean.setTermId(item.getTermId());
|
|
|
|
|
photoBean.setWidth(item.getWidth());
|
|
|
|
|
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));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
photoBean.setId(item.getId());
|
|
|
|
|
photoBean.setTermId(item.getTermId());
|
|
|
|
|
photoBean.setWidth(item.getWidth());
|
|
|
|
|
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));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
model.setList(beans);
|
|
|
|
|
}
|
|
|
|
@ -160,8 +163,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
} else {
|
|
|
|
|
List<Integer> termidlist = new ArrayList<>();
|
|
|
|
|
ArrayList<Integer> channelidlist = new ArrayList<>();
|
|
|
|
|
ArrayList<Integer> lineidlist = new ArrayList<>();
|
|
|
|
|
ArrayList<Integer> toweridlist = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
|
|
|
|
|
if (dyid == null || dyid.intValue() == 0) {
|
|
|
|
@ -210,6 +211,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
|
|
|
|
|
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
|
|
|
|
|
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
|
|
|
|
|
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
|
|
|
|
|
for (TerminalPhoto item : list) {
|
|
|
|
|
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
|
|
|
|
|
photoBean.setTermid(item.getTermId());
|
|
|
|
@ -221,6 +223,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setChannelid(item.getChannelId());
|
|
|
|
|
photoBean.setCmdid(terminals.getCmdid());
|
|
|
|
|
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName());
|
|
|
|
|
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
photoBean.setOrginalid(item.getOrginalId());
|
|
|
|
|
if (item.getMediaType() == 0) {
|
|
|
|
@ -380,46 +383,73 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtil.isEmpty(list)) {
|
|
|
|
|
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
|
|
|
|
|
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
|
|
|
|
|
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
|
|
|
|
|
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
|
|
|
|
|
List<Integer> termidlist = new ArrayList<>();
|
|
|
|
|
for (ChannelAndTermDto item : list) {
|
|
|
|
|
Integer termid = item.getTermid();
|
|
|
|
|
termidlist.add(termid);
|
|
|
|
|
}
|
|
|
|
|
List<TermAndChannelLatestPhotoMapperDto> list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist);
|
|
|
|
|
for (ChannelAndTermDto item : list) {
|
|
|
|
|
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
|
|
|
|
|
photosBean.setTermid(item.getTermid());
|
|
|
|
|
photosBean.setLineid(item.getLineid());
|
|
|
|
|
photosBean.setChannnelname(item.getChannelname());
|
|
|
|
|
photosBean.setChannelid(item.getChannelid());
|
|
|
|
|
photosBean.setDisplayname(item.getDisplayname());
|
|
|
|
|
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = XyCache.lineMap.get(item.getLineid());
|
|
|
|
|
photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
|
|
|
|
|
for (int y = 0; y < list2.size(); y++) {
|
|
|
|
|
TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
|
|
|
|
|
if (item.getTermid().intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
|
|
|
|
|
photosBean.setPath(item2.getPath());
|
|
|
|
|
long recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue());
|
|
|
|
|
photosBean.setRecvTime(MyDateUtils.date(recvtime));
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue());
|
|
|
|
|
photosBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
photosBean.setMediatype(item2.getMediatype());
|
|
|
|
|
if (item2.getMediatype().intValue() == 0) {
|
|
|
|
|
photosBean.setPath(photoaddress + item2.getPath());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int y = 0; y < list2.size(); y++) {
|
|
|
|
|
log.info("日志开始");
|
|
|
|
|
TermAndChannelLatestPhotoMapperDto item = list2.get(y);
|
|
|
|
|
Integer mediatype = item.getMediatype();
|
|
|
|
|
if (mediatype == 0 || mediatype == 1) {
|
|
|
|
|
Integer termid = item.getTermid();
|
|
|
|
|
Integer lineid = terminalMap.get(termid).getLineid();
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
|
|
|
|
|
Integer channelid = item.getChannelid();
|
|
|
|
|
|
|
|
|
|
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
|
|
|
|
|
photosBean.setTermid(termid);
|
|
|
|
|
photosBean.setLineid(lineid);
|
|
|
|
|
if (lineAndDyNameDto != null) {
|
|
|
|
|
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
|
|
|
|
|
photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setChannnelname("");
|
|
|
|
|
photosBean.setLinename("");
|
|
|
|
|
}
|
|
|
|
|
photosBean.setChannelid(channelid);
|
|
|
|
|
Terminals terminals = terminalMap.get(termid);
|
|
|
|
|
if (terminals != null) {
|
|
|
|
|
photosBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setDisplayname("");
|
|
|
|
|
}
|
|
|
|
|
if (termchannelMapMap != null) {
|
|
|
|
|
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
|
|
|
|
|
if (terminalChannelMapper != null) {
|
|
|
|
|
photosBean.setAlias(terminalChannelMapper.getAlias());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setPath(videoaddress + item2.getPath());
|
|
|
|
|
photosBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
photosBean.setOrginalid(item2.getOrginalid());
|
|
|
|
|
photosBean.setPresetId(item2.getPresetId());
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
photosBean.setPath(item.getPath());
|
|
|
|
|
long recvtime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
|
|
|
|
|
photosBean.setRecvTime(MyDateUtils.date(recvtime));
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
|
|
|
|
|
photosBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
photosBean.setMediatype(mediatype);
|
|
|
|
|
if (mediatype.intValue() == 0) {
|
|
|
|
|
photosBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
photosBean.setOrginalid(item.getOrginalid());
|
|
|
|
|
photosBean.setPresetId(item.getPresetId());
|
|
|
|
|
beans.add(photosBean);
|
|
|
|
|
}
|
|
|
|
|
beans.add(photosBean);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.setList(beans);
|
|
|
|
|
PageInfo pageData = PageUtils.getPageData(list);
|
|
|
|
|
int currentpage = pageData.getPageNum();
|
|
|
|
|