|
|
|
@ -33,8 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.Min;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@ -82,11 +80,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
/**
|
|
|
|
|
* 根据装置id和通道id获取图片
|
|
|
|
|
*
|
|
|
|
|
* @param requestIp
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotoListModel> getTerminalPhotoList(TerminalAndChannelIdAndTimeVo vo) {
|
|
|
|
|
public ServiceBody<TerminalPhotoListModel> getTerminalPhotoList(String requestIp, TerminalAndChannelIdAndTimeVo vo) {
|
|
|
|
|
TerminalPhotoListModel model = new TerminalPhotoListModel();
|
|
|
|
|
Date time = vo.getTime();
|
|
|
|
|
DateTime begindateTime = MyDateUtils.beginOfDay(time);
|
|
|
|
@ -109,7 +108,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
|
|
|
|
|
for (TerminalPhoto item : list) {
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType == 0 || mediaType == 1) {
|
|
|
|
|
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
|
|
|
|
|
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
|
|
|
|
|
Integer termId = item.getTermId();
|
|
|
|
|
Integer channelId = item.getChannelId();
|
|
|
|
@ -118,12 +117,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setFileSize(item.getFileSize());
|
|
|
|
|
photoBean.setHeight(item.getHeight());
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
if (mediaType == 0) {
|
|
|
|
|
photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
if (mediaType.intValue() == 0) {
|
|
|
|
|
photoBean.setPath(requestIp + photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
photoBean.setPath(requestIp + videoaddress + item.getPath());
|
|
|
|
|
if (StringUtils.isNotBlank(item.getThumb())) {
|
|
|
|
|
photoBean.setThumb(videoaddress + item.getThumb());
|
|
|
|
|
photoBean.setThumb(requestIp + videoaddress + item.getThumb());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
photoBean.setChannelName(termchannelMap.get(channelId).getChannelName());
|
|
|
|
@ -157,7 +156,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
* 图片查询
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotoSelectListModel> getPhotoList(TerminalPhotoSelectVo vo) {
|
|
|
|
|
public ServiceBody<TerminalPhotoSelectListModel> getPhotoList(String requestIp, TerminalPhotoSelectVo vo) {
|
|
|
|
|
TerminalPhotoSelectListModel model = new TerminalPhotoSelectListModel();
|
|
|
|
|
List<TerminalPhoto> list = new ArrayList<>();
|
|
|
|
|
List<TerminalPhotoSelectListModel.PhotoBean> beans = new ArrayList<>();
|
|
|
|
@ -232,27 +231,30 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setTermid(item.getTermId());
|
|
|
|
|
Terminals terminals = terminalMap.get(item.getTermId());
|
|
|
|
|
if (!BeanUtil.isEmpty(terminals)) {
|
|
|
|
|
photoBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
photoBean.setLineid(terminals.getLineid());
|
|
|
|
|
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
|
|
|
|
|
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) {
|
|
|
|
|
photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
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());
|
|
|
|
|
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 (mediaType.intValue() == 0) {
|
|
|
|
|
photoBean.setPath(requestIp + photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(requestIp + videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
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.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);
|
|
|
|
@ -274,11 +276,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
/**
|
|
|
|
|
* 根据装置和时间提供给第三方
|
|
|
|
|
*
|
|
|
|
|
* @param requestIp
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotoListForOpenModel> getPhotoListForOpen(OpenTerminalAndTimeVo vo) {
|
|
|
|
|
public ServiceBody<TerminalPhotoListForOpenModel> getPhotoListForOpen(String requestIp, OpenTerminalAndTimeVo vo) {
|
|
|
|
|
String cmdid = vo.getCmdId();
|
|
|
|
|
TerminalPhotoListForOpenModel model = new TerminalPhotoListForOpenModel();
|
|
|
|
|
|
|
|
|
@ -312,29 +315,30 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
} else {
|
|
|
|
|
List<TerminalPhotoListForOpenModel.PhotoBean> beans = new ArrayList<>();
|
|
|
|
|
for (TerminalPhoto item : list) {
|
|
|
|
|
TerminalPhotoListForOpenModel.PhotoBean photoBean = new TerminalPhotoListForOpenModel.PhotoBean();
|
|
|
|
|
photoBean.setCmdId(cmdid);
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
photoBean.setOrginalId(item.getOrginalId());
|
|
|
|
|
// photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
String path = item.getPath();
|
|
|
|
|
if (item.getMediaType() == 0) {
|
|
|
|
|
photoBean.setPath(photoaddress + path);
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
if (path != null) {
|
|
|
|
|
photoBean.setPath(photoaddress + path);
|
|
|
|
|
String[] split = path.split("/");
|
|
|
|
|
int length = split.length;
|
|
|
|
|
String s = split[length - 1];
|
|
|
|
|
photoBean.setName(s);
|
|
|
|
|
|
|
|
|
|
Integer mediaType = item.getMediaType();
|
|
|
|
|
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
|
|
|
|
|
TerminalPhotoListForOpenModel.PhotoBean photoBean = new TerminalPhotoListForOpenModel.PhotoBean();
|
|
|
|
|
photoBean.setCmdId(cmdid);
|
|
|
|
|
photoBean.setMediaType(item.getMediaType());
|
|
|
|
|
photoBean.setOrginalId(item.getOrginalId());
|
|
|
|
|
String path = item.getPath();
|
|
|
|
|
if (mediaType.intValue() == 0) {
|
|
|
|
|
photoBean.setPath(requestIp + photoaddress + path);
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(requestIp + videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
if (path != null) {
|
|
|
|
|
photoBean.setPath(photoaddress + path);
|
|
|
|
|
String[] split = path.split("/");
|
|
|
|
|
int length = split.length;
|
|
|
|
|
String s = split[length - 1];
|
|
|
|
|
photoBean.setName(s);
|
|
|
|
|
}
|
|
|
|
|
photoBean.setPresetId(item.getPresetId());
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
photoBean.setPresetId(item.getPresetId());
|
|
|
|
|
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
|
|
|
|
|
photoBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
beans.add(photoBean);
|
|
|
|
|
}
|
|
|
|
|
model.setList(beans);
|
|
|
|
|
}
|
|
|
|
@ -391,11 +395,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
/**
|
|
|
|
|
* 图片轮询接口
|
|
|
|
|
*
|
|
|
|
|
* @param requestIp
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotosModel> getPhotoBanner(PageVo vo) {
|
|
|
|
|
public ServiceBody<TerminalPhotosModel> getPhotoBanner(String requestIp, PageVo vo) {
|
|
|
|
|
TerminalPhotosModel model = new TerminalPhotosModel();
|
|
|
|
|
|
|
|
|
|
int pageindex = vo.getPageindex();
|
|
|
|
@ -446,7 +451,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
|
|
|
|
|
if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
|
|
|
|
|
Integer mediatype = item2.getMediatype();
|
|
|
|
|
if (mediatype == 0 || mediatype == 1) {
|
|
|
|
|
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));
|
|
|
|
@ -454,9 +459,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photosBean.setPhotoTime(MyDateUtils.date(phototime));
|
|
|
|
|
photosBean.setMediatype(mediatype);
|
|
|
|
|
if (mediatype.intValue() == 0) {
|
|
|
|
|
photosBean.setPath(photoaddress + item2.getPath());
|
|
|
|
|
photosBean.setPath(requestIp + photoaddress + item2.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photosBean.setPath(videoaddress + item2.getPath());
|
|
|
|
|
photosBean.setPath(requestIp + videoaddress + item2.getPath());
|
|
|
|
|
}
|
|
|
|
|
photosBean.setOrginalid(item2.getOrginalid());
|
|
|
|
|
photosBean.setPresetId(item2.getPresetId());
|
|
|
|
@ -481,40 +486,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<String> getPhotoTime(TerminalPhotoTimeVo vo) {
|
|
|
|
|
List<TerminalPhotoScheduleDto> dtoList = terminalPhotoDao.selectPhotoSchedule(vo);
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < dtoList.size(); j++) {
|
|
|
|
|
TerminalPhotosTimeModel.PhotosTimeBean bean = new TerminalPhotosTimeModel.PhotosTimeBean();
|
|
|
|
|
Short span = dtoList.get(j).getSpan();
|
|
|
|
|
Date startTime = dtoList.get(j).getStartTime();
|
|
|
|
|
Short startHour = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[0]);
|
|
|
|
|
Short startMin = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date endTime = dtoList.get(j).getEndTime();
|
|
|
|
|
Short endTimeHour = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[0]);
|
|
|
|
|
Short endTimeMin = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[1]);
|
|
|
|
|
|
|
|
|
|
Short span1 = -1;
|
|
|
|
|
Short span2 = -1;
|
|
|
|
|
if (span / 60 > 0) {
|
|
|
|
|
span1 = (short) (span / 60);
|
|
|
|
|
span2 = (short) (span % 60);
|
|
|
|
|
} else if (span < 60) {
|
|
|
|
|
span1 = (short) 0;
|
|
|
|
|
span2 = span;
|
|
|
|
|
}
|
|
|
|
|
String cmd = Constants.CMD + "schedule --flag=1 --cmdid=" + dtoList.get(j).getCmid() + " --channel=" + vo.getChannel()
|
|
|
|
|
+ " --group=3 --hour1=" + startHour + " --min1=" + startMin + " --preset1=255 --hour2=" + endTimeHour + " --min2="
|
|
|
|
|
+ endTimeMin + " --preset2=255 --hour3=" + span1 + " --min3=" + span2 + " --preset3=255";
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
return Asserts.success("修改成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<GetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) {
|
|
|
|
|
GetModel model = new GetModel();
|
|
|
|
@ -601,11 +572,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
/**
|
|
|
|
|
* 获取历史图片接口实现
|
|
|
|
|
*
|
|
|
|
|
* @param requestIp
|
|
|
|
|
* @param vo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalPhotoSelectListModel> getHistoryList(TermIdAndChannelIdVo vo) {
|
|
|
|
|
public ServiceBody<TerminalPhotoSelectListModel> getHistoryList(String requestIp, TermIdAndChannelIdVo vo) {
|
|
|
|
|
TerminalPhotoSelectListModel model = new TerminalPhotoSelectListModel();
|
|
|
|
|
List<TerminalPhotoSelectListModel.PhotoBean> beans = new ArrayList<>();
|
|
|
|
|
Integer termId = vo.getTermId();
|
|
|
|
@ -627,27 +599,30 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
photoBean.setTermid(item.getTermId());
|
|
|
|
|
Terminals terminals = terminalMap.get(item.getTermId());
|
|
|
|
|
if (!BeanUtil.isEmpty(terminals)) {
|
|
|
|
|
photoBean.setDisplayname(terminals.getDisplayName());
|
|
|
|
|
photoBean.setLineid(terminals.getLineid());
|
|
|
|
|
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
|
|
|
|
|
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) {
|
|
|
|
|
photoBean.setPath(photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(videoaddress + item.getPath());
|
|
|
|
|
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());
|
|
|
|
|
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 (mediaType.intValue() == 0) {
|
|
|
|
|
photoBean.setPath(requestIp + photoaddress + item.getPath());
|
|
|
|
|
} else {
|
|
|
|
|
photoBean.setPath(requestIp + videoaddress + item.getPath());
|
|
|
|
|
}
|
|
|
|
|
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.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);
|
|
|
|
@ -665,5 +640,4 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|