|
|
@@ -0,0 +1,56 @@
|
|
|
+package com.zd.smartlock.controller;
|
|
|
+
|
|
|
+import com.zd.common.core.web.controller.BaseController;
|
|
|
+import com.zd.common.core.web.page.TableDataInfo;
|
|
|
+import com.zd.common.security.annotation.PreAuthorize;
|
|
|
+import com.zd.smartlock.domain.SlSubjectRelation;
|
|
|
+import com.zd.smartlock.domain.SlUserRelation;
|
|
|
+import com.zd.smartlock.domain.api.SlLockOnline;
|
|
|
+import com.zd.smartlock.domain.vo.SlSubjectRelationVo;
|
|
|
+import com.zd.smartlock.service.ISlSubjectRelationService;
|
|
|
+import com.zd.smartlock.utils.SmartlockUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: liujh
|
|
|
+ * @Date: 2022/09/07/9:43
|
|
|
+ * @Description:
|
|
|
+ */
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Api(tags = "门锁相关信息查询")
|
|
|
+@RequestMapping("/lockinfo")
|
|
|
+public class SmartlockController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISlSubjectRelationService slSubjectRelationService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询实验室门锁信息
|
|
|
+ */
|
|
|
+ @GetMapping("/detalis")
|
|
|
+ @ApiOperation(value = "查询实验室门锁信息")
|
|
|
+ public TableDataInfo<SlLockOnline> list(Long subjectId)
|
|
|
+ {
|
|
|
+ List<SlLockOnline> lockOnlineslist = new ArrayList<>();
|
|
|
+
|
|
|
+ //查询实验室绑定的门锁集合
|
|
|
+ SlSubjectRelationVo subjectRelation = new SlSubjectRelationVo();
|
|
|
+ subjectRelation.setSubjectId(subjectId);
|
|
|
+ List<SlSubjectRelationVo> list = slSubjectRelationService.selectSlSubjectRelationList(subjectRelation);
|
|
|
+ for (SlSubjectRelationVo sub: list ) {
|
|
|
+ //查询门锁状态
|
|
|
+ SlLockOnline lockOnline = SmartlockUtil.getRoomDetails(sub.getLockRoomId());
|
|
|
+ lockOnlineslist.add(lockOnline);
|
|
|
+ }
|
|
|
+ return getDataTable(lockOnlineslist);
|
|
|
+ }
|
|
|
+}
|