管理员开门
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sv.oms.controller;
|
||||
import com.enums.DeviceStatusEnum;
|
||||
import com.enums.EnterEnum;
|
||||
import com.sv.exception.oms.OmsException;
|
||||
import com.sv.service.oms.DeviceService;
|
||||
import com.ydd.framework.core.common.Pagination;
|
||||
import com.ydd.framework.core.common.dto.ResponseDTO;
|
||||
@@ -81,8 +82,9 @@ public class DeviceController extends OmsController {
|
||||
*/
|
||||
@RequestMapping("/device/admin/enter/{id}")
|
||||
public ResponseDTO adminEnter(@PathVariable("id") Integer deviceId){
|
||||
deviceService.adminOperate(deviceId,EnterEnum.ENTER);
|
||||
return ResponseDTO.ok("入场开门成功!");
|
||||
// deviceService.adminOperate(deviceId,EnterEnum.ENTER);
|
||||
// return ResponseDTO.ok("入场开门成功!");
|
||||
throw new ServiceException("非法操作!!!");
|
||||
}
|
||||
|
||||
@RequestMapping("/device/upload/log/{id}")
|
||||
@@ -97,7 +99,18 @@ public class DeviceController extends OmsController {
|
||||
* @return
|
||||
*/
|
||||
@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);
|
||||
return ResponseDTO.ok("出场开门成功!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user