feat(payment): 初始化支付模块基础功能

- 添加订单号生成工具类 OrderIdGenerator
- 定义订单状态枚举 OrderStatus
- 实现OSS文件上传服务接口及阿里云OSS实现
- 添加支付常量类 PaymentConstants
- 创建支付控制器 PaymentController 支持下单、查单和收银台页面
- 新增支付记录实体类 PaymentRecord 用于存储回调和查询记录
This commit is contained in:
2025-12-19 18:13:20 +08:00
parent c338571dc1
commit a544eb6d0e
8 changed files with 597 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package com.mtkj.mtpay.util;
import com.mtkj.mtpay.common.constants.PaymentConstants;
import lombok.extern.slf4j.Slf4j;
import java.util.UUID;
/**
* 订单号生成器
*/
@Slf4j
public class OrderIdGenerator {
/**
* 生成商户订单号
* 格式MTN + 时间戳 + 随机数
*/
public static String generateMerchantTransactionId() {
long timestamp = System.currentTimeMillis();
int random = (int) (Math.random() * 10000);
String orderId = String.format("%s%d%04d", PaymentConstants.ORDER_ID_PREFIX, timestamp, random);
log.debug("生成商户订单号: {}", orderId);
return orderId;
}
/**
* 生成商户订单号带UUID后缀
*/
public static String generateMerchantTransactionIdWithUuid() {
long timestamp = System.currentTimeMillis();
String uuid = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
String orderId = String.format("%s%d%s", PaymentConstants.ORDER_ID_PREFIX, timestamp, uuid);
log.debug("生成商户订单号UUID: {}", orderId);
return orderId;
}
}