| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.moral.common.json.BooleanValueFilter; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | |
| | | public static String getAlarmKey(int organizationId){ |
| | | return AlarmPrefix+organizationId; |
| | | } |
| | | private static final String Adjust = "adjust_"; |
| | | public static String getAdjustKey(String mac){ |
| | | return Adjust + mac; |
| | | } |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private BooleanValueFilter javaTypePatchValueFilter; |
| | | /** |
| | | * 批量删除对应的value |
| | | * |
| | |
| | | boolean result = false; |
| | | try { |
| | | if(value!=null&&!(value instanceof String)) { |
| | | value = JSON.toJSONString(value,new BooleanValueFilter()); |
| | | value = JSON.toJSONString(value, javaTypePatchValueFilter); |
| | | } |
| | | ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue(); |
| | | operations.set(key, value); |