|
|
|
@ -3,6 +3,7 @@ package com.shxy.xymanager_service.impl;
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
|
|
|
import com.shxy.xymanager_common.dto.DyLineAndTerminalAndChannelDto;
|
|
|
|
@ -22,8 +23,11 @@ import com.shxy.xymanager_dao.dao.TerminalStatusDao;
|
|
|
|
|
import com.shxy.xymanager_service.service.TerminalChannelService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -51,7 +55,13 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
|
public ServiceBody<String> addChannelList(TerminalChannelVo vo) {
|
|
|
|
|
List<TerminalChannels> list = BeanUtil.copyToList(vo.getList(), TerminalChannels.class, CopyOptions.create().ignoreCase());
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
int count = terminalChannelsDao.selectChannelCount(vo.getList());
|
|
|
|
|
if(count>0){
|
|
|
|
|
return Asserts.success("通道重复");
|
|
|
|
|
}
|
|
|
|
|
int i = terminalChannelsDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i != 0) {
|
|
|
|
|
return Asserts.success("录入成功");
|
|
|
|
|
} else {
|
|
|
|
@ -67,6 +77,10 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ServiceBody<String> updateChannelList(UpdateTerminalChannelVo vo) {
|
|
|
|
|
int count = terminalChannelsDao.selectChannelCountById(vo);
|
|
|
|
|
if(count>0){
|
|
|
|
|
return Asserts.success("通道重复");
|
|
|
|
|
}
|
|
|
|
|
TerminalChannels bean = new TerminalChannels();
|
|
|
|
|
BeanUtil.copyProperties(vo, bean, CopyOptions.create().ignoreCase());
|
|
|
|
|
int i = terminalChannelsDao.updateByPrimaryKeySelective(bean, new Date());
|
|
|
|
@ -154,6 +168,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
|
public ServiceBody<TerminalChannelMapperListModel> getChannelByTermid(TerminalIdVo vo) {
|
|
|
|
|
TerminalChannelMapperListModel model = new TerminalChannelMapperListModel();
|
|
|
|
|
List<TermChannelAndMapperDto> list = terminalChannelsDao.selectByTermid(vo.getTermid(), CommonStatus.EFFECTIVE.value());
|
|
|
|
|
log.info("通道查出数据:{}", JSON.toJSONString(list));
|
|
|
|
|
boolean empty = CollectionUtil.isEmpty(list);
|
|
|
|
|
if (empty) {
|
|
|
|
|
model.setList(new ArrayList<>());
|
|
|
|
@ -165,6 +180,7 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
|
|
|
|
|
if (!BeanUtil.isEmpty(terminalStatus)) {
|
|
|
|
|
model.setGpsstatus(terminalStatus.getGpsStatus());
|
|
|
|
|
}
|
|
|
|
|
log.info("通道查出返回数据:{}", JSON.toJSONString(model));
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|