优化网关机和设备逻辑
This commit is contained in:
parent
8625da00dd
commit
347c33bd95
@ -1,6 +1,5 @@
|
|||||||
package com.yfd.platform.modules.auxcontrol.controller;
|
package com.yfd.platform.modules.auxcontrol.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -10,11 +9,11 @@ import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
|||||||
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -44,7 +43,8 @@ public class GatewayDeviceController {
|
|||||||
***********************************/
|
***********************************/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ApiOperation("分页查询变电站网关设备")
|
@ApiOperation("分页查询变电站网关设备")
|
||||||
public ResponseResult getGatewayDevicePage(String stationId,String deviceName, String deviceModel, String deviceType,
|
public ResponseResult getGatewayDevicePage(String stationId, String deviceName, String deviceModel,
|
||||||
|
String deviceType,
|
||||||
String status, Page<GatewayDevice> page) {
|
String status, Page<GatewayDevice> page) {
|
||||||
//分页查询
|
//分页查询
|
||||||
Page<GatewayDevice> deviceAlarmParameterPage = gatewayDeviceService.getGatewayDevicePage(stationId, deviceName,
|
Page<GatewayDevice> deviceAlarmParameterPage = gatewayDeviceService.getGatewayDevicePage(stationId, deviceName,
|
||||||
@ -52,6 +52,13 @@ public class GatewayDeviceController {
|
|||||||
return ResponseResult.successData(deviceAlarmParameterPage);
|
return ResponseResult.successData(deviceAlarmParameterPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getGatewayList")
|
||||||
|
@ApiOperation("查询网关机列表")
|
||||||
|
public ResponseResult getGatewayList(String stationId) {
|
||||||
|
List<Map<String, Object>> meterDeviceList = gatewayDeviceService.getGatewayList(stationId);
|
||||||
|
return ResponseResult.successData(meterDeviceList);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* 用途说明:新增变电站网关设备
|
* 用途说明:新增变电站网关设备
|
||||||
* 参数说明
|
* 参数说明
|
||||||
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -45,7 +46,6 @@ public class MeterDeviceController {
|
|||||||
***********************************/
|
***********************************/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ApiOperation("分页查询变电站辅控设备")
|
@ApiOperation("分页查询变电站辅控设备")
|
||||||
@PreAuthorize("@el.check('select:device')")
|
|
||||||
public ResponseResult getDevicePage(String deviceName, String deviceModel, String deviceType, String status,
|
public ResponseResult getDevicePage(String deviceName, String deviceModel, String deviceType, String status,
|
||||||
String systemcode, Page<MeterDevice> page) {
|
String systemcode, Page<MeterDevice> page) {
|
||||||
//参数校验 系统编号不能为空
|
//参数校验 系统编号不能为空
|
||||||
@ -58,6 +58,13 @@ public class MeterDeviceController {
|
|||||||
return ResponseResult.successData(devicePage);
|
return ResponseResult.successData(devicePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getMeterDeviceByCode")
|
||||||
|
@ApiOperation("根据系统编号查询设备")
|
||||||
|
public ResponseResult getMeterDeviceByCode(String stationId, String systemCode) {
|
||||||
|
List<Map<String, Object>> meterDeviceList = meterDeviceService.getMeterDeviceByCode(stationId, systemCode);
|
||||||
|
return ResponseResult.successData(meterDeviceList);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* 用途说明:新增变电站辅控设备信息
|
* 用途说明:新增变电站辅控设备信息
|
||||||
* 参数说明
|
* 参数说明
|
||||||
@ -67,7 +74,6 @@ public class MeterDeviceController {
|
|||||||
@Log(module = "综合辅控系统", value = "新增变电站辅控设备信息!", type = "1")
|
@Log(module = "综合辅控系统", value = "新增变电站辅控设备信息!", type = "1")
|
||||||
@PostMapping("/addMeterDevice")
|
@PostMapping("/addMeterDevice")
|
||||||
@ApiOperation("新增变电站辅控设备信息")
|
@ApiOperation("新增变电站辅控设备信息")
|
||||||
@ResponseBody
|
|
||||||
public ResponseResult addMeterDevice(@RequestBody MeterDevice meterDevice) {
|
public ResponseResult addMeterDevice(@RequestBody MeterDevice meterDevice) {
|
||||||
//对象不能为空
|
//对象不能为空
|
||||||
if (ObjectUtil.isEmpty(meterDevice)) {
|
if (ObjectUtil.isEmpty(meterDevice)) {
|
||||||
|
@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 变电站-通讯网关设备 服务类
|
* 变电站-通讯网关设备 服务类
|
||||||
@ -50,4 +53,11 @@ public interface IGatewayDeviceService extends IService<GatewayDevice> {
|
|||||||
boolean connectToSlave(String ip);
|
boolean connectToSlave(String ip);
|
||||||
|
|
||||||
boolean disconnectToSlave(String ip);
|
boolean disconnectToSlave(String ip);
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* 用途说明: 查询网关机列表
|
||||||
|
* 参数说明 stationId 变电站ID
|
||||||
|
* 返回值说明: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
***********************************/
|
||||||
|
List<Map<String, Object>> getGatewayList(String stationId);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 变电站二次设备中的智能仪表监控设备 服务类
|
* 变电站二次设备中的智能仪表监控设备 服务类
|
||||||
@ -48,4 +51,11 @@ public interface IMeterDeviceService extends IService<MeterDevice> {
|
|||||||
***********************************/
|
***********************************/
|
||||||
boolean batchUpdateDeviceIp(String ids, String ip);
|
boolean batchUpdateDeviceIp(String ids, String ip);
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* 用途说明: 根据系统编号查询设备
|
||||||
|
* 参数说明 stationId 变电站Id
|
||||||
|
* 参数说明 systemCode 系统编号
|
||||||
|
* 返回值说明: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
***********************************/
|
||||||
|
List<Map<String, Object>> getMeterDeviceByCode(String stationId, String systemCode);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yfd.platform.modules.auxcontrol.service.impl;
|
package com.yfd.platform.modules.auxcontrol.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@ -97,6 +98,14 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
|||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public boolean addGatewayDevice(GatewayDevice gatewayDevice) {
|
public boolean addGatewayDevice(GatewayDevice gatewayDevice) {
|
||||||
|
if (StrUtil.isNotBlank(gatewayDevice.getIpAddr())) {
|
||||||
|
LambdaQueryWrapper<GatewayDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(GatewayDevice::getIpAddr, gatewayDevice.getIpAddr());
|
||||||
|
int count = this.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new RuntimeException("当前ip已经有网关机绑定");
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.saveOrUpdate(gatewayDevice);
|
return this.saveOrUpdate(gatewayDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +116,15 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
|||||||
***********************************/
|
***********************************/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateGatewayDevice(GatewayDevice gatewayDevice) {
|
public boolean updateGatewayDevice(GatewayDevice gatewayDevice) {
|
||||||
|
if (StrUtil.isNotBlank(gatewayDevice.getIpAddr())) {
|
||||||
|
LambdaQueryWrapper<GatewayDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.ne(GatewayDevice::getId, gatewayDevice.getId()).eq(GatewayDevice::getIpAddr,
|
||||||
|
gatewayDevice.getIpAddr());
|
||||||
|
int count = this.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new RuntimeException("当前ip已经有网关机绑定");
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.saveOrUpdate(gatewayDevice);
|
return this.saveOrUpdate(gatewayDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,4 +201,16 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* 用途说明: 查询网关机列表
|
||||||
|
* 参数说明 stationId 变电站ID
|
||||||
|
* 返回值说明: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
***********************************/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getGatewayList(String stationId) {
|
||||||
|
LambdaQueryWrapper<GatewayDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(stationId), GatewayDevice::getStationId, stationId).select(GatewayDevice::getIpAddr, GatewayDevice::getDeviceName);
|
||||||
|
return this.listMaps(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yfd.platform.modules.auxcontrol.service.impl;
|
package com.yfd.platform.modules.auxcontrol.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
||||||
@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -70,4 +72,17 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
|||||||
updateWrapper.in(MeterDevice::getDeviceId, idList).set(MeterDevice::getNetdeviceIp, ip);
|
updateWrapper.in(MeterDevice::getDeviceId, idList).set(MeterDevice::getNetdeviceIp, ip);
|
||||||
return this.update(updateWrapper);
|
return this.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************
|
||||||
|
* 用途说明: 根据系统编号查询设备
|
||||||
|
* 参数说明 stationId 变电站Id
|
||||||
|
* 参数说明 systemCode 系统编号
|
||||||
|
* 返回值说明: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||||
|
***********************************/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getMeterDeviceByCode(String stationId, String systemCode) {
|
||||||
|
LambdaQueryWrapper<MeterDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(stationId), MeterDevice::getStationId, stationId).eq(StrUtil.isNotBlank(systemCode), MeterDevice::getSystemcode, systemCode).select(MeterDevice::getDeviceId, MeterDevice::getDeviceName);
|
||||||
|
return this.listMaps(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user