diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java index 594a038..350d673 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -83,7 +83,7 @@ public class HwDeviceController extends BaseController @PostMapping("/export") public void export(HttpServletResponse response, HwDevice hwDevice) { - List list = hwDeviceService.selectHwDeviceList(hwDevice); + List list = hwDeviceService.selectHwDeviceJoinList(hwDevice); ExcelUtil util = new ExcelUtil(HwDevice.class); util.exportExcel(response, list, "设备信息数据"); } @@ -148,9 +148,6 @@ public class HwDeviceController extends BaseController @GetMapping("/getEditedScenes") public AjaxResult getEditedScenes(HwScene scene) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser user = loginUser.getSysUser(); - scene.setTenantId(user.getTenantId()); return success(hwSceneService.selectHwSceneList4Select(scene)); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java index cd47dca..c3f32eb 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeController.java @@ -1,39 +1,29 @@ package com.ruoyi.business.controller; -import java.util.HashMap; -import java.util.List; -import java.io.IOException; -import java.util.Map; -import java.util.stream.Collectors; -import javax.servlet.http.HttpServletResponse; - +import com.ruoyi.business.domain.HwDeviceMode; import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.service.IHwDeviceModeService; import com.ruoyi.business.service.IHwSceneService; import com.ruoyi.common.core.constant.HwDictConstants; -import com.ruoyi.common.core.constant.SecurityConstants; -import com.ruoyi.common.core.context.SecurityContextHolder; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.log.annotation.Log; -import com.ruoyi.common.log.enums.BusinessType; -import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.business.domain.HwDeviceMode; -import com.ruoyi.business.service.IHwDeviceModeService; -import com.ruoyi.common.core.web.controller.BaseController; -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 设备模型Controller @@ -69,7 +59,7 @@ public class HwDeviceModeController extends BaseController { @Log(title = "设备模型", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwDeviceMode hwDeviceMode) { - List list = hwDeviceModeService.selectHwDeviceModeList(hwDeviceMode); + List list = hwDeviceModeService.selectHwDeviceModeJoinList(hwDeviceMode); ExcelUtil util = new ExcelUtil(HwDeviceMode.class); util.exportExcel(response, list, "设备模型数据"); } @@ -134,10 +124,7 @@ public class HwDeviceModeController extends BaseController { @RequiresPermissions("business:deviceMode:list") @GetMapping("/getEditedScenes") public AjaxResult getEditedScenes(HwScene scene) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser user = loginUser.getSysUser(); - scene.setTenantId(user.getTenantId()); + return success(hwSceneService.selectHwSceneList4Select(scene)); } - } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java index efe4adc..257cc2c 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceModeFunctionController.java @@ -25,7 +25,7 @@ public class HwDeviceModeFunctionController extends BaseController { /** * 新增设备模型功能 */ - @RequiresPermissions("business:deviceModeFunction:add") + @RequiresPermissions("business:deviceMode:add") @Log(title = "设备模型功能", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) { @@ -35,7 +35,7 @@ public class HwDeviceModeFunctionController extends BaseController { /** * 修改设备模型功能 */ - @RequiresPermissions("business:deviceModeFunction:edit") + @RequiresPermissions("business:deviceMode:edit") @Log(title = "设备模型功能", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwDeviceModeFunction hwDeviceModeFunction) { @@ -45,7 +45,7 @@ public class HwDeviceModeFunctionController extends BaseController { /** * 删除设备模型功能 */ - @RequiresPermissions("business:deviceModeFunction:remove") + @RequiresPermissions("business:deviceMode:remove") @Log(title = "设备模型功能", businessType = BusinessType.DELETE) @DeleteMapping("/{modeFunctionId}") public AjaxResult remove(@PathVariable Long modeFunctionId) { diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitTypeService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitTypeService.java index 7264789..ab7d363 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitTypeService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitTypeService.java @@ -2,6 +2,7 @@ package com.ruoyi.business.service; import java.util.List; import com.ruoyi.business.domain.HwMonitorUnitType; +import com.ruoyi.common.datascope.annotation.DataScope; /** * 监控单元类型Service接口 @@ -62,4 +63,20 @@ public interface IHwMonitorUnitTypeService * @return 结果 */ public int deleteHwMonitorUnitTypeByMonitorUnitTypeId(Long monitorUnitTypeId); + + /** + * 查询监控单元类型列表供编辑页面使用,不过滤权限,设置条件查询 + * + * @param hwMonitorUnitType 监控单元类型 + * @return 监控单元类型集合 + */ + public List selectHwMonitorUnitTypeList4Select(HwMonitorUnitType hwMonitorUnitType); + + /** + * 查询监控单元类型列表,Join租户和场景 + * + * @param hwMonitorUnitType 监控单元类型 + * @return 监控单元类型 + */ + public List selectHwMonitorUnitTypeJoinList(HwMonitorUnitType hwMonitorUnitType); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java index 2354536..d9ff8b7 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java @@ -5,19 +5,35 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.HwDevice; import com.ruoyi.business.domain.HwSceneMode; import com.ruoyi.business.domain.VO.HwSceneVo; +import com.ruoyi.business.mapper.HwDeviceMapper; +import com.ruoyi.common.core.constant.Constants; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.datascope.annotation.DataScope; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.model.LoginUser; +import com.ruoyi.tdengine.api.RemoteTdEngineService; import org.apache.commons.lang3.RandomStringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import com.ruoyi.business.mapper.HwSceneMapper; import com.ruoyi.business.domain.HwScene; import com.ruoyi.business.service.IHwSceneService; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; /** * 场景信息Service业务层处理 @@ -26,12 +42,15 @@ import com.ruoyi.business.service.IHwSceneService; * @date 2023-08-23 */ @Service -public class HwSceneServiceImpl implements IHwSceneService -{ +public class HwSceneServiceImpl implements IHwSceneService { @Autowired private HwSceneMapper hwSceneMapper; @Autowired - private RedisService redisService; + private HwDeviceMapper hwDeviceMapper; + @Resource + private RemoteTdEngineService remoteTdEngineService; + @Autowired + private StringRedisTemplate redisTemplate; /** @@ -41,8 +60,7 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 场景信息 */ @Override - public HwScene selectHwSceneBySceneId(Long sceneId) - { + public HwScene selectHwSceneBySceneId(Long sceneId) { return hwSceneMapper.selectHwSceneBySceneId(sceneId); } @@ -53,17 +71,6 @@ public class HwSceneServiceImpl implements IHwSceneService return hwScenes; } - @Override - public List selectHwSceneByTenantId(Long tenantId) { - if (tenantId == 0){ - return hwSceneMapper.selectHwSceneByTenantId0(tenantId); - } - else - return hwSceneMapper.selectHwSceneByTenantIdNot0(tenantId); - - } - - /** * 查询场景信息列表 * @@ -71,24 +78,28 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 场景信息 */ @Override - public List selectHwSceneList(HwScene hwScene) - { - return hwSceneMapper.selectHwSceneList(hwScene); + @DataScope(tenantAlias = "hs") + public List selectHwSceneList(HwScene hwScene) { + List scenes = hwSceneMapper.selectHwSceneList(hwScene); + boolean defaultFlag = false; + for (HwScene scene : scenes) { + if (defaultFlag) { + scene.setDefaultFlag(HwDictConstants.SCENE_DEFAULT_FLAG_NO); + } else { + if (scene.getDefaultFlag().equalsIgnoreCase(HwDictConstants.SCENE_DEFAULT_FLAG_YES)) { + defaultFlag = true; + } + } + scene.setRouter(HwDictConstants.SCENE_MODE_ROUTER_MAP.get(scene.getSceneModeId())); + } + return scenes; } @Override - public List selectHwSceneList2(HwSceneVo hwScene) { - LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser sysUser = loginUser.getSysUser(); - if (sysUser.getUserName().equals("admin")) + public List selectHwSceneJoinList(HwSceneVo hwScene) { return hwSceneMapper.selectHwSceneVoList(hwScene); - else - { - return hwSceneMapper.selectHwSceneVoListByTenantId(sysUser.getTenantId()); - } } - /** * 新增场景信息 * @@ -96,35 +107,36 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int insertHwScene(HwScene hwScene) - { - if(hwScene.getDefaultFlag() == "1"){ - hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); - } - hwScene.setDefaultFlag("1"); + @Transactional + public int insertHwScene(HwScene hwScene) { LoginUser loginUser = SecurityUtils.getLoginUser(); SysUser sysUser = loginUser.getSysUser(); - hwScene.setSceneStatus("1"); - Long lon = new Long(10); - hwScene.setSceneId(lon); - hwScene.setCreateBy(sysUser.getNickName()); + hwScene.setCreateBy(sysUser.getUserName()); + hwScene.setTenantId(sysUser.getTenantId()); - if (hwScene.getPreserveTime()==null){ + if (hwScene.getPreserveTime() == null) { hwScene.setPreserveTime(new BigDecimal(90)); } - if (hwScene.getTestPreserveTime()==null){ + if (hwScene.getTestPreserveTime() == null) { hwScene.setTestPreserveTime(new BigDecimal(30)); } - String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); - String randomSecret = RandomStringUtils.random(16,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); - hwScene.setModeKey(randomKey); - hwScene.setModeSecret(randomSecret); +// String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); +// String randomSecret = RandomStringUtils.random(16, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); +// hwScene.setModeKey(randomKey); +// hwScene.setModeSecret(randomSecret); hwScene.setCreateTime(DateUtils.getNowDate()); - List list = new ArrayList(); - list.add(hwScene); - redisService.setCacheList(hwScene.getSceneId()+"",list); - return hwSceneMapper.insertHwScene(hwScene); + int rows = hwSceneMapper.insertHwScene(hwScene); + this.createTdDatabase(hwScene); + return rows; + } + + private void createTdDatabase(HwScene hwScene) { + String databaseName = TdEngineConstants.getDatabaseName(hwScene.getSceneId()); + R tdReturnMsg = this.remoteTdEngineService.createDataBase(databaseName); + if (tdReturnMsg.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } /** @@ -134,19 +146,74 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int updateHwScene(HwScene hwScene) - { - if(hwScene.getDefaultFlag() == "1"){ - hwSceneMapper.updateDefaultFlag(hwScene.getTenantId()); + @Transactional + public int updateHwScene(HwScene hwScene) { + if (hwScene.getDefaultFlag().equals(HwDictConstants.SCENE_DEFAULT_FLAG_YES)) { + HwScene queryScene = new HwScene(); + queryScene.setTenantId(hwScene.getTenantId()); + List dbScenes = hwSceneMapper.selectHwSceneList(queryScene); + if (dbScenes != null && dbScenes.isEmpty()) { + dbScenes.forEach(dbScene -> { + dbScene.setDefaultFlag(HwDictConstants.SCENE_DEFAULT_FLAG_NO); + hwSceneMapper.updateHwScene(dbScene); + }); + } } - hwScene.setDefaultFlag("1"); + hwScene.setUpdateTime(DateUtils.getNowDate()); - List list = new ArrayList(); - list.add(hwScene); - redisService.setCacheList(hwScene.getSceneId()+"",list); - return hwSceneMapper.updateHwScene(hwScene); + int rows = hwSceneMapper.updateHwScene(hwScene); + this.updateRedisAuth(hwScene); + return rows; + } + + /** + * 更新redis的auth认证信息 + */ + private void updateRedisAuth(HwScene hwScene) { + try { + HwScene dbScene = hwSceneMapper.selectHwSceneBySceneId(hwScene.getSceneId()); + if (dbScene.getModeAccount().equals(hwScene.getModeAccount()) || + dbScene.getModeKey().equals(hwScene.getModeKey())) { + String modeAccount = hwScene.getModeAccount(); + String modeKey = hwScene.getModeKey(); + HwDevice queryDevice = new HwDevice(); + queryDevice.setSceneId(hwScene.getSceneId()); + List devices = hwDeviceMapper.selectHwDeviceList(queryDevice); + if (devices != null && !devices.isEmpty()) { + String deviceInfoStr = redisTemplate.opsForValue().get(HwDictConstants.REDIS_KEY_DEVICE_INFO); + JSONArray deviceInfoJsonArr = new JSONArray(); + if (StringUtils.isNotEmpty(deviceInfoStr)) { + deviceInfoJsonArr = JSON.parseArray(deviceInfoStr); + } + for (HwDevice device : devices) { + boolean redisUpdated = false;//是否更新已有的值 + for (Object deviceInfoObj : deviceInfoJsonArr) { + JSONObject deviceInfoJson = (JSONObject) deviceInfoObj; + if (deviceInfoJson.getString("deviceCode").equals(device.getDeviceCode())) { + deviceInfoJson.put("username", modeAccount); + deviceInfoJson.put("password", modeKey); + redisUpdated = true; + } + } + + if (!redisUpdated) { + JSONObject deviceInfoJson = new JSONObject(); + deviceInfoJson.put("deviceCode", device.getDeviceCode()); + deviceInfoJson.put("username", modeAccount); + deviceInfoJson.put("password", modeKey); + deviceInfoJsonArr.add(deviceInfoJson); + } + + } + redisTemplate.opsForValue().set(HwDictConstants.REDIS_KEY_DEVICE_INFO, deviceInfoJsonArr.toString()); + } + } + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } } + /** * 批量删除场景信息 * @@ -154,13 +221,11 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int deleteHwSceneBySceneIds(Long[] sceneIds) - { + public int deleteHwSceneBySceneIds(Long[] sceneIds) { List list = new ArrayList<>(); - for (int i = 0; i < sceneIds.length;i++){ + for (int i = 0; i < sceneIds.length; i++) { list.add(sceneIds[i]); } - redisService.deleteObject(sceneIds+""); return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds); } @@ -171,9 +236,30 @@ public class HwSceneServiceImpl implements IHwSceneService * @return 结果 */ @Override - public int deleteHwSceneBySceneId(Long sceneId) - { - redisService.deleteObject(sceneId+""); + public int deleteHwSceneBySceneId(Long sceneId) { return hwSceneMapper.deleteHwSceneBySceneId(sceneId); } + + /** + * 查询场景信息列表供其他页面选择使用 + * + * @param hwScene 场景信息 + * @return 场景信息 + */ + @Override + public List selectHwSceneList4Select(HwScene hwScene) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser user = loginUser.getSysUser(); + hwScene.setTenantId(user.getTenantId()); + + List scenes = hwSceneMapper.selectHwSceneList(hwScene); + scenes.forEach(s ->{ + if(!s.getTenantId().equals( user.getTenantId())){ + s.setSelectedDisable("1"); + } + }); + + return scenes; + } + } diff --git a/ruoyi-modules/ruoyi-job/pom.xml b/ruoyi-modules/ruoyi-job/pom.xml index e295d99..932b0cf 100644 --- a/ruoyi-modules/ruoyi-job/pom.xml +++ b/ruoyi-modules/ruoyi-job/pom.xml @@ -77,7 +77,11 @@ com.ruoyi ruoyi-common-swagger - + + com.ruoyi + hw-api-tdengine + + diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/RyTask.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/RyTask.java index 3a127ef..26dc409 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/RyTask.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/task/RyTask.java @@ -1,28 +1,76 @@ package com.ruoyi.job.task; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.tdengine.api.RemoteTdEngineService; +import com.ruoyi.tdengine.api.domain.DeviceStatus; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import com.ruoyi.common.core.utils.StringUtils; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + /** * 定时任务调度测试 - * + * * @author ruoyi */ @Component("ryTask") -public class RyTask -{ - public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) - { +public class RyTask { + @Resource + private RemoteTdEngineService remoteTdEngineService; + + @Autowired + private StringRedisTemplate redisTemplate; + + + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); } - public void ryParams(String params) - { + public void ryParams(String params) { System.out.println("执行有参方法:" + params); } - public void ryNoParams() - { + public void ryNoParams() { System.out.println("执行无参方法"); } + + + public void updateDeviceStatusData(Long days) { + Long startTime = 0L;//先是昨天 + Long endTime = 1L; + DeviceStatus queryGroupStatus = new DeviceStatus(); + queryGroupStatus.setStartTime(startTime); + queryGroupStatus.setEndTime(endTime); + + DeviceStatus queryLastStatus = new DeviceStatus(); + queryLastStatus.setEndTime(startTime); + + + Map> groupDeviceStatuMapList = + (Map>) this.remoteTdEngineService.getOnlineDevicesGroupByDay(queryGroupStatus).getData(); + List> lastDeviceStatuMapList = + (List>) this.remoteTdEngineService.getLastOnlineDevices(queryLastStatus).getData(); + for (Map groupDeviceStatuMap : lastDeviceStatuMapList) { + DeviceStatus ds = new DeviceStatus(); + for (Map.Entry entry : groupDeviceStatuMap.entrySet()) { + if (entry.getKey().equals(TdEngineConstants.ST_TAG_DEVICEID)) { + ds.setDeviceId((Long) entry.getValue()); + } else if (entry.getKey().equals(TdEngineConstants.ST_TAG_DEVICETYPE)) { + ds.setDeviceType((Integer) entry.getValue()); + } else if (entry.getKey().equals(TdEngineConstants.ST_TAG_ONLINESTATUS)) { + ds.setOnlineStatus((Integer) entry.getValue()); + } + } + + if(groupDeviceStatuMapList.get(ds.getDeviceId())==null){ +// groupDeviceStatuMapList.put(ds.getDeviceId(), Lists.newArrayList()); + } + + } + + } } diff --git a/ruoyi-ui/src/api/business/monitorUnit.js b/ruoyi-ui/src/api/business/monitorUnit.js index dc75589..5bce847 100644 --- a/ruoyi-ui/src/api/business/monitorUnit.js +++ b/ruoyi-ui/src/api/business/monitorUnit.js @@ -42,3 +42,50 @@ export function delMonitorUnit(monitorUnitId) { method: 'delete' }) } + + +// 查询场景信息列表供查询页面选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/monitorUnit/getScenes', + method: 'get', + params: query + }) +} + +// 查询场景信息列表供编辑页面选择使用(例如下拉列表) +export function getEditedScenes(query) { + return request({ + url: '/business/monitorUnit/getEditedScenes', + method: 'get', + params: query + }) +} + +// 查询监控单元类型供查询页面选择使用 +export function getMonitorUnitTypes(query) { + return request({ + url: '/business/monitorUnit/getMonitorUnitTypes', + method: 'get', + params: query + }) +} + +// 查询监控单元类型供编辑页面选择使用 +export function getEditedMonitorUnitTypes(query) { + return request({ + url: '/business/monitorUnit/getEditedMonitorUnitTypes', + method: 'get', + params: query + }) +} + +// 查询监控单元列表供编辑页面选择使用 +export function getEditedMonitorUnits(query) { + return request({ + url: '/business/monitorUnit/getEditedMonitorUnits', + method: 'get', + params: query + }) +} + diff --git a/ruoyi-ui/src/api/business/monitorUnitType.js b/ruoyi-ui/src/api/business/monitorUnitType.js index a7acfcc..cd3b89b 100644 --- a/ruoyi-ui/src/api/business/monitorUnitType.js +++ b/ruoyi-ui/src/api/business/monitorUnitType.js @@ -42,3 +42,21 @@ export function delMonitorUnitType(monitorUnitTypeId) { method: 'delete' }) } + +// 查询场景信息列表供查询页面选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/monitorUnitType/getScenes', + method: 'get', + params: query + }) +} + +// 查询场景信息列表供编辑页面选择使用(例如下拉列表) +export function getEditedScenes(query) { + return request({ + url: '/business/monitorUnitType/getEditedScenes', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/business/deviceMode/editDeviceMode.vue b/ruoyi-ui/src/views/business/deviceMode/editDeviceMode.vue index d3a5e07..012b8b6 100644 --- a/ruoyi-ui/src/views/business/deviceMode/editDeviceMode.vue +++ b/ruoyi-ui/src/views/business/deviceMode/editDeviceMode.vue @@ -20,6 +20,7 @@ :key="index" :label="scene.sceneName" :value="scene.sceneId" + :disabled="scene.selectedDisable && scene.selectedDisable == 1" > @@ -44,7 +45,7 @@ v-for="dict in dict.type.hw_mode_function_mode_classfication" :key="dict.value" :label="dict.label" - :value="dict.value" + :value="parseInt(dict.value)" > diff --git a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue index cf73a38..4ff1032 100644 --- a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue +++ b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue @@ -6,12 +6,13 @@ - + @@ -49,11 +50,10 @@ diff --git a/ruoyi-ui/src/views/business/monitorUnit/index.vue b/ruoyi-ui/src/views/business/monitorUnit/index.vue index 5fc3eb6..077d45f 100644 --- a/ruoyi-ui/src/views/business/monitorUnit/index.vue +++ b/ruoyi-ui/src/views/business/monitorUnit/index.vue @@ -1,6 +1,6 @@ diff --git a/ruoyi-ui/src/views/business/monitorUnitType/index.vue b/ruoyi-ui/src/views/business/monitorUnitType/index.vue index cd2ec60..e833e28 100644 --- a/ruoyi-ui/src/views/business/monitorUnitType/index.vue +++ b/ruoyi-ui/src/views/business/monitorUnitType/index.vue @@ -1,7 +1,7 @@