作者 yangfu

审核修改

@@ -781,6 +781,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related @@ -781,6 +781,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
781 approver *models.User 781 approver *models.User
782 roleIds []int 782 roleIds []int
783 roleId int 783 roleId int
  784 + admin *models.UserCompany
784 ) 785 )
785 if configs, err = models.GetAuditFlowConfigsLevel(templateId, 1); err != nil { 786 if configs, err = models.GetAuditFlowConfigsLevel(templateId, 1); err != nil {
786 if err == orm.ErrNoRows { 787 if err == orm.ErrNoRows {
@@ -844,6 +845,12 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related @@ -844,6 +845,12 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
844 err = fmt.Errorf("GenAuditFlowProcess:company.admin is not set") 845 err = fmt.Errorf("GenAuditFlowProcess:company.admin is not set")
845 return 846 return
846 } 847 }
  848 +
  849 + if admin, err = models.GetUserCompanyByUserId(company.AdminId, header.CompanyId); err != nil {
  850 + err = fmt.Errorf("GenAuditFlowProcess:company.admin is not set")
  851 + return
  852 + }
  853 +
847 //3.生成审核列表 854 //3.生成审核列表
848 for i := range configs { 855 for i := range configs {
849 config := configs[i] 856 config := configs[i]
@@ -882,14 +889,14 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related @@ -882,14 +889,14 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, related
882 for j := 0; j < len(userIds); j++ { 889 for j := 0; j < len(userIds); j++ {
883 uid := userIds[j] 890 uid := userIds[j]
884 if uid == 0 && auditConfig.NoApprover == protocol.NoApproverToAdmin { //审批人为空 转交给管理员 891 if uid == 0 && auditConfig.NoApprover == protocol.NoApproverToAdmin { //审批人为空 转交给管理员
885 - uid = company.AdminId 892 + uid = admin.Id
886 } 893 }
887 if uid == 0 { 894 if uid == 0 {
888 - uid = company.AdminId 895 + uid = admin.Id
889 } 896 }
890 if uid == header.UserId { //审核人自己 转交给管理员 897 if uid == header.UserId { //审核人自己 转交给管理员
891 log.Info(fmt.Sprintf("生成机会审批流-转给管理员:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId)) 898 log.Info(fmt.Sprintf("生成机会审批流-转给管理员:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId))
892 - uid = company.AdminId 899 + uid = admin.Id
893 } 900 }
894 if approver, err = models.GetUserByUcid(uid); err != nil { 901 if approver, err = models.GetUserByUcid(uid); err != nil {
895 log.Error(uid, err) 902 log.Error(uid, err)