|
@@ -30,77 +30,5 @@ import java.util.Set;
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/bms/api/ubiapp")
|
|
@RequestMapping("/bms/api/ubiapp")
|
|
public class UbiWxController extends BaseController {
|
|
public class UbiWxController extends BaseController {
|
|
- @Resource
|
|
|
|
- private IPrivilegeApplyRecordService privilegeApplyRecordService;
|
|
|
|
- @Resource
|
|
|
|
- private IUserPrivilegeService userPrivilegeService;
|
|
|
|
- @Resource
|
|
|
|
- private IUbiInfoStateService ubiInfoStateService;
|
|
|
|
- @Resource
|
|
|
|
- private IGroupService groupService;
|
|
|
|
- @Resource
|
|
|
|
- private IPostMqttMsgService postMqttMsgService;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 查看用户拥有权限的设备组列表
|
|
|
|
- */
|
|
|
|
- @GetMapping("getOwnGroups.do")
|
|
|
|
- public ServerResponse getOwnGroups() {
|
|
|
|
- List<String> groupIds = userPrivilegeService.ownGroupIds(userId());
|
|
|
|
- return ServerResponse.success(groupService.list(new QueryWrapper<Group>()
|
|
|
|
- .in("id", groupIds.toArray())));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 申请查看设备组权限
|
|
|
|
- */
|
|
|
|
- @PostMapping("apply.do")
|
|
|
|
- public ServerResponse apply(PrivilegeApplyRecord entity) {
|
|
|
|
- entity.setUserId(userId());
|
|
|
|
- return ServerResponse.success(privilegeApplyRecordService.save(entity));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 通过用户ID分页查询该用户拥有权限的设备列表
|
|
|
|
- */
|
|
|
|
- @GetMapping("getDeviceList.do")
|
|
|
|
- public ServerResponse getDeviceList(String group) {
|
|
|
|
- Set<String> groupIds = new HashSet<>(userPrivilegeService.ownGroupIds(userId()));
|
|
|
|
- if (!groupIds.contains(group)) return ServerResponse.warning("无权限");
|
|
|
|
- return ServerResponse.success(ubiInfoStateService.listWx(group));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取设备详情信息
|
|
|
|
- */
|
|
|
|
- @GetMapping("getDeviceDetail.do")
|
|
|
|
- public ServerResponse getDeviceDetail(String openNum) {
|
|
|
|
- return ServerResponse.success(ubiInfoStateService.getDetailWx(openNum));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 蜂鸣器
|
|
|
|
- */
|
|
|
|
- @GetMapping("buzzing.do")
|
|
|
|
- public ServerResponse buzzing(String openNum) {
|
|
|
|
- postMqttMsgService.requestBuzzingUbi(openNum);
|
|
|
|
- return ServerResponse.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 立即请求获取最新心跳包
|
|
|
|
- */
|
|
|
|
- @GetMapping("heartbeat.do")
|
|
|
|
- public ServerResponse heartbeat(String openNum) {
|
|
|
|
- postMqttMsgService.requestHeartbeatUbi(openNum);
|
|
|
|
- return ServerResponse.success();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取设备详情信息
|
|
|
|
- */
|
|
|
|
- @GetMapping("checkOpenNum.do")
|
|
|
|
- public ServerResponse checkOpenNum(String openNum) {
|
|
|
|
- return ServerResponse.success(ubiInfoStateService.checkOpenNum(openNum));
|
|
|
|
- }
|
|
|
|
}
|
|
}
|