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 "未知结果"
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,22 @@ const (
|
||||
// 审计留存相关错误 (1220-1229)
|
||||
CodeAuditDataArchived = 1220 // 查询范围已归档,当前不支持在线查询
|
||||
|
||||
// 员工代收款账单相关错误 (1230-1249)
|
||||
CodeEmployeeCollectionPaymentMethodNotFound = 1230 // 线下收款方式不存在
|
||||
CodeEmployeeCollectionPaymentMethodCodeExists = 1231 // 线下收款方式编码已存在
|
||||
CodeEmployeeCollectionPaymentMethodReferenced = 1232 // 线下收款方式已被引用,只能停用
|
||||
CodeEmployeeCollectionPaymentMethodDisabled = 1233 // 线下收款方式已停用
|
||||
CodeEmployeeCollectionBillNotFound = 1234 // 员工代收款账单不存在
|
||||
CodeEmployeeCollectionBillNotSettleable = 1235 // 账单状态不允许核销
|
||||
CodeEmployeeCollectionAllocationExceeded = 1236 // 分摊金额超过账单可核销余额
|
||||
CodeEmployeeCollectionAllocationAmountInvalid = 1237 // 分摊金额必须大于零
|
||||
CodeEmployeeCollectionPaidAmountExceeded = 1238 // 分摊总额超过本次付款金额
|
||||
CodeEmployeeCollectionApplicationNotFound = 1239 // 核销申请不存在
|
||||
CodeEmployeeCollectionApplicationStatusInvalid = 1240 // 核销申请状态不允许此操作
|
||||
CodeEmployeeCollectionApplicationPending = 1241 // 账单存在审批中核销申请,不能关闭
|
||||
CodeEmployeeCollectionBillClosed = 1242 // 账单已关闭
|
||||
CodeEmployeeCollectionVoucherInvalid = 1243 // 支付凭证数量或内容不符合要求
|
||||
|
||||
// 服务端错误 (2000-2999) -> 5xx HTTP 状态码
|
||||
CodeInternalError = 2001 // 内部服务器错误
|
||||
CodeDatabaseError = 2002 // 数据库错误
|
||||
@@ -320,6 +336,20 @@ var allErrorCodes = []int{
|
||||
CodeWeComApplicationNotFound,
|
||||
CodeWeComCredentialInvalid,
|
||||
CodeAuditDataArchived,
|
||||
CodeEmployeeCollectionPaymentMethodNotFound,
|
||||
CodeEmployeeCollectionPaymentMethodCodeExists,
|
||||
CodeEmployeeCollectionPaymentMethodReferenced,
|
||||
CodeEmployeeCollectionPaymentMethodDisabled,
|
||||
CodeEmployeeCollectionBillNotFound,
|
||||
CodeEmployeeCollectionBillNotSettleable,
|
||||
CodeEmployeeCollectionAllocationExceeded,
|
||||
CodeEmployeeCollectionAllocationAmountInvalid,
|
||||
CodeEmployeeCollectionPaidAmountExceeded,
|
||||
CodeEmployeeCollectionApplicationNotFound,
|
||||
CodeEmployeeCollectionApplicationStatusInvalid,
|
||||
CodeEmployeeCollectionApplicationPending,
|
||||
CodeEmployeeCollectionBillClosed,
|
||||
CodeEmployeeCollectionVoucherInvalid,
|
||||
CodeInternalError,
|
||||
CodeDatabaseError,
|
||||
CodeRedisError,
|
||||
@@ -338,144 +368,158 @@ func init() {
|
||||
|
||||
// errorMessages 错误消息映射表(中文)
|
||||
var errorMessages = map[int]string{
|
||||
CodeSuccess: "成功",
|
||||
CodeInvalidParam: "参数验证失败",
|
||||
CodeMissingToken: "缺失认证令牌",
|
||||
CodeInvalidToken: "无效或过期的令牌",
|
||||
CodeUnauthorized: "未授权访问",
|
||||
CodeForbidden: "禁止访问",
|
||||
CodeNotFound: "资源未找到",
|
||||
CodeConflict: "资源冲突",
|
||||
CodeTooManyRequests: "请求过多,请稍后重试",
|
||||
CodeRequestTooLarge: "请求体过大",
|
||||
CodeAccountNotFound: "账号不存在",
|
||||
CodeAccountDisabled: "账号已禁用",
|
||||
CodeAccountDeleted: "账号已删除",
|
||||
CodeUsernameExists: "用户名已存在",
|
||||
CodePhoneExists: "手机号已存在",
|
||||
CodeInvalidPassword: "密码格式不正确",
|
||||
CodePasswordTooWeak: "密码强度不足",
|
||||
CodeParentIDRequired: "非 root 用户必须提供上级账号",
|
||||
CodeInvalidParentID: "上级账号不存在或无效",
|
||||
CodeCannotModifyParent: "禁止修改上级账号",
|
||||
CodeCannotModifyUserType: "禁止修改用户类型",
|
||||
CodeRoleNotFound: "角色不存在",
|
||||
CodeRoleNameExists: "角色名称已存在",
|
||||
CodePermissionNotFound: "权限不存在",
|
||||
CodePermCodeExists: "权限编码已存在",
|
||||
CodeInvalidPermCode: "权限编码格式不正确(应为 module:action 格式)",
|
||||
CodeRoleAlreadyAssigned: "角色已分配",
|
||||
CodePermAlreadyAssigned: "权限已分配",
|
||||
CodeRoleInUse: "角色使用中,无法删除",
|
||||
CodeShopNotFound: "店铺不存在",
|
||||
CodeShopCodeExists: "店铺编号已存在",
|
||||
CodeShopLevelExceeded: "店铺层级不能超过 7 级",
|
||||
CodeEnterpriseNotFound: "企业不存在",
|
||||
CodeEnterpriseCodeExists: "企业编号已存在",
|
||||
CodeCustomerNotFound: "个人客户不存在",
|
||||
CodeCustomerPhoneExists: "个人客户手机号已存在",
|
||||
CodeShopDisabled: "店铺已禁用",
|
||||
CodeInvalidStatus: "状态不允许此操作",
|
||||
CodeInsufficientBalance: "余额不足",
|
||||
CodeWithdrawalNotFound: "提现申请不存在",
|
||||
CodeWalletNotFound: "钱包不存在",
|
||||
CodeInsufficientQuota: "额度不足",
|
||||
CodeIotCardNotFound: "IoT 卡不存在",
|
||||
CodeIotCardBoundToDevice: "IoT 卡已绑定设备,不能单独操作",
|
||||
CodeIotCardStatusNotAllowed: "卡状态不允许此操作",
|
||||
CodeAssetAllocationRecordNotFound: "分配记录不存在",
|
||||
CodeNotDirectSubordinate: "只能操作直属下级店铺",
|
||||
CodeCannotAllocateToSelf: "不能分配给自己",
|
||||
CodeCannotRecallFromSelf: "不能从自己回收",
|
||||
CodeCardAlreadyAuthorized: "卡已授权给该企业",
|
||||
CodeCardNotAuthorized: "卡未授权给该企业",
|
||||
CodeCannotAuthorizeOthersCard: "不能授权非自己的卡",
|
||||
CodeCannotRevokeOthersAuthorization: "不能回收非自己创建的授权",
|
||||
CodeCannotAuthorizeBoundCard: "不能授权已绑定设备的卡",
|
||||
CodeCannotAuthorizeToOthersEnterprise: "不能授权给非自己的企业",
|
||||
CodeDeviceAlreadyAuthorized: "设备已授权给该企业",
|
||||
CodeDeviceNotAuthorized: "设备未授权给该企业",
|
||||
CodeDeviceAuthorizedToOther: "设备已授权给其他企业",
|
||||
CodeCannotAuthorizeOthersDevice: "不能授权非自己的设备",
|
||||
CodeStorageNotConfigured: "对象存储服务未配置",
|
||||
CodeStorageUploadFailed: "文件上传失败",
|
||||
CodeStorageDownloadFailed: "文件下载失败",
|
||||
CodeStorageFileNotFound: "文件不存在",
|
||||
CodeStorageInvalidPurpose: "不支持的文件用途",
|
||||
CodeStorageInvalidFileType: "不支持的文件类型",
|
||||
CodeCarrierNotFound: "运营商不存在",
|
||||
CodeCarrierCodeExists: "运营商编码已存在",
|
||||
CodeGatewayError: "Gateway 请求失败",
|
||||
CodeGatewayEncryptError: "数据加密失败",
|
||||
CodeGatewaySignError: "签名生成失败",
|
||||
CodeGatewayTimeout: "Gateway 请求超时",
|
||||
CodeGatewayInvalidResp: "Gateway 响应格式错误",
|
||||
CodeRechargeAmountInvalid: "充值金额不符合要求",
|
||||
CodeRechargeNotFound: "充值订单不存在",
|
||||
CodeRechargeAlreadyPaid: "充值订单已支付",
|
||||
CodePurchaseOnBehalfForbidden: "无权使用线下支付",
|
||||
CodePurchaseOnBehalfInvalidTarget: "代购目标无效",
|
||||
CodeForceRechargeRequired: "必须充值指定金额",
|
||||
CodeForceRechargeAmountMismatch: "强充金额不匹配",
|
||||
CodePollingConfigNotFound: "轮询配置不存在",
|
||||
CodePollingConfigNameExists: "轮询配置名称已存在",
|
||||
CodePollingQueueFull: "轮询队列已满",
|
||||
CodePollingConcurrencyLimit: "并发数已达上限",
|
||||
CodePollingAlertRuleNotFound: "告警规则不存在",
|
||||
CodePollingCleanupConfigNotFound: "数据清理配置不存在",
|
||||
CodePollingManualTriggerLimit: "手动触发次数已达上限",
|
||||
CodeNoAvailablePackage: "没有可用套餐",
|
||||
CodePackageActivationConflict: "套餐正在激活中,请稍后重试",
|
||||
CodeNoMainPackage: "必须有主套餐才能购买加油包",
|
||||
CodeRealnameRequired: "设备/卡必须先完成实名认证才能购买套餐",
|
||||
CodeMixedOrderForbidden: "同订单不能同时购买正式套餐和加油包",
|
||||
CodeMainPackageExists: "已有主套餐,不能重复购买主套餐",
|
||||
CodeWechatConfigNotFound: "微信支付配置不存在",
|
||||
CodeWechatConfigActive: "不能删除当前生效的支付配置,请先停用",
|
||||
CodeWechatConfigHasPendingOrders: "该配置存在未完成的支付订单,暂时无法删除",
|
||||
CodeFuiouPayFailed: "支付发起失败,请重试",
|
||||
CodeFuiouCallbackInvalid: "支付回调签名验证失败",
|
||||
CodeNoPaymentConfig: "当前无可用的支付配置,请联系管理员",
|
||||
CodeAssetNotFound: "资产不存在",
|
||||
CodeWechatConfigUnavailable: "微信配置不可用",
|
||||
CodeSmsSendFailed: "短信发送失败",
|
||||
CodeVerificationCodeInvalid: "验证码错误或已过期",
|
||||
CodePhoneAlreadyBound: "手机号已被其他客户绑定",
|
||||
CodeAlreadyBoundPhone: "当前客户已绑定手机号,不可重复绑定",
|
||||
CodeOldPhoneMismatch: "旧手机号与当前绑定不匹配",
|
||||
CodeNeedRealname: "该套餐需实名认证后购买",
|
||||
CodeOpenIDNotFound: "未找到微信授权信息,请先完成授权",
|
||||
CodeRealnameNotAvailable: "请先完成充值或购买套餐后再进行实名认证",
|
||||
CodeExchangeOrderNotFound: "换货单不存在或无权限",
|
||||
CodeExchangeInProgress: "该资产存在进行中的换货单",
|
||||
CodeExchangeStatusInvalid: "换货单当前状态不允许此操作",
|
||||
CodeExchangeAssetTypeMismatch: "换货资产类型必须一致(卡换卡/设备换设备)",
|
||||
CodeExchangeNewAssetNotInStock: "新资产非在库状态,不可用于换货",
|
||||
CodeExchangeAssetNotExchanged: "资产当前状态不允许转新",
|
||||
CodeExchangeMigrationFailed: "换货数据迁移失败",
|
||||
CodeExchangeActiveRefund: "该资产存在退款申请",
|
||||
CodePaymentMethodUnavailable: "当前资产不支持所选支付方式",
|
||||
CodeWeComApplicationNotFound: "企业微信应用配置不存在或已禁用",
|
||||
CodeWeComCredentialInvalid: "企业微信凭据配置无效",
|
||||
CodeAuditDataArchived: "数据已归档,第一阶段不支持在线查询",
|
||||
CodeInvalidCredentials: "用户名或密码错误",
|
||||
CodeAccountLocked: "账号已锁定",
|
||||
CodePasswordExpired: "密码已过期",
|
||||
CodeInvalidOldPassword: "旧密码错误",
|
||||
CodeWechatOAuthFailed: "微信授权失败",
|
||||
CodeWechatUserInfoFailed: "获取微信用户信息失败",
|
||||
CodeWechatPayFailed: "微信支付发起失败",
|
||||
CodeWechatCallbackInvalid: "微信回调验证失败",
|
||||
CodeOpenAPIAuthFailed: "开放接口认证失败",
|
||||
CodeOpenAPISignInvalid: "开放接口签名无效",
|
||||
CodeOpenAPITimestampInvalid: "开放接口时间戳无效",
|
||||
CodeOpenAPINonceReplay: "重复请求,请勿重放",
|
||||
CodeInternalError: "内部服务器错误",
|
||||
CodeDatabaseError: "数据库错误",
|
||||
CodeRedisError: "缓存服务错误",
|
||||
CodeServiceUnavailable: "服务暂时不可用",
|
||||
CodeTimeout: "请求超时",
|
||||
CodeTaskQueueError: "任务队列错误",
|
||||
CodeSuccess: "成功",
|
||||
CodeInvalidParam: "参数验证失败",
|
||||
CodeMissingToken: "缺失认证令牌",
|
||||
CodeInvalidToken: "无效或过期的令牌",
|
||||
CodeUnauthorized: "未授权访问",
|
||||
CodeForbidden: "禁止访问",
|
||||
CodeNotFound: "资源未找到",
|
||||
CodeConflict: "资源冲突",
|
||||
CodeTooManyRequests: "请求过多,请稍后重试",
|
||||
CodeRequestTooLarge: "请求体过大",
|
||||
CodeAccountNotFound: "账号不存在",
|
||||
CodeAccountDisabled: "账号已禁用",
|
||||
CodeAccountDeleted: "账号已删除",
|
||||
CodeUsernameExists: "用户名已存在",
|
||||
CodePhoneExists: "手机号已存在",
|
||||
CodeInvalidPassword: "密码格式不正确",
|
||||
CodePasswordTooWeak: "密码强度不足",
|
||||
CodeParentIDRequired: "非 root 用户必须提供上级账号",
|
||||
CodeInvalidParentID: "上级账号不存在或无效",
|
||||
CodeCannotModifyParent: "禁止修改上级账号",
|
||||
CodeCannotModifyUserType: "禁止修改用户类型",
|
||||
CodeRoleNotFound: "角色不存在",
|
||||
CodeRoleNameExists: "角色名称已存在",
|
||||
CodePermissionNotFound: "权限不存在",
|
||||
CodePermCodeExists: "权限编码已存在",
|
||||
CodeInvalidPermCode: "权限编码格式不正确(应为 module:action 格式)",
|
||||
CodeRoleAlreadyAssigned: "角色已分配",
|
||||
CodePermAlreadyAssigned: "权限已分配",
|
||||
CodeRoleInUse: "角色使用中,无法删除",
|
||||
CodeShopNotFound: "店铺不存在",
|
||||
CodeShopCodeExists: "店铺编号已存在",
|
||||
CodeShopLevelExceeded: "店铺层级不能超过 7 级",
|
||||
CodeEnterpriseNotFound: "企业不存在",
|
||||
CodeEnterpriseCodeExists: "企业编号已存在",
|
||||
CodeCustomerNotFound: "个人客户不存在",
|
||||
CodeCustomerPhoneExists: "个人客户手机号已存在",
|
||||
CodeShopDisabled: "店铺已禁用",
|
||||
CodeInvalidStatus: "状态不允许此操作",
|
||||
CodeInsufficientBalance: "余额不足",
|
||||
CodeWithdrawalNotFound: "提现申请不存在",
|
||||
CodeWalletNotFound: "钱包不存在",
|
||||
CodeInsufficientQuota: "额度不足",
|
||||
CodeIotCardNotFound: "IoT 卡不存在",
|
||||
CodeIotCardBoundToDevice: "IoT 卡已绑定设备,不能单独操作",
|
||||
CodeIotCardStatusNotAllowed: "卡状态不允许此操作",
|
||||
CodeAssetAllocationRecordNotFound: "分配记录不存在",
|
||||
CodeNotDirectSubordinate: "只能操作直属下级店铺",
|
||||
CodeCannotAllocateToSelf: "不能分配给自己",
|
||||
CodeCannotRecallFromSelf: "不能从自己回收",
|
||||
CodeCardAlreadyAuthorized: "卡已授权给该企业",
|
||||
CodeCardNotAuthorized: "卡未授权给该企业",
|
||||
CodeCannotAuthorizeOthersCard: "不能授权非自己的卡",
|
||||
CodeCannotRevokeOthersAuthorization: "不能回收非自己创建的授权",
|
||||
CodeCannotAuthorizeBoundCard: "不能授权已绑定设备的卡",
|
||||
CodeCannotAuthorizeToOthersEnterprise: "不能授权给非自己的企业",
|
||||
CodeDeviceAlreadyAuthorized: "设备已授权给该企业",
|
||||
CodeDeviceNotAuthorized: "设备未授权给该企业",
|
||||
CodeDeviceAuthorizedToOther: "设备已授权给其他企业",
|
||||
CodeCannotAuthorizeOthersDevice: "不能授权非自己的设备",
|
||||
CodeStorageNotConfigured: "对象存储服务未配置",
|
||||
CodeStorageUploadFailed: "文件上传失败",
|
||||
CodeStorageDownloadFailed: "文件下载失败",
|
||||
CodeStorageFileNotFound: "文件不存在",
|
||||
CodeStorageInvalidPurpose: "不支持的文件用途",
|
||||
CodeStorageInvalidFileType: "不支持的文件类型",
|
||||
CodeCarrierNotFound: "运营商不存在",
|
||||
CodeCarrierCodeExists: "运营商编码已存在",
|
||||
CodeGatewayError: "Gateway 请求失败",
|
||||
CodeGatewayEncryptError: "数据加密失败",
|
||||
CodeGatewaySignError: "签名生成失败",
|
||||
CodeGatewayTimeout: "Gateway 请求超时",
|
||||
CodeGatewayInvalidResp: "Gateway 响应格式错误",
|
||||
CodeRechargeAmountInvalid: "充值金额不符合要求",
|
||||
CodeRechargeNotFound: "充值订单不存在",
|
||||
CodeRechargeAlreadyPaid: "充值订单已支付",
|
||||
CodePurchaseOnBehalfForbidden: "无权使用线下支付",
|
||||
CodePurchaseOnBehalfInvalidTarget: "代购目标无效",
|
||||
CodeForceRechargeRequired: "必须充值指定金额",
|
||||
CodeForceRechargeAmountMismatch: "强充金额不匹配",
|
||||
CodePollingConfigNotFound: "轮询配置不存在",
|
||||
CodePollingConfigNameExists: "轮询配置名称已存在",
|
||||
CodePollingQueueFull: "轮询队列已满",
|
||||
CodePollingConcurrencyLimit: "并发数已达上限",
|
||||
CodePollingAlertRuleNotFound: "告警规则不存在",
|
||||
CodePollingCleanupConfigNotFound: "数据清理配置不存在",
|
||||
CodePollingManualTriggerLimit: "手动触发次数已达上限",
|
||||
CodeNoAvailablePackage: "没有可用套餐",
|
||||
CodePackageActivationConflict: "套餐正在激活中,请稍后重试",
|
||||
CodeNoMainPackage: "必须有主套餐才能购买加油包",
|
||||
CodeRealnameRequired: "设备/卡必须先完成实名认证才能购买套餐",
|
||||
CodeMixedOrderForbidden: "同订单不能同时购买正式套餐和加油包",
|
||||
CodeMainPackageExists: "已有主套餐,不能重复购买主套餐",
|
||||
CodeWechatConfigNotFound: "微信支付配置不存在",
|
||||
CodeWechatConfigActive: "不能删除当前生效的支付配置,请先停用",
|
||||
CodeWechatConfigHasPendingOrders: "该配置存在未完成的支付订单,暂时无法删除",
|
||||
CodeFuiouPayFailed: "支付发起失败,请重试",
|
||||
CodeFuiouCallbackInvalid: "支付回调签名验证失败",
|
||||
CodeNoPaymentConfig: "当前无可用的支付配置,请联系管理员",
|
||||
CodeAssetNotFound: "资产不存在",
|
||||
CodeWechatConfigUnavailable: "微信配置不可用",
|
||||
CodeSmsSendFailed: "短信发送失败",
|
||||
CodeVerificationCodeInvalid: "验证码错误或已过期",
|
||||
CodePhoneAlreadyBound: "手机号已被其他客户绑定",
|
||||
CodeAlreadyBoundPhone: "当前客户已绑定手机号,不可重复绑定",
|
||||
CodeOldPhoneMismatch: "旧手机号与当前绑定不匹配",
|
||||
CodeNeedRealname: "该套餐需实名认证后购买",
|
||||
CodeOpenIDNotFound: "未找到微信授权信息,请先完成授权",
|
||||
CodeRealnameNotAvailable: "请先完成充值或购买套餐后再进行实名认证",
|
||||
CodeExchangeOrderNotFound: "换货单不存在或无权限",
|
||||
CodeExchangeInProgress: "该资产存在进行中的换货单",
|
||||
CodeExchangeStatusInvalid: "换货单当前状态不允许此操作",
|
||||
CodeExchangeAssetTypeMismatch: "换货资产类型必须一致(卡换卡/设备换设备)",
|
||||
CodeExchangeNewAssetNotInStock: "新资产非在库状态,不可用于换货",
|
||||
CodeExchangeAssetNotExchanged: "资产当前状态不允许转新",
|
||||
CodeExchangeMigrationFailed: "换货数据迁移失败",
|
||||
CodeExchangeActiveRefund: "该资产存在退款申请",
|
||||
CodePaymentMethodUnavailable: "当前资产不支持所选支付方式",
|
||||
CodeWeComApplicationNotFound: "企业微信应用配置不存在或已禁用",
|
||||
CodeWeComCredentialInvalid: "企业微信凭据配置无效",
|
||||
CodeAuditDataArchived: "数据已归档,第一阶段不支持在线查询",
|
||||
CodeEmployeeCollectionPaymentMethodNotFound: "线下收款方式不存在",
|
||||
CodeEmployeeCollectionPaymentMethodCodeExists: "线下收款方式编码已存在",
|
||||
CodeEmployeeCollectionPaymentMethodReferenced: "线下收款方式已被核销申请引用,只能停用",
|
||||
CodeEmployeeCollectionPaymentMethodDisabled: "线下收款方式已停用,不能用于新的核销申请",
|
||||
CodeEmployeeCollectionBillNotFound: "员工代收款账单不存在",
|
||||
CodeEmployeeCollectionBillNotSettleable: "账单当前状态不允许核销",
|
||||
CodeEmployeeCollectionAllocationExceeded: "分摊金额超过账单可核销余额",
|
||||
CodeEmployeeCollectionAllocationAmountInvalid: "分摊金额必须大于零",
|
||||
CodeEmployeeCollectionPaidAmountExceeded: "分摊总额不能超过本次付款金额",
|
||||
CodeEmployeeCollectionApplicationNotFound: "核销申请不存在",
|
||||
CodeEmployeeCollectionApplicationStatusInvalid: "核销申请当前状态不允许此操作",
|
||||
CodeEmployeeCollectionApplicationPending: "账单存在审批中核销申请,不能关闭",
|
||||
CodeEmployeeCollectionBillClosed: "账单已关闭",
|
||||
CodeEmployeeCollectionVoucherInvalid: "支付凭证数量或内容不符合要求",
|
||||
CodeInvalidCredentials: "用户名或密码错误",
|
||||
CodeAccountLocked: "账号已锁定",
|
||||
CodePasswordExpired: "密码已过期",
|
||||
CodeInvalidOldPassword: "旧密码错误",
|
||||
CodeWechatOAuthFailed: "微信授权失败",
|
||||
CodeWechatUserInfoFailed: "获取微信用户信息失败",
|
||||
CodeWechatPayFailed: "微信支付发起失败",
|
||||
CodeWechatCallbackInvalid: "微信回调验证失败",
|
||||
CodeOpenAPIAuthFailed: "开放接口认证失败",
|
||||
CodeOpenAPISignInvalid: "开放接口签名无效",
|
||||
CodeOpenAPITimestampInvalid: "开放接口时间戳无效",
|
||||
CodeOpenAPINonceReplay: "重复请求,请勿重放",
|
||||
CodeInternalError: "内部服务器错误",
|
||||
CodeDatabaseError: "数据库错误",
|
||||
CodeRedisError: "缓存服务错误",
|
||||
CodeServiceUnavailable: "服务暂时不可用",
|
||||
CodeTimeout: "请求超时",
|
||||
CodeTaskQueueError: "任务队列错误",
|
||||
}
|
||||
|
||||
// GetMessage 获取错误码对应的消息
|
||||
@@ -502,7 +546,10 @@ func GetHTTPStatus(code int) int {
|
||||
return 401 // Unauthorized
|
||||
case CodeForbidden:
|
||||
return 403 // Forbidden
|
||||
case CodeNotFound:
|
||||
case CodeNotFound,
|
||||
CodeEmployeeCollectionPaymentMethodNotFound,
|
||||
CodeEmployeeCollectionBillNotFound,
|
||||
CodeEmployeeCollectionApplicationNotFound:
|
||||
return 404 // Not Found
|
||||
case CodeAuditDataArchived:
|
||||
return 410 // Gone
|
||||
@@ -515,6 +562,13 @@ func GetHTTPStatus(code int) int {
|
||||
CodeEnterpriseCodeExists,
|
||||
CodeCustomerPhoneExists,
|
||||
CodeCarrierCodeExists,
|
||||
CodeEmployeeCollectionPaymentMethodCodeExists,
|
||||
CodeEmployeeCollectionPaymentMethodReferenced,
|
||||
CodeEmployeeCollectionPaymentMethodDisabled,
|
||||
CodeEmployeeCollectionBillNotSettleable,
|
||||
CodeEmployeeCollectionApplicationStatusInvalid,
|
||||
CodeEmployeeCollectionApplicationPending,
|
||||
CodeEmployeeCollectionBillClosed,
|
||||
CodeOpenAPINonceReplay:
|
||||
return 409 // Conflict
|
||||
case CodeTooManyRequests:
|
||||
|
||||
@@ -69,6 +69,7 @@ func BuildDocHandlers() *bootstrap.Handlers {
|
||||
AssetWallet: admin.NewAssetWalletHandler(nil),
|
||||
WechatConfig: admin.NewWechatConfigHandler(nil),
|
||||
PaymentMerchant: admin.NewPaymentMerchantHandler(nil),
|
||||
EmployeeCollection: admin.NewEmployeeCollectionHandler(nil, nil, nil),
|
||||
AgentRecharge: admin.NewAgentRechargeHandler(nil, nil),
|
||||
Refund: admin.NewRefundHandler(nil),
|
||||
OrderPackageInvalidate: admin.NewOrderPackageInvalidateHandler(nil),
|
||||
|
||||
Reference in New Issue
Block a user