feat:如果有缓存 但是没返回数据 清除缓存 针对信发设备切换账号
This commit is contained in:
@@ -156,6 +156,9 @@ public class XinFaDeviceService {
|
||||
List<StoreXinFaDeviceDetail> deviceDetailDetail = getStoreXinFaDeviceDetailDetail(storeNum, token);
|
||||
if (CollectionUtils.isNotEmpty(deviceDetailDetail)) {
|
||||
return deviceDetailDetail;
|
||||
}else {
|
||||
//如果在该账号下没有数据 清除缓存
|
||||
redisUtilPool.hashDel(RedisConstant.HUOMA_STORE_DEVICE_RESOURCE_KEY, storeNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,8 +176,8 @@ public class XinFaDeviceService {
|
||||
|
||||
|
||||
public List<StoreXinFaDeviceDetail> getStoreXinFaDeviceDetailDetail(String storeNum, String token) {
|
||||
Integer storeIdByStoreNum = getStoreIdByStoreNum(storeNum, token);
|
||||
return getStoreXinFaDeviceDetailByPointId(storeIdByStoreNum, token);
|
||||
Integer pointId = getStoreIdByStoreNum(storeNum, token);
|
||||
return getStoreXinFaDeviceDetailByPointId(storeNum,pointId, token);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +297,7 @@ public class XinFaDeviceService {
|
||||
|
||||
|
||||
|
||||
public List<StoreXinFaDeviceDetail> getStoreXinFaDeviceDetailByPointId(Integer pointId, String token) {
|
||||
public List<StoreXinFaDeviceDetail> getStoreXinFaDeviceDetailByPointId(String storeNum,Integer pointId, String token) {
|
||||
if (pointId != null){
|
||||
StoreXinFaDetailRequestDTO storeXinFaDetailRequestDTO = new StoreXinFaDetailRequestDTO(0, 10, pointId);
|
||||
String responseBody = null;
|
||||
@@ -304,10 +307,14 @@ public class XinFaDeviceService {
|
||||
JsonNode rootNode = mapper.readTree(responseBody);
|
||||
|
||||
// 直接转换整个数组
|
||||
return mapper.convertValue(
|
||||
List<StoreXinFaDeviceDetail> list = mapper.convertValue(
|
||||
rootNode.path("data").path("content"),
|
||||
mapper.getTypeFactory().constructCollectionType(List.class, StoreXinFaDeviceDetail.class)
|
||||
);
|
||||
mapper.getTypeFactory().constructCollectionType(List.class, StoreXinFaDeviceDetail.class));
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
//如果网店没有设备 清除缓存
|
||||
redisUtilPool.hashDel(RedisConstant.HUO_MA_STORE_ID, storeNum);
|
||||
}
|
||||
return list;
|
||||
}catch (Exception e){
|
||||
log.error("getStoreXinFaDeviceDetailByPointId解析获取data失败,url:{},responseBody:{}",huoMaTokenUrl, responseBody);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user