| | |
| | | if (StringUtils.isEmpty(companyId)) { |
| | | companyId = ContextUtil.getCompanyId(); |
| | | } |
| | | |
| | | GatewaySer result = null; |
| | | GatewaySer ser = null; |
| | | String patten = RedisConst.buildKey(companyId, RedisConst.KEY_GATEWAY_SER_LIST) + "*"; |
| | | Collection<String> keys = redisCache.keys(patten); |
| | | if (null == keys) { |
| | | return null; |
| | | } |
| | | |
| | | GatewaySer ser = null; |
| | | for (String key : keys) { |
| | | ser = (GatewaySer) redisCache.getCacheObject(key); |
| | | if(id.equals(ser.getId())){ |
| | | break; |
| | | if (null != keys && !keys.isEmpty()) { |
| | | for (String key : keys) { |
| | | ser = (GatewaySer) redisCache.getCacheObject(key); |
| | | if(id.equals(ser.getId())){ |
| | | result = ser; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(null == ser){ |
| | | ser = getById(id); |
| | | this.setCacheSer(ser); |
| | | if(null == result){ |
| | | result = getById(id); |
| | | this.setCacheSer(result); |
| | | } |
| | | |
| | | return ser; |
| | | return result; |
| | | } |
| | | |
| | | /** |