From bbfa19c0a835203f740958999973f8c0e8883ef5 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Thu, 14 Sep 2023 10:49:55 +0800 Subject: [PATCH] =?UTF-8?q?1.1.3=20=E7=9B=91=E6=8E=A7=E5=8D=95=E5=85=83Con?= =?UTF-8?q?troller=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HwMonitorPlatformController.java | 15 ++++++++++----- .../business/service/IHwMonitorUnitService.java | 3 ++- .../service/impl/HwMonitorUnitServiceImpl.java | 10 ++++++---- .../resources/mapper/business/HwSceneMapper.xml | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index a078277..7ccb28c 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -160,6 +160,7 @@ public class HwMonitorPlatformController extends BaseController { * */ @PostMapping("/SubDevice") public SubDeviceSumVo subDevice(Long sceneId){ + SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); return subDeviceSumVos; @@ -170,6 +171,7 @@ public class HwMonitorPlatformController extends BaseController { * */ @PostMapping("/ElectronicNumVo") public TableDataInfo ElectronicNumVo(Long sceneId){ + List eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); return getDataTable(eleMonitorDeviceSumVos); } @@ -180,6 +182,7 @@ public class HwMonitorPlatformController extends BaseController { @PostMapping("/selectMonitorUnitSub") //ok public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){ + HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); return hwMonitorUnits; @@ -199,9 +202,10 @@ public class HwMonitorPlatformController extends BaseController { * 设备汇总 * */ @PostMapping("/selectLatestDataByTags") - public TableDataInfo selectLatestDataByTags(Long monitorUnitId){ - List> list= hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); - return getDataTable(list); + public R>>selectLatestDataByTags(Long monitorUnitId){ + + R>> mapR = hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); + return mapR; } /** * 场景选择 @@ -213,8 +217,9 @@ public class HwMonitorPlatformController extends BaseController { LoginUser loginUser = SecurityUtils.getLoginUser(); SysUser sysUser = loginUser.getSysUser(); Long tenantId = sysUser.getTenantId(); - List hwScenes = hwSceneService.selectHwSceneByTenantId(tenantId); - hwScenes.get(0).setDefaultFlag("1"); + List hwScenes = hwSceneService.selectHwSceneByTenantId(1l); + if (hwScenes.size()!=0){ + hwScenes.get(0).setDefaultFlag("1");} return getDataTable(hwScenes); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java index 9c03b12..65f7299 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java @@ -5,6 +5,7 @@ import java.util.Map; import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.*; +import com.ruoyi.common.core.domain.R; /** @@ -76,7 +77,7 @@ public interface IHwMonitorUnitService * 设备汇总 * * @return*/ - public List> selectLatestDataByTags(Long monitorUnitId); + public R>> selectLatestDataByTags(Long monitorUnitId); /** diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index d2377fd..253394b 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -13,6 +13,7 @@ import com.ruoyi.business.domain.VO.*; import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwElectronicFenceMapper; 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.tdengine.api.RemoteTdEngineService; @@ -249,8 +250,9 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService } @Override - public List> selectLatestDataByTags(Long monitorUnitId) { - List> latestData = new ArrayList>(); + public R>> selectLatestDataByTags(Long monitorUnitId) { +// + R>> latestDataByTags = new R>>(); List hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); TdSelectDto tdSelectDto = new TdSelectDto(); for (int i = 0; i < hwDevices.size(); i++){ @@ -258,9 +260,9 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService tdSelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId())); tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - latestData = (List>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); + latestDataByTags = remoteTdEgineService.getLatestDataByTags(tdSelectDto); } - return latestData; + return latestDataByTags; } //todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml index d01a5f2..42593fa 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwSceneMapper.xml @@ -91,12 +91,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"