辅助模块swagger配置和Map的key值驼峰
This commit is contained in:
parent
62caddbd98
commit
6d0a0f6ac9
@ -110,11 +110,24 @@ public class SwaggerConfig {
|
||||
.enable(swaggerEnabled);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket createAuxcontrolApi() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.apiInfo(apiInfo())
|
||||
.groupName("8. 辅控接口")
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.yfd.platform.modules.auxcontrol.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.pathMapping("/")
|
||||
.enable(swaggerEnabled);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket createTestApi() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.apiInfo(apiInfo())
|
||||
.groupName("8. 测试接口")
|
||||
.groupName("9. 测试接口")
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.yfd.platform.modules.test.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/device-alarm-parameter")
|
||||
@Api(value = "DeviceAlarmParameterController", tags = "变电站辅控设备告警参数设置")
|
||||
public class DeviceAlarmParameterController {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/device-alarm-record")
|
||||
@Api(value = "DeviceAlarmRecordController", tags = "变电站辅控设备告警记录")
|
||||
public class DeviceAlarmRecordController {
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,22 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
|
||||
import com.yfd.platform.modules.auxcontrol.mapper.DeviceSignalMapper;
|
||||
import com.yfd.platform.modules.basedata.domain.SubstationModel;
|
||||
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;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 变电站-辅控设备-信号 前端控制器
|
||||
@ -15,6 +27,16 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/device-signal")
|
||||
@Api(value = "DeviceSignalController", tags = "变电站辅控设备信号")
|
||||
public class DeviceSignalController {
|
||||
|
||||
@Resource
|
||||
private DeviceSignalMapper deviceSignalMapper;
|
||||
|
||||
@GetMapping("/getDeviceSignal")
|
||||
@ApiOperation("查询信号")
|
||||
public ResponseResult getDeviceSignal(String type, String address) {
|
||||
return ResponseResult.successData(deviceSignalMapper.selectDeviceSignalMap("", type, address));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/device-work-data")
|
||||
@Api(value = "DeviceWorkDataController", tags = "变电站设备运行数据")
|
||||
public class DeviceWorkDataController {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/gateway-device")
|
||||
@Api(value = "GatewayDeviceController", tags = "变电站通讯网关设备")
|
||||
public class GatewayDeviceController {
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/auxcontrol/meter-device")
|
||||
@Api(value = "MeterDeviceController", tags = "变电站二次设备中的智能仪表监控设备")
|
||||
public class MeterDeviceController {
|
||||
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
//如果是yx 遥信 (设备自身报警记录)
|
||||
if ("yx".equals(type)) {
|
||||
//如果信号类型是1 设备告警
|
||||
if ("1".equals(map.get("signal_type").toString())) {
|
||||
if ("1".equals(map.get("signalType").toString())) {
|
||||
//紧接者判断 value (1是告警 0是正常) status
|
||||
if (1 == Integer.parseInt(value)) {
|
||||
//填充告警记录信息接口
|
||||
@ -112,7 +112,7 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
} else {
|
||||
//紧接者判断 value (1是告警 0是正常) status 同一信号监测到报警状态消除,对当前信号所有未处理历史报警打上已处理标签,并记录消除时间
|
||||
LambdaQueryWrapper<DeviceAlarmRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DeviceAlarmRecord::getSignalId, map.get("signal_id").toString());
|
||||
queryWrapper.eq(DeviceAlarmRecord::getSignalId, map.get("signalId").toString());
|
||||
queryWrapper.eq(DeviceAlarmRecord::getAlarmClass, "2");
|
||||
queryWrapper.in(DeviceAlarmRecord::getStatus, "01", "02");
|
||||
DeviceAlarmRecord deviceAlarmRecord = new DeviceAlarmRecord();
|
||||
@ -125,14 +125,14 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
}
|
||||
} else if ("yc".equals(type)) {
|
||||
//1.通过设备id 和信号id 查询告警参数设置表(告警规则)
|
||||
LambdaQueryWrapper<DeviceAlarmParameter> queryWrapperDAP = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotEmpty(map.get("device_id").toString())) {
|
||||
queryWrapperDAP.eq(DeviceAlarmParameter::getDeviceId, map.get("device_id").toString());
|
||||
LambdaQueryWrapper<DeviceAlarmParameter> querywrapperdap = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotEmpty(map.get("meterDeviceId").toString())) {
|
||||
querywrapperdap.eq(DeviceAlarmParameter::getDeviceId, map.get("meterDeviceId").toString());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(map.get("signal_id").toString())) {
|
||||
queryWrapperDAP.eq(DeviceAlarmParameter::getSignalId, map.get("signal_id").toString());
|
||||
if (StrUtil.isNotEmpty(map.get("signalId").toString())) {
|
||||
querywrapperdap.eq(DeviceAlarmParameter::getSignalId, map.get("signalId").toString());
|
||||
}
|
||||
List<DeviceAlarmParameter> deviceAlarmParameters = deviceAlarmParameterMapper.selectList(queryWrapperDAP);
|
||||
List<DeviceAlarmParameter> deviceAlarmParameters = deviceAlarmParameterMapper.selectList(querywrapperdap);
|
||||
if (deviceAlarmParameters != null && deviceAlarmParameters.size() > 0) {
|
||||
for (DeviceAlarmParameter deviceAlarmParameter : deviceAlarmParameters) {
|
||||
//如果告警触发条件 不为空 1<=value<=100
|
||||
@ -147,28 +147,19 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
//首先判断 在不在时间范围之内 判断时间在不在时间范围之内接口
|
||||
Map<String, Object> timeInterval = getTimeInterval(7);
|
||||
//如果在时间范围内
|
||||
if ("1".equals(timeInterval.get("beforeclock").toString())) {
|
||||
//查询表中是否存在该报警记录
|
||||
List<DeviceAlarmRecord> alarmRecords = queryDeviceAlarmRecord(deviceAlarmRecord,
|
||||
timeInterval);
|
||||
//如果没有有报警记录 新增记录
|
||||
if (alarmRecords.size() == 0) {
|
||||
// 新增
|
||||
deviceAlarmRecordMapper.insert(deviceAlarmRecord);
|
||||
//TODO 邮件推送暂时删除了
|
||||
}
|
||||
} else {
|
||||
List<DeviceAlarmRecord> alarmRecords = queryDeviceAlarmRecord(deviceAlarmRecord,
|
||||
timeInterval);
|
||||
if (alarmRecords.size() == 0) {
|
||||
deviceAlarmRecordMapper.insert(deviceAlarmRecord);
|
||||
//TODO 邮件推送暂时删除了
|
||||
}
|
||||
//查询表中是否存在该报警记录
|
||||
List<DeviceAlarmRecord> alarmRecords = queryDeviceAlarmRecord(deviceAlarmRecord,
|
||||
timeInterval);
|
||||
//如果没有有报警记录 新增记录
|
||||
if (alarmRecords.size() == 0) {
|
||||
// 新增
|
||||
deviceAlarmRecordMapper.insert(deviceAlarmRecord);
|
||||
//TODO 邮件推送暂时删除了
|
||||
}
|
||||
} else {
|
||||
//不满足条件 同一信号监测到报警状态消除,对当前信号所有未处理历史报警打上已处理标签,并记录消除时间
|
||||
LambdaUpdateWrapper<DeviceAlarmRecord> queryWrapper = new LambdaUpdateWrapper<>();
|
||||
queryWrapper.eq(DeviceAlarmRecord::getSignalId, map.get("signal_id").toString());
|
||||
queryWrapper.eq(DeviceAlarmRecord::getSignalId, map.get("signalId").toString());
|
||||
queryWrapper.eq(DeviceAlarmRecord::getAlarmClass, "1");
|
||||
queryWrapper.eq(DeviceAlarmRecord::getAlarmLevel, deviceAlarmParameter.getAlarmLevel());
|
||||
queryWrapper.in(DeviceAlarmRecord::getStatus, "01", "02")
|
||||
@ -190,34 +181,34 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
* @return 返回告警记录信息
|
||||
*/
|
||||
public DeviceAlarmRecord FillingDeviceAlarmRecord(String type, DeviceAlarmParameter deviceAlarmParameter,
|
||||
Map singaldata, String value) {
|
||||
Map<String,Object> singaldata, String value) {
|
||||
DeviceAlarmRecord deviceAlarmRecord = new DeviceAlarmRecord();
|
||||
MeterDevice device = meterDeviceMapper.selectById(singaldata.get("device_id").toString());
|
||||
MeterDevice device = meterDeviceMapper.selectById(singaldata.get("meterDeviceId").toString());
|
||||
|
||||
// 创建 SimpleDateFormat 对象,指定日期格式
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if ("yx".equals(type)) {
|
||||
deviceAlarmRecord.setRecordId(IdUtil.fastSimpleUUID());
|
||||
deviceAlarmRecord.setStationId(singaldata.get("station_id").toString());
|
||||
deviceAlarmRecord.setStationId(singaldata.get("stationId").toString());
|
||||
//变电站id
|
||||
deviceAlarmRecord.setSystemcode(singaldata.get("systemcode").toString());
|
||||
//所属系统
|
||||
deviceAlarmRecord.setAlarmTime(DateUtil.toLocalDateTime(DateUtil.date()));
|
||||
//告警时间
|
||||
deviceAlarmRecord.setDeviceId(singaldata.get("device_id").toString());
|
||||
deviceAlarmRecord.setDeviceId(singaldata.get("meterDeviceId").toString());
|
||||
//告警设备ID
|
||||
deviceAlarmRecord.setDeviceName(singaldata.get("device_name").toString());
|
||||
deviceAlarmRecord.setDeviceName(singaldata.get("deviceName").toString());
|
||||
//告警设名称
|
||||
deviceAlarmRecord.setSignalId(singaldata.get("signal_id").toString());
|
||||
deviceAlarmRecord.setSignalId(singaldata.get("signalId").toString());
|
||||
//告警信号id
|
||||
deviceAlarmRecord.setSignalName(singaldata.get("signal_name").toString());
|
||||
deviceAlarmRecord.setSignalName(singaldata.get("signalName").toString());
|
||||
//告警信号名称
|
||||
deviceAlarmRecord.setAlarmValue(value);
|
||||
//告警值
|
||||
deviceAlarmRecord.setSignalUnit("");
|
||||
//值单位
|
||||
String alarmMessage = String.format("[%s]发生了%s!", singaldata.get("device_name").toString(),
|
||||
singaldata.get("signal_name").toString());
|
||||
String alarmMessage = String.format("[%s]发生了%s!", singaldata.get("deviceName").toString(),
|
||||
singaldata.get("signalName").toString());
|
||||
deviceAlarmRecord.setAlarmMessage(alarmMessage);
|
||||
//告警信息
|
||||
deviceAlarmRecord.setStatus("01");
|
||||
@ -231,27 +222,27 @@ public class DeviceAlarmRecordServiceImpl extends ServiceImpl<DeviceAlarmRecordM
|
||||
if ("yc".equals(type)) {
|
||||
deviceAlarmRecord.setRecordId(IdUtil.fastSimpleUUID());
|
||||
//变电站id
|
||||
deviceAlarmRecord.setStationId(singaldata.get("station_id").toString());
|
||||
deviceAlarmRecord.setStationId(singaldata.get("stationId").toString());
|
||||
//所属系统
|
||||
deviceAlarmRecord.setSystemcode(singaldata.get("systemcode").toString());
|
||||
//告警时间
|
||||
deviceAlarmRecord.setAlarmTime(DateUtil.toLocalDateTime(DateUtil.date()));
|
||||
//告警设备ID
|
||||
deviceAlarmRecord.setDeviceId(singaldata.get("device_id").toString());
|
||||
deviceAlarmRecord.setDeviceId(singaldata.get("meterDeviceId").toString());
|
||||
//告警设备名称
|
||||
deviceAlarmRecord.setDeviceName(singaldata.get("device_name").toString());
|
||||
deviceAlarmRecord.setDeviceName(singaldata.get("deviceName").toString());
|
||||
//告警信号id
|
||||
deviceAlarmRecord.setSignalId(singaldata.get("signal_id").toString());
|
||||
deviceAlarmRecord.setSignalId(singaldata.get("signalId").toString());
|
||||
//告警信号名称
|
||||
deviceAlarmRecord.setSignalName(singaldata.get("signal_name").toString());
|
||||
deviceAlarmRecord.setSignalName(singaldata.get("signalName").toString());
|
||||
//告警类型
|
||||
deviceAlarmRecord.setAlarmType(deviceAlarmParameter.getAlarmType());
|
||||
//告警等级
|
||||
deviceAlarmRecord.setAlarmLevel(deviceAlarmParameter.getAlarmLevel());
|
||||
//告警值
|
||||
deviceAlarmRecord.setAlarmValue(value);
|
||||
String sinalUnit = ObjUtil.isNotEmpty(singaldata.get("signal_unit")) ?
|
||||
singaldata.get("signal_unit").toString() : "";
|
||||
String sinalUnit = ObjUtil.isNotEmpty(singaldata.get("signalUnit")) ?
|
||||
singaldata.get("signalUnit").toString() : "";
|
||||
//值单位
|
||||
deviceAlarmRecord.setSignalUnit(sinalUnit);
|
||||
//正常范围
|
||||
|
@ -49,12 +49,12 @@ public class DeviceWorkDataServiceImpl extends ServiceImpl<DeviceWorkDataMapper,
|
||||
}
|
||||
workdata.setId(IdUtil.fastSimpleUUID());
|
||||
workdata.setSystemcode(map.get("systemcode").toString());
|
||||
workdata.setStationId(map.get("station_id").toString());
|
||||
workdata.setDeviceId(map.get("device_id").toString());
|
||||
workdata.setDeviceName(map.get("device_name").toString());
|
||||
workdata.setSignalId(map.get("signal_id").toString());
|
||||
workdata.setSignalName(map.get("signal_name").toString());
|
||||
workdata.setUnit(ObjUtil.isNotEmpty(map.get("signal_unit")) ? map.get("signal_unit").toString() : "");
|
||||
workdata.setStationId(map.get("stationId").toString());
|
||||
workdata.setDeviceId(map.get("meterDeviceId").toString());
|
||||
workdata.setDeviceName(map.get("deviceName").toString());
|
||||
workdata.setSignalId(map.get("signalId").toString());
|
||||
workdata.setSignalName(map.get("signalName").toString());
|
||||
workdata.setUnit(ObjUtil.isNotEmpty(map.get("signalUnit")) ? map.get("signalUnit").toString() : "");
|
||||
workdata.setValue(new BigDecimal(value));
|
||||
if (StrUtil.isEmpty(dateTimeString) || "null".equals(dateTimeString)) {
|
||||
workdata.setStartTime(LocalDateTime.now());
|
||||
|
Loading…
Reference in New Issue
Block a user