支持自定义线下出款分类
This commit is contained in:
@@ -16,21 +16,22 @@ import (
|
||||
)
|
||||
|
||||
type manualDisbursementRecord struct {
|
||||
ID uint64
|
||||
DisbursementNo string
|
||||
Category string
|
||||
PayeeName string
|
||||
AmountCent int64
|
||||
PaidAt time.Time
|
||||
Remark string
|
||||
VoucherURL string
|
||||
Status string
|
||||
CreatedBy uint64
|
||||
VoidedBy *uint64
|
||||
VoidedAt *time.Time
|
||||
VoidReason string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
ID uint64
|
||||
DisbursementNo string
|
||||
Category string
|
||||
CustomCategoryName string
|
||||
PayeeName string
|
||||
AmountCent int64
|
||||
PaidAt time.Time
|
||||
Remark string
|
||||
VoucherURL string
|
||||
Status string
|
||||
CreatedBy uint64
|
||||
VoidedBy *uint64
|
||||
VoidedAt *time.Time
|
||||
VoidReason string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (manualDisbursementRecord) TableName() string {
|
||||
@@ -48,15 +49,16 @@ func (r *Repository) CreateManualDisbursement(
|
||||
return nil, err
|
||||
}
|
||||
record := manualDisbursementRecord{
|
||||
DisbursementNo: disbursementNo,
|
||||
Category: req.Category,
|
||||
PayeeName: req.PayeeName,
|
||||
AmountCent: req.AmountCent,
|
||||
PaidAt: req.PaidAt,
|
||||
Remark: req.Remark,
|
||||
VoucherURL: req.VoucherURL,
|
||||
Status: "paid",
|
||||
CreatedBy: adminID,
|
||||
DisbursementNo: disbursementNo,
|
||||
Category: req.Category,
|
||||
CustomCategoryName: req.CustomCategoryName,
|
||||
PayeeName: req.PayeeName,
|
||||
AmountCent: req.AmountCent,
|
||||
PaidAt: req.PaidAt,
|
||||
Remark: req.Remark,
|
||||
VoucherURL: req.VoucherURL,
|
||||
Status: "paid",
|
||||
CreatedBy: adminID,
|
||||
}
|
||||
err = r.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
if err := tx.Create(&record).Error; err != nil {
|
||||
@@ -71,12 +73,13 @@ func (r *Repository) CreateManualDisbursement(
|
||||
BizID: &id,
|
||||
Meta: meta,
|
||||
Detail: map[string]any{
|
||||
"disbursement_no": disbursementNo,
|
||||
"category": req.Category,
|
||||
"payee_name": req.PayeeName,
|
||||
"amount_cent": req.AmountCent,
|
||||
"paid_at": req.PaidAt,
|
||||
"has_voucher": req.VoucherURL != "",
|
||||
"disbursement_no": disbursementNo,
|
||||
"category": req.Category,
|
||||
"custom_category_name": req.CustomCategoryName,
|
||||
"payee_name": req.PayeeName,
|
||||
"amount_cent": req.AmountCent,
|
||||
"paid_at": req.PaidAt,
|
||||
"has_voucher": req.VoucherURL != "",
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -153,42 +156,44 @@ func (r *Repository) findManualDisbursement(ctx context.Context, id uint64) (*Ma
|
||||
return nil, err
|
||||
}
|
||||
return &ManualDisbursementDTO{
|
||||
ID: row.ID,
|
||||
DisbursementNo: row.DisbursementNo,
|
||||
Category: row.Category,
|
||||
PayeeName: row.PayeeName,
|
||||
AmountCent: row.AmountCent,
|
||||
PaidAt: row.PaidAt,
|
||||
Remark: row.Remark,
|
||||
VoucherURL: row.VoucherURL,
|
||||
Status: row.Status,
|
||||
CreatedBy: row.CreatedBy,
|
||||
CreatedByName: row.CreatedByName,
|
||||
VoidedBy: row.VoidedBy,
|
||||
VoidedByName: row.VoidedByName,
|
||||
VoidedAt: row.VoidedAt,
|
||||
VoidReason: row.VoidReason,
|
||||
CreatedAt: row.CreatedAt,
|
||||
ID: row.ID,
|
||||
DisbursementNo: row.DisbursementNo,
|
||||
Category: row.Category,
|
||||
CustomCategoryName: row.CustomCategoryName,
|
||||
PayeeName: row.PayeeName,
|
||||
AmountCent: row.AmountCent,
|
||||
PaidAt: row.PaidAt,
|
||||
Remark: row.Remark,
|
||||
VoucherURL: row.VoucherURL,
|
||||
Status: row.Status,
|
||||
CreatedBy: row.CreatedBy,
|
||||
CreatedByName: row.CreatedByName,
|
||||
VoidedBy: row.VoidedBy,
|
||||
VoidedByName: row.VoidedByName,
|
||||
VoidedAt: row.VoidedAt,
|
||||
VoidReason: row.VoidReason,
|
||||
CreatedAt: row.CreatedAt,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type manualDisbursementDetailRow struct {
|
||||
ID uint64
|
||||
DisbursementNo string
|
||||
Category string
|
||||
PayeeName string
|
||||
AmountCent int64
|
||||
PaidAt time.Time
|
||||
Remark string
|
||||
VoucherURL string
|
||||
Status string
|
||||
CreatedBy uint64
|
||||
CreatedByName string
|
||||
VoidedBy *uint64
|
||||
VoidedByName string
|
||||
VoidedAt *time.Time
|
||||
VoidReason string
|
||||
CreatedAt time.Time
|
||||
ID uint64
|
||||
DisbursementNo string
|
||||
Category string
|
||||
CustomCategoryName string
|
||||
PayeeName string
|
||||
AmountCent int64
|
||||
PaidAt time.Time
|
||||
Remark string
|
||||
VoucherURL string
|
||||
Status string
|
||||
CreatedBy uint64
|
||||
CreatedByName string
|
||||
VoidedBy *uint64
|
||||
VoidedByName string
|
||||
VoidedAt *time.Time
|
||||
VoidReason string
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
func newManualDisbursementNo() (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user