|
|
@ -7,9 +7,12 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
import com.shxy.xymanager_common.dto.DyLineAndTerminalAndChannelDto;
|
|
|
|
import com.shxy.xymanager_common.dto.DyLineAndTerminalAndChannelDto;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.dto.LineAndDyNameDto;
|
|
|
|
import com.shxy.xymanager_common.dto.TermChannelAndMapperDto;
|
|
|
|
import com.shxy.xymanager_common.dto.TermChannelAndMapperDto;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.dto.TowerDto;
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalChannels;
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalChannels;
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalStatus;
|
|
|
|
import com.shxy.xymanager_common.entity.TerminalStatus;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.entity.Terminals;
|
|
|
|
import com.shxy.xymanager_common.enums.CommonStatus;
|
|
|
|
import com.shxy.xymanager_common.enums.CommonStatus;
|
|
|
|
import com.shxy.xymanager_common.exception.Asserts;
|
|
|
|
import com.shxy.xymanager_common.exception.Asserts;
|
|
|
|
import com.shxy.xymanager_common.model.DyLineTreeAndChannelListModel;
|
|
|
|
import com.shxy.xymanager_common.model.DyLineTreeAndChannelListModel;
|
|
|
@ -21,6 +24,7 @@ import com.shxy.xymanager_common.vo.*;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalChannelsDao;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalChannelsDao;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
|
|
|
|
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
|
|
|
|
|
|
|
|
import com.shxy.xymanager_service.service.CacheService;
|
|
|
|
import com.shxy.xymanager_service.service.TerminalChannelService;
|
|
|
|
import com.shxy.xymanager_service.service.TerminalChannelService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@ -29,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 装置通道实现层
|
|
|
|
* 装置通道实现层
|
|
|
@ -46,6 +51,9 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
TerminalPhotoDao terminalPhotoDao;
|
|
|
|
TerminalPhotoDao terminalPhotoDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
CacheService cacheService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增通道列表
|
|
|
|
* 新增通道列表
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -57,7 +65,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
List<TerminalChannels> list = BeanUtil.copyToList(vo.getList(), TerminalChannels.class, CopyOptions.create().ignoreCase());
|
|
|
|
List<TerminalChannels> list = BeanUtil.copyToList(vo.getList(), TerminalChannels.class, CopyOptions.create().ignoreCase());
|
|
|
|
Date date = new Date();
|
|
|
|
Date date = new Date();
|
|
|
|
int count = terminalChannelsDao.selectChannelCount(vo.getList());
|
|
|
|
int count = terminalChannelsDao.selectChannelCount(vo.getList());
|
|
|
|
if(count>0){
|
|
|
|
if (count > 0) {
|
|
|
|
return Asserts.error("通道重复");
|
|
|
|
return Asserts.error("通道重复");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int i = terminalChannelsDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
|
|
|
|
int i = terminalChannelsDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
|
|
|
@ -165,12 +173,40 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ServiceBody<TerminalChannelMapperListModel> getChannelByTermid(TerminalIdVo vo) {
|
|
|
|
public ServiceBody<TerminalChannelMapperListModel> getChannelByTermid(TerminalIdVo vo) {
|
|
|
|
|
|
|
|
TerminalChannelMapperListModel model = new TerminalChannelMapperListModel();
|
|
|
|
Integer termId = vo.getTermid();
|
|
|
|
Integer termId = vo.getTermid();
|
|
|
|
// boolean b = TerminalUtils.judgeTerminalStatus(XyCache.terminalStatusMap, termId);
|
|
|
|
// boolean b = TerminalUtils.judgeTerminalStatus(XyCache.terminalStatusMap, termId);
|
|
|
|
// if (!b) {
|
|
|
|
// if (!b) {
|
|
|
|
// Asserts.fail(100, "装置下线");
|
|
|
|
// Asserts.fail(100, "装置下线");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
TerminalChannelMapperListModel model = new TerminalChannelMapperListModel();
|
|
|
|
if (termId != null) {
|
|
|
|
|
|
|
|
model.setTermId(termId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
|
|
|
|
|
|
|
|
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
|
|
|
|
|
|
|
|
Map<Integer, LineAndDyNameDto> lineMap = cacheService.getLineMap();
|
|
|
|
|
|
|
|
if (terminalMap != null) {
|
|
|
|
|
|
|
|
Terminals terminals = terminalMap.get(termId);
|
|
|
|
|
|
|
|
if (terminals != null) {
|
|
|
|
|
|
|
|
Integer towerid = terminals.getTowerid();
|
|
|
|
|
|
|
|
if (towerid != null) {
|
|
|
|
|
|
|
|
model.setTowerId(towerid);
|
|
|
|
|
|
|
|
if (towerMap != null) {
|
|
|
|
|
|
|
|
TowerDto towerDto = towerMap.get(towerid);
|
|
|
|
|
|
|
|
if (towerDto != null) {
|
|
|
|
|
|
|
|
Integer lineId = towerDto.getLineId();
|
|
|
|
|
|
|
|
model.setLineId(lineId);
|
|
|
|
|
|
|
|
if (lineMap != null) {
|
|
|
|
|
|
|
|
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineId);
|
|
|
|
|
|
|
|
Integer dyLevelId = lineAndDyNameDto.getDyLevelId();
|
|
|
|
|
|
|
|
model.setDyId(dyLevelId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
List<TermChannelAndMapperDto> list = terminalChannelsDao.selectByTermid(termId, CommonStatus.EFFECTIVE.value());
|
|
|
|
List<TermChannelAndMapperDto> list = terminalChannelsDao.selectByTermid(termId, CommonStatus.EFFECTIVE.value());
|
|
|
|
log.info("通道查出数据:{}", JSON.toJSONString(list));
|
|
|
|
log.info("通道查出数据:{}", JSON.toJSONString(list));
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list);
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list);
|
|
|
|