This commit is contained in:
2023-06-21 13:30:37 +08:00
parent 9dc7c9c249
commit 1003af0af2
2 changed files with 14 additions and 24 deletions

View File

@@ -361,23 +361,12 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
/**
* 通过计费模板id查询计费模板详情
* 缓存30分账,修改清缓存
* 缓存1天,修改清缓存
* @param id
* @return
*/
@Override
public List<PileBillingDetail> queryBillingDetailById(Long id) {
String redisKey = CacheConstants.QUERY_BILLING_DETAIL_BY_ID + id;
List<PileBillingDetail> pileBillingDetails = redisCache.getCacheList(redisKey);
if (CollectionUtils.isEmpty(pileBillingDetails)) {
pileBillingDetails = pileBillingTemplateMapper.queryBillingDetailByTemplateId(id);
if (CollectionUtils.isNotEmpty(pileBillingDetails)) {
redisCache.setCacheList(redisKey, pileBillingDetails);
redisCache.expire(redisKey, 30, TimeUnit.MINUTES);
}
}
return pileBillingDetails;
}
public List<PileBillingDetail> queryBillingDetailById(Long id)
@Override
public List<BillingTemplateVO> queryPublicBillingTemplateList() {

View File

@@ -390,17 +390,18 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
*/
@Override
public List<ConnectorInfoVO> getUniAppConnectorList(Long stationId) {
// TODO 加缓存
// String redisKey = CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID + stationId;
// List<ConnectorInfoVO> list = redisCache.getCacheObject(redisKey);
// if (CollectionUtils.isEmpty(list)) {
// // 查数据库
// list = pileConnectorInfoMapper.getUniAppConnectorList(stationId);
// if (CollectionUtils.isNotEmpty(list)) {
// redisCache.setCacheObject(redisKey, list, 5, TimeUnit.MINUTES);
// }
// }
return pileConnectorInfoMapper.getUniAppConnectorList(stationId);
// 加缓存
String redisKey = CacheConstants.GET_UNIAPP_CONNECTOR_LIST_BY_STATION_ID + stationId;
List<ConnectorInfoVO> list = redisCache.getCacheList(redisKey);
if (CollectionUtils.isEmpty(list)) {
// 查数据库
list = pileConnectorInfoMapper.getUniAppConnectorList(stationId);
if (CollectionUtils.isNotEmpty(list)) {
redisCache.setCacheList(redisKey, list);
redisCache.expire(redisKey, CacheConstants.cache_expire_time_1d);
}
}
return list;
}
public List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId) {