YYC
2023-09-07 7243e0b4bd9a267a633d2e481e17646509b6868d
igds-core/src/main/java/com/ld/igds/common/impl/CoreDeviceServiceImpl.java
@@ -9,6 +9,8 @@
import com.ld.igds.constant.DeviceStatus;
import com.ld.igds.constant.DeviceType;
import com.ld.igds.io.request.ExeDevice;
import com.ld.igds.models.Depot;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -112,6 +114,30 @@
        return list;
    }
    @SuppressWarnings("unchecked")
    @Override
    public Set<String> getCacheDeviceSerByDepotId(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> list = new ArrayList<>();
        for (String key : keys) {
            list.addAll((List<Device>) redisUtil.get(key));
        }
        if (list.isEmpty()) {
            return null;
        }
        Set<String> result = new HashSet<>();
        for (Device device : list) {
            if(depotId.equals(device.getDepotId())){
                result.add(device.getSerId());
            }
        }
        return result;
    }
    @Override
    public Device getCacheDeviceById(String companyId, String id) {
        String key = RedisConst.buildDeviceKey(companyId, RedisConst.KEY_DEVICE, id);