mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 打印日志
This commit is contained in:
@@ -125,22 +125,28 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共方法 根据桩编号删除redis缓存
|
||||
* 公共方法 根据桩编号或者枪口号删除redis缓存
|
||||
*/
|
||||
private void deleteRedisByPileSn(String pileSn) {
|
||||
private void deleteRedisByPileSnOrPileConnectorCode(String pileSn, String pileConnectorCode) {
|
||||
List<String> keys = Lists.newArrayList();
|
||||
// 删除枪口信息缓存
|
||||
keys.add(CacheConstants.SELECT_PILE_CONNECTOR_INFO_LIST + pileSn);
|
||||
// 删除充电桩详情缓存
|
||||
keys.add(CacheConstants.PILE_DETAIL_KEY + pileSn);
|
||||
// 删除充电桩枪口状态缓存
|
||||
Set<String> scan = redisCache.scan(CacheConstants.PILE_CONNECTOR_STATUS_KEY + pileSn + "*");
|
||||
if (CollectionUtils.isNotEmpty(scan)) {
|
||||
keys.addAll(scan);
|
||||
if (StringUtils.isNotBlank(pileSn)) {
|
||||
// 删除枪口信息缓存
|
||||
keys.add(CacheConstants.SELECT_PILE_CONNECTOR_INFO_LIST + pileSn);
|
||||
|
||||
// 删除充电桩详情缓存
|
||||
keys.add(CacheConstants.PILE_DETAIL_KEY + pileSn);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(pileConnectorCode)) {
|
||||
// 删除充电桩枪口状态缓存
|
||||
keys.add(CacheConstants.PILE_CONNECTOR_STATUS_KEY + pileConnectorCode);
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
log.info("批量删除缓存 pileSn:{}, keys:{}", pileSn, keys);
|
||||
redisCache.deleteObject(keys);
|
||||
if (CollectionUtils.isNotEmpty(keys)) {
|
||||
redisCache.deleteObject(keys);
|
||||
}
|
||||
log.info("批量删除缓存 pileSn:{}, pileConnectorCode:{}, keys:{}", pileSn, pileConnectorCode, keys);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -578,7 +584,7 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
String pileSn = pileConnectorCode.substring(0, pileConnectorCode.length() - 2);
|
||||
// 只修改一个枪口的状态
|
||||
num = pileConnectorInfoMapper.updateConnectorStatus(pileConnectorCode, status);
|
||||
deleteRedisByPileSn(pileSn);
|
||||
deleteRedisByPileSnOrPileConnectorCode(pileSn, pileConnectorCode);
|
||||
redisCache.setCacheObject(redisKey, status, CacheConstants.cache_expire_time_3m);
|
||||
|
||||
// 异步放缓存
|
||||
@@ -745,7 +751,7 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
int i = pileConnectorInfoMapper.updatePileConnectorInfo(info);
|
||||
// 删除缓存
|
||||
String pileSn = dto.getPileSn();
|
||||
deleteRedisByPileSn(pileSn);
|
||||
deleteRedisByPileSnOrPileConnectorCode(pileSn, null);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user