变电站网关设备模块
This commit is contained in:
parent
9308213289
commit
faa8d48ccd
@ -17,9 +17,7 @@ public class GlobalExceptionHandler {
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = Throwable.class)
|
||||
public ResponseResult handleException(Throwable e) {
|
||||
log.error(e.getMessage());;
|
||||
String message = e.getMessage();
|
||||
log.error("message:{}", message);
|
||||
e.printStackTrace();
|
||||
return ResponseResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,9 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IDeviceAlarmRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 变电站-辅控设备-告警参数设置 前端控制器
|
||||
@ -28,32 +17,5 @@ import javax.annotation.Resource;
|
||||
@Api(value = "DeviceAlarmParameterController", tags = "变电站辅控设备告警参数设置")
|
||||
public class DeviceAlarmParameterController {
|
||||
|
||||
@Resource
|
||||
private IDeviceAlarmRecordService deviceAlarmRecordService;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备告警记录
|
||||
* 参数说明
|
||||
* systemcode 所属系统
|
||||
* deviceName 告警设备名称
|
||||
* signalName 告警信号名称
|
||||
* startDate (开始日期)
|
||||
* endDate (结束日期)
|
||||
* alarmLevel 告警等级
|
||||
* status 告警状态
|
||||
* page 分页对象
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询变电站辅控设备告警记录")
|
||||
public ResponseResult getDeviceAlarmRecordPage(String systemcode, String deviceName, String signalName, String startDate, String endDate, String alarmLevel, String status, Page<DeviceAlarmRecord> page) {
|
||||
//参数校验 所属系统不能为空
|
||||
if (systemcode == null) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
//分页查询
|
||||
Page<DeviceAlarmRecord> deviceAlarmRecordPage = deviceAlarmRecordService.getDeviceAlarmRecordPage(systemcode, deviceName, signalName, startDate,endDate,alarmLevel,status,page);
|
||||
return ResponseResult.successData(deviceAlarmRecordPage);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,19 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceAlarmRecord;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IDeviceAlarmRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 变电站-辅控设备-告警记录 前端控制器
|
||||
@ -19,4 +27,31 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(value = "DeviceAlarmRecordController", tags = "变电站辅控设备告警记录")
|
||||
public class DeviceAlarmRecordController {
|
||||
|
||||
@Resource
|
||||
private IDeviceAlarmRecordService deviceAlarmRecordService;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备告警记录
|
||||
* 参数说明
|
||||
* systemcode 所属系统
|
||||
* deviceName 告警设备名称
|
||||
* signalName 告警信号名称
|
||||
* startDate (开始日期)
|
||||
* endDate (结束日期)
|
||||
* alarmLevel 告警等级
|
||||
* status 告警状态
|
||||
* page 分页对象
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询变电站辅控设备告警记录")
|
||||
public ResponseResult getDeviceAlarmRecordPage(String systemcode, String deviceName, String signalName, String startDate, String endDate, String alarmLevel, String status, Page<DeviceAlarmRecord> page) {
|
||||
//参数校验 所属系统不能为空
|
||||
if (systemcode == null) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
//分页查询
|
||||
Page<DeviceAlarmRecord> deviceAlarmRecordPage = deviceAlarmRecordService.getDeviceAlarmRecordPage(systemcode, deviceName, signalName, startDate,endDate,alarmLevel,status,page);
|
||||
return ResponseResult.successData(deviceAlarmRecordPage);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,20 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.annotation.Log;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -19,4 +29,112 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(value = "GatewayDeviceController", tags = "变电站通讯网关设备")
|
||||
public class GatewayDeviceController {
|
||||
|
||||
@Resource
|
||||
private IGatewayDeviceService gatewayDeviceService;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站网关设备
|
||||
* 参数说明
|
||||
* deviceName 设备名称
|
||||
* deviceModel 设备型号
|
||||
*deviceType 设备类型
|
||||
*status 设备状态
|
||||
* pageNum 当前页
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回分页查询结果
|
||||
***********************************/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询变电站网关设备")
|
||||
public ResponseResult getGatewayDevicePage(String deviceName, String deviceModel, String deviceType,
|
||||
String status, Page<GatewayDevice> page) {
|
||||
//分页查询
|
||||
Page<GatewayDevice> deviceAlarmParameterPage = gatewayDeviceService.getGatewayDevicePage(deviceName,
|
||||
deviceModel, deviceType, status, page);
|
||||
return ResponseResult.successData(deviceAlarmParameterPage);
|
||||
}
|
||||
|
||||
/***********************************
|
||||
* 用途说明:新增变电站网关设备
|
||||
* 参数说明
|
||||
* systemDevice 变电站网关
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回新增成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "数据变电站网关设备", value = "新增变电站网关设备!", type = "1")
|
||||
@PostMapping("/addGatewayDevice")
|
||||
@ApiOperation("新增变电站网关设备")
|
||||
@ResponseBody
|
||||
public ResponseResult addGatewayDevice(@RequestBody GatewayDevice gatewayDevice) {
|
||||
//对象不能为空
|
||||
if (ObjectUtil.isEmpty(gatewayDevice)) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = gatewayDeviceService.addGatewayDevice(gatewayDevice);
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 修改变电站网关设备
|
||||
* 参数说明
|
||||
* systemDevice 变电站网关设备
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回修改成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "数据变电站网关设备", value = "修改变电站网关设备", type = "1")
|
||||
@PostMapping("/updateGatewayDevice")
|
||||
@ApiOperation("修改变电站网关设备")
|
||||
public ResponseResult updateGatewayDevice(@RequestBody GatewayDevice gatewayDevice) {
|
||||
//对象不能为空
|
||||
if (ObjectUtil.isEmpty(gatewayDevice)) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = gatewayDeviceService.updateGatewayDevice(gatewayDevice);
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据ID删除变电站网关设备
|
||||
* 参数说明 id 变电站网关设备ID
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回删除成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "数据变电站网关设备", value = "根据ID删除变电站网关设备", type = "1")
|
||||
@PostMapping("/deleteGatewayDeviceById")
|
||||
@ApiOperation("根据ID删除变电站网关设备")
|
||||
public ResponseResult deleteGatewayDeviceById(@RequestParam String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = gatewayDeviceService.removeById(id);
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据ID删除变电站网关设备
|
||||
* 参数说明 ids 变电站网关设备ID
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回删除成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "数据变电站系统设备", value = "根据ID删除变电站网关设备", type = "1")
|
||||
@PostMapping("/deleteBatchGateway")
|
||||
@ApiOperation("根据ID批量删除变电站网关设备")
|
||||
public ResponseResult deleteBatchGateway(@RequestBody List<String> ids) {
|
||||
if (ids.size() <= 0) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = gatewayDeviceService.removeByIds(ids);
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -20,4 +21,29 @@ public interface IGatewayDeviceService extends IService<GatewayDevice> {
|
||||
* 返回值说明: 无
|
||||
***********************************/
|
||||
void updateKeepLiveTime(String ip);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站网关设备
|
||||
* 参数说明 deviceName 设备名称
|
||||
* 参数说明 deviceModel 设备型号
|
||||
* 参数说明 deviceType 设备类型
|
||||
* 参数说明 status 状态
|
||||
* 参数说明 page
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.GatewayDevice>
|
||||
***********************************/
|
||||
Page<GatewayDevice> getGatewayDevicePage(String deviceName, String deviceModel, String deviceType, String status, Page<GatewayDevice> page);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 新增变电站网关设备
|
||||
* 参数说明 gatewayDevice 网关设备对象
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
boolean addGatewayDevice(GatewayDevice gatewayDevice);
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 修改变变电站网关设备
|
||||
* 参数说明 gatewayDevice 网关设备对象
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
boolean updateGatewayDevice(GatewayDevice gatewayDevice);
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
package com.yfd.platform.modules.auxcontrol.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.GatewayDevice;
|
||||
import com.yfd.platform.modules.auxcontrol.mapper.GatewayDeviceMapper;
|
||||
import com.yfd.platform.modules.auxcontrol.service.IGatewayDeviceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -23,6 +26,9 @@ import java.sql.Timestamp;
|
||||
@Service
|
||||
public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, GatewayDevice> implements IGatewayDeviceService {
|
||||
|
||||
@Resource
|
||||
private GatewayDeviceMapper gatewayDeviceMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 根据IP,更新心跳保持时间
|
||||
* 参数说明
|
||||
@ -35,4 +41,50 @@ public class GatewayDeviceServiceImpl extends ServiceImpl<GatewayDeviceMapper, G
|
||||
queryWrapper.eq(GatewayDevice::getIpAddr, ip).set(GatewayDevice::getStatus, "01").set(GatewayDevice::getKeepliveTime, new Timestamp(System.currentTimeMillis()));
|
||||
this.update(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<GatewayDevice> getGatewayDevicePage(String deviceName, String deviceModel, String deviceType,
|
||||
String status, Page<GatewayDevice> page) {
|
||||
//根据条件查询 变电站系统设备 分页查询变电站系统设备
|
||||
LambdaQueryWrapper<GatewayDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//如果设备名称 deviceName不为空
|
||||
if (StringUtils.isNotEmpty(deviceName)) {
|
||||
queryWrapper.like(GatewayDevice::getDeviceName, deviceName);
|
||||
}
|
||||
//如果设备型号 deviceModel不为空
|
||||
if (StringUtils.isNotEmpty(deviceModel)) {
|
||||
queryWrapper.like(GatewayDevice::getDeviceModel, deviceModel);
|
||||
}
|
||||
//如果设备类型 deviceType不为空
|
||||
if (StringUtils.isNotEmpty(deviceType)) {
|
||||
queryWrapper.eq(GatewayDevice::getDeviceType, deviceType);
|
||||
}
|
||||
//如果设备状态 status不为空
|
||||
if (StringUtils.isNotEmpty(status)) {
|
||||
queryWrapper.eq(GatewayDevice::getStatus, status);
|
||||
}
|
||||
//根据设备编号排序
|
||||
queryWrapper.orderByAsc(GatewayDevice::getDeviceCode);
|
||||
return gatewayDeviceMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 新增变电站网关设备
|
||||
* 参数说明 gatewayDevice 网关设备对象
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean addGatewayDevice(GatewayDevice gatewayDevice) {
|
||||
return this.saveOrUpdate(gatewayDevice);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 修改变电站网关设备
|
||||
* 参数说明 gatewayDevice 网关设备对象
|
||||
* 返回值说明: boolean
|
||||
***********************************/
|
||||
@Override
|
||||
public boolean updateGatewayDevice(GatewayDevice gatewayDevice) {
|
||||
return this.saveOrUpdate(gatewayDevice);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user