mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 打印日志
This commit is contained in:
@@ -81,6 +81,7 @@ public class PileConnectorInfoController extends BaseController {
|
||||
@Log(title = "充电桩枪口信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateParkNo")
|
||||
public RestApiResponse<?> updateParkNo(@RequestBody UpdateConnectorParkNoDTO dto) {
|
||||
logger.info("修改车位号 param:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
int i = pileConnectorInfoService.updateConnectorParkNo(dto);
|
||||
|
||||
@@ -98,7 +98,9 @@ public class CacheConstants {
|
||||
*/
|
||||
public static final String GET_ORDER_INFO_BY_ORDER_CODE = "get_order_info_by_order_code:";
|
||||
|
||||
// 通过交易流水号查询订单信息
|
||||
/**
|
||||
* 通过交易流水号查询订单信息
|
||||
*/
|
||||
public static final String GET_ORDER_INFO_BY_TRANSACTION_CODE = "get_order_info_by_transaction_code:";
|
||||
|
||||
/**
|
||||
@@ -106,6 +108,9 @@ public class CacheConstants {
|
||||
*/
|
||||
public static final String PILE_REAL_TIME_MONITOR_DATA = "pile_real_time_monitor_data:";
|
||||
|
||||
/**
|
||||
* 充电桩充电状态
|
||||
*/
|
||||
public static final String PILE_IS_CHARGING = "pile_is_charging:";
|
||||
|
||||
/**
|
||||
|
||||
@@ -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