feat(finance): 增加线下结算实际操作人
This commit is contained in:
@@ -78,6 +78,7 @@ func (r *Repository) disbursementListBaseQuery(ctx context.Context, phoneKeyword
|
||||
ro.offline_settled_at AS paid_at,
|
||||
ro.offline_settled_by AS operator_id,
|
||||
COALESCE(NULLIF(operator.nickname, ''), operator.username, '') AS operator_name,
|
||||
ro.offline_settlement_actual_operator AS actual_operator_name,
|
||||
ro.offline_settlement_remark AS remark,
|
||||
'' AS category,
|
||||
'' AS custom_category_name,
|
||||
@@ -119,6 +120,7 @@ func (r *Repository) disbursementListBaseQuery(ctx context.Context, phoneKeyword
|
||||
ap.offline_settled_at AS paid_at,
|
||||
ap.offline_settled_by AS operator_id,
|
||||
COALESCE(NULLIF(operator.nickname, ''), operator.username, '') AS operator_name,
|
||||
ap.offline_settlement_actual_operator AS actual_operator_name,
|
||||
ap.offline_settlement_remark AS remark,
|
||||
'' AS category,
|
||||
'' AS custom_category_name,
|
||||
@@ -157,6 +159,7 @@ func (r *Repository) disbursementListBaseQuery(ctx context.Context, phoneKeyword
|
||||
fa.settled_at AS paid_at,
|
||||
fa.settled_by AS operator_id,
|
||||
COALESCE(NULLIF(operator.nickname, ''), operator.username, '') AS operator_name,
|
||||
ap.offline_settlement_actual_operator AS actual_operator_name,
|
||||
fa.reason AS remark,
|
||||
'' AS category,
|
||||
'' AS custom_category_name,
|
||||
@@ -201,6 +204,7 @@ func (r *Repository) disbursementListBaseQuery(ctx context.Context, phoneKeyword
|
||||
wr.paid_at,
|
||||
COALESCE(wr.paid_by, wr.reviewed_by) AS operator_id,
|
||||
COALESCE(NULLIF(operator.nickname, ''), operator.username, '') AS operator_name,
|
||||
'' AS actual_operator_name,
|
||||
CASE WHEN wr.payment_remark <> '' THEN wr.payment_remark ELSE wr.review_remark END AS remark,
|
||||
'' AS category,
|
||||
'' AS custom_category_name,
|
||||
@@ -242,6 +246,7 @@ func (r *Repository) disbursementListBaseQuery(ctx context.Context, phoneKeyword
|
||||
md.paid_at,
|
||||
md.created_by AS operator_id,
|
||||
COALESCE(NULLIF(creator.nickname, ''), creator.username, '') AS operator_name,
|
||||
'' AS actual_operator_name,
|
||||
md.remark,
|
||||
md.category,
|
||||
md.custom_category_name,
|
||||
@@ -289,6 +294,9 @@ func (r *Repository) applyDisbursementFilters(db *gorm.DB, query DisbursementQue
|
||||
if query.OperatorID > 0 {
|
||||
db = db.Where("d.operator_id = ?", query.OperatorID)
|
||||
}
|
||||
if query.ActualOperator != "" {
|
||||
db = db.Where("d.actual_operator_name LIKE ?", "%"+query.ActualOperator+"%")
|
||||
}
|
||||
if !query.StartDate.IsZero() && !query.EndDate.IsZero() {
|
||||
if query.DateType == "paid" {
|
||||
db = db.Where("d.paid_at >= ? AND d.paid_at <= ?", query.StartDate, query.EndDate)
|
||||
@@ -335,6 +343,7 @@ type disbursementItemRow struct {
|
||||
PaidAt *time.Time
|
||||
OperatorID *uint64
|
||||
OperatorName string
|
||||
ActualOperatorName string
|
||||
Remark string
|
||||
Category string
|
||||
CustomCategoryName string
|
||||
@@ -380,6 +389,7 @@ func (r disbursementItemRow) toDTO() DisbursementItemDTO {
|
||||
PaidAt: r.PaidAt,
|
||||
OperatorID: r.OperatorID,
|
||||
OperatorName: r.OperatorName,
|
||||
ActualOperatorName: r.ActualOperatorName,
|
||||
Remark: r.Remark,
|
||||
Category: r.Category,
|
||||
CustomCategoryName: r.CustomCategoryName,
|
||||
|
||||
Reference in New Issue
Block a user