管理员开门
This commit is contained in:
@@ -302,6 +302,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void adminEnter(String deviceName, Integer venueId) {
|
public void adminEnter(String deviceName, Integer venueId) {
|
||||||
|
// 暂不应该支持
|
||||||
Channel channel = getCurrentChannel(deviceName, venueId);
|
Channel channel = getCurrentChannel(deviceName, venueId);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
throw new ServiceException("设备离线!请检查连接");
|
throw new ServiceException("设备离线!请检查连接");
|
||||||
@@ -320,7 +321,7 @@ public class ServerMessageHandlerAdapter implements MessageService {
|
|||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
throw new ServiceException("设备离线!请检查连接");
|
throw new ServiceException("设备离线!请检查连接");
|
||||||
}
|
}
|
||||||
logger.info("管理员入场");
|
logger.info("管理员开门" + deviceName + "$" + venueId);
|
||||||
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.OUT_DOOR,"OK"));
|
ServerMessageUtils.INSTANCE.sendMsg(channel,new VenueMessage(MessageType.OUT_DOOR,"OK"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.sv.oms.controller;
|
package com.sv.oms.controller;
|
||||||
import com.enums.DeviceStatusEnum;
|
import com.enums.DeviceStatusEnum;
|
||||||
import com.enums.EnterEnum;
|
import com.enums.EnterEnum;
|
||||||
|
import com.sv.exception.oms.OmsException;
|
||||||
import com.sv.service.oms.DeviceService;
|
import com.sv.service.oms.DeviceService;
|
||||||
import com.ydd.framework.core.common.Pagination;
|
import com.ydd.framework.core.common.Pagination;
|
||||||
import com.ydd.framework.core.common.dto.ResponseDTO;
|
import com.ydd.framework.core.common.dto.ResponseDTO;
|
||||||
@@ -81,8 +82,9 @@ public class DeviceController extends OmsController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/device/admin/enter/{id}")
|
@RequestMapping("/device/admin/enter/{id}")
|
||||||
public ResponseDTO adminEnter(@PathVariable("id") Integer deviceId){
|
public ResponseDTO adminEnter(@PathVariable("id") Integer deviceId){
|
||||||
deviceService.adminOperate(deviceId,EnterEnum.ENTER);
|
// deviceService.adminOperate(deviceId,EnterEnum.ENTER);
|
||||||
return ResponseDTO.ok("入场开门成功!");
|
// return ResponseDTO.ok("入场开门成功!");
|
||||||
|
throw new ServiceException("非法操作!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/device/upload/log/{id}")
|
@RequestMapping("/device/upload/log/{id}")
|
||||||
@@ -97,7 +99,18 @@ public class DeviceController extends OmsController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/device/admin/out/{id}")
|
@RequestMapping("/device/admin/out/{id}")
|
||||||
public ResponseDTO adminOut(@PathVariable("id") Integer deviceId){
|
public ResponseDTO adminOut(@PathVariable("id") Integer deviceId,@RequestParam("password") String password){
|
||||||
|
Device device = deviceService.findById(deviceId);
|
||||||
|
if (device == null) {
|
||||||
|
throw new OmsException("设备离线!请检查连接");
|
||||||
|
}
|
||||||
|
if (!DeviceStatusEnum.ONLINE.value.equals(device.getStatus())){
|
||||||
|
throw new OmsException("设备离线!请检查连接");
|
||||||
|
}
|
||||||
|
logger.info("管理员开门" + deviceId + "输入密码为:【" + password + "】");
|
||||||
|
if (!"123465".equals(password)) {
|
||||||
|
throw new OmsException("密码错误,开门失败!");
|
||||||
|
}
|
||||||
deviceService.adminOperate(deviceId, EnterEnum.OUT);
|
deviceService.adminOperate(deviceId, EnterEnum.OUT);
|
||||||
return ResponseDTO.ok("出场开门成功!");
|
return ResponseDTO.ok("出场开门成功!");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user