监测平台系统bug优化处理

master
马雪伟 3 months ago
parent f35d45a3a1
commit 441b390210

@ -138,14 +138,17 @@ public class HwAlarmRuleController extends BaseController {
alarmLevel.setSceneId(sceneId);
List<HwAlarmLevel> alarmLevels = hwAlarmLevelService.selectHwAlarmLevelList(alarmLevel);
HwDevice device = new HwDevice();
device.setSceneId(sceneId);
List<HwDevice> devices = hwDeviceService.selectHwDeviceListWithDeviceMode(device);
// HwDevice device = new HwDevice();
// device.setSceneId(sceneId);
// List<HwDevice> devices = hwDeviceService.selectHwDeviceListWithDeviceMode(device);
List<HwDeviceMode> models = hwDeviceModeService.selectModel(sceneId);
JSONObject result = new JSONObject();
result.put("alarmTypes", alarmTypes);
result.put("alarmLevels",alarmLevels);
result.put("devices",devices);
// result.put("devices",devices);
result.put("models",models);
return success(result);
}

@ -246,5 +246,9 @@ public class HwDeviceController extends BaseController {
public void computeOnlineDevicecCount(@PathVariable("days") int days) {
hwDeviceService.computeOnlineDevicecCount(days);
}
@GetMapping("/getDeviceByModel")
public AjaxResult getDeviceByModel(Long modelId){
return AjaxResult.success(hwDeviceModeService.getDeviceByModel(modelId));
}
}

@ -147,4 +147,6 @@ public class HwDeviceModeController extends BaseController {
public void rebuildTdSuperTables() {
hwDeviceModeService.rebuildTdSuperTables();
}
}

@ -0,0 +1,25 @@
package com.ruoyi.business.controller;
import com.ruoyi.business.domain.HwOfflineRule;
import com.ruoyi.business.service.HwOfflineRuleService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/offlineRule")
public class HwOfflineRuleController extends BaseController {
@Autowired
private HwOfflineRuleService hwOfflineRuleService;
@GetMapping("list")
public TableDataInfo list(HwOfflineRule hwOfflineRule){
startPage();
List<HwOfflineRule> hwOfflineRules = hwOfflineRuleService.selectRuleList(hwOfflineRule);
return getDataTable(hwOfflineRules);
}
}

@ -134,4 +134,8 @@ public interface HwDeviceMapper
* @return List<HwDevice>
*/
public List<HwDevice> selectUnallocatedList(HwDevice hwDevice);
int getOnlineDeviceNum1(Long sceneId);
List<HwDevice> getDeviceByModel(Long modelId);
}

@ -143,4 +143,6 @@ public interface HwDeviceModeMapper
* @return
*/
public List<HwDeviceMode> selectHwDeviceModeJoinList(HwDeviceMode hwDeviceMode);
List<HwDeviceMode> selectModel(Long sceneId);
}

@ -0,0 +1,12 @@
package com.ruoyi.business.mapper;
import com.ruoyi.business.domain.HwOfflineRule;
import java.util.List;
public interface HwOfflineRuleMapper {
List<HwOfflineRule> selectHwOfflineRuleJoinList(HwOfflineRule hwOfflineRule);
}

@ -0,0 +1,9 @@
package com.ruoyi.business.service;
import com.ruoyi.business.domain.HwOfflineRule;
import java.util.List;
public interface HwOfflineRuleService {
List<HwOfflineRule> selectRuleList(HwOfflineRule hwOfflineRule);
}

@ -3,6 +3,7 @@ package com.ruoyi.business.service;
import java.util.List;
import java.util.Map;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.HwDeviceMode;
import com.ruoyi.business.domain.HwDeviceModeFunction;
import com.ruoyi.business.domain.HwDeviceModeParameter;
@ -134,4 +135,7 @@ public interface IHwDeviceModeService
*/
public HwDeviceMode selectHwDeviceModeByDeviceId(Long deviceId);
List<HwDeviceMode> selectModel(Long sceneId);
List<HwDevice> getDeviceByModel(Long modelId);
}

@ -117,14 +117,21 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService {
@Transactional
@Override
public int insertHwAlarmRule(HwAlarmRule hwAlarmRule) {
String triggerExpression = this.getTriggerExpression(hwAlarmRule);
hwAlarmRule.setTriggerExpression(triggerExpression);
hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO);
hwAlarmRule.setCreateTime(DateUtils.getNowDate());
hwAlarmRule.setTenantId(SecurityUtils.getTenantId());
hwAlarmRule.setCreateBy(SecurityUtils.getUsername());
int rows = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule);
insertHwAlarmRuleLink(hwAlarmRule);
List<Long> ruleDeviceIds = hwAlarmRule.getRuleDeviceIds();
int rows = 0;
for (Long ruleDeviceId : ruleDeviceIds) {
hwAlarmRule.setRuleDeviceId(ruleDeviceId);
String triggerExpression = this.getTriggerExpression(hwAlarmRule);
hwAlarmRule.setTriggerExpression(triggerExpression);
hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO);
hwAlarmRule.setCreateTime(DateUtils.getNowDate());
hwAlarmRule.setTenantId(SecurityUtils.getTenantId());
hwAlarmRule.setCreateBy(SecurityUtils.getUsername());
int rowsAdd = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule);
insertHwAlarmRuleLink(hwAlarmRule);
rows += rowsAdd;
}
return rows;
}

@ -433,6 +433,16 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
return deviceMode;
}
@Override
public List<HwDeviceMode> selectModel(Long sceneId) {
return hwDeviceModeMapper.selectModel(sceneId);
}
@Override
public List<HwDevice> getDeviceByModel(Long modelId) {
return hwDeviceMapper.getDeviceByModel(modelId);
}
/**
* @param: hwDeviceModeFunction

@ -174,7 +174,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService {
public SubDeviceSumVo selectSubDeviceSum(Long sceneId) {
AllNumsVo numsVo = selectAllNums(sceneId);
//获取在线设备数量,获取已发布状态子设备并且关联网关为在线的数量以及在线状态发布状态的直连设备数量之和
int onlineDeviceNum = hwDeviceMapper.getOnlineDeviceNum(sceneId);
int onlineDeviceNum = hwDeviceMapper.getOnlineDeviceNum1(sceneId);
SubDeviceSumVo subDeviceSumVo = new SubDeviceSumVo();
subDeviceSumVo.setSubSum(numsVo.getSubSum());//监控单元数量

@ -0,0 +1,19 @@
package com.ruoyi.business.service.impl;
import com.ruoyi.business.domain.HwOfflineRule;
import com.ruoyi.business.mapper.HwOfflineRuleMapper;
import com.ruoyi.business.service.HwOfflineRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class HwOfflineRuleServiceImpl implements HwOfflineRuleService {
@Autowired
private HwOfflineRuleMapper hwOfflineRuleMapper;
@Override
public List<HwOfflineRule> selectRuleList(HwOfflineRule hwOfflineRule) {
List<HwOfflineRule> hwOfflineRules = hwOfflineRuleMapper.selectHwOfflineRuleJoinList(hwOfflineRule);
return hwOfflineRules;
}
}

@ -118,13 +118,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by har.alarm_rule_id desc
</select>
<select id="selectHwAlarmRuleByAlarmRuleId" parameterType="Long" resultMap="HwAlarmRuleHwAlarmRuleLinkResult">
<select id="selectHwAlarmRuleByAlarmRuleId" resultType="com.ruoyi.business.domain.HwAlarmRule">
select a.alarm_rule_id, a.alarm_rule_name, a.tenant_id, a.scene_id, a.language_code, a.alarm_level_id, a.alarm_type_id, a.rule_type, a.rule_device_id, a.rule_function_total, a.trigger_expression, a.link_flag, a.alarm_rule_status, a.alarm_push_flag, a.alarm_push_content, a.alarm_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.alarm_rule_field,
b.rule_link_id as sub_rule_link_id, b.alarm_rule_type as sub_alarm_rule_type, b.alarm_rule_id as sub_alarm_rule_id, b.link_type as sub_link_type, b.link_device_id as sub_link_device_id, b.link_device_function_id as sub_link_device_function_id, b.link_device_function_identifier as sub_link_device_function_identifier, b.link_device_function_data as sub_link_device_function_data, hd.device_name as sub_link_device_name,hdmf.function_name as sub_link_device_mode_function_name
,d.device_mode_id as device_mode_id,d.device_mode_name as device_mode_name
from hw_alarm_rule a
left join hw_alarm_rule_link b on b.alarm_rule_id = a.alarm_rule_id and b.alarm_rule_type=1
left join hw_device hd on b.link_device_id = hd.device_id
left join hw_device_mode_function hdmf on b.link_device_function_id=hdmf.mode_function_id
left join hw_device c on a.rule_device_id = c.device_id
left join hw_device_mode d on d.device_mode_id = c.device_mode_id
where a.alarm_rule_id = #{alarmRuleId}
</select>

@ -40,7 +40,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceModeName" column="device_mode_name" />
<result property="monitorUnitName" column="monitor_unit_name" />
</resultMap>
<!--以下为监控平台接口所用-->
<resultMap id="DeviceModeVoResult" type="com.ruoyi.business.domain.VO.DeviceModeVo" >
<result property="deviceModeName" column="device_mode_name"/>
@ -48,9 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="err" column="err"/>
</resultMap>
<select id="selectDeviceModeNameVo" resultMap="DeviceModeVoResult">
SELECT b.device_mode_name ,a.sum FROM hw_device_mode b
SELECT concat(c.scene_name,'',b.device_mode_name) as device_mode_name ,a.sum as sum FROM hw_device_mode b
LEFT JOIN (SELECT device_mode_id,count(*) as sum FROM hw_device GROUP BY device_mode_id order by sum desc
) a on a.device_mode_id = b.device_mode_id
) a on a.device_mode_id = b.device_mode_id left join hw_scene c on b.scene_id = c.scene_id
</select>
<select id="selectDeviceByDeviceModeByDeviceModeFunction" parameterType="Long" resultType="String">
@ -358,5 +357,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 租户数据范围过滤 -->
${params.tenantDataScope}
</select>
<select id="getOnlineDeviceNum1" resultType="java.lang.Integer" parameterType="java.lang.Long">
select count(1) from
(select
b.device_mode_name device_mode_name
from
hw_device hd left join hw_device_mode b on hd.device_mode_id = b.device_mode_id
where
hd.device_status = 1
and ((hd.device_type = 2
and exists (
select
1
from
hw_device hdd
where
hd.releated_device_id = hdd.device_id
and hdd.online_status = 1
and hdd.device_status = 1))
or (hd.device_type = 3
and hd.online_status = 1))
<if test="sceneId != null and sceneId!=0"> and hd.scene_id=#{sceneId}</if>) a where a.device_mode_name = '定位信标'
</select>
<select id="getDeviceByModel" resultType="com.ruoyi.business.domain.HwDevice"
parameterType="java.lang.Long">
select * from hw_device where device_mode_id = #{modelId}
</select>
</mapper>

@ -321,6 +321,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by hdm.device_mode_id desc
</select>
<select id="selectModel" parameterType="java.lang.Long">
select * from hw_device_mode where scene_id = #{sceneId}
</select>
</mapper>

@ -236,5 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by hor.offline_rule_id desc
</select>
<select id="selectRuleList" resultType="com.ruoyi.business.domain.HwOfflineRule"
parameterType="com.ruoyi.business.domain.HwOfflineRule"></select>
</mapper>

@ -75,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwSceneList" parameterType="HwScene" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/>
<where>
scene_status != '9'
<if test="sceneName != null and sceneName != ''"> and scene_name like concat('%', #{sceneName}, '%')</if>
<if test="tenantId != null"> and tenant_id = #{tenantId}</if>
<if test="sceneModeId != null "> and scene_mode_id = #{sceneModeId}</if>

Loading…
Cancel
Save