|
@@ -26,15 +26,15 @@ import lombok.extern.slf4j.Slf4j;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class AlarmRedisCache implements RedisCache {
|
|
public class AlarmRedisCache implements RedisCache {
|
|
|
|
|
|
- @Resource(name = "emsRedisTemplate")
|
|
|
|
- private RedisTemplate<String, String> emsRedisTemplate;
|
|
|
|
|
|
+ @Resource(name = "alarmRedisTemplate")
|
|
|
|
+ private RedisTemplate<String, String> alarmRedisTemplate;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
AlarmRecordRepository alarmRecordRepository;
|
|
AlarmRecordRepository alarmRecordRepository;
|
|
|
|
|
|
public AlarmConditionState getAlarmDefineState(String defineId) {
|
|
public AlarmConditionState getAlarmDefineState(String defineId) {
|
|
AlarmConditionState alarmConditionState = null;
|
|
AlarmConditionState alarmConditionState = null;
|
|
- String str = emsRedisTemplate.opsForHash().get(RedisConstant.DEFINE_ID, defineId).toString();
|
|
|
|
|
|
+ String str = alarmRedisTemplate.opsForHash().get(RedisConstant.DEFINE_ID, defineId).toString();
|
|
if (StringUtils.isNotBlank(str)) {
|
|
if (StringUtils.isNotBlank(str)) {
|
|
try {
|
|
try {
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
@@ -65,11 +65,11 @@ public class AlarmRedisCache implements RedisCache {
|
|
}
|
|
}
|
|
|
|
|
|
public void setAlarmState(String defineId, AlarmConditionState alarmConditionState) {
|
|
public void setAlarmState(String defineId, AlarmConditionState alarmConditionState) {
|
|
- emsRedisTemplate.opsForHash().put(RedisConstant.DEFINE_ID, defineId, JSON.toJSONString(alarmConditionState));
|
|
|
|
|
|
+ alarmRedisTemplate.opsForHash().put(RedisConstant.DEFINE_ID, defineId, JSON.toJSONString(alarmConditionState));
|
|
}
|
|
}
|
|
|
|
|
|
public AlarmCondition getAlarmConditionRedis(String conditionId) {
|
|
public AlarmCondition getAlarmConditionRedis(String conditionId) {
|
|
- String str = emsRedisTemplate.execute((RedisCallback<String>) conn -> {
|
|
|
|
|
|
+ String str = alarmRedisTemplate.execute((RedisCallback<String>) conn -> {
|
|
conn.select(14);
|
|
conn.select(14);
|
|
byte[] condition = conn.hGet(RedisConstant.ALARMCONDITION_ID.getBytes(), conditionId.getBytes());
|
|
byte[] condition = conn.hGet(RedisConstant.ALARMCONDITION_ID.getBytes(), conditionId.getBytes());
|
|
return new String(condition);
|
|
return new String(condition);
|
|
@@ -81,7 +81,7 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
|
|
|
public ObjConditionInfo getAlarmConditionsByObjId(String meterId) {
|
|
public ObjConditionInfo getAlarmConditionsByObjId(String meterId) {
|
|
try {
|
|
try {
|
|
- String str = emsRedisTemplate.opsForHash().get(RedisConstant.METER_ID, meterId).toString();
|
|
|
|
|
|
+ String str = alarmRedisTemplate.opsForHash().get(RedisConstant.METER_ID, meterId).toString();
|
|
if (StringUtils.isNotBlank(str)) {
|
|
if (StringUtils.isNotBlank(str)) {
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
ObjConditionInfo objConditionInfo = JSON.toJavaObject(object, ObjConditionInfo.class);
|
|
ObjConditionInfo objConditionInfo = JSON.toJavaObject(object, ObjConditionInfo.class);
|
|
@@ -95,7 +95,7 @@ public class AlarmRedisCache implements RedisCache {
|
|
|
|
|
|
public AlarmCondition getAlarmCondition(String conditionId) {
|
|
public AlarmCondition getAlarmCondition(String conditionId) {
|
|
try {
|
|
try {
|
|
- String str = emsRedisTemplate.opsForHash().get(RedisConstant.CONDITION_ID, conditionId).toString();
|
|
|
|
|
|
+ String str = alarmRedisTemplate.opsForHash().get(RedisConstant.ALARMCONDITION_ID, conditionId).toString();
|
|
if (StringUtils.isNotBlank(str)) {
|
|
if (StringUtils.isNotBlank(str)) {
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
JSONObject object = JSONObject.parseObject(str);
|
|
AlarmCondition alarmCondition = JSON.toJavaObject(object, AlarmCondition.class);
|
|
AlarmCondition alarmCondition = JSON.toJavaObject(object, AlarmCondition.class);
|