作者 yangfu

审核修改

... ... @@ -781,6 +781,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
approver *models.User
roleIds []int
roleId int
admin *models.UserCompany
)
if configs, err = models.GetAuditFlowConfigsLevel(templateId, 1); err != nil {
if err == orm.ErrNoRows {
... ... @@ -844,6 +845,12 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
err = fmt.Errorf("GenAuditFlowProcess:company.admin is not set")
return
}
if admin, err = models.GetUserCompanyByUserId(company.AdminId, header.CompanyId); err != nil {
err = fmt.Errorf("GenAuditFlowProcess:company.admin is not set")
return
}
//3.生成审核列表
for i := range configs {
config := configs[i]
... ... @@ -882,14 +889,14 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
for j := 0; j < len(userIds); j++ {
uid := userIds[j]
if uid == 0 && auditConfig.NoApprover == protocol.NoApproverToAdmin { //审批人为空 转交给管理员
uid = company.AdminId
uid = admin.Id
}
if uid == 0 {
uid = company.AdminId
uid = admin.Id
}
if uid == header.UserId { //审核人自己 转交给管理员
log.Info(fmt.Sprintf("生成机会审批流-转给管理员:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId))
uid = company.AdminId
uid = admin.Id
}
if approver, err = models.GetUserByUcid(uid); err != nil {
log.Error(uid, err)
... ...