|
|
|
@ -69,10 +69,10 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
LinesDao linesDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
CacheService cacheService;
|
|
|
|
|
RequestResultsDao requestResultsDao;
|
|
|
|
|
|
|
|
|
|
@Value("${photo.address}")
|
|
|
|
|
private String photoaddress;
|
|
|
|
|
@Autowired
|
|
|
|
|
CacheService cacheService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -84,100 +84,77 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
public ServiceBody<TerminalListModel> getTerminalList(TerminalSelectVo vo) {
|
|
|
|
|
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
|
|
|
|
|
Map<Integer, TermAndChannelDto> termAndChannelMap = cacheService.getTermAndChannelMap();
|
|
|
|
|
Integer dyid = vo.getDyid();
|
|
|
|
|
Integer lineid = vo.getLineid();
|
|
|
|
|
Integer tower = vo.getTowerid();
|
|
|
|
|
Integer dyid = vo.getDyId();
|
|
|
|
|
Integer lineid = vo.getLineId();
|
|
|
|
|
Integer tower = vo.getTowerId();
|
|
|
|
|
String search = vo.getSearch();
|
|
|
|
|
if (StrUtil.isEmpty(search)) {
|
|
|
|
|
search = null;
|
|
|
|
|
}
|
|
|
|
|
List<DyLineAndTowertDto> dyLineAndTowertDtos = new ArrayList<>();
|
|
|
|
|
if (dyid == null || dyid.intValue() == -1) {
|
|
|
|
|
tower = null;
|
|
|
|
|
} else {
|
|
|
|
|
if (lineid == null || lineid.intValue() == -1) {
|
|
|
|
|
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, null, null, search);
|
|
|
|
|
} else {
|
|
|
|
|
if (tower == null || tower.intValue() == -1) {
|
|
|
|
|
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, null, search);
|
|
|
|
|
} else {
|
|
|
|
|
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, tower, search);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<TerminalsAndStatusDto> list2 = new ArrayList<>();
|
|
|
|
|
TerminalListModel model = new TerminalListModel();
|
|
|
|
|
int pageindex = vo.getPageindex();
|
|
|
|
|
int pagesize = vo.getPagesize();
|
|
|
|
|
PageUtils.SetPage(pageindex, pagesize);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dyLineAndTowertDtos)) {
|
|
|
|
|
ArrayList<Integer> toweridlist = new ArrayList<>();
|
|
|
|
|
for (DyLineAndTowertDto item : dyLineAndTowertDtos) {
|
|
|
|
|
toweridlist.add(item.getTowerId());
|
|
|
|
|
}
|
|
|
|
|
list2 = terminalsDao.selectTermAndStatusList(null, toweridlist, search);
|
|
|
|
|
} else {
|
|
|
|
|
list2 = terminalsDao.selectTermAndStatusList(null, null, search);
|
|
|
|
|
}
|
|
|
|
|
List<TerminalsAndStatusDto> list2 = terminalsDao.selectTermAndStatusList(null, dyid, lineid, tower, search);
|
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list2);
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
TowerDto towerDto = towerMap.get(towerid);
|
|
|
|
|
if (BeanUtil.isNotEmpty(towerDto)) {
|
|
|
|
|
terminalsBean.setTowerName(towerDto.getName());
|
|
|
|
|
terminalsBean.setLineId(towerDto.getLineId());
|
|
|
|
|
terminalsBean.setLineName(towerDto.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());
|
|
|
|
|
terminalsBean.setStatus(item.getStatus());
|
|
|
|
|
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.getList();
|
|
|
|
|
if (CollectionUtil.isEmpty(channellist)) {
|
|
|
|
|
if (BeanUtil.isNotEmpty(item)) {
|
|
|
|
|
TerminalListModel.TerminalsBean terminalsBean = new TerminalListModel.TerminalsBean();
|
|
|
|
|
terminalsBean.setCmdId(item.getCmdid());
|
|
|
|
|
Integer towerid = item.getTowerid();
|
|
|
|
|
terminalsBean.setId(item.getId());
|
|
|
|
|
terminalsBean.setTowerId(towerid);
|
|
|
|
|
TowerDto towerDto = towerMap.get(towerid);
|
|
|
|
|
if (BeanUtil.isNotEmpty(towerDto)) {
|
|
|
|
|
terminalsBean.setTowerName(towerDto.getName());
|
|
|
|
|
terminalsBean.setLineId(towerDto.getLineId());
|
|
|
|
|
terminalsBean.setLineName(towerDto.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());
|
|
|
|
|
terminalsBean.setStatus(item.getStatus());
|
|
|
|
|
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 {
|
|
|
|
|
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);
|
|
|
|
|
List<TermChannelAndMapperDto> channellist = termAndChannelDto.getList();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
terminalsBean.setList(list);
|
|
|
|
|
}
|
|
|
|
|
beanlist.add(terminalsBean);
|
|
|
|
|
}
|
|
|
|
|
beanlist.add(terminalsBean);
|
|
|
|
|
}
|
|
|
|
|
model.setList(beanlist);
|
|
|
|
|
}
|
|
|
|
@ -389,9 +366,9 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
|
|
|
|
|
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
|
|
|
|
|
if (b) {
|
|
|
|
|
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
|
|
|
|
|
} else {
|
|
|
|
|
terminalsWithHeart.setOnlinestatus(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
} else {
|
|
|
|
|
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -419,7 +396,7 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<TerminalIdModel> selectTerminalId(Integer requestId) {
|
|
|
|
|
String result = terminalPhotoDao.getRequestResult(requestId);
|
|
|
|
|
String result = requestResultsDao.getRequestResult(requestId);
|
|
|
|
|
TerminalIdModel model = new TerminalIdModel();
|
|
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
|
|
model = JSONObject.parseObject(result, TerminalIdModel.class);
|
|
|
|
@ -461,7 +438,8 @@ public class TerminalServiceImpl implements TerminalService {
|
|
|
|
|
if (vo.getNeedPic() == 0) {
|
|
|
|
|
dto = terminalPhotoDao.selectPhotoMark(vo);
|
|
|
|
|
if (null != dto && StringUtils.isNotBlank(dto.getPath())) {
|
|
|
|
|
dto.setPath(requestIp + photoaddress + dto.getPath());
|
|
|
|
|
String photoPath = TerminalUtils.getPhotoPath(0, requestIp, dto.getPath());
|
|
|
|
|
dto.setPath(photoPath);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dto = terminalPhotoDao.selectPhotoWithoutPic(vo);
|
|
|
|
|