|
|
@@ -0,0 +1,97 @@
|
|
|
+package com.zhongshu.card.server.core.controller.devices;
|
|
|
+
|
|
|
+import com.github.microservice.auth.security.annotations.ResourceAuth;
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
+import com.github.microservice.models.gateDoor.use.GateDoorUseParam;
|
|
|
+import com.github.microservice.net.ResultContent;
|
|
|
+import com.zhongshu.card.client.model.base.IDParam;
|
|
|
+import com.zhongshu.card.client.model.devices.*;
|
|
|
+import com.zhongshu.card.client.service.school.DeviceInfoService;
|
|
|
+import com.zhongshu.card.server.core.service.devices.DeviceUseRecordService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.web.PageableDefault;
|
|
|
+import org.springframework.util.Assert;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 设备使用日志
|
|
|
+ *
|
|
|
+ * @author TRX
|
|
|
+ * @date 2024/6/5
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/deviceUse")
|
|
|
+@Tag(name = "平台-设备使用日志")
|
|
|
+public class DeviceUseRecordController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DeviceInfoService deviceInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DeviceUseRecordService deviceUseRecordService;
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "物联网添加设备使用日志(通用不带复杂的业务)", description = "物联网添加设备使用日志")
|
|
|
+ @RequestMapping(value = "saveDeviceLogs", method = {RequestMethod.POST})
|
|
|
+ public ResultContent saveDeviceLogs(@RequestBody GateDoorUseParam param) {
|
|
|
+ return this.deviceUseRecordService.saveDeviceLogs(param);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "根据设备数据ID 设备详情", description = "根据设备数据ID 设备详情")
|
|
|
+ @RequestMapping(value = "getDeviceById", method = {RequestMethod.POST})
|
|
|
+ public ResultContent<DeviceInfoMoreModel> getDeviceById(@RequestBody IDParam param) {
|
|
|
+ return this.deviceInfoService.getDeviceDetail(param.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "根据设备ID 设备详情(精确匹配)", description = "根据设备ID 设备详情(精确匹配)")
|
|
|
+ @RequestMapping(value = "getDeviceByDeviceId", method = {RequestMethod.GET})
|
|
|
+ public ResultContent<DeviceInfoMoreModel> getDeviceByDeviceId(@RequestParam(name = "deviceId") String deviceId) {
|
|
|
+ return this.deviceInfoService.getDeviceDetailByDeviceId(deviceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "根据设备ID 设备列表(模糊匹配)", description = "根据设备ID 设备列表(模糊匹配)")
|
|
|
+ @RequestMapping(value = "getDeviceDetailByDeviceIdLike", method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<DeviceInfoMoreModel>> getDeviceDetailByDeviceIdLike(@RequestParam(name = "deviceId") String deviceId) {
|
|
|
+ return this.deviceInfoService.getDeviceDetailByDeviceIdLike(deviceId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "删除设备", description = "删除设备")
|
|
|
+ @RequestMapping(value = "deleteDeviceInfo", method = {RequestMethod.POST})
|
|
|
+ public ResultContent deleteDeviceInfo(@RequestBody IDParam param) {
|
|
|
+ return this.deviceInfoService.deleteDeviceInfo(param.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "设备列表-分页查询", description = "设备列表-分页查询")
|
|
|
+ @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<DeviceInfoModel>> page(
|
|
|
+ @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
|
|
|
+ @Parameter(required = false) DeviceInfoSearch param) {
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
+ return deviceInfoService.page(param, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "修改设备信息", description = "修改设备信息")
|
|
|
+ @RequestMapping(value = "updateDevice", method = {RequestMethod.POST})
|
|
|
+ public ResultContent updateDevice(@RequestBody @Valid DeviceBindAreaParam param) {
|
|
|
+ return this.deviceInfoService.updateDevice(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ //----------------------------设备基础信息 end--------------------------
|
|
|
+
|
|
|
+}
|