diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RedisStreamUtil.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/common/util/RedisStreamUtil.java similarity index 98% rename from jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RedisStreamUtil.java rename to jeecg-module-abnormal-alarm/src/main/java/org/jeecg/common/util/RedisStreamUtil.java index 103eb1d0..18fdd99c 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/RedisStreamUtil.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/common/util/RedisStreamUtil.java @@ -7,6 +7,7 @@ import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.SymbolConstant; import org.jeecg.modules.base.dto.RuleDto; import org.jeecg.modules.base.entity.postgre.AlarmRule; +import org.jeecg.modules.entity.AlarmRuleAbnormal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.stream.*; @@ -166,7 +167,7 @@ public class RedisStreamUtil{ return putRecord(record); } - public void setRules(Map ruleMap){ + public void setRules(Map ruleMap){ Jackson2JsonRedisSerializer jacksonSerializer = new Jackson2JsonRedisSerializer(Object.class); ObjectMapper objectMapper = new ObjectMapper(); // 使Jackson支持Java8的新日期API diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java index 7a3ce705..90c728b8 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmContactGroupMapper.java @@ -2,6 +2,7 @@ package org.jeecg.modules.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.base.entity.postgre.AlarmContactGroup; +import org.jeecg.modules.entity.AlarmContactGroupAbnormal; -public interface AlarmContactGroupMapper extends BaseMapper { +public interface AlarmContactGroupMapper extends BaseMapper { } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java index f7c9d10d..494cbaaa 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/mapper/AlarmRuleMapper.java @@ -3,12 +3,12 @@ package org.jeecg.modules.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.base.dto.AlarmRuleDto; import org.jeecg.modules.base.dto.AlarmRuleInfo; -import org.jeecg.modules.base.entity.postgre.AlarmRule; +import org.jeecg.modules.entity.AlarmRuleAbnormal; import java.util.List; import java.util.Map; -public interface AlarmRuleMapper extends BaseMapper { +public interface AlarmRuleMapper extends BaseMapper { List findPage(Map params); diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java index e78f3b62..e03f62f4 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java @@ -4,20 +4,21 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.base.entity.postgre.AlarmContactGroup; +import org.jeecg.modules.entity.AlarmContactGroupAbnormal; -public interface IAlarmContactGroupService extends IService { +public interface IAlarmContactGroupService extends IService { - Result findPage(QueryRequest queryRequest, AlarmContactGroup alarmContactGroup); + Result findPage(QueryRequest queryRequest, AlarmContactGroupAbnormal alarmContactGroup); Result findInfo(String id); - Result create(AlarmContactGroup alarmContactGroup); + Result create(AlarmContactGroupAbnormal alarmContactGroup); - Result update(AlarmContactGroup alarmContactGroup); + Result update(AlarmContactGroupAbnormal alarmContactGroup); Result deleteById(String id); Result deleteUserById(String id, String userId); - AlarmContactGroup getByName(String groupName); + AlarmContactGroupAbnormal getByName(String groupName); } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java index 644bfbb9..fac1d2a2 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmRuleService.java @@ -2,18 +2,18 @@ package org.jeecg.modules.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.vo.Result; -import org.jeecg.modules.base.entity.postgre.AlarmRule; import org.jeecg.modules.base.vo.AlarmRuleVo; +import org.jeecg.modules.entity.AlarmRuleAbnormal; -public interface IAlarmRuleService extends IService { +public interface IAlarmRuleService extends IService { Result findPage(AlarmRuleVo alarmRuleVo); Result findInfo(String alarmRuleId); - Result create(AlarmRule alarmRule); + Result create(AlarmRuleAbnormal alarmRule); - Result update(AlarmRule alarmRule); + Result update(AlarmRuleAbnormal alarmRule); Result deleteById(String alarmRuleId); diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java index 91a17797..83f7fd11 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java @@ -14,6 +14,7 @@ import org.jeecg.common.util.SpringContextUtils; import org.jeecg.modules.base.entity.postgre.AlarmContactGroup; import org.jeecg.modules.base.entity.postgre.AlarmContactGroupMember; import org.jeecg.modules.base.entity.postgre.SysUser; +import org.jeecg.modules.entity.AlarmContactGroupAbnormal; import org.jeecg.modules.feignclient.SystemClient; import org.jeecg.modules.mapper.AlarmContactGroupMapper; import org.jeecg.modules.mapper.AlarmContactGroupMemberMapper; @@ -30,7 +31,7 @@ import java.util.Objects; import java.util.stream.Collectors; @Service("alarmContactGroupService") -public class AlarmContactGroupServiceImpl extends ServiceImpl implements IAlarmContactGroupService { +public class AlarmContactGroupServiceImpl extends ServiceImpl implements IAlarmContactGroupService { @Autowired private AlarmContactGroupMemberMapper alarmContactGroupMemberMapper; @@ -38,14 +39,14 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl userList = systemClient.findUserMap(); - Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.orderByDesc(AlarmContactGroup::getCreateTime); - Page alarmContactGroupPage = this.baseMapper.selectPage(page, queryWrapper); + Page page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.orderByDesc(AlarmContactGroupAbnormal::getCreateTime); + Page alarmContactGroupPage = this.baseMapper.selectPage(page, queryWrapper); LambdaQueryWrapper contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); List alarmContactGroupMembers = alarmContactGroupMemberMapper.selectList(contactGroupMemberQueryWrapper); alarmContactGroupPage.getRecords().forEach(item->{ @@ -77,9 +78,9 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(AlarmContactGroup::getId, id); - AlarmContactGroup alarmContactGroup = this.baseMapper.selectOne(queryWrapper); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmContactGroupAbnormal::getId, id); + AlarmContactGroupAbnormal alarmContactGroup = this.baseMapper.selectOne(queryWrapper); if (Objects.isNull(alarmContactGroup)){ result.error500("Failed to query the data because the corresponding data does not exist!"); return result; @@ -98,7 +99,7 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(AlarmContactGroup::getId, alarmContactGroup.getId()); - AlarmContactGroup contactGroup = this.baseMapper.selectOne(queryWrapper); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(AlarmContactGroupAbnormal::getId, alarmContactGroup.getId()); + AlarmContactGroupAbnormal contactGroup = this.baseMapper.selectOne(queryWrapper); if (Objects.isNull(contactGroup)){ result.error500("The corresponding data does not exist!"); return result; @@ -205,9 +206,9 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AlarmContactGroup::getName,groupName); + public AlarmContactGroupAbnormal getByName(String groupName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(AlarmContactGroupAbnormal::getName,groupName); return getOne(wrapper); } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java index 575cc64f..3cf7b395 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmRuleServiceImpl.java @@ -15,8 +15,8 @@ import org.jeecg.modules.base.dto.AlarmRuleDto; import org.jeecg.modules.base.dto.AlarmRuleInfo; import org.jeecg.modules.base.dto.SourceDto; import org.jeecg.modules.base.entity.Rule; -import org.jeecg.modules.base.entity.postgre.AlarmRule; import org.jeecg.modules.base.vo.AlarmRuleVo; +import org.jeecg.modules.entity.AlarmRuleAbnormal; import org.jeecg.modules.mapper.AlarmRuleMapper; import org.jeecg.modules.service.IAlarmRuleService; import org.jeecg.modules.service.ISysDatabaseService; @@ -34,7 +34,7 @@ import java.util.Map; import static org.jeecg.modules.base.enums.SourceType.*; @Service("alarmRuleService") -public class AlarmRuleServiceImpl extends ServiceImpl implements IAlarmRuleService { +public class AlarmRuleServiceImpl extends ServiceImpl implements IAlarmRuleService { @Autowired private RedisStreamUtil redisStreamUtil; @@ -73,7 +73,7 @@ public class AlarmRuleServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AlarmRule::getId, alarmRule.getId()); - AlarmRule alarmRuleOld = this.baseMapper.selectOne(wrapper); + public Result update(AlarmRuleAbnormal alarmRule) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(AlarmRuleAbnormal::getId, alarmRule.getId()); + AlarmRuleAbnormal alarmRuleOld = this.baseMapper.selectOne(wrapper); if (ObjectUtil.isNull(alarmRuleOld)){ return Result.error(Prompt.DATA_NOT_EXITS); } @@ -124,7 +124,7 @@ public class AlarmRuleServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AlarmRule::getEnabled,1); - List alarmRules = this.list(wrapper); - Map ruleMap = new HashMap<>(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(AlarmRuleAbnormal::getEnabled,1); + List alarmRules = this.list(wrapper); + Map ruleMap = new HashMap<>(); Map silenceMap = new HashMap<>(); - for (AlarmRule alarmRule : alarmRules) { + for (AlarmRuleAbnormal alarmRule : alarmRules) { String sourceType = alarmRule.getSourceType(); String ruleId = alarmRule.getId(); Long silence = alarmRule.getSilenceCycle();