9 changed files with 95 additions and 48 deletions
-
48storeroom/src/main/java/com/storeroom/modules/device/controller/BindDeviceController.java
-
4storeroom/src/main/java/com/storeroom/modules/device/controller/OutsideDevicesController.java
-
4storeroom/src/main/java/com/storeroom/modules/device/domain/DeviceSpecParam.java
-
2storeroom/src/main/java/com/storeroom/modules/device/service/DeviceService.java
-
7storeroom/src/main/java/com/storeroom/modules/device/service/DeviceSpecParamService.java
-
47storeroom/src/main/java/com/storeroom/modules/device/service/dto/DeviceAllDto.java
-
14storeroom/src/main/java/com/storeroom/modules/device/service/dto/DeviceMacDto.java
-
3storeroom/src/main/java/com/storeroom/modules/device/service/impl/DeviceImpl.java
-
14storeroom/src/main/java/com/storeroom/modules/device/service/impl/DeviceSpecParamImpl.java
@ -0,0 +1,48 @@ |
|||||
|
package com.storeroom.modules.device.controller; |
||||
|
|
||||
|
|
||||
|
import com.storeroom.annotaion.rest.AnonymousGetMapping; |
||||
|
import com.storeroom.annotaion.rest.AnonymousPostMapping; |
||||
|
import com.storeroom.exception.BaseException; |
||||
|
import com.storeroom.modules.device.service.DeviceService; |
||||
|
import com.storeroom.modules.device.service.DeviceSpecParamService; |
||||
|
import com.storeroom.modules.device.service.dto.DeviceMacDto; |
||||
|
import com.storeroom.utils.ApiResponse; |
||||
|
import com.storeroom.utils.MacUtil; |
||||
|
import com.storeroom.utils.StringUtils; |
||||
|
import com.storeroom.utils.enums.ResponseStatus; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
@RestController |
||||
|
@RequiredArgsConstructor |
||||
|
@Api(tags = "设备Mac地址") |
||||
|
@RequestMapping("/api/mac/") |
||||
|
public class BindDeviceController { |
||||
|
|
||||
|
private final DeviceSpecParamService deviceSpecParamService; |
||||
|
|
||||
|
@ApiOperation("获取mac地址") |
||||
|
@AnonymousGetMapping("get") |
||||
|
public ApiResponse<Object> getMacAddress() throws Exception{ |
||||
|
return ApiResponse.success(MacUtil.getMac()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@ApiOperation("绑定Mac地址") |
||||
|
@AnonymousPostMapping("bind") |
||||
|
public ApiResponse<Object> bind(@RequestBody DeviceMacDto deviceMacDto){ |
||||
|
if (StringUtils.isEmpty(deviceMacDto.getDeviceId()) || StringUtils.isEmpty(deviceMacDto.getMacAddress())){ |
||||
|
throw new BaseException("设备id或Mac地址不能为空"); |
||||
|
} |
||||
|
deviceSpecParamService.bindMac(deviceMacDto); |
||||
|
return ApiResponse.success(ResponseStatus.SUCCESS); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -1,47 +0,0 @@ |
|||||
package com.storeroom.modules.device.service.dto; |
|
||||
|
|
||||
import com.storeroom.modules.device.domain.Storeroom; |
|
||||
import com.storeroom.modules.device.domain.Supplier; |
|
||||
|
|
||||
/** |
|
||||
* 所有设备属性 |
|
||||
*/ |
|
||||
public class DeviceAllDto { |
|
||||
|
|
||||
private String id; |
|
||||
|
|
||||
private Supplier supplierId; |
|
||||
|
|
||||
private Storeroom storeroomId; |
|
||||
|
|
||||
private String deviceName; |
|
||||
|
|
||||
private String deviceIp; |
|
||||
|
|
||||
private Integer devicePort; |
|
||||
|
|
||||
private Integer deviceState; |
|
||||
|
|
||||
private Integer sequence; |
|
||||
|
|
||||
private String storeroomCode; |
|
||||
|
|
||||
private String deviceId; |
|
||||
|
|
||||
private Integer rowNo; |
|
||||
|
|
||||
private Integer areaNo; |
|
||||
|
|
||||
private Integer sumColumnNo; |
|
||||
|
|
||||
private Integer firstColumnNo; |
|
||||
|
|
||||
private Integer partNo; |
|
||||
|
|
||||
private Integer isLinkage; |
|
||||
|
|
||||
private Integer isCallback; |
|
||||
|
|
||||
private Integer isNotice; |
|
||||
|
|
||||
} |
|
@ -0,0 +1,14 @@ |
|||||
|
package com.storeroom.modules.device.service.dto; |
||||
|
|
||||
|
|
||||
|
import lombok.Getter; |
||||
|
import lombok.Setter; |
||||
|
|
||||
|
@Getter |
||||
|
@Setter |
||||
|
public class DeviceMacDto { |
||||
|
|
||||
|
private String deviceId; |
||||
|
|
||||
|
private String macAddress; |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue