1. 更新枚举用法
This commit is contained in:
parent
6c8f67be1c
commit
242e1de112
|
@ -29,15 +29,4 @@ public enum AlarmControlTypeName implements EnumerationBase {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.desc;
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据code值获取枚举类型
|
|
||||||
public static AlarmControlTypeName getByCode(int code) {
|
|
||||||
for (AlarmControlTypeName myEnum : AlarmControlTypeName.values()) {
|
|
||||||
if (myEnum.getValue() == code) {
|
|
||||||
return myEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果找不到对应的枚举类型,可以根据具体需求抛出异常或者返回null
|
|
||||||
throw new IllegalArgumentException("Invalid code: " + code);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,4 @@ public enum AlarmModeName implements EnumerationBase {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.desc;
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据code值获取枚举类型
|
|
||||||
public static AlarmModeName getByCode(int code) {
|
|
||||||
for (AlarmModeName myEnum : AlarmModeName.values()) {
|
|
||||||
if (myEnum.getValue() == code) {
|
|
||||||
return myEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果找不到对应的枚举类型,可以根据具体需求抛出异常或者返回null
|
|
||||||
throw new IllegalArgumentException("Invalid code: " + code);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,15 +27,4 @@ public enum AlarmTypeName implements EnumerationBase {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.desc;
|
return this.desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据code值获取枚举类型
|
|
||||||
public static AlarmTypeName getByCode(int code) {
|
|
||||||
for (AlarmTypeName myEnum : AlarmTypeName.values()) {
|
|
||||||
if (myEnum.getValue() == code) {
|
|
||||||
return myEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果找不到对应的枚举类型,可以根据具体需求抛出异常或者返回null
|
|
||||||
throw new IllegalArgumentException("Invalid code: " + code);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@ package com.zjyr.beidouservice.service.impl;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.zjyr.beidouservice.common.CommonEnumHandler;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmControlTypeName;
|
import com.zjyr.beidouservice.common.impl.AlarmControlTypeName;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmModeName;
|
import com.zjyr.beidouservice.common.impl.AlarmModeName;
|
||||||
import com.zjyr.beidouservice.common.impl.AlarmTypeName;
|
import com.zjyr.beidouservice.common.impl.AlarmTypeName;
|
||||||
|
import com.zjyr.beidouservice.common.impl.ControlChannelStatus;
|
||||||
import com.zjyr.beidouservice.common.impl.SensorControlTunnelName;
|
import com.zjyr.beidouservice.common.impl.SensorControlTunnelName;
|
||||||
import com.zjyr.beidouservice.common.impl.TaskStatusName;
|
import com.zjyr.beidouservice.common.impl.TaskStatusName;
|
||||||
import com.zjyr.beidouservice.constenum.ApprovalStatusEnum;
|
import com.zjyr.beidouservice.constenum.ApprovalStatusEnum;
|
||||||
|
@ -110,9 +112,9 @@ public class AlarmTaskServiceImpl implements AlarmTaskService {
|
||||||
//执行控制任,默认只有一种通道方式
|
//执行控制任,默认只有一种通道方式
|
||||||
adapterProtocolService.createSensorControlProtocol(
|
adapterProtocolService.createSensorControlProtocol(
|
||||||
generatedId.intValue(),
|
generatedId.intValue(),
|
||||||
AlarmModeName.getByCode(alarmTaskReqDTO.getAlarmMode()),
|
CommonEnumHandler.codeOf(AlarmModeName.class, alarmTaskReqDTO.getAlarmMode()),
|
||||||
AlarmControlTypeName.getByCode(alarmTaskReqDTO.getAlarmType()),
|
CommonEnumHandler.codeOf(AlarmControlTypeName.class, alarmTaskReqDTO.getAlarmType()),
|
||||||
AlarmTypeName.getByCode(alarmTaskReqDTO.getAlarmKind()),
|
CommonEnumHandler.codeOf(AlarmTypeName.class, alarmTaskReqDTO.getAlarmKind()),
|
||||||
alarmTaskReqDTO.getControlChannel(),
|
alarmTaskReqDTO.getControlChannel(),
|
||||||
alarmTaskReqDTO.getSendTime(),
|
alarmTaskReqDTO.getSendTime(),
|
||||||
deviceInfo.getCityCodes(),
|
deviceInfo.getCityCodes(),
|
||||||
|
|
Loading…
Reference in New Issue