update 查询站点计费模板使用缓存

This commit is contained in:
2023-08-08 16:32:40 +08:00
parent 0ddf3eb46b
commit 7eaf4afd42
3 changed files with 9 additions and 8 deletions

View File

@@ -102,8 +102,8 @@ public interface PileBillingTemplateMapper {
* @param stationId 站点id
* @return
*/
List<BillingTemplateVO> queryStationBillingTemplateList(@Param("stationId") String stationId,
@Param("stationDeptIds") List<String> stationDeptIds);
List<BillingTemplateVO> queryStationBillingTemplateListWithAuth(@Param("stationId") String stationId,
@Param("stationDeptIds") List<String> stationDeptIds);
/**
* 根据站点id查询站点计费模板列表
@@ -111,7 +111,7 @@ public interface PileBillingTemplateMapper {
* @param stationId 站点id
* @return
*/
List<BillingTemplateVO> queryStationBillingTemplateListForUniApp(@Param("stationId") String stationId);
List<BillingTemplateVO> queryStationBillingTemplateList(@Param("stationId") String stationId);
/**
* 通过桩sn号查询计费模板

View File

@@ -332,7 +332,8 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
LocalTime localTime = LocalTime.now();
String now = LocalTime.of(localTime.getHour(), localTime.getMinute(), localTime.getSecond()).toString();
// 通过站点id查询计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateMapper.selectBillingTemplateByStationId(stationId);
// BillingTemplateVO billingTemplateVO = pileBillingTemplateMapper.selectBillingTemplateByStationId(stationId);
BillingTemplateVO billingTemplateVO = queryUsedBillingTemplate(stationId);
if (Objects.nonNull(billingTemplateVO)) {
result = new CurrentTimePriceDetails();
result.setTemplateCode(billingTemplateVO.getTemplateCode());
@@ -419,7 +420,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
// 为空表示没有权限,返回空数组
return Lists.newArrayList();
}
return pileBillingTemplateMapper.queryStationBillingTemplateList(stationId, authorizedMap.getStationDeptIds());
return pileBillingTemplateMapper.queryStationBillingTemplateListWithAuth(stationId, authorizedMap.getStationDeptIds());
}
/**
@@ -454,7 +455,7 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
String redisKey = CacheConstants.QUERY_STATION_BILLING_TEMPLATE_LIST + stationId;
List<BillingTemplateVO> voList = redisCache.getCacheList(redisKey);
if (CollectionUtils.isEmpty(voList)) {
voList = pileBillingTemplateMapper.queryStationBillingTemplateListForUniApp(stationId);
voList = pileBillingTemplateMapper.queryStationBillingTemplateList(stationId);
if (CollectionUtils.isNotEmpty(voList)) {
redisCache.setCacheList(redisKey, voList);
redisCache.expire(redisKey, 15, TimeUnit.MINUTES);