mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 00:15:06 +08:00
trade:完善退款详情
This commit is contained in:
@ -22,6 +22,6 @@ public interface RedisKeyConstants {
|
||||
* KEY 格式:pay_no:{prefix}
|
||||
* VALUE 数据格式:编号自增
|
||||
*/
|
||||
String PAY_NO = "pay_no";
|
||||
String PAY_NO = "pay_no:";
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package cn.iocoder.yudao.module.pay.dal.redis.no;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil;import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;import java.time.LocalDateTime;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付序号的 Redis DAO
|
||||
@ -23,8 +27,12 @@ public class PayNoRedisDAO {
|
||||
* @return 序号
|
||||
*/
|
||||
public String generate(String prefix) {
|
||||
// 递增序号
|
||||
String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
|
||||
Long no = stringRedisTemplate.opsForValue().increment(noPrefix);
|
||||
String key = RedisKeyConstants.PAY_NO + noPrefix;
|
||||
Long no = stringRedisTemplate.opsForValue().increment(key);
|
||||
// 设置过期时间
|
||||
stringRedisTemplate.expire(key, Duration.ofMinutes(1L));
|
||||
return noPrefix + no;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user