|
|
|
@ -4,9 +4,9 @@ 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.DateUnit;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.setting.SettingUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
@ -22,7 +22,7 @@ import com.shxy.xymanager_common.page.PageUtils;
|
|
|
|
|
import com.shxy.xymanager_common.util.*;
|
|
|
|
|
import com.shxy.xymanager_common.vo.*;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.*;
|
|
|
|
|
import com.shxy.xymanager_service.cache.XyCache;
|
|
|
|
|
import com.shxy.xymanager_service.service.CacheService;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalPhotoService;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -64,6 +64,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
TerminalScheduleRuleService terminalScheduleRuleService;
|
|
|
|
|
@Autowired
|
|
|
|
|
CacheService cacheService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${photo.address}")
|
|
|
|
|
private String photoaddress;
|
|
|
|
@ -101,8 +104,6 @@ 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) {
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
|
|
|
|
@ -122,14 +123,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setThumb(requestIp + videoaddress + item.getThumb());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
photoBean.setChannelName(termchannelMap.get(channelId).getChannelName());
|
|
|
|
|
photoBean.setChannelName(cacheService.getTermchannelMap(channelId).getChannelName());
|
|
|
|
|
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termId, channelId);
|
|
|
|
|
if (termchannelMapMap != null) {
|
|
|
|
|
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId);
|
|
|
|
|
if (terminalChannelMapper != null) {
|
|
|
|
|
photoBean.setAlias(terminalChannelMapper.getAlias());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
photoBean.setAlias(termchannelMapMap.getAlias());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
@ -203,12 +200,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (channelid == null || channelid.intValue() == 0) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
channelidlist.add(channelid);
|
|
|
|
|
}
|
|
|
|
|
if (termidlist.size() == 0) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
|
|
|
|
@ -219,25 +214,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
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());
|
|
|
|
|
Terminals terminals = terminalMap.get(item.getTermId());
|
|
|
|
|
Terminals terminals = cacheService.getTerminal(item.getTermId());
|
|
|
|
|
if (!BeanUtil.isEmpty(terminals)) {
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
|
|
|
|
|
photoBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
photoBean.setLineid(terminals.getLineid());
|
|
|
|
|
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
|
|
|
|
|
Lines line = cacheService.getLine(terminals.getLineid());
|
|
|
|
|
if (BeanUtil.isNotEmpty(line)) {
|
|
|
|
|
photoBean.setLinename(line.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setLinename("");
|
|
|
|
|
}
|
|
|
|
|
photoBean.setChannelid(item.getChannelId());
|
|
|
|
|
photoBean.setCmdid(terminals.getCmdid());
|
|
|
|
|
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName());
|
|
|
|
|
photoBean.setChannnelname(cacheService.getTermchannelMap(item.getChannelId()).getChannelName());
|
|
|
|
|
|
|
|
|
|
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
|
|
|
|
|
photoBean.setAlias(cacheService.getTermchannelMapMap(item.getTermId(), item.getChannelId()).getAlias());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
photoBean.setOrginalid(item.getOrginalId());
|
|
|
|
|
if (mediaType.intValue() == 0) {
|
|
|
|
@ -295,10 +291,16 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
pagesize = 10;
|
|
|
|
|
}
|
|
|
|
|
PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
Date starttime = MyDateUtils.myparseDate(vo.getStartTime());
|
|
|
|
|
String startTime = vo.getStartTime();
|
|
|
|
|
Date startDate = null;
|
|
|
|
|
if (StrUtil.isEmpty(startTime)) {
|
|
|
|
|
startDate = MyDateUtils.getNowDate();
|
|
|
|
|
} else {
|
|
|
|
|
startDate = MyDateUtils.myparseDate(startTime);
|
|
|
|
|
}
|
|
|
|
|
long start = 0;
|
|
|
|
|
if (starttime != null) {
|
|
|
|
|
start = MyDateUtils.TimeMillSecond2Second(DateTime.of(starttime));
|
|
|
|
|
if (startDate != null) {
|
|
|
|
|
start = MyDateUtils.TimeMillSecond2Second(DateTime.of(startDate));
|
|
|
|
|
}
|
|
|
|
|
Date endtime = MyDateUtils.myparseDate(vo.getEndTime());
|
|
|
|
|
long end = 0;
|
|
|
|
@ -333,7 +335,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
}
|
|
|
|
|
photoBean.setPresetId(item.getPresetId());
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.formatDateTime(MyDateUtils.date(phototime)));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -356,8 +358,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
|
|
|
|
|
Integer termId = vo.getTermId();
|
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
|
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
|
|
|
|
|
Terminals terminals = terminalMap.get(termId);
|
|
|
|
|
Terminals terminals = cacheService.getTerminal(termId);
|
|
|
|
|
String cmdid = null;
|
|
|
|
|
if (terminals != null) {
|
|
|
|
|
cmdid = terminals.getCmdid();
|
|
|
|
@ -501,11 +502,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
for (TerminalChannelMapper item : list) {
|
|
|
|
|
photolist.add(item.getPhotoId());
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
|
|
|
|
|
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
|
|
|
|
|
Map<Integer, TowerDto> towerMap = XyCache.towerMap;
|
|
|
|
|
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
|
|
|
|
|
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
|
|
|
|
|
List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
|
|
|
|
|
|
|
|
|
|
for (TerminalChannelMapper item : list) {
|
|
|
|
@ -515,7 +511,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
BigInteger photoId = item.getPhotoId();
|
|
|
|
|
Integer lineid = null;
|
|
|
|
|
photosBean.setTermid(termid);
|
|
|
|
|
Terminals terminals = terminalMap.get(termid);
|
|
|
|
|
Terminals terminals = cacheService.getTerminal(termid);
|
|
|
|
|
if (terminals != null) {
|
|
|
|
|
lineid = terminals.getLineid();
|
|
|
|
|
photosBean.setLineid(lineid);
|
|
|
|
@ -523,22 +519,18 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photosBean.setCmdid(terminals.getCmdid());
|
|
|
|
|
}
|
|
|
|
|
photosBean.setChannelid(channelid);
|
|
|
|
|
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
|
|
|
|
|
photosBean.setChannnelname(cacheService.getTermchannelMap(channelid).getChannelName());
|
|
|
|
|
|
|
|
|
|
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termid, channelid);
|
|
|
|
|
if (termchannelMapMap != null) {
|
|
|
|
|
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
|
|
|
|
|
if (terminalChannelMapper != null) {
|
|
|
|
|
photosBean.setAlias(terminalChannelMapper.getAlias());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
photosBean.setAlias(termchannelMapMap.getAlias());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
if (lineid != null) {
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
|
|
|
|
|
if (lineAndDyNameDto != null) {
|
|
|
|
|
photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
Lines line = cacheService.getLine(lineid);
|
|
|
|
|
if (line != null) {
|
|
|
|
|
photosBean.setLinename(line.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setLinename("");
|
|
|
|
|
}
|
|
|
|
@ -686,25 +678,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
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());
|
|
|
|
|
Terminals terminals = terminalMap.get(item.getTermId());
|
|
|
|
|
Terminals terminals = cacheService.getTerminal(item.getTermId());
|
|
|
|
|
if (!BeanUtil.isEmpty(terminals)) {
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
|
|
|
|
|
photoBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
photoBean.setLineid(terminals.getLineid());
|
|
|
|
|
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
|
|
|
|
|
Lines line = cacheService.getLine(terminals.getLineid());
|
|
|
|
|
if (BeanUtil.isNotEmpty(line)) {
|
|
|
|
|
photoBean.setLinename(line.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setLinename("");
|
|
|
|
|
}
|
|
|
|
|
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.setChannnelname(cacheService.getTermchannelMap(item.getChannelId()).getChannelName());
|
|
|
|
|
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(item.getTermId(), item.getChannelId());
|
|
|
|
|
photoBean.setAlias(termchannelMapMap.getAlias());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
photoBean.setOrginalid(item.getOrginalId());
|
|
|
|
|
if (mediaType.intValue() == 0) {
|
|
|
|
|