通知规则设置的监测参数改成使用id关联
This commit is contained in:
parent
0178a065dd
commit
c0e29aec93
@ -154,7 +154,7 @@ public class AsyncAiAnalyse {
|
|||||||
);
|
);
|
||||||
if (rule != null) {
|
if (rule != null) {
|
||||||
String monitoringLevelName = xzAiDeductRuleService.getLevelName(rule.getLevel());
|
String monitoringLevelName = xzAiDeductRuleService.getLevelName(rule.getLevel());
|
||||||
EnableMessageDevRule messageDevRule = enableMessageDevRuleService.getEnableRule(ParamEnum.MessageModuleNameEnum.AIJC, hardwareId, dictionaryItem.getName(), monitoringLevelName, projectSn);
|
EnableMessageDevRule messageDevRule = enableMessageDevRuleService.getEnableRule(ParamEnum.MessageModuleNameEnum.AIJC, hardwareId, dictionaryItem.getId().toString(), monitoringLevelName, projectSn);
|
||||||
if (messageDevRule != null) {
|
if (messageDevRule != null) {
|
||||||
if (Objects.equals(messageDevRule.getEnableSmsNotification(), 1) && Objects.equals(messageDevRule.getSmsPushFrequency(),0)) {
|
if (Objects.equals(messageDevRule.getEnableSmsNotification(), 1) && Objects.equals(messageDevRule.getSmsPushFrequency(),0)) {
|
||||||
List<String> templateParams = new ArrayList<>();
|
List<String> templateParams = new ArrayList<>();
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class DictionaryItemController {
|
|||||||
if (dictionaryItemEntity == null) {
|
if (dictionaryItemEntity == null) {
|
||||||
result.error500(MessageUtil.get("notFindErr"));
|
result.error500(MessageUtil.get("notFindErr"));
|
||||||
} else {
|
} else {
|
||||||
boolean ok = dictionaryItemService.updateById(dictionaryItem);
|
boolean ok = dictionaryItemService.edit(dictionaryItem);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
result.successMsg(MessageUtil.get("editSucess"));
|
result.successMsg(MessageUtil.get("editSucess"));
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ public class DictionaryItemController {
|
|||||||
if (dictionaryItem == null) {
|
if (dictionaryItem == null) {
|
||||||
result.error500(MessageUtil.get("notFindErr"));
|
result.error500(MessageUtil.get("notFindErr"));
|
||||||
} else {
|
} else {
|
||||||
boolean ok = dictionaryItemService.removeById(MapUtils.getString(map, "id"));
|
boolean ok = dictionaryItemService.delete(map);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,4 +71,8 @@ public interface IDictionaryItemService extends IService<DictionaryItem> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DictionaryItem> queryList(DictionaryItem dictionaryItem, HttpServletRequest req);
|
List<DictionaryItem> queryList(DictionaryItem dictionaryItem, HttpServletRequest req);
|
||||||
|
|
||||||
|
boolean edit(DictionaryItem dictionaryItem);
|
||||||
|
|
||||||
|
boolean delete(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.basicdata.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||||
@ -11,9 +12,13 @@ import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
|||||||
import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryItemMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryItemMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.DictionaryMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService;
|
import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.EnableMessageDevRule;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IEnableMessageDevRuleService;
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
import com.zhgd.xmgl.util.RefUtil;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
@ -32,6 +37,9 @@ public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemMapper,
|
|||||||
private DictionaryItemMapper dictionaryItemMapper;
|
private DictionaryItemMapper dictionaryItemMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryMapper dictionaryMapper;
|
private DictionaryMapper dictionaryMapper;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IEnableMessageDevRuleService enableMessageDevRuleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典列表
|
* 获取字典列表
|
||||||
@ -136,4 +144,22 @@ public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemMapper,
|
|||||||
return pageList;
|
return pageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean edit(DictionaryItem dictionaryItem) {
|
||||||
|
this.updateById(dictionaryItem);
|
||||||
|
enableMessageDevRuleService.update(null, new LambdaUpdateWrapper<EnableMessageDevRule>()
|
||||||
|
.set(EnableMessageDevRule::getMonitoringParameterName, dictionaryItem.getName())
|
||||||
|
.eq(EnableMessageDevRule::getParameterId, dictionaryItem.getId())
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delete(Map<String, Object> map) {
|
||||||
|
String dicId = MapUtils.getString(map, "id");
|
||||||
|
this.removeById(dicId);
|
||||||
|
enableMessageDevRuleService.remove(new LambdaQueryWrapper<EnableMessageDevRule>().eq(EnableMessageDevRule::getParameterId, dicId));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -821,7 +821,7 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
|
|||||||
String threshold = NumberUtil.sub(environmentAlarm.getAlarmValue(), environmentAlarm.getExceed()) + "";
|
String threshold = NumberUtil.sub(environmentAlarm.getAlarmValue(), environmentAlarm.getExceed()) + "";
|
||||||
String time = DateUtil.formatDateTime(environmentAlarm.getAlarmTime());
|
String time = DateUtil.formatDateTime(environmentAlarm.getAlarmTime());
|
||||||
String monitoringParameterName = environmentAlarmTypeService.getById(environmentAlarm.getAlarmTypeId()).getAlarmType();
|
String monitoringParameterName = environmentAlarmTypeService.getById(environmentAlarm.getAlarmTypeId()).getAlarmType();
|
||||||
EnableMessageDevRule messageDevRule = enableMessageDevRuleService.getEnableRule(ParamEnum.MessageModuleNameEnum.YCJC, environmentAlarm.getDeviceId(), monitoringParameterName, monitoringLevelName, environmentAlarm.getProjectSn());
|
EnableMessageDevRule messageDevRule = enableMessageDevRuleService.getEnableRule(ParamEnum.MessageModuleNameEnum.YCJC, environmentAlarm.getDeviceId(), environmentAlarm.getAlarmTypeId().toString(), monitoringLevelName, environmentAlarm.getProjectSn());
|
||||||
if (messageDevRule != null) {
|
if (messageDevRule != null) {
|
||||||
if (Objects.equals(messageDevRule.getEnableSmsNotification(), 1) && Objects.equals(messageDevRule.getSmsPushFrequency(),0)) {
|
if (Objects.equals(messageDevRule.getEnableSmsNotification(), 1) && Objects.equals(messageDevRule.getSmsPushFrequency(),0)) {
|
||||||
List<String> templateParams = new ArrayList<>();
|
List<String> templateParams = new ArrayList<>();
|
||||||
|
|||||||
@ -155,24 +155,24 @@ public class EnableMessageDevRuleController {
|
|||||||
Integer monitoringModule = MapUtils.getInteger(param, "monitoringModule");
|
Integer monitoringModule = MapUtils.getInteger(param, "monitoringModule");
|
||||||
List<EnableMessageDevRule> rtList = new ArrayList<>();
|
List<EnableMessageDevRule> rtList = new ArrayList<>();
|
||||||
Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap = enableMessageDevRuleService.queryList(param).stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName,
|
Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap = enableMessageDevRuleService.queryList(param).stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName,
|
||||||
Collectors.groupingBy(EnableMessageDevRule::getMonitoringParameterName,
|
Collectors.groupingBy(EnableMessageDevRule::getParameterId,
|
||||||
Collectors.toMap(EnableMessageDevRule::getMonitoringLevelName, Function.identity(), (existing, replacement) -> existing))));
|
Collectors.toMap(EnableMessageDevRule::getMonitoringLevelName, Function.identity(), (existing, replacement) -> existing))));
|
||||||
if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.YCJC.getValue())) {
|
if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.YCJC.getValue())) {
|
||||||
List<EnvironmentAlarmType> alarmTypes = environmentAlarmTypeService.list();
|
List<EnvironmentAlarmType> alarmTypes = environmentAlarmTypeService.list();
|
||||||
for (EnvironmentAlarmType alarmType : alarmTypes) {
|
for (EnvironmentAlarmType alarmType : alarmTypes) {
|
||||||
String bj = "报警";
|
String bj = "报警";
|
||||||
String yj = "预警";
|
String yj = "预警";
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), bj));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), bj, alarmType.getId().toString()));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), yj));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), yj, alarmType.getId().toString()));
|
||||||
}
|
}
|
||||||
} else if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.AIJC.getValue())) {
|
} else if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.AIJC.getValue())) {
|
||||||
List<DictionaryItem> dictList = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, projectSn);
|
List<DictionaryItem> dictList = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, projectSn);
|
||||||
for (DictionaryItem item : dictList) {
|
for (DictionaryItem item : dictList) {
|
||||||
//问题等级,1一级,2二级,3三级,4四级
|
//问题等级,1一级,2二级,3三级,4四级
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "一级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "一级", item.getId().toString()));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "二级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "二级", item.getId().toString()));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "三级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "三级", item.getId().toString()));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "四级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "四级", item.getId().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer enableSmsNotification = MapUtils.getInteger(param, "enableSmsNotification");
|
Integer enableSmsNotification = MapUtils.getInteger(param, "enableSmsNotification");
|
||||||
@ -209,13 +209,15 @@ public class EnableMessageDevRuleController {
|
|||||||
* @param moduleName 扬尘监测、AI监测
|
* @param moduleName 扬尘监测、AI监测
|
||||||
* @param monitoringParameterName
|
* @param monitoringParameterName
|
||||||
* @param monitoringLevelName
|
* @param monitoringLevelName
|
||||||
|
* @param parameterId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private EnableMessageDevRule getEnableMessageDevRuleVo(Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap,
|
private EnableMessageDevRule getEnableMessageDevRuleVo(Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap,
|
||||||
String moduleName,
|
String moduleName,
|
||||||
String monitoringParameterName,
|
String monitoringParameterName,
|
||||||
String monitoringLevelName) {
|
String monitoringLevelName,
|
||||||
return Optional.ofNullable(module2param2levelMap.get(moduleName)).map(m -> m.get(monitoringParameterName)).map(m -> m.get(monitoringLevelName))
|
String parameterId) {
|
||||||
|
return Optional.ofNullable(module2param2levelMap.get(moduleName)).map(m -> m.get(parameterId)).map(m -> m.get(monitoringLevelName))
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
EnableMessageDevRule v = new EnableMessageDevRule();
|
EnableMessageDevRule v = new EnableMessageDevRule();
|
||||||
v.setIsEnabled(0);
|
v.setIsEnabled(0);
|
||||||
@ -237,13 +239,13 @@ public class EnableMessageDevRuleController {
|
|||||||
public Result editByCondition(@RequestBody EnableMessageDevRuleDto enableMessageDevRuleDto) {
|
public Result editByCondition(@RequestBody EnableMessageDevRuleDto enableMessageDevRuleDto) {
|
||||||
String devSn = enableMessageDevRuleDto.getDevSn();
|
String devSn = enableMessageDevRuleDto.getDevSn();
|
||||||
String monitoringModuleName = enableMessageDevRuleDto.getMonitoringModuleName();
|
String monitoringModuleName = enableMessageDevRuleDto.getMonitoringModuleName();
|
||||||
String monitoringParameterName = enableMessageDevRuleDto.getMonitoringParameterName();
|
String parameterId = enableMessageDevRuleDto.getParameterId();
|
||||||
String monitoringLevelName = enableMessageDevRuleDto.getMonitoringLevelName();
|
String monitoringLevelName = enableMessageDevRuleDto.getMonitoringLevelName();
|
||||||
EnableMessageDevRule db = enableMessageDevRuleService.getOne(new LambdaQueryWrapper<EnableMessageDevRule>()
|
EnableMessageDevRule db = enableMessageDevRuleService.getOne(new LambdaQueryWrapper<EnableMessageDevRule>()
|
||||||
.eq(EnableMessageDevRule::getDevSn, devSn)
|
.eq(EnableMessageDevRule::getDevSn, devSn)
|
||||||
.eq(EnableMessageDevRule::getProjectSn, enableMessageDevRuleDto.getProjectSn())
|
.eq(EnableMessageDevRule::getProjectSn, enableMessageDevRuleDto.getProjectSn())
|
||||||
.eq(EnableMessageDevRule::getMonitoringModuleName, monitoringModuleName)
|
.eq(EnableMessageDevRule::getMonitoringModuleName, monitoringModuleName)
|
||||||
.eq(EnableMessageDevRule::getMonitoringParameterName, monitoringParameterName)
|
.eq(EnableMessageDevRule::getParameterId, parameterId)
|
||||||
.eq(EnableMessageDevRule::getMonitoringLevelName, monitoringLevelName));
|
.eq(EnableMessageDevRule::getMonitoringLevelName, monitoringLevelName));
|
||||||
if (db == null) {
|
if (db == null) {
|
||||||
enableMessageDevRuleService.save(enableMessageDevRuleDto);
|
enableMessageDevRuleService.save(enableMessageDevRuleDto);
|
||||||
|
|||||||
@ -169,4 +169,9 @@ public class EnableMessageDevRule implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "短信告警接收人ids(多个,分割)")
|
@ApiModelProperty(value = "短信告警接收人ids(多个,分割)")
|
||||||
private java.lang.String smsAlarmRecipientIds;
|
private java.lang.String smsAlarmRecipientIds;
|
||||||
|
/**
|
||||||
|
* 监测参数id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "监测参数id")
|
||||||
|
private java.lang.String parameterId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public class EnableMessageDevRuleServiceImpl extends ServiceImpl<EnableMessageDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnableMessageDevRule getEnableRule(ParamEnum.MessageModuleNameEnum moduleEnum, String devSn, String monitoringParameterName, String monitoringLevelName, String projectSn) {
|
public EnableMessageDevRule getEnableRule(ParamEnum.MessageModuleNameEnum moduleEnum, String devSn, String parameterId, String monitoringLevelName, String projectSn) {
|
||||||
EnableMessageDev messageDev = enableMessageDevService.getOne(new LambdaQueryWrapper<EnableMessageDev>()
|
EnableMessageDev messageDev = enableMessageDevService.getOne(new LambdaQueryWrapper<EnableMessageDev>()
|
||||||
.eq(EnableMessageDev::getMonitoringModule, moduleEnum.getValue())
|
.eq(EnableMessageDev::getMonitoringModule, moduleEnum.getValue())
|
||||||
.eq(EnableMessageDev::getDevSn, devSn)
|
.eq(EnableMessageDev::getDevSn, devSn)
|
||||||
@ -185,7 +185,7 @@ public class EnableMessageDevRuleServiceImpl extends ServiceImpl<EnableMessageDe
|
|||||||
.eq(EnableMessageDevRule::getMonitoringModuleName, moduleEnum.getDesc())
|
.eq(EnableMessageDevRule::getMonitoringModuleName, moduleEnum.getDesc())
|
||||||
.eq(EnableMessageDevRule::getDevSn, devSn)
|
.eq(EnableMessageDevRule::getDevSn, devSn)
|
||||||
.eq(EnableMessageDevRule::getProjectSn, messageDev.getProjectSn())
|
.eq(EnableMessageDevRule::getProjectSn, messageDev.getProjectSn())
|
||||||
.eq(EnableMessageDevRule::getMonitoringParameterName, monitoringParameterName)
|
.eq(EnableMessageDevRule::getParameterId, parameterId)
|
||||||
.eq(EnableMessageDevRule::getMonitoringLevelName, monitoringLevelName)
|
.eq(EnableMessageDevRule::getMonitoringLevelName, monitoringLevelName)
|
||||||
.eq(EnableMessageDevRule::getIsEnabled, 1)
|
.eq(EnableMessageDevRule::getIsEnabled, 1)
|
||||||
);
|
);
|
||||||
@ -223,8 +223,11 @@ public class EnableMessageDevRuleServiceImpl extends ServiceImpl<EnableMessageDe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendSystemMessageIfEnable(EnableMessageDevRule rule, String type) {
|
public void sendSystemMessageIfEnable(EnableMessageDevRule rule, String type) {
|
||||||
if (rule != null && Objects.equals(rule.getEnableSystemMessagePush(), 1) && StrUtil.isNotBlank(rule.getAlarmRecipientIds()) && EnableMessageDevRuleServiceImpl.isInSystemTime(rule)) {
|
if (rule != null && Objects.equals(rule.getEnableSystemMessagePush(), 1) && EnableMessageDevRuleServiceImpl.isInSystemTime(rule)) {
|
||||||
List<Long> ids = StrUtil.split(rule.getAlarmRecipientIds(), ",").stream().map(Convert::toLong).collect(Collectors.toList());
|
List<Long> ids = new ArrayList<>();
|
||||||
|
if (StrUtil.isNotBlank(rule.getAlarmRecipientIds())) {
|
||||||
|
ids = StrUtil.split(rule.getAlarmRecipientIds(), ",").stream().map(Convert::toLong).collect(Collectors.toList());
|
||||||
|
}
|
||||||
NoticeMessagePromptTone tone = null;
|
NoticeMessagePromptTone tone = null;
|
||||||
//系统站内声音提示
|
//系统站内声音提示
|
||||||
if (Objects.equals(rule.getEnableSystemMessagePromptTone(), 1)) {
|
if (Objects.equals(rule.getEnableSystemMessagePromptTone(), 1)) {
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class MessageDevRuleTask {
|
|||||||
.le(EnvironmentAlarm::getAlarmTime, new Date())
|
.le(EnvironmentAlarm::getAlarmTime, new Date())
|
||||||
).stream().collect(Collectors.groupingBy(EnvironmentAlarm::getDeviceId,
|
).stream().collect(Collectors.groupingBy(EnvironmentAlarm::getDeviceId,
|
||||||
Collectors.groupingBy(EnvironmentAlarm::getProjectSn,
|
Collectors.groupingBy(EnvironmentAlarm::getProjectSn,
|
||||||
Collectors.groupingBy(ea -> environmentTypeMap.get(ea.getAlarmTypeId()).getAlarmType(),
|
Collectors.groupingBy(ea -> ea.getAlarmTypeId().toString(),
|
||||||
Collectors.groupingBy(ea -> Objects.equals(ea.getType(), 0) ? "报警" : "预警")))));
|
Collectors.groupingBy(ea -> Objects.equals(ea.getType(), 0) ? "报警" : "预警")))));
|
||||||
List<EnableMessageDevRule> ruleList = enableMessageDevRuleService.list(new LambdaQueryWrapper<EnableMessageDevRule>().eq(EnableMessageDevRule::getIsEnabled, 1));
|
List<EnableMessageDevRule> ruleList = enableMessageDevRuleService.list(new LambdaQueryWrapper<EnableMessageDevRule>().eq(EnableMessageDevRule::getIsEnabled, 1));
|
||||||
Map<Long, SystemUser> userMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity(), (o1, o2) -> o1));
|
Map<Long, SystemUser> userMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity(), (o1, o2) -> o1));
|
||||||
@ -114,7 +114,7 @@ public class MessageDevRuleTask {
|
|||||||
return Objects.nonNull(Optional.ofNullable(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(XzAiDeductRule::getLevel).orElse(null));
|
return Objects.nonNull(Optional.ofNullable(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(XzAiDeductRule::getLevel).orElse(null));
|
||||||
}).collect(Collectors.groupingBy(AiAnalyseHardWareAlarmRecord::getHardwareId,
|
}).collect(Collectors.groupingBy(AiAnalyseHardWareAlarmRecord::getHardwareId,
|
||||||
Collectors.groupingBy(AiAnalyseHardWareAlarmRecord::getProjectSn,
|
Collectors.groupingBy(AiAnalyseHardWareAlarmRecord::getProjectSn,
|
||||||
Collectors.groupingBy(r1 -> dictDataMap.get(Convert.toStr(r1.getAlarmType())).getName(),
|
Collectors.groupingBy(r1 -> dictDataMap.get(Convert.toStr(r1.getAlarmType())).getId().toString(),
|
||||||
Collectors.groupingBy(r -> Optional.of(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(r1 -> {
|
Collectors.groupingBy(r -> Optional.of(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(r1 -> {
|
||||||
return xzAiDeductRuleService.getLevelName(r1.getLevel());
|
return xzAiDeductRuleService.getLevelName(r1.getLevel());
|
||||||
}).orElse(null))))));
|
}).orElse(null))))));
|
||||||
@ -129,7 +129,7 @@ public class MessageDevRuleTask {
|
|||||||
if (Objects.equals(ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), moduleEntry.getKey())) {
|
if (Objects.equals(ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), moduleEntry.getKey())) {
|
||||||
List<EnvironmentAlarm> filterAlarms = Optional.ofNullable(devSn2ProjectSn2Parameter2LevelEnvironmentAlarmMap.get(rule.getDevSn()))
|
List<EnvironmentAlarm> filterAlarms = Optional.ofNullable(devSn2ProjectSn2Parameter2LevelEnvironmentAlarmMap.get(rule.getDevSn()))
|
||||||
.map(m -> m.get(rule.getProjectSn()))
|
.map(m -> m.get(rule.getProjectSn()))
|
||||||
.map(m -> m.get(rule.getMonitoringParameterName())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
.map(m -> m.get(rule.getParameterId())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
||||||
List<EnvironmentAlarm> filterAlarms1 = getFilterEnvironmentAlarmRecords(filterAlarms, rule.getSmsPushFrequency());
|
List<EnvironmentAlarm> filterAlarms1 = getFilterEnvironmentAlarmRecords(filterAlarms, rule.getSmsPushFrequency());
|
||||||
if (CollUtil.isNotEmpty(filterAlarms1)) {
|
if (CollUtil.isNotEmpty(filterAlarms1)) {
|
||||||
sendSmsNotice(rule, filterAlarms1.size(), userMap);
|
sendSmsNotice(rule, filterAlarms1.size(), userMap);
|
||||||
@ -150,7 +150,7 @@ public class MessageDevRuleTask {
|
|||||||
else if (Objects.equals(ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), moduleEntry.getKey())) {
|
else if (Objects.equals(ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), moduleEntry.getKey())) {
|
||||||
List<AiAnalyseHardWareAlarmRecord> filterAlarms = Optional.ofNullable(devSn2ProjectSn2Parameter2LevelAiMap.get(rule.getDevSn()))
|
List<AiAnalyseHardWareAlarmRecord> filterAlarms = Optional.ofNullable(devSn2ProjectSn2Parameter2LevelAiMap.get(rule.getDevSn()))
|
||||||
.map(m -> m.get(rule.getProjectSn()))
|
.map(m -> m.get(rule.getProjectSn()))
|
||||||
.map(m -> m.get(rule.getMonitoringParameterName())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
.map(m -> m.get(rule.getParameterId())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
||||||
List<AiAnalyseHardWareAlarmRecord> filterAlarms1 = getFilterAiAlarmRecords(filterAlarms, rule.getSmsPushFrequency());
|
List<AiAnalyseHardWareAlarmRecord> filterAlarms1 = getFilterAiAlarmRecords(filterAlarms, rule.getSmsPushFrequency());
|
||||||
if (CollUtil.isNotEmpty(filterAlarms1)) {
|
if (CollUtil.isNotEmpty(filterAlarms1)) {
|
||||||
sendSmsNotice(rule, filterAlarms1.size(), userMap);
|
sendSmsNotice(rule, filterAlarms1.size(), userMap);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user