f
This commit is contained in:
@@ -552,6 +552,57 @@ func (c *Certification) ResetAfterSignTaskCreateFailed() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ResetForResignContract 管理员触发重新认证:回退到 pending,用户可重新填写企业信息并走完整入驻流程
|
||||
// 不改动用户域认证标记、钱包、API Key、历史合同记录
|
||||
func (c *Certification) ResetForResignContract(actorID, reason string) error {
|
||||
switch c.Status {
|
||||
case enums.StatusCompleted, enums.StatusContractSigned, enums.StatusContractApplied,
|
||||
enums.StatusContractRejected, enums.StatusContractExpired,
|
||||
enums.StatusEnterpriseVerified, enums.StatusInfoSubmitted, enums.StatusInfoPendingReview:
|
||||
// 允许从已进入流程的各状态重置,供用户重新填写企业信息
|
||||
default:
|
||||
if c.Status == enums.StatusPending {
|
||||
return fmt.Errorf("当前已是待提交企业信息状态,无需重置")
|
||||
}
|
||||
return fmt.Errorf("当前状态 %s 不允许重新认证", enums.GetStatusName(c.Status))
|
||||
}
|
||||
|
||||
oldStatus := c.Status
|
||||
now := time.Now()
|
||||
|
||||
c.Status = enums.StatusPending
|
||||
c.SignPlatform = ""
|
||||
c.AuthFlowID = ""
|
||||
c.AuthURL = ""
|
||||
c.ContractCode = ""
|
||||
c.ContractFileID = ""
|
||||
c.EsignFlowID = ""
|
||||
c.ContractURL = ""
|
||||
c.ContractSignURL = ""
|
||||
c.InfoSubmittedAt = nil
|
||||
c.EnterpriseVerifiedAt = nil
|
||||
c.ContractAppliedAt = nil
|
||||
c.ContractSignedAt = nil
|
||||
c.CompletedAt = nil
|
||||
c.ContractFileCreatedAt = nil
|
||||
c.RetryCount = 0
|
||||
c.clearFailureInfo()
|
||||
c.updateTransitionAudit(enums.ActorTypeAdmin, actorID)
|
||||
c.UpdatedAt = now
|
||||
|
||||
c.addDomainEvent(&CertificationStatusChangedEvent{
|
||||
CertificationID: c.ID,
|
||||
UserID: c.UserID,
|
||||
FromStatus: oldStatus,
|
||||
ToStatus: enums.StatusPending,
|
||||
Actor: enums.ActorTypeAdmin,
|
||||
ActorID: actorID,
|
||||
Reason: reason,
|
||||
TransitionedAt: now,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSignPlatform 设置签署平台(选定后锁定)
|
||||
func (c *Certification) SetSignPlatform(platform enums.SignPlatform) error {
|
||||
if !enums.IsValidSignPlatform(platform) {
|
||||
|
||||
Reference in New Issue
Block a user