|
|
@ -4,14 +4,20 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
import com.ruoyi.common.json.JsonUtils;
|
|
|
|
import com.ruoyi.common.json.JsonUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.system.domain.BaseMonitorunitInfo;
|
|
|
|
import com.ruoyi.system.domain.BaseSensorInfo;
|
|
|
|
import com.ruoyi.system.domain.BaseSensorInfo;
|
|
|
|
import com.ruoyi.system.domain.BaseSensorType;
|
|
|
|
import com.ruoyi.system.domain.BaseSensorType;
|
|
|
|
import com.ruoyi.system.domain.SysParamConfig;
|
|
|
|
import com.ruoyi.system.domain.SysParamConfig;
|
|
|
|
|
|
|
|
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.IBaseSensorInfoService;
|
|
|
|
import com.ruoyi.system.service.IBaseSensorInfoService;
|
|
|
|
import com.ruoyi.system.service.IBaseSensorTypeService;
|
|
|
|
import com.ruoyi.system.service.IBaseSensorTypeService;
|
|
|
|
import com.ruoyi.system.service.ISysParamConfigService;
|
|
|
|
import com.ruoyi.system.service.ISysParamConfigService;
|
|
|
|
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
@ -45,6 +51,9 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private StringRedisTemplate redisTemplate;
|
|
|
|
@Autowired private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ISysRoleService iSysRoleService;
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping()
|
|
|
|
@GetMapping()
|
|
|
|
public String sensorSummary() {
|
|
|
|
public String sensorSummary() {
|
|
|
|
return "iot-ui/sensorSummary";
|
|
|
|
return "iot-ui/sensorSummary";
|
|
|
@ -64,8 +73,30 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
public String getSensorHistoryData(String sensorTypeId) {
|
|
|
|
public String getSensorHistoryData(String sensorTypeId) {
|
|
|
|
int indexId = 1;
|
|
|
|
int indexId = 1;
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos =
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDtos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysUser sysUser = ShiroUtils.getSysUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SysRole> sysRoles = iSysRoleService.selectRolesByUserId(sysUser.getUserId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ShiroUtils.getLoginName().equals("admin")){
|
|
|
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDto =
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));
|
|
|
|
|
|
|
|
baseSensorInfoDtos.addAll(baseSensorInfoDto);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
for (SysRole sysRole : sysRoles) {
|
|
|
|
|
|
|
|
BaseSensorInfo baseSensorInfo = new BaseSensorInfo();
|
|
|
|
|
|
|
|
baseSensorInfo.setSensorType(sensorTypeId);
|
|
|
|
|
|
|
|
baseSensorInfo.setRoleId(sysRole.getRoleId());
|
|
|
|
|
|
|
|
baseSensorInfo.setEnableFlag(0L);
|
|
|
|
|
|
|
|
List<BaseSensorInfoDto> baseSensorInfoDto =
|
|
|
|
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo);
|
|
|
|
|
|
|
|
baseSensorInfoDtos.addAll(baseSensorInfoDto);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*List<BaseSensorInfoDto> baseSensorInfoDto =
|
|
|
|
|
|
|
|
baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo(sensorTypeId, 0L));*/
|
|
|
|
|
|
|
|
|
|
|
|
for (BaseSensorInfoDto x : baseSensorInfoDtos) {
|
|
|
|
for (BaseSensorInfoDto x : baseSensorInfoDtos) {
|
|
|
|
Map<String, Object> info = new HashMap<>();
|
|
|
|
Map<String, Object> info = new HashMap<>();
|
|
|
|