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

View File

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

View File

@@ -306,7 +306,7 @@
and t.public_flag = '1' and t.public_flag = '1'
</select> </select>
<select id="queryStationBillingTemplateList" resultType="com.jsowell.pile.vo.web.BillingTemplateVO"> <select id="queryStationBillingTemplateListWithAuth" resultType="com.jsowell.pile.vo.web.BillingTemplateVO">
select select
t2.id as templateId, t2.id as templateId,
t2.template_code as templateCode, t2.template_code as templateCode,
@@ -488,7 +488,7 @@
limit 1 limit 1
</select> </select>
<select id="queryStationBillingTemplateListForUniApp" resultType="com.jsowell.pile.vo.web.BillingTemplateVO"> <select id="queryStationBillingTemplateList" resultType="com.jsowell.pile.vo.web.BillingTemplateVO">
select select
t2.id as templateId, t2.id as templateId,
t2.template_code as templateCode, t2.template_code as templateCode,