|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.ruoyi.web.controller.base;
|
|
|
|
package com.ruoyi.web.controller.base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
@ -7,6 +8,7 @@ import java.util.UUID;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
import com.ruoyi.system.domain.BaseAlarmInfo;
|
|
|
|
import com.ruoyi.system.domain.BaseAlarmInfo;
|
|
|
@ -16,6 +18,7 @@ import com.ruoyi.system.domain.dto.BaseAlarmInfoDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
|
|
|
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
|
|
|
import com.ruoyi.system.service.IBaseDeviceParamService;
|
|
|
|
import com.ruoyi.system.service.IBaseDeviceParamService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@ -47,6 +50,9 @@ public class BaseMonitorunitInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private IBaseDeviceParamService baseDeviceParamService;
|
|
|
|
@Autowired private IBaseDeviceParamService baseDeviceParamService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysRoleService iSysRoleService;
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("base:monitorUnitInfo:view")
|
|
|
|
@RequiresPermissions("base:monitorUnitInfo:view")
|
|
|
|
@GetMapping()
|
|
|
|
@GetMapping()
|
|
|
|
public String monitorUnitInfo() {
|
|
|
|
public String monitorUnitInfo() {
|
|
|
@ -58,9 +64,31 @@ public class BaseMonitorunitInfoController extends BaseController {
|
|
|
|
@PostMapping("/list")
|
|
|
|
@PostMapping("/list")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public List<BaseMonitorunitInfoDto> list(BaseMonitorunitInfo baseMonitorunitInfo) {
|
|
|
|
public List<BaseMonitorunitInfoDto> list(BaseMonitorunitInfo baseMonitorunitInfo) {
|
|
|
|
List<BaseMonitorunitInfoDto> list =
|
|
|
|
/*List<BaseMonitorunitInfoDto> list =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos1 =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(
|
|
|
|
|
|
|
|
new BaseMonitorunitInfo(null, null, null, null, 0L));
|
|
|
|
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfoDtos1);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setEnableFlag(0L);
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos1 =
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
|
|
|
|
return list;
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfoDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return baseMonitorunitInfoDtos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/listByParent")
|
|
|
|
@GetMapping("/listByParent")
|
|
|
@ -272,7 +300,30 @@ public class BaseMonitorunitInfoController extends BaseController {
|
|
|
|
@GetMapping("/treeData")
|
|
|
|
@GetMapping("/treeData")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public List<Ztree> treeData() {
|
|
|
|
public List<Ztree> treeData() {
|
|
|
|
List<Ztree> ztrees = baseMonitorunitInfoService.selectBaseMonitorunitInfoTree();
|
|
|
|
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos1 =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(
|
|
|
|
|
|
|
|
new BaseMonitorunitInfo(null, null, null, null, 0L));
|
|
|
|
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfoDtos1);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
|
|
|
baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setEnableFlag(0L);
|
|
|
|
|
|
|
|
baseMonitorunitInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
List<BaseMonitorunitInfoDto> baseMonitorunitInfoDtos1 =
|
|
|
|
|
|
|
|
baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
|
|
|
|
|
|
|
|
baseMonitorunitInfoDtos.addAll(baseMonitorunitInfoDtos1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Ztree> ztrees = baseMonitorunitInfoService.selectBaseMonitorunitInfoTree(baseMonitorunitInfoDtos);
|
|
|
|
return ztrees;
|
|
|
|
return ztrees;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|