1.1.3 监控单元Controller修改

dev
zhouhy 1 year ago
parent 8854095388
commit bbfa19c0a8

@ -160,6 +160,7 @@ public class HwMonitorPlatformController extends BaseController {
* */ * */
@PostMapping("/SubDevice") @PostMapping("/SubDevice")
public SubDeviceSumVo subDevice(Long sceneId){ public SubDeviceSumVo subDevice(Long sceneId){
SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId);
return subDeviceSumVos; return subDeviceSumVos;
@ -170,6 +171,7 @@ public class HwMonitorPlatformController extends BaseController {
* */ * */
@PostMapping("/ElectronicNumVo") @PostMapping("/ElectronicNumVo")
public TableDataInfo ElectronicNumVo(Long sceneId){ public TableDataInfo ElectronicNumVo(Long sceneId){
List<EleMonitorDeviceSumVo> eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); List<EleMonitorDeviceSumVo> eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId);
return getDataTable(eleMonitorDeviceSumVos); return getDataTable(eleMonitorDeviceSumVos);
} }
@ -180,6 +182,7 @@ public class HwMonitorPlatformController extends BaseController {
@PostMapping("/selectMonitorUnitSub") @PostMapping("/selectMonitorUnitSub")
//ok //ok
public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){ public HwMonitorUnit selectMonitorUnitSub(Long monitorUnitId){
HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId);
return hwMonitorUnits; return hwMonitorUnits;
@ -199,9 +202,10 @@ public class HwMonitorPlatformController extends BaseController {
* *
* */ * */
@PostMapping("/selectLatestDataByTags") @PostMapping("/selectLatestDataByTags")
public TableDataInfo selectLatestDataByTags(Long monitorUnitId){ public R<Map<String, Map<String, Object>>>selectLatestDataByTags(Long monitorUnitId){
List<Map<String, Object>> list= hwMonitorUnitService.selectLatestDataByTags(monitorUnitId);
return getDataTable(list); R<Map<String, Map<String, Object>>> mapR = hwMonitorUnitService.selectLatestDataByTags(monitorUnitId);
return mapR;
} }
/** /**
* *
@ -213,8 +217,9 @@ public class HwMonitorPlatformController extends BaseController {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser(); SysUser sysUser = loginUser.getSysUser();
Long tenantId = sysUser.getTenantId(); Long tenantId = sysUser.getTenantId();
List<HwScene> hwScenes = hwSceneService.selectHwSceneByTenantId(tenantId); List<HwScene> hwScenes = hwSceneService.selectHwSceneByTenantId(1l);
hwScenes.get(0).setDefaultFlag("1"); if (hwScenes.size()!=0){
hwScenes.get(0).setDefaultFlag("1");}
return getDataTable(hwScenes); return getDataTable(hwScenes);
} }
} }

@ -5,6 +5,7 @@ import java.util.Map;
import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.HwMonitorUnit;
import com.ruoyi.business.domain.VO.*; import com.ruoyi.business.domain.VO.*;
import com.ruoyi.common.core.domain.R;
/** /**
@ -76,7 +77,7 @@ public interface IHwMonitorUnitService
* *
* *
* @return*/ * @return*/
public List<Map<String, Object>> selectLatestDataByTags(Long monitorUnitId); public R<Map<String, Map<String, Object>>> selectLatestDataByTags(Long monitorUnitId);
/** /**

@ -13,6 +13,7 @@ import com.ruoyi.business.domain.VO.*;
import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwDeviceMapper;
import com.ruoyi.business.mapper.HwElectronicFenceMapper; import com.ruoyi.business.mapper.HwElectronicFenceMapper;
import com.ruoyi.common.core.constant.TdEngineConstants; 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.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.RemoteTdEngineService;
@ -249,8 +250,9 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
} }
@Override @Override
public List<Map<String, Object>> selectLatestDataByTags(Long monitorUnitId) { public R<Map<String, Map<String, Object>>> selectLatestDataByTags(Long monitorUnitId) {
List<Map<String, Object>> latestData = new ArrayList<Map<String, Object>>(); //
R<Map<String, Map<String, Object>>> latestDataByTags = new R<Map<String,Map<String, Object>>>();
List<HwDevice> hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); List<HwDevice> hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId);
TdSelectDto tdSelectDto = new TdSelectDto(); TdSelectDto tdSelectDto = new TdSelectDto();
for (int i = 0; i < hwDevices.size(); i++){ 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.setTableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId()));
tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode());
latestData = (List<Map<String, Object>>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); latestDataByTags = remoteTdEgineService.getLatestDataByTags(tdSelectDto);
} }
return latestData; return latestDataByTags;
} }
//todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) //todo SysDeptServiceImpl类中的递归方法recursionFn(以实现)

@ -91,12 +91,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectHwSceneByTenantId0" parameterType="Long" resultMap="HwSceneResult"> <select id="selectHwSceneByTenantId0" parameterType="Long" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/> <include refid="selectHwSceneVo"/>
where order by update_time desc order by update_time desc
</select> </select>
<select id="selectHwSceneByTenantIdNot0" parameterType="Long" resultMap="HwSceneResult"> <select id="selectHwSceneByTenantIdNot0" parameterType="Long" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/> <include refid="selectHwSceneVo"/>
where tenant_id = #{tenantId} where tenant_id = #{tenantId}
and
order by update_time desc order by update_time desc
</select> </select>
<select id="selectHwSceneBySceneId" parameterType="Long" resultMap="HwSceneResult"> <select id="selectHwSceneBySceneId" parameterType="Long" resultMap="HwSceneResult">

Loading…
Cancel
Save