|
|
|
@ -9,10 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
import com.shxy.xymanager_common.constant.Constants;
|
|
|
|
|
import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.PhotoMarkDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.TerminalInfoDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
|
|
|
|
|
import com.shxy.xymanager_common.dto.*;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalStatus;
|
|
|
|
|
import com.shxy.xymanager_common.entity.Terminals;
|
|
|
|
@ -27,7 +24,6 @@ import com.shxy.xymanager_common.util.StringUtils;
|
|
|
|
|
import com.shxy.xymanager_common.util.TerminalUtils;
|
|
|
|
|
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.TerminalService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -90,28 +86,66 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
int pageindex = vo.getPageindex();
|
|
|
|
|
int pagesize = vo.getPagesize();
|
|
|
|
|
PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
List<Integer> termidlist = new ArrayList<>();
|
|
|
|
|
List<Terminals> list = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
for (Terminals item : list) {
|
|
|
|
|
termidlist.add(item.getId());
|
|
|
|
|
}
|
|
|
|
|
List<TerminalsAndLineAndChannelDto> list2 = terminalsDao.selectTermAndLineList(termidlist, CommonStatus.EFFECTIVE.value());
|
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list2);
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
List<TerminalListModel.TerminalsBean> beans = BeanUtil.copyToList(list2, TerminalListModel.TerminalsBean.class, CopyOptions.create().ignoreCase());
|
|
|
|
|
for (TerminalListModel.TerminalsBean item : beans) {
|
|
|
|
|
boolean b = TerminalUtils.judgeTerminalStatus(item.getLastHeartbeat());
|
|
|
|
|
item.setIsonline(b);
|
|
|
|
|
List<TerminalsAndStatusDto> list2 = terminalsDao.selectTermAndStatusList(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list2);
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
|
|
|
|
|
Map<Integer, TermAndChannelDto> termAndChannelMap = cacheService.getTermAndChannelMap();
|
|
|
|
|
ArrayList<TerminalListModel.TerminalsBean> beanlist = new ArrayList<>();
|
|
|
|
|
for (TerminalsAndStatusDto item : list2) {
|
|
|
|
|
TerminalListModel.TerminalsBean terminalsBean = new TerminalListModel.TerminalsBean();
|
|
|
|
|
terminalsBean.setCmdId(item.getCmdid());
|
|
|
|
|
Integer towerid = item.getTowerid();
|
|
|
|
|
terminalsBean.setId(item.getId());
|
|
|
|
|
terminalsBean.setTowerId(towerid);
|
|
|
|
|
terminalsBean.setTowerName(towerMap.get(towerid).getName());
|
|
|
|
|
terminalsBean.setLineId(towerMap.get(towerid).getLineId());
|
|
|
|
|
terminalsBean.setLineName(towerMap.get(towerid).getLineName());
|
|
|
|
|
terminalsBean.setCmdId(item.getCmdid());
|
|
|
|
|
terminalsBean.setOrgId(item.getOrgId());
|
|
|
|
|
terminalsBean.setEquipName(item.getEquipName());
|
|
|
|
|
terminalsBean.setDisplayName(item.getDisplayName());
|
|
|
|
|
terminalsBean.setModel(item.getModel());
|
|
|
|
|
terminalsBean.setEssentialInfoVersion(item.getEssentialInfoVersion());
|
|
|
|
|
terminalsBean.setHasPan(item.getHasPan());
|
|
|
|
|
terminalsBean.setBsManufacturer(item.getBsManufacturer());
|
|
|
|
|
terminalsBean.setBsProductionDate(item.getBsProductionDate());
|
|
|
|
|
terminalsBean.setBsIdentifier(item.getBsIdentifier());
|
|
|
|
|
terminalsBean.setLatitude(item.getLatitude());
|
|
|
|
|
terminalsBean.setLongitude(item.getLongitude());
|
|
|
|
|
terminalsBean.setSignalStrength4g(item.getSignalStrength4g());
|
|
|
|
|
terminalsBean.setBootTime(item.getBootTime());
|
|
|
|
|
terminalsBean.setBatteryCapacity(item.getBatteryCapacity());
|
|
|
|
|
terminalsBean.setBatteryVoltage(item.getBatteryVoltage());
|
|
|
|
|
terminalsBean.setLastHeartbeat(item.getLastHeartbeat());
|
|
|
|
|
boolean b = TerminalUtils.judgeTerminalStatus(item.getLastHeartbeat());
|
|
|
|
|
terminalsBean.setIsonline(b);
|
|
|
|
|
TermAndChannelDto termAndChannelDto = termAndChannelMap.get(item.getId());
|
|
|
|
|
ArrayList<TerminalListModel.ChannelBeans> list = new ArrayList<>();
|
|
|
|
|
if (BeanUtil.isEmpty(termAndChannelDto)) {
|
|
|
|
|
terminalsBean.setList(list);
|
|
|
|
|
} else {
|
|
|
|
|
List<TermChannelAndMapperDto> channellist = termAndChannelDto.getChannellist();
|
|
|
|
|
if (CollectionUtil.isEmpty(channellist)) {
|
|
|
|
|
terminalsBean.setList(list);
|
|
|
|
|
} else {
|
|
|
|
|
for (TermChannelAndMapperDto dto : channellist) {
|
|
|
|
|
TerminalListModel.ChannelBeans e = new TerminalListModel.ChannelBeans();
|
|
|
|
|
e.setAlias(dto.getAlias());
|
|
|
|
|
e.setId(dto.getId());
|
|
|
|
|
e.setName(dto.getChannelname());
|
|
|
|
|
list.add(e);
|
|
|
|
|
}
|
|
|
|
|
terminalsBean.setList(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model.setList(beans);
|
|
|
|
|
beanlist.add(terminalsBean);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
model.setList(beanlist);
|
|
|
|
|
}
|
|
|
|
|
PageInfo pageData = PageUtils.getPageData(list);
|
|
|
|
|
PageInfo pageData = PageUtils.getPageData(list2);
|
|
|
|
|
int currentpage = pageData.getPageNum();
|
|
|
|
|
model.setCurrentpage(currentpage);
|
|
|
|
|
long total = pageData.getTotal();
|
|
|
|
|