| | |
| | | import com.ld.igds.constant.DeviceStatus; |
| | | import com.ld.igds.constant.DeviceType; |
| | | |
| | | import com.ld.igds.models.Depot; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | return list; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public List<Device> getCacheDeviceByDepotId(String companyId, String depotId) { |
| | | String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEVICE_LIST); |
| | | |
| | | Set<String> keys = redisUtil.keys(patten); |
| | | if (null == keys) return null; |
| | | |
| | | List<Device> result = new ArrayList<>(); |
| | | List<Device> list = new ArrayList<>(); |
| | | for (String key : keys) { |
| | | list.addAll((List<Device>) redisUtil.get(key)); |
| | | } |
| | | |
| | | if (list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | for (Device device : list) { |
| | | if(depotId.equals(device.getDepotId())){ |
| | | result.add(device); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Device getCacheDeviceById(String companyId, String id) { |
| | | String key = RedisConst.buildDeviceKey(companyId, RedisConst.KEY_DEVICE, id); |