temp
This commit is contained in:
88
internal/domains/certification/enums/certification_status.go
Normal file
88
internal/domains/certification/enums/certification_status.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package enums
|
||||
|
||||
// CertificationStatus 认证状态枚举
|
||||
type CertificationStatus string
|
||||
|
||||
const (
|
||||
// 主流程状态
|
||||
StatusPending CertificationStatus = "pending" // 待开始
|
||||
StatusInfoSubmitted CertificationStatus = "info_submitted" // 企业信息已提交
|
||||
StatusFaceVerified CertificationStatus = "face_verified" // 人脸识别完成
|
||||
StatusContractApplied CertificationStatus = "contract_applied" // 已申请合同
|
||||
StatusContractPending CertificationStatus = "contract_pending" // 合同待审核
|
||||
StatusContractApproved CertificationStatus = "contract_approved" // 合同已审核(有链接)
|
||||
StatusContractSigned CertificationStatus = "contract_signed" // 合同已签署
|
||||
StatusCompleted CertificationStatus = "completed" // 认证完成
|
||||
|
||||
// 失败和重试状态
|
||||
StatusFaceFailed CertificationStatus = "face_failed" // 人脸识别失败
|
||||
StatusSignFailed CertificationStatus = "sign_failed" // 签署失败
|
||||
StatusRejected CertificationStatus = "rejected" // 已拒绝
|
||||
)
|
||||
|
||||
// IsValidStatus 检查状态是否有效
|
||||
func IsValidStatus(status CertificationStatus) bool {
|
||||
validStatuses := []CertificationStatus{
|
||||
StatusPending, StatusInfoSubmitted, StatusFaceVerified,
|
||||
StatusContractApplied, StatusContractPending, StatusContractApproved,
|
||||
StatusContractSigned, StatusCompleted, StatusFaceFailed,
|
||||
StatusSignFailed, StatusRejected,
|
||||
}
|
||||
|
||||
for _, validStatus := range validStatuses {
|
||||
if status == validStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetStatusName 获取状态的中文名称
|
||||
func GetStatusName(status CertificationStatus) string {
|
||||
statusNames := map[CertificationStatus]string{
|
||||
StatusPending: "待开始",
|
||||
StatusInfoSubmitted: "企业信息已提交",
|
||||
StatusFaceVerified: "人脸识别完成",
|
||||
StatusContractApplied: "已申请合同",
|
||||
StatusContractPending: "合同待审核",
|
||||
StatusContractApproved: "合同已审核",
|
||||
StatusContractSigned: "合同已签署",
|
||||
StatusCompleted: "认证完成",
|
||||
StatusFaceFailed: "人脸识别失败",
|
||||
StatusSignFailed: "签署失败",
|
||||
StatusRejected: "已拒绝",
|
||||
}
|
||||
|
||||
if name, exists := statusNames[status]; exists {
|
||||
return name
|
||||
}
|
||||
return string(status)
|
||||
}
|
||||
|
||||
// IsFinalStatus 判断是否为最终状态
|
||||
func IsFinalStatus(status CertificationStatus) bool {
|
||||
finalStatuses := []CertificationStatus{
|
||||
StatusCompleted, StatusRejected,
|
||||
}
|
||||
|
||||
for _, finalStatus := range finalStatuses {
|
||||
if status == finalStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsFailedStatus 判断是否为失败状态
|
||||
func IsFailedStatus(status CertificationStatus) bool {
|
||||
failedStatuses := []CertificationStatus{
|
||||
StatusFaceFailed, StatusSignFailed, StatusRejected,
|
||||
}
|
||||
|
||||
for _, failedStatus := range failedStatuses {
|
||||
if status == failedStatus {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user