mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-29 07:25:05 +08:00
通过桩sn号查询计费模板 加缓存
This commit is contained in:
@@ -635,6 +635,14 @@ public class SpringBootTestController {
|
||||
// memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount("test01", payAmount, refundAmt);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectBillingTemplateDetailByPileSnTest() {
|
||||
String pileSn = "88000000000001";
|
||||
// 查询充电桩的计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
System.out.println(JSON.toJSONString(billingTemplateVO));
|
||||
}
|
||||
|
||||
// 生成订单
|
||||
private OrderBasicInfo generateAnOrder() throws ParseException {
|
||||
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||||
|
||||
@@ -344,4 +344,9 @@ public class CacheConstants {
|
||||
* 验证码有效期时长 redis key
|
||||
*/
|
||||
public static final String SMS_VERIFICATION_CODE_KEY = "sms_verification_code:";
|
||||
|
||||
/**
|
||||
* 根据桩号查询计费模板
|
||||
*/
|
||||
public static final String BILLING_TEMPLATE_BY_PILE_SN = "billing_template_by_pile_sn:";
|
||||
}
|
||||
|
||||
@@ -839,7 +839,16 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
|
||||
*/
|
||||
@Override
|
||||
public BillingTemplateVO selectBillingTemplateDetailByPileSn(String pileSn) {
|
||||
return pileBillingTemplateMapper.selectBillingTemplateByPileSn(pileSn);
|
||||
String redisKey = CacheConstants.BILLING_TEMPLATE_BY_PILE_SN + pileSn;
|
||||
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||
if (cacheObject != null) {
|
||||
return JSON.parseObject(cacheObject.toString(), BillingTemplateVO.class);
|
||||
}
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateMapper.selectBillingTemplateByPileSn(pileSn);
|
||||
if (billingTemplateVO != null) {
|
||||
redisCache.setCacheObject(redisKey, JSON.toJSONString(billingTemplateVO), CacheConstants.cache_expire_time_1d);
|
||||
}
|
||||
return billingTemplateVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user