|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -212,7 +255,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
|
|
|
|
|
if (lineid == null || lineid.intValue() == -1) {
|
|
|
|
|
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, search, CommonStatus.EFFECTIVE.value());
|
|
|
|
|
} else {
|
|
|
|
|
if (towerid == null || towerid.intValue() == -1) {
|
|
|
|
|
if (towerid == null || towerid.intValue() == -1) {
|
|
|
|
|
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, search, CommonStatus.EFFECTIVE.value());
|
|
|
|
|
} else {
|
|
|
|
|
if (termid == null || termid.intValue() == -1) {
|
|
|
|
@ -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) {
|
|
|
|
|
photolist.add(item.getPhotoId());
|
|
|
|
|
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);
|
|
|
|
|