Commit bdce2596 by YG8999

设备操作枚举代码

parent 74b5e660
......@@ -61,7 +61,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
}
if (DeviceType.DEVICE_0001.getCode().equals(device.getDevType())) {
// 取电开关
this.deviceOpInit(device.getDevId(), deviceParam.getPhone(), OpTypeEnum.GET_ELECTRIC.getCode(), true, 2L);
this.deviceOpInit(device.getDevId(), deviceParam.getPhone(), OpTypeEnum.GET_ELECTRIC.getCode(), true, 3L);
}
}
......
......@@ -12,6 +12,7 @@ import share.common.constant.MqttConstants;
import share.common.enums.MqttOpType;
import share.common.enums.MqttOpenType;
import share.common.enums.MqttReportType;
import share.common.enums.OpTypeEnum;
import share.common.utils.DateUtils;
import share.system.domain.Device;
import share.system.domain.DeviceGateway;
......@@ -153,29 +154,22 @@ public class MqttxServiceImpl implements MqttxService {
@Override
public MqttxVo openOrCloseDevice(String devId, String phone, String opType) {
MqttxVo mqttxVo = null;
switch (opType) {
case "10":
// 开锁
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.OPEN.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_OPEN);
break;
case "20":
// 取电
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.OPEN.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_ELECTRICITY_INTAKE);
break;
case "30":
// 锁门
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.CLOSE.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_CLOSE);
break;
case "40":
// 断电
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.CLOSE.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_ELECTRICITY_CLOSE);
break;
default:
break;
if (OpTypeEnum.OPEN_DOOR.getCode().equals(opType)) {
// 开锁
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.OPEN.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_OPEN);
} else if (OpTypeEnum.GET_ELECTRIC.getCode().equals(opType)) {
// 取电
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.OPEN.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_ELECTRICITY_INTAKE);
} else if (OpTypeEnum.LOCK_DOOR.getCode().equals(opType)) {
// 锁门
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.CLOSE.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_CLOSE);
} else if (OpTypeEnum.CUT_ELECTRIC.getCode().equals(opType)) {
// 断电
mqttxVo = this.openOrCloseDeviceInit(devId,phone, MqttOpenType.CLOSE.getCode(),
MqttConstants.MQTT_DESCRIBE_DEVICE_ELECTRICITY_CLOSE);
}
return mqttxVo;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment