|
@@ -40,7 +40,7 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
public AlarmConditionState getAlarmDefineState(String defineId) {
|
|
|
AlarmConditionState alarmConditionState = null;
|
|
|
try {
|
|
|
- Object obj = alarmRedisTemplate.opsForHash().get(RedisConstant.DEFINE_ID, defineId);
|
|
|
+ Object obj = alarmRedisTemplate.opsForHash().get(RedisConstant.ALARM_CONDITION_STATE, defineId);
|
|
|
if (null != obj && StringUtils.isNotBlank(obj.toString())) {
|
|
|
try {
|
|
|
alarmConditionState =JSONUtil.toBean(obj.toString(), AlarmConditionState.class);
|
|
@@ -70,13 +70,13 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
}
|
|
|
|
|
|
public void setAlarmState(String defineId, AlarmConditionState alarmConditionState) {
|
|
|
- alarmRedisTemplate.opsForHash().put(RedisConstant.DEFINE_ID, defineId, JSON.toJSONString(alarmConditionState));
|
|
|
+ alarmRedisTemplate.opsForHash().put(RedisConstant.ALARM_CONDITION_STATE, defineId, JSON.toJSONString(alarmConditionState));
|
|
|
}
|
|
|
|
|
|
public AlarmCondition getAlarmConditionRedis(String conditionId) {
|
|
|
String str = alarmRedisTemplate.execute((RedisCallback<String>) conn -> {
|
|
|
conn.select(14);
|
|
|
- byte[] condition = conn.hGet(RedisConstant.ALARMCONDITION_ID.getBytes(), conditionId.getBytes());
|
|
|
+ byte[] condition = conn.hGet(RedisConstant.ALARM_CONDITIONS.getBytes(), conditionId.getBytes());
|
|
|
return new String(condition);
|
|
|
});
|
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
@@ -86,7 +86,7 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
|
|
|
public ObjConditionInfo getAlarmConditionsByObjId(String meterId) {
|
|
|
try {
|
|
|
- String str = alarmRedisTemplate.opsForHash().get(RedisConstant.METER_ID, meterId).toString();
|
|
|
+ String str = alarmRedisTemplate.opsForHash().get(RedisConstant.OBJ_CONDITION_REL, meterId).toString();
|
|
|
if (StringUtils.isNotBlank(str)) {
|
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
|
JSONArray conditions = object.getJSONArray("conditions");
|
|
@@ -106,7 +106,7 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
|
|
|
public AlarmCondition getAlarmCondition(String conditionId) {
|
|
|
try {
|
|
|
- Object obj = alarmRedisTemplate.opsForHash().get(RedisConstant.ALARMCONDITION_ID, conditionId);
|
|
|
+ Object obj = alarmRedisTemplate.opsForHash().get(RedisConstant.ALARM_CONDITIONS, conditionId);
|
|
|
if (null != obj && StringUtils.isNotBlank(obj.toString())) {
|
|
|
JSONObject object = JSONObject.parseObject(obj.toString());
|
|
|
AlarmCondition alarmCondition = JSON.toJavaObject(object, AlarmCondition.class);
|