feat(员工代收款): 新增员工代收款账单闭环
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m20s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m20s
- 新增 6 张表与成对迁移 000212,扩展企业微信审批场景业务类型白名单 - 后台线下套餐订单与两条代理线下充值入账路径在来源成功事务内建账,来源唯一键幂等 - 核销申请、审批尝试记录、账单分摊预占与驳回重提,审批业务类型 employee_collection_approval - 企业微信终态消费幂等:通过转已核销、驳回释放预占、通过后撤销不回滚并转异常终态 - 退款成功事务内按 bill_id+refund_id 幂等冲销账单或仅写退款关联提示 - 线下收款方式字典、账单查询/统计/关闭、申请查询与代办权限,均写入事务内审计 OpenSpec Change: add-employee-collection-bills
This commit is contained in:
@@ -7,6 +7,9 @@ const (
|
||||
ApprovalBusinessTypeRefund = "refund_approval"
|
||||
// ApprovalBusinessTypeOfflineRecharge 表示员工线下代充值审批业务场景。
|
||||
ApprovalBusinessTypeOfflineRecharge = "offline_recharge_approval"
|
||||
// ApprovalBusinessTypeEmployeeCollection 表示员工代收款核销审批业务场景。
|
||||
// 该场景的业务ID取核销申请的审批尝试记录主键,使同一申请每次提交各自持有独立审批实例。
|
||||
ApprovalBusinessTypeEmployeeCollection = "employee_collection_approval"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -48,6 +51,24 @@ const (
|
||||
ApprovalFieldRefundReason = "refund_reason"
|
||||
// ApprovalFieldPackageUsageID 表示退款指定套餐使用记录 ID 业务字段。
|
||||
ApprovalFieldPackageUsageID = "package_usage_id"
|
||||
// ApprovalFieldCollectionApplicationID 表示员工代收款核销申请 ID 业务字段。
|
||||
ApprovalFieldCollectionApplicationID = "collection_application_id"
|
||||
// ApprovalFieldCollectionPaymentMethod 表示员工代收款线下收款方式名称业务字段。
|
||||
ApprovalFieldCollectionPaymentMethod = "collection_payment_method"
|
||||
// ApprovalFieldCollectionPaidAmount 表示员工代收款付款金额元展示业务字段。
|
||||
ApprovalFieldCollectionPaidAmount = "collection_paid_amount"
|
||||
// ApprovalFieldCollectionPaidAmountCent 表示员工代收款付款金额分业务字段。
|
||||
ApprovalFieldCollectionPaidAmountCent = "collection_paid_amount_cent"
|
||||
// ApprovalFieldCollectionPayerName 表示员工代收款付款方名称业务字段。
|
||||
ApprovalFieldCollectionPayerName = "collection_payer_name"
|
||||
// ApprovalFieldCollectionPaidAt 表示员工代收款付款时间业务字段。
|
||||
ApprovalFieldCollectionPaidAt = "collection_paid_at"
|
||||
// ApprovalFieldCollectionExternalTransactionNo 表示员工代收款外部交易流水号业务字段。
|
||||
ApprovalFieldCollectionExternalTransactionNo = "collection_external_transaction_no"
|
||||
// ApprovalFieldCollectionBillCount 表示员工代收款分摊账单数量业务字段。
|
||||
ApprovalFieldCollectionBillCount = "collection_bill_count"
|
||||
// ApprovalFieldCollectionBillSummary 表示员工代收款分摊账单摘要业务字段。
|
||||
ApprovalFieldCollectionBillSummary = "collection_bill_summary"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -409,6 +409,26 @@ const (
|
||||
AuditActionWeComMembersSynced = "wecom.application.sync_members"
|
||||
// AuditActionWeComApprovalSceneSaved 表示保存企业微信审批场景配置。
|
||||
AuditActionWeComApprovalSceneSaved = "wecom.approval_scene.save"
|
||||
// AuditActionEmployeeCollectionPaymentMethodCreated 表示创建线下收款方式。
|
||||
AuditActionEmployeeCollectionPaymentMethodCreated = "employee_collection.payment_method.create"
|
||||
// AuditActionEmployeeCollectionPaymentMethodUpdated 表示更新线下收款方式。
|
||||
AuditActionEmployeeCollectionPaymentMethodUpdated = "employee_collection.payment_method.update"
|
||||
// AuditActionEmployeeCollectionPaymentMethodDeleted 表示删除线下收款方式。
|
||||
AuditActionEmployeeCollectionPaymentMethodDeleted = "employee_collection.payment_method.delete"
|
||||
// AuditActionEmployeeCollectionBillCreated 表示创建员工代收款账单。
|
||||
AuditActionEmployeeCollectionBillCreated = "employee_collection.bill.create"
|
||||
// AuditActionEmployeeCollectionBillClosed 表示关闭员工代收款账单。
|
||||
AuditActionEmployeeCollectionBillClosed = "employee_collection.bill.close"
|
||||
// AuditActionEmployeeCollectionApplicationSubmitted 表示提交或重提核销申请。
|
||||
AuditActionEmployeeCollectionApplicationSubmitted = "employee_collection.application.submit"
|
||||
// AuditActionEmployeeCollectionApplicationApproved 表示核销申请企业微信最终通过。
|
||||
AuditActionEmployeeCollectionApplicationApproved = "employee_collection.application.approve"
|
||||
// AuditActionEmployeeCollectionApplicationRejected 表示核销申请企业微信最终驳回或撤销。
|
||||
AuditActionEmployeeCollectionApplicationRejected = "employee_collection.application.reject"
|
||||
// AuditActionEmployeeCollectionApplicationRevoked 表示已通过核销申请被企业微信撤销。
|
||||
AuditActionEmployeeCollectionApplicationRevoked = "employee_collection.application.revoke"
|
||||
// AuditActionEmployeeCollectionBillRefundOffseted 表示来源订单退款成功对账单的冲销或提示。
|
||||
AuditActionEmployeeCollectionBillRefundOffseted = "employee_collection.bill.refund_offset"
|
||||
// AuditActionOutboxReplayed 表示人工重放 Outbox 事件。
|
||||
AuditActionOutboxReplayed = "outbox.replayed"
|
||||
// AuditActionOutboxExpiredLeaseReleased 表示人工释放 Outbox 过期租约。
|
||||
@@ -533,6 +553,12 @@ const (
|
||||
AuditOperationOutboxReplay = "outbox_replay"
|
||||
// AuditOperationOutboxReleaseExpiredLease 表示 Outbox 人工释放过期租约接缝操作类型。
|
||||
AuditOperationOutboxReleaseExpiredLease = "outbox_release_expired_lease"
|
||||
// AuditOperationEmployeeCollectionPaymentMethodCreate 表示创建线下收款方式。
|
||||
AuditOperationEmployeeCollectionPaymentMethodCreate = "employee_collection_payment_method_create"
|
||||
// AuditOperationEmployeeCollectionPaymentMethodUpdate 表示更新线下收款方式。
|
||||
AuditOperationEmployeeCollectionPaymentMethodUpdate = "employee_collection_payment_method_update"
|
||||
// AuditOperationEmployeeCollectionPaymentMethodDelete 表示删除线下收款方式。
|
||||
AuditOperationEmployeeCollectionPaymentMethodDelete = "employee_collection_payment_method_delete"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -542,6 +568,14 @@ const (
|
||||
AuditResourcePaymentConfig = "payment_config"
|
||||
// AuditResourceCarrier 表示运营商配置资源。
|
||||
AuditResourceCarrier = "carrier"
|
||||
// AuditResourceEmployeeCollectionPaymentMethod 表示线下收款方式字典资源。
|
||||
AuditResourceEmployeeCollectionPaymentMethod = "employee_collection_payment_method"
|
||||
// AuditResourceEmployeeCollectionBill 表示员工代收款账单资源。
|
||||
AuditResourceEmployeeCollectionBill = "employee_collection_bill"
|
||||
// AuditResourceEmployeeCollectionApplication 表示员工代收款核销申请资源。
|
||||
AuditResourceEmployeeCollectionApplication = "employee_collection_application"
|
||||
// AuditResourceEmployeeCollectionAttempt 表示员工代收款核销审批尝试记录资源。
|
||||
AuditResourceEmployeeCollectionAttempt = "employee_collection_application_attempt"
|
||||
// AuditResourceWeComApprovalScene 表示企业微信审批场景配置资源。
|
||||
AuditResourceWeComApprovalScene = "wecom_approval_scene"
|
||||
// AuditResourceOutboxEvent 表示公共 Outbox 事件资源。
|
||||
@@ -692,6 +726,14 @@ const (
|
||||
AuditResourceRoleRetentionMonth = "retention_month"
|
||||
// AuditResourceRoleNotificationTarget 表示本次写操作的通知资源。
|
||||
AuditResourceRoleNotificationTarget = "notification_target"
|
||||
// AuditResourceRoleCollectionBill 表示员工代收款账单主资源。
|
||||
AuditResourceRoleCollectionBill = "collection_bill"
|
||||
// AuditResourceRoleCollectionApplication 表示员工代收款核销申请主资源。
|
||||
AuditResourceRoleCollectionApplication = "collection_application"
|
||||
// AuditResourceRoleCollectionAttempt 表示员工代收款核销审批尝试记录资源。
|
||||
AuditResourceRoleCollectionAttempt = "collection_attempt"
|
||||
// AuditResourceRoleCollectionBillAffected 表示核销申请影响的员工代收款账单资源。
|
||||
AuditResourceRoleCollectionBillAffected = "collection_bill_affected"
|
||||
// AuditResourceRoleSensitiveReadTarget 表示敏感读取目标资源。
|
||||
AuditResourceRoleSensitiveReadTarget = "sensitive_read_target"
|
||||
// AuditResourceRoleAccountTarget 表示账号生命周期的目标账号。
|
||||
|
||||
164
pkg/constants/employee_collection.go
Normal file
164
pkg/constants/employee_collection.go
Normal file
@@ -0,0 +1,164 @@
|
||||
package constants
|
||||
|
||||
// 员工代收款账单来源类型,取值与 tb_employee_collection_bill.source_type 检查约束一致。
|
||||
const (
|
||||
// EmployeeCollectionSourceTypeOrder 表示来源为后台线下套餐订单。
|
||||
EmployeeCollectionSourceTypeOrder = "order"
|
||||
// EmployeeCollectionSourceTypeRecharge 表示来源为代理线下充值入账。
|
||||
EmployeeCollectionSourceTypeRecharge = "recharge"
|
||||
)
|
||||
|
||||
// 员工代收款账单状态,取值与 tb_employee_collection_bill.status 检查约束一致。
|
||||
const (
|
||||
// EmployeeCollectionBillStatusPending 表示账单待核销。
|
||||
EmployeeCollectionBillStatusPending = 0
|
||||
// EmployeeCollectionBillStatusPartial 表示账单部分核销。
|
||||
EmployeeCollectionBillStatusPartial = 1
|
||||
// EmployeeCollectionBillStatusSettled 表示账单已核销。
|
||||
EmployeeCollectionBillStatusSettled = 2
|
||||
// EmployeeCollectionBillStatusClosed 表示账单已关闭,未核销余额作废。
|
||||
EmployeeCollectionBillStatusClosed = 3
|
||||
)
|
||||
|
||||
// 核销申请状态,取值与 tb_employee_collection_application.status 检查约束一致。
|
||||
// 申请状态不覆盖账单核销状态,两者独立保存。
|
||||
const (
|
||||
// EmployeeCollectionApplicationStatusPending 表示核销申请审批中。
|
||||
EmployeeCollectionApplicationStatusPending = 0
|
||||
// EmployeeCollectionApplicationStatusApproved 表示核销申请企业微信最终通过。
|
||||
EmployeeCollectionApplicationStatusApproved = 1
|
||||
// EmployeeCollectionApplicationStatusRejected 表示核销申请企业微信最终驳回。
|
||||
EmployeeCollectionApplicationStatusRejected = 2
|
||||
// EmployeeCollectionApplicationStatusRevoked 表示核销申请通过后撤销等异常终态或已关闭。
|
||||
EmployeeCollectionApplicationStatusRevoked = 3
|
||||
)
|
||||
|
||||
// 核销分摊状态,取值与 tb_employee_collection_application_allocation.status 检查约束一致。
|
||||
const (
|
||||
// EmployeeCollectionAllocationStatusPending 表示分摊审批中并预占账单余额。
|
||||
EmployeeCollectionAllocationStatusPending = 0
|
||||
// EmployeeCollectionAllocationStatusApproved 表示分摊已通过并转入账单已核销金额。
|
||||
EmployeeCollectionAllocationStatusApproved = 1
|
||||
// EmployeeCollectionAllocationStatusReleased 表示分摊已驳回或已释放预占。
|
||||
EmployeeCollectionAllocationStatusReleased = 2
|
||||
)
|
||||
|
||||
// 退款冲销处理结果,取值与 tb_employee_collection_bill_refund.outcome 检查约束一致。
|
||||
const (
|
||||
// EmployeeCollectionRefundOutcomeClosedFull 表示退款金额等于账单应收且无分摊,账单全额关闭。
|
||||
EmployeeCollectionRefundOutcomeClosedFull = "closed_full"
|
||||
// EmployeeCollectionRefundOutcomeReduced 表示退款金额小于账单应收且无分摊,按退款金额冲减应收。
|
||||
EmployeeCollectionRefundOutcomeReduced = "reduced"
|
||||
// EmployeeCollectionRefundOutcomeHintOnly 表示存在已通过或审批中分摊,仅写退款关联提示。
|
||||
EmployeeCollectionRefundOutcomeHintOnly = "hint_only"
|
||||
)
|
||||
|
||||
// 线下收款方式字典启停状态,取值与 tb_employee_collection_payment_method.status 检查约束一致。
|
||||
const (
|
||||
// EmployeeCollectionPaymentMethodStatusDisabled 表示收款方式已停用,新申请不可选择。
|
||||
EmployeeCollectionPaymentMethodStatusDisabled = 0
|
||||
// EmployeeCollectionPaymentMethodStatusEnabled 表示收款方式已启用。
|
||||
EmployeeCollectionPaymentMethodStatusEnabled = 1
|
||||
)
|
||||
|
||||
// 员工代收款账单与核销申请的输入边界。
|
||||
const (
|
||||
// EmployeeCollectionCodeMaxLength 表示收款方式稳定编码最大长度。
|
||||
EmployeeCollectionCodeMaxLength = 64
|
||||
// EmployeeCollectionNameMaxLength 表示收款方式名称最大长度。
|
||||
EmployeeCollectionNameMaxLength = 100
|
||||
// EmployeeCollectionRemarkMaxLength 表示备注最大长度。
|
||||
EmployeeCollectionRemarkMaxLength = 500
|
||||
// EmployeeCollectionPayerNameMaxLength 表示付款方名称最大长度。
|
||||
EmployeeCollectionPayerNameMaxLength = 100
|
||||
// EmployeeCollectionExternalTransactionNoMaxLength 表示外部交易流水号最大长度。
|
||||
EmployeeCollectionExternalTransactionNoMaxLength = 128
|
||||
// EmployeeCollectionVoucherMinCount 表示一次申请要求的最少支付凭证数量。
|
||||
EmployeeCollectionVoucherMinCount = 1
|
||||
// EmployeeCollectionVoucherMaxCount 表示一次申请允许的最多支付凭证数量。
|
||||
EmployeeCollectionVoucherMaxCount = 5
|
||||
// EmployeeCollectionVoucherKeyMaxLength 表示单个支付凭证对象键最大长度。
|
||||
EmployeeCollectionVoucherKeyMaxLength = 512
|
||||
// EmployeeCollectionAllocationMaxCount 表示一次申请允许的最多账单分摊数量。
|
||||
EmployeeCollectionAllocationMaxCount = 50
|
||||
)
|
||||
|
||||
// 员工代收款审计配置键前缀。
|
||||
const (
|
||||
// EmployeeCollectionAuditConfigKeyPrefix 表示线下收款方式字典审计配置键前缀。
|
||||
EmployeeCollectionAuditConfigKeyPrefix = "employee_collection.payment_method"
|
||||
// EmployeeCollectionAuditModule 表示员工代收款能力的审计模块标识。
|
||||
EmployeeCollectionAuditModule = "employee_collection"
|
||||
)
|
||||
|
||||
// GetEmployeeCollectionBillStatusName 返回员工代收款账单状态的中文名称。
|
||||
func GetEmployeeCollectionBillStatusName(status int) string {
|
||||
switch status {
|
||||
case EmployeeCollectionBillStatusPending:
|
||||
return "待核销"
|
||||
case EmployeeCollectionBillStatusPartial:
|
||||
return "部分核销"
|
||||
case EmployeeCollectionBillStatusSettled:
|
||||
return "已核销"
|
||||
case EmployeeCollectionBillStatusClosed:
|
||||
return "已关闭"
|
||||
default:
|
||||
return "未知状态"
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmployeeCollectionApplicationStatusName 返回核销申请状态的中文名称。
|
||||
func GetEmployeeCollectionApplicationStatusName(status int) string {
|
||||
switch status {
|
||||
case EmployeeCollectionApplicationStatusPending:
|
||||
return "审批中"
|
||||
case EmployeeCollectionApplicationStatusApproved:
|
||||
return "已通过"
|
||||
case EmployeeCollectionApplicationStatusRejected:
|
||||
return "已驳回"
|
||||
case EmployeeCollectionApplicationStatusRevoked:
|
||||
return "已撤销或已关闭"
|
||||
default:
|
||||
return "未知状态"
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmployeeCollectionAllocationStatusName 返回核销分摊状态的中文名称。
|
||||
func GetEmployeeCollectionAllocationStatusName(status int) string {
|
||||
switch status {
|
||||
case EmployeeCollectionAllocationStatusPending:
|
||||
return "审批中预占"
|
||||
case EmployeeCollectionAllocationStatusApproved:
|
||||
return "已通过"
|
||||
case EmployeeCollectionAllocationStatusReleased:
|
||||
return "已驳回或已释放"
|
||||
default:
|
||||
return "未知状态"
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmployeeCollectionSourceTypeName 返回员工代收款账单来源类型的中文名称。
|
||||
func GetEmployeeCollectionSourceTypeName(sourceType string) string {
|
||||
switch sourceType {
|
||||
case EmployeeCollectionSourceTypeOrder:
|
||||
return "后台线下套餐订单"
|
||||
case EmployeeCollectionSourceTypeRecharge:
|
||||
return "代理线下充值"
|
||||
default:
|
||||
return "未知来源"
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmployeeCollectionRefundOutcomeName 返回退款冲销处理结果的中文名称。
|
||||
func GetEmployeeCollectionRefundOutcomeName(outcome string) string {
|
||||
switch outcome {
|
||||
case EmployeeCollectionRefundOutcomeClosedFull:
|
||||
return "来源订单全额退款关闭"
|
||||
case EmployeeCollectionRefundOutcomeReduced:
|
||||
return "按退款金额冲减应收"
|
||||
case EmployeeCollectionRefundOutcomeHintOnly:
|
||||
return "仅记录退款关联提示"
|
||||
default:
|
||||
return "未知结果"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user