|
@@ -9,15 +9,13 @@ import com.persagy.apm.energyalarmstarter.alarmengine.feign.AlarmCondition;
|
|
|
import com.persagy.apm.energyalarmstarter.alarmengine.feign.ObjConditionRel;
|
|
|
import com.persagy.apm.energyalarmstarter.alarmengine.jms.model.ItemCodeCondition;
|
|
|
import com.persagy.apm.energyalarmstarter.alarmengine.jms.model.ObjConditionInfo;
|
|
|
-import com.persagy.apm.energyalarmstarter.alarmengine.redis.RedisUtil;
|
|
|
+import com.persagy.apm.energyalarmstarter.alarmengine.redis.RedisUtil4EngineStater;
|
|
|
import com.persagy.apm.energyalarmstarter.alarmengine.service.AlarmRecordMsgHandler;
|
|
|
import io.netty.channel.ChannelHandler;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -36,11 +34,8 @@ public class AlarmEngineMsgHandler {
|
|
|
@Autowired
|
|
|
private AlarmRecordMsgHandler alarmRecordMsgHandler;
|
|
|
|
|
|
- @Resource(name = "alarmRedisTemplate")
|
|
|
- private RedisTemplate<String, String> alarmRedisTemplate;
|
|
|
-
|
|
|
@Autowired
|
|
|
- private RedisUtil redisUtil;
|
|
|
+ private RedisUtil4EngineStater redisUtil;
|
|
|
|
|
|
@SneakyThrows
|
|
|
public String getAlarmCategory(DmpMessage dmpMessage) {
|
|
@@ -106,8 +101,7 @@ public class AlarmEngineMsgHandler {
|
|
|
*/
|
|
|
public void syncNewCondition(DmpMessage msg) {
|
|
|
AlarmCondition alarmCondition = JSONObject.parseObject(msg.getStr1(), AlarmCondition.class);
|
|
|
- // TODO: 2021/11/16 更新redis
|
|
|
- alarmRedisTemplate.opsForHash().put("ALARM_CONDITION", alarmCondition.getId(), JSON.toJSONString(alarmCondition));
|
|
|
+ redisUtil.put(RedisConstants.ALARM_CONDITIONS, alarmCondition.getId(), JSON.toJSONString(alarmCondition));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -119,9 +113,7 @@ public class AlarmEngineMsgHandler {
|
|
|
*/
|
|
|
public void syncUpdatedCondition(DmpMessage msg) {
|
|
|
AlarmCondition alarmCondition = JSONObject.parseObject(msg.getStr1(), AlarmCondition.class);
|
|
|
- // TODO: 2021/11/16 更新redis
|
|
|
- alarmRedisTemplate.opsForHash().delete("ALARM_CONDITION",alarmCondition.getId());
|
|
|
- alarmRedisTemplate.opsForHash().put("ALARM_CONDITION", alarmCondition.getId(), JSON.toJSONString(alarmCondition));
|
|
|
+ redisUtil.put(RedisConstants.ALARM_CONDITIONS, alarmCondition.getId(), JSON.toJSONString(alarmCondition));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -132,9 +124,8 @@ public class AlarmEngineMsgHandler {
|
|
|
* @version V1.0 2021/10/26 7:51 下午
|
|
|
*/
|
|
|
public void syncDeletedCondition(DmpMessage msg) {
|
|
|
- // TODO: 2021/11/16 更新redis
|
|
|
- alarmRedisTemplate.opsForHash().delete("ALARM_CONDITION",msg.getStr1());
|
|
|
-
|
|
|
+ String conditionId = msg.getStr1();
|
|
|
+ redisUtil.delete(RedisConstants.ALARM_CONDITIONS, conditionId);
|
|
|
}
|
|
|
|
|
|
/**
|