|
|
|
@ -49,6 +49,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
@Autowired
|
|
|
|
|
TerminalsDao terminalsDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
TerminalChannelMapperDao terminalChannelMapperDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
DyLevelDao dyLevelDao;
|
|
|
|
|
|
|
|
|
@ -64,12 +67,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
@Autowired
|
|
|
|
|
TerminalScheduleRuleService terminalScheduleRuleService;
|
|
|
|
|
|
|
|
|
|
@Value("${cma.server}")
|
|
|
|
|
private String server;
|
|
|
|
|
|
|
|
|
|
@Value("${cma.port}")
|
|
|
|
|
private int port;
|
|
|
|
|
|
|
|
|
|
@Value("${photo.address}")
|
|
|
|
|
private String photoaddress;
|
|
|
|
|
|
|
|
|
@ -328,7 +325,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setPath(requestIp + videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
if (path != null) {
|
|
|
|
|
photoBean.setPath(photoaddress + path);
|
|
|
|
|
photoBean.setPath(requestIp + photoaddress + path);
|
|
|
|
|
String[] split = path.split("/");
|
|
|
|
|
int length = split.length;
|
|
|
|
|
String s = split[length - 1];
|
|
|
|
@ -399,6 +396,92 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
// @Override
|
|
|
|
|
// public ServiceBody<TerminalPhotosModel> getPhotoBanner(String requestIp, PageVo vo) {
|
|
|
|
|
// TerminalPhotosModel model = new TerminalPhotosModel();
|
|
|
|
|
//
|
|
|
|
|
// int pageindex = vo.getPageindex();
|
|
|
|
|
// int pagesize = vo.getPagesize();
|
|
|
|
|
// PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
//
|
|
|
|
|
// List<ChannelAndTermDto> list = terminalsDao.selectChannelAndTermList(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
// List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
// if (!CollectionUtil.isEmpty(list)) {
|
|
|
|
|
// Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
|
|
|
|
|
// 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();
|
|
|
|
|
// Integer termid = item.getTermid();
|
|
|
|
|
// Integer channelid = item.getChannelid();
|
|
|
|
|
//
|
|
|
|
|
// photosBean.setTermid(termid);
|
|
|
|
|
// photosBean.setLineid(item.getLineid());
|
|
|
|
|
// photosBean.setChannnelname(item.getChannelname());
|
|
|
|
|
// if (termchannelMapMap != null) {
|
|
|
|
|
// TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
|
|
|
|
|
// if (terminalChannelMapper != null) {
|
|
|
|
|
// photosBean.setAlias(terminalChannelMapper.getAlias());
|
|
|
|
|
// } else {
|
|
|
|
|
// photosBean.setAlias("");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// photosBean.setAlias("");
|
|
|
|
|
// }
|
|
|
|
|
// photosBean.setChannelid(channelid);
|
|
|
|
|
// photosBean.setDisplayname(item.getDisplayname());
|
|
|
|
|
//
|
|
|
|
|
// LineAndDyNameDto lineAndDyNameDto = lineMap.get(item.getLineid());
|
|
|
|
|
// if (lineAndDyNameDto != null) {
|
|
|
|
|
// photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
// } else {
|
|
|
|
|
// photosBean.setLinename("");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for (int y = 0; y < list2.size(); y++) {
|
|
|
|
|
// TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
|
|
|
|
|
// if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
|
|
|
|
|
// Integer mediatype = item2.getMediatype();
|
|
|
|
|
// if (mediatype != null && (mediatype.intValue() == 0 || mediatype.intValue() == 1)) {
|
|
|
|
|
// 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(mediatype);
|
|
|
|
|
// if (mediatype.intValue() == 0) {
|
|
|
|
|
// photosBean.setPath(requestIp + photoaddress + item2.getPath());
|
|
|
|
|
// } else {
|
|
|
|
|
// photosBean.setPath(requestIp + videoaddress + item2.getPath());
|
|
|
|
|
// }
|
|
|
|
|
// photosBean.setOrginalid(item2.getOrginalid());
|
|
|
|
|
// photosBean.setPresetId(item2.getPresetId());
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// beans.add(photosBean);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// model.setList(beans);
|
|
|
|
|
// PageInfo pageData = PageUtils.getPageData(list);
|
|
|
|
|
// int currentpage = pageData.getPageNum();
|
|
|
|
|
// model.setCurrentpage(currentpage);
|
|
|
|
|
// long total = pageData.getTotal();
|
|
|
|
|
// model.setTotal(total);
|
|
|
|
|
//
|
|
|
|
|
// int pageSize = pageData.getPageSize();
|
|
|
|
|
// model.setPagesize(pageSize);
|
|
|
|
|
// int pages = pageData.getPages();
|
|
|
|
|
// model.setTotalpage(pages);
|
|
|
|
|
// return Asserts.success(model);
|
|
|
|
|
// }
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotosModel> getPhotoBanner(String requestIp, PageVo vo) {
|
|
|
|
|
TerminalPhotosModel model = new TerminalPhotosModel();
|
|
|
|
@ -407,26 +490,39 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
int pagesize = vo.getPagesize();
|
|
|
|
|
PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
|
|
|
|
|
List<ChannelAndTermDto> list = terminalsDao.selectChannelAndTermList(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
DateTime dateTime = MyDateUtils.offsetDay(new Date(), -1);
|
|
|
|
|
long l = MyDateUtils.TimeMillSecond2Second(dateTime);
|
|
|
|
|
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(BigInteger.valueOf(l));
|
|
|
|
|
ArrayList<BigInteger> photolist = new ArrayList<>();
|
|
|
|
|
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtil.isEmpty(list)) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
for (TerminalChannelMapper item : list) {
|
|
|
|
|
photolist.add(item.getPhotoId());
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
|
|
|
|
|
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();
|
|
|
|
|
Integer termid = item.getTermid();
|
|
|
|
|
Integer channelid = item.getChannelid();
|
|
|
|
|
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) {
|
|
|
|
|
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
|
|
|
|
|
Integer termid = item.getTermId();
|
|
|
|
|
Integer channelid = item.getChannelId();
|
|
|
|
|
BigInteger photoId = item.getPhotoId();
|
|
|
|
|
Integer lineid = null;
|
|
|
|
|
photosBean.setTermid(termid);
|
|
|
|
|
photosBean.setLineid(item.getLineid());
|
|
|
|
|
photosBean.setChannnelname(item.getChannelname());
|
|
|
|
|
Terminals terminals = terminalMap.get(termid);
|
|
|
|
|
if (terminals != null) {
|
|
|
|
|
lineid = terminals.getLineid();
|
|
|
|
|
photosBean.setLineid(lineid);
|
|
|
|
|
photosBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
photosBean.setChannelid(channelid);
|
|
|
|
|
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
|
|
|
|
|
|
|
|
|
|
if (termchannelMapMap != null) {
|
|
|
|
|
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
|
|
|
|
|
if (terminalChannelMapper != null) {
|
|
|
|
@ -437,34 +533,32 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setAlias("");
|
|
|
|
|
}
|
|
|
|
|
photosBean.setChannelid(channelid);
|
|
|
|
|
photosBean.setDisplayname(item.getDisplayname());
|
|
|
|
|
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = lineMap.get(item.getLineid());
|
|
|
|
|
if (lineAndDyNameDto != null) {
|
|
|
|
|
photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setLinename("");
|
|
|
|
|
if (lineid != null) {
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
|
|
|
|
|
if (lineAndDyNameDto != null) {
|
|
|
|
|
photosBean.setLinename(lineAndDyNameDto.getName());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setLinename("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int y = 0; y < list2.size(); y++) {
|
|
|
|
|
TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
|
|
|
|
|
if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
|
|
|
|
|
Integer mediatype = item2.getMediatype();
|
|
|
|
|
for (int y = 0; y < photoList.size(); y++) {
|
|
|
|
|
TerminalPhoto terminalPhoto = photoList.get(y);
|
|
|
|
|
if (terminalPhoto.getId().longValue() == photoId.longValue()) {
|
|
|
|
|
Integer mediatype = terminalPhoto.getMediaType();
|
|
|
|
|
if (mediatype != null && (mediatype.intValue() == 0 || mediatype.intValue() == 1)) {
|
|
|
|
|
photosBean.setPath(item2.getPath());
|
|
|
|
|
long recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue());
|
|
|
|
|
photosBean.setPath(terminalPhoto.getPath());
|
|
|
|
|
long recvtime = MyDateUtils.TimeSecond2MillSecond(terminalPhoto.getRecvTime().longValue());
|
|
|
|
|
photosBean.setRecvTime(MyDateUtils.date(recvtime));
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue());
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(terminalPhoto.getPhotoTime().longValue());
|
|
|
|
|
photosBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
photosBean.setMediatype(mediatype);
|
|
|
|
|
if (mediatype.intValue() == 0) {
|
|
|
|
|
photosBean.setPath(requestIp + photoaddress + item2.getPath());
|
|
|
|
|
photosBean.setPath(requestIp + photoaddress + terminalPhoto.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setPath(requestIp + videoaddress + item2.getPath());
|
|
|
|
|
photosBean.setPath(requestIp + videoaddress + terminalPhoto.getPath());
|
|
|
|
|
}
|
|
|
|
|
photosBean.setOrginalid(item2.getOrginalid());
|
|
|
|
|
photosBean.setPresetId(item2.getPresetId());
|
|
|
|
|
photosBean.setOrginalid(terminalPhoto.getOrginalId());
|
|
|
|
|
photosBean.setPresetId(terminalPhoto.getPresetId());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|