|
|
@@ -1,9 +1,14 @@
|
|
|
package com.zd.alg.smartlock.controller;
|
|
|
|
|
|
import com.zd.alg.smartlock.domain.SlUserRelation;
|
|
|
+import com.zd.alg.smartlock.domain.api.SlLockOnline;
|
|
|
import com.zd.alg.smartlock.domain.api.SlUser;
|
|
|
+import com.zd.alg.smartlock.domain.vo.SlSubjectRelationVo;
|
|
|
+import com.zd.alg.smartlock.service.ISlSubjectRelationService;
|
|
|
import com.zd.alg.smartlock.service.ISlUserRelationService;
|
|
|
import com.zd.alg.smartlock.utils.SmartlockUtil;
|
|
|
+import com.zd.common.core.constant.SecurityConstants;
|
|
|
+import com.zd.common.core.domain.R;
|
|
|
import com.zd.common.core.utils.poi.ExcelUtil;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
import com.zd.common.core.web.domain.ResultData;
|
|
|
@@ -11,6 +16,8 @@ import com.zd.common.core.web.page.TableDataInfo;
|
|
|
import com.zd.common.log.annotation.Log;
|
|
|
import com.zd.common.log.enums.BusinessType;
|
|
|
import com.zd.common.security.annotation.PreAuthorize;
|
|
|
+import com.zd.system.api.RemoteUserService;
|
|
|
+import com.zd.system.api.domain.SysUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -18,107 +25,59 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * 人员关联Controller
|
|
|
- *
|
|
|
- * @author xxf
|
|
|
- * @date 2022-09-02
|
|
|
+ * @Author: xxf
|
|
|
+ * @Date: 2022/09/07/9:43
|
|
|
+ * @Description:
|
|
|
*/
|
|
|
+
|
|
|
@RestController
|
|
|
-@Api(tags = "【人员关联】")
|
|
|
-@RequestMapping("/userRelation")
|
|
|
+@Api(tags = "门锁相关信息查询")
|
|
|
+@RequestMapping("/lockinfo")
|
|
|
public class SlUserRelationController extends BaseController
|
|
|
{
|
|
|
- @Autowired
|
|
|
- private ISlUserRelationService slUserRelationService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ISlSubjectRelationService slSubjectRelationService;
|
|
|
+ @Autowired
|
|
|
+ private RemoteUserService remoteUserService;
|
|
|
+ @Autowired
|
|
|
private SmartlockUtil smartlockUtil;
|
|
|
|
|
|
/**
|
|
|
- * 查询人员关联列表
|
|
|
- */
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:list")
|
|
|
- @GetMapping("/list")
|
|
|
- @ApiOperation(value = "查询人员关联列表")
|
|
|
- public TableDataInfo<SlUserRelation> list(SlUserRelation slUserRelation)
|
|
|
- {
|
|
|
- startPage();
|
|
|
- List<SlUserRelation> list = slUserRelationService.selectSlUserRelationList(slUserRelation);
|
|
|
- return getDataTable(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出人员关联列表
|
|
|
- */
|
|
|
- @ApiOperation(value = "导出人员关联列表")
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:export")
|
|
|
- @Log(title = "人员关联", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, SlUserRelation slUserRelation) throws IOException
|
|
|
- {
|
|
|
- List<SlUserRelation> list = slUserRelationService.selectSlUserRelationList(slUserRelation);
|
|
|
- ExcelUtil<SlUserRelation> util = new ExcelUtil<SlUserRelation>(SlUserRelation.class);
|
|
|
- util.exportExcel(response, list, "人员关联数据");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取人员关联详细信息
|
|
|
- */
|
|
|
- @ApiOperation(value = "获取人员关联详细信息")
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:query")
|
|
|
- @GetMapping(value = "/{id}")
|
|
|
- public ResultData<SlUserRelation> getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
- return ResultData.success(slUserRelationService.selectSlUserRelationById(id));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增人员关联
|
|
|
+ * 查询实验室门锁信息
|
|
|
*/
|
|
|
- @ApiOperation(value = "新增人员关联")
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:add")
|
|
|
- @Log(title = "人员关联", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping
|
|
|
- public ResultData add(@RequestBody SlUserRelation slUserRelation)
|
|
|
+ @GetMapping("/detalis")
|
|
|
+ @ApiOperation(value = "查询实验室门锁信息")
|
|
|
+ public TableDataInfo<SlLockOnline> list(Long subjectId)
|
|
|
{
|
|
|
- return ResultData.result(slUserRelationService.insertSlUserRelation(slUserRelation));
|
|
|
- }
|
|
|
+ List<SlLockOnline> lockOnlineslist = new ArrayList<>();
|
|
|
|
|
|
- /**
|
|
|
- * 修改人员关联
|
|
|
- */
|
|
|
- @ApiOperation(value = "修改人员关联")
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:edit")
|
|
|
- @Log(title = "人员关联", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping
|
|
|
- public ResultData edit(@RequestBody SlUserRelation slUserRelation)
|
|
|
- {
|
|
|
- return ResultData.result(slUserRelationService.updateSlUserRelation(slUserRelation));
|
|
|
+ //查询实验室绑定的门锁集合
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 删除人员关联
|
|
|
- */
|
|
|
- @ApiOperation(value = "删除人员关联")
|
|
|
- @PreAuthorize(hasPermi = "laboratory:relation:remove")
|
|
|
- @Log(title = "人员关联", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public ResultData remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
- return ResultData.result(slUserRelationService.deleteSlUserRelationByIds(ids));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询智能锁人员列表
|
|
|
- */
|
|
|
- @GetMapping("/listLockUser")
|
|
|
- @ApiOperation(value = "查询智能锁人员列表")
|
|
|
- public TableDataInfo<SlUser> listLockUser(SlUser sluser)
|
|
|
+ @GetMapping("/test")
|
|
|
+ public ResultData<Long> test()
|
|
|
{
|
|
|
- List<SlUser> list = smartlockUtil.getUser(sluser);
|
|
|
- return getDataTable(list);
|
|
|
+ R<SysUser> r = remoteUserService.getUserInfoByUserId(1L, SecurityConstants.INNER);
|
|
|
+ logger.info(r.getData().toString());
|
|
|
+ logger.info(smartlockUtil.SERVICE_URL);
|
|
|
+ logger.info(smartlockUtil.USER_LOGIN);
|
|
|
+ logger.info(smartlockUtil.PASSWORD);
|
|
|
+ logger.info(smartlockUtil.AUTHS_LENGTH.toString());
|
|
|
+ logger.info(smartlockUtil.OPEN_COUNT.toString());
|
|
|
+ return ResultData.result(1L);
|
|
|
}
|
|
|
}
|