多笔立减金

This commit is contained in:
ziming 2025-12-15 15:03:31 +08:00
parent 408a929b33
commit 654540ba65
6 changed files with 56 additions and 18 deletions

View File

@ -210,6 +210,7 @@ message CmbNotifyRequest {
string ext = 13 [json_name = "ext"];
string attach = 14 [json_name = "attach"];
}
message CmbNotifyReply {
// 1000 1001
string respCode = 1 [json_name = "respCode"];
@ -217,6 +218,32 @@ message CmbNotifyReply {
string respMsg = 2 [json_name = "respMsg"];
}
message CmbMultiNotifyRequest {
// cmb业务号
string transactionId = 1 [json_name = "transactionId"];
//
string activityId = 2 [json_name = "activityId"];
// id
string couponId = 3 [json_name = "couponId"];
//
string acquiredDate = 4 [json_name = "acquiredDate"];
// 0使1使
string status = 5 [json_name = "status"];
// yyyy-MM-dd HH:mm:ss.sss
string transDate = 6 [json_name = "transDate"];
// -
string transAmount = 7 [json_name = "transAmount"];
// ,
string orderId = 8 [json_name = "orderId"];
// codeNo
string ticket = 9 [json_name = "ticket"];
//
string orgNo = 10 [json_name = "orgNo"];
// 500
string attach = 12 [json_name = "attach"];
//
string ext = 11 [json_name = "ext"];
}
message EncryptBodyRequest {
string encryptBody = 1 [json_name = "encryptBody"];

View File

@ -1,6 +1,9 @@
package bo
import "time"
import (
"time"
"voucher/internal/biz/vo"
)
// MultiNotifyLogBo 领域实体Bo结构字段和模型字段保持一致
type MultiNotifyLogBo struct {
@ -12,7 +15,7 @@ type MultiNotifyLogBo struct {
ActivityNo string
StockID string
EventType string
Status string
Status vo.WechatVoucherStatus
ConsumeAmount int32
ConsumeTime *time.Time
TransactionID string

View File

@ -184,7 +184,7 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
ActivityNo: order.ProductNo,
StockID: mnd.StockID,
EventType: mnd.EventType,
Status: req.PlainText.Status.GetValue(),
Status: req.PlainText.Status,
ConsumeAmount: mnd.ConsumeAmount,
ConsumeTime: mnd.ConsumeTime,
TransactionID: req.PlainText.ConsumeInformation.TransactionID,
@ -193,10 +193,12 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
OrderCreateTime: order.CreateTime,
CouponCreateTime: &req.PlainText.CreateTime,
}
request, err := biz.GetRequest(ctx, nl, order)
if err != nil {
return nil, err
}
b, _ := json.Marshal(request)
nl.Request = string(b)
@ -205,18 +207,23 @@ func (biz *MultiBiz) nlCreate(ctx context.Context, req *bo.WechatVoucherNotifyBo
func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (string, error) {
req := &v1.CmbNotifyRequest{ // 待确定
Ticket: nl.OrderNo, // 券订单号lsxd订单号
TransDate: "", // 核销时间验券时间格式yyyy-mm-dd hh:mm:ss.sss
Status: "1", // 状态1-核销成功
OrgNo: biz.bc.Cmb.OrgNo, // cmb固定值
Attach: order.Attach, // cmb拓展参数
Ext: "",
req := &v1.CmbMultiNotifyRequest{
TransactionId: nl.OutBizNo, // cmb业务号
ActivityId: nl.ActivityNo, // 批次活动号
CouponId: nl.CouponID, // 微信券券号
AcquiredDate: order.ReceiveSuccessTime.Format("2006-01-02 15:04:05.000"), // 券领取时间
Status: "0", // 券状态 0可使用1已使用
TransDate: nl.ConsumeTime.Format("2006-01-02 15:04:05.000"), // 核销时间验券时间格式yyyy-mm-dd hh:mm:ss.sss
TransAmount: fmt.Sprintf("%d", nl.ConsumeAmount),
OrderId: nl.TransactionID, // 券核销支付单号
Ticket: nl.OrderNo, // 券订单号lsxd订单号
OrgNo: biz.bc.Cmb.OrgNo, // cmb固定值
Attach: order.Attach, // cmb拓展参数
Ext: "",
}
if nl.ConsumeTime != nil {
req.TransDate = nl.ConsumeTime.Format("2006-01-02 15:04:05.000")
} else {
req.TransDate = nl.CreateTime.Format("2006-01-02 15:04:05.000")
if nl.Status.IsUsed() {
req.Status = "1"
}
bizJsonBytes, err := json.Marshal(req)
@ -235,7 +242,7 @@ func (biz *MultiBiz) GetRequest(ctx context.Context, nl *bo.MultiNotifyLogBo, or
}
request, err := biz.CmbMixRepo.GetRequest(ctx, &bo.CmbRequestBo{
FuncName: vo.CmbNotifyFuncName, // 待确定
FuncName: vo.CmbNotifyFuncNameUpdateCodeStatusForMulti,
BizContent: bizContent,
})
if err != nil {

View File

@ -5,7 +5,8 @@ type CmbFuncName string
const (
// CmbNotifyFuncName . 券状态回调通知方法
CmbNotifyFuncName CmbFuncName = "updateCodeStatus.json"
CmbNotifyFuncName CmbFuncName = "updateCodeStatus.json"
CmbNotifyFuncNameUpdateCodeStatusForMulti CmbFuncName = "updateCodeStatusForMulti.json"
)
func (s CmbFuncName) GetValue() string {

View File

@ -41,7 +41,7 @@ func (p *MultiNotifyLogRepoImpl) Create(ctx context.Context, req *bo.MultiNotify
ActivityNo: req.ActivityNo,
StockID: req.StockID,
EventType: req.EventType,
Status: req.Status,
Status: req.Status.GetValue(),
ConsumeAmount: req.ConsumeAmount,
ConsumeTime: req.ConsumeTime,
TransactionID: req.TransactionID,

View File

@ -186,7 +186,7 @@ func TestVerifyBody(t *testing.T) {
}
func TestDecryptBody(t *testing.T) {
//priKey := "f6a8d2f412e289686aba6a0f33cad1a64367d0ba012046ee0fbbefd3ffd675bd"
//priKey := "f6a8d2f412e289686aba6a0f33cad1a64367d0ba012046ee0fbbefd3ffd675bd" // 测试
priKey := "8d39ff3d2559258c163f4510f082727f51531e1953ab203d5ab1ea4a6d94fd73"
//content := "BAdcIauIjNx3LsrplpJiZoljE4hCiGHra6ulhgG1qL0tKcAeenX+Z9VaHfXLSdkji1fYBpdZiiI35R0vFtnXPXJCJdHsGbfbae+PzNznYQS3KM8/90Y/FIWzSoszfUiF6fAuv8I6v9kQuqHUTidHeHyICDoyvJ0nhbNyUyg85bAKd6TmkVX1MgXLQ81m|5KfR/5UkpVBEQv1dx+iJbojOykNRuDV8Gsy3QOIlRI+cZvafRRPUUG6eeixnPMumhOvyZwsSG/OBeg0U/lSlAepg12tXWcQ601wjgyLaKN1iMvb1DCtfnJFAm8EWAc2SLH3NQuyhxGe/jgCXvj0wGphh4vBUzm8la8i8Aij0BI5lfgU5OzglkKDln6zHN3vBHDqOurEh18eU6z1bfvNnDpzdwEcygcEIH/6lGiqVnGH+C2+QpcKeCnj5qKGFiuSC"