Browse Source

Merge branch 'bzq/knowledge_add_viewpoint' of eta_gn_server/eta_api into debug

baoziqiang 3 months ago
parent
commit
1b48845c37
3 changed files with 59 additions and 34 deletions
  1. 22 2
      controllers/ppt_v2.go
  2. 6 1
      models/ppt_v2.go
  3. 31 31
      models/system/sys_user.go

+ 22 - 2
controllers/ppt_v2.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"eta_gn/eta_api/models"
 	"eta_gn/eta_api/models/company"
+	"eta_gn/eta_api/models/system"
 	"eta_gn/eta_api/services"
 	"eta_gn/eta_api/services/ppt"
 	"eta_gn/eta_api/utils"
@@ -458,19 +459,38 @@ func (this *PptV2Controller) DetailPpt() {
 		br.ErrMsg = "信息获取失败,Err:" + err.Error()
 		return
 	}
+	pptInfo2 := new(models.PptV2Detail)
+	pptInfo2.PptV2 = pptInfo
 
 	// 权限
 	var hasAuth bool
 	if pptInfo.AdminId == sysUser.AdminId {
 		hasAuth = true
 	}
-	if hasAuth == false && pptInfo.CollaborateUsers != "" {
+
+	if !hasAuth && pptInfo.CollaborateUsers != "" {
 		authorArr := strings.Split(pptInfo.CollaborateUsers, ",")
 		strId := strconv.Itoa(sysUser.AdminId)
 		if utils.InArrayByStr(authorArr, strId) {
 			hasAuth = true
 		}
 	}
+	if pptInfo.CollaborateUsers != "" {
+		authorArr := strings.Split(pptInfo.CollaborateUsers, ",")
+		cond := ` AND enabled = 1 AND admin_id IN (?) `
+		pars := make([]interface{}, 0)
+		pars = append(pars, authorArr)
+		sysAdmin, e := system.GetSysAdminList(cond, pars, []string{"admin_id", "real_name"}, "")
+		if e != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取用户失败,Err:" + e.Error()
+			return
+		}
+		for _, v := range sysAdmin {
+			pptInfo2.CollaborateUserNames = append(pptInfo2.CollaborateUserNames, map[int]string{v.AdminId: v.RealName})
+		}
+
+	}
 
 	// 维护背景图
 	if pptInfo.CurrentBackgroundImg == "" {
@@ -521,7 +541,7 @@ func (this *PptV2Controller) DetailPpt() {
 		return
 	}
 	resp := new(models.PPTDetailResp)
-	resp.PptV2 = pptInfo
+	resp.PptV2Detail = pptInfo2
 	resp.Editor = editor
 	resp.HasAuth = hasAuth
 

+ 6 - 1
models/ppt_v2.go

@@ -53,6 +53,11 @@ type PptV2 struct {
 	BackgroundImgId        int       `gorm:"column:background_img_id" description:"封面图id"`
 }
 
+type PptV2Detail struct {
+	*PptV2
+	CollaborateUserNames []map[int]string
+}
+
 type PptV2Item struct {
 	PptId         int       `gorm:"column:ppt_id;primaryKey" description:"ppt的Id"`
 	TemplateType  int       `gorm:"column:template_type" description:"模版类型"`
@@ -317,7 +322,7 @@ type PPTEditingReq struct {
 
 // PPTDetailResp PPT详情响应体
 type PPTDetailResp struct {
-	*PptV2
+	*PptV2Detail
 	Editor  PPTEditingCache `description:"编辑人信息"`
 	HasAuth bool            `description:"是否有权限"`
 }

+ 31 - 31
models/system/sys_user.go

@@ -29,42 +29,42 @@ type LoginResp struct {
 type Admin struct {
 	//AdminId                   int    `grm:"column:admin_id;identity:true" description:"系统用户id"`
 	AdminId                   int    `gorm:"primaryKey;autoIncrement;column:admin_id"`
-	AdminName                 string `description:"系统用户名称"`
-	AdminAvatar               string `description:"用户头像"`
-	RealName                  string `description:"系统用户姓名"`
+	AdminName                 string `gorm:"column:admin_name" description:"系统用户名称"`
+	AdminAvatar               string `grom:"admin_avatar" description:"用户头像"`
+	RealName                  string `grom:"real_name" description:"系统用户姓名"`
 	Password                  string `json:"-"`
 	LastUpdatedPasswordTime   string `json:"-"`
-	Enabled                   int
-	Email                     string `description:"系统用户邮箱"`
+	Enabled                   int    `gorm:"column:enabled"`
+	Email                     string `gorm:"column:email" description:"系统用户邮箱"`
 	LastLoginTime             string
 	CreatedTime               time.Time
 	LastUpdatedTime           string
-	Role                      string    `description:"系统用户角色"`
-	Mobile                    string    `description:"手机号"`
-	RoleType                  int       `description:"角色类型:1需要录入指标,0:不需要"`
-	RoleId                    int       `description:"角色ID"`
-	RoleName                  string    `description:"角色名称"`
-	RoleTypeCode              string    `description:"角色类型编码"`
-	DepartmentId              int       `description:"部门id"`
-	DepartmentName            string    `description:"部门名称"`
-	GroupId                   int       `description:"分组id"`
-	GroupName                 string    `description:"分组名称"`
-	Authority                 int       `description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,3:超级管理员,4:ficc销售组长"`
-	Position                  string    `description:"职位"`
-	DisableTime               time.Time `description:"禁用时间"`
-	ChartPermission           int8      `description:"图表权限id"`
-	OpenId                    string    `description:"国能部门公众号的openid"`
-	UnionId                   string    `description:"微信公众平台唯一标识"`
-	EdbPermission             int8      `description:"指标库操作权限,0:只能操作 自己的,1:所有指标可操作"`
-	MysteelChemicalPermission int8      `description:"钢联化工指标操作权限,0:只能操作 自己的,1:所有指标可操作"`
-	PredictEdbPermission      int8      `description:"预测指标库操作权限,0:只能操作 自己的,1:所有预测指标可操作"`
-	Province                  string    `description:"省"`
-	ProvinceCode              string    `description:"省编码"`
-	City                      string    `description:"市"`
-	CityCode                  string    `description:"市编码"`
-	EmployeeId                string    `description:"员工工号(钉钉/每刻报销)"`
-	TelAreaCode               string    `description:"手机区号"`
-	IsLdap                    int       `description:"是否为域用户:0-系统账户;1-域用户"`
+	Role                      string    `gorm:"column:role" description:"系统用户角色"`
+	Mobile                    string    `gorm:"column:mobile" description:"手机号"`
+	RoleType                  int       `gorm:"role_type" description:"角色类型:1需要录入指标,0:不需要"`
+	RoleId                    int       `gorm:"role_id" description:"角色ID"`
+	RoleName                  string    `gorm:"column:role_name" description:"角色名称"`
+	RoleTypeCode              string    `gorm:"column:role_type_code" description:"角色类型编码"`
+	DepartmentId              int       `gorm:"column:department_id" description:"部门id"`
+	DepartmentName            string    `gorm:"column:department_name" description:"部门名称"`
+	GroupId                   int       `gorm:"column:group_id" description:"分组id"`
+	GroupName                 string    `gorm:"column:group_name" description:"分组名称"`
+	Authority                 int       `gorm:"column:authority" description:"管理权限,0:无,1:部门负责人,2:小组负责人,或者ficc销售主管,3:超级管理员,4:ficc销售组长"`
+	Position                  string    `gorm:"column:position" description:"职位"`
+	DisableTime               time.Time `gorm:"column:disable_time" description:"禁用时间"`
+	ChartPermission           int8      `gorm:"column:chart_permission" description:"图表权限id"`
+	OpenId                    string    `gorm:"column:open_id" description:"国能部门公众号的openid"`
+	UnionId                   string    `gorm:"column:union_id" description:"微信公众平台唯一标识"`
+	EdbPermission             int8      `gorm:"column:edb_permission" description:"指标库操作权限,0:只能操作 自己的,1:所有指标可操作"`
+	MysteelChemicalPermission int8      `gorm:"column:mysteel_chemical_permission" description:"钢联化工指标操作权限,0:只能操作 自己的,1:所有指标可操作"`
+	PredictEdbPermission      int8      `gorm:"column:predict_edb_permission" description:"预测指标库操作权限,0:只能操作 自己的,1:所有预测指标可操作"`
+	Province                  string    `gorm:"column:province" description:"省"`
+	ProvinceCode              string    `gorm:"column:province_code" description:"省编码"`
+	City                      string    `gorm:"column:city" description:"市"`
+	CityCode                  string    `gorm:"column:city_code" description:"市编码"`
+	EmployeeId                string    `gorm:"column:employee_id" description:"员工工号(钉钉/每刻报销)"`
+	TelAreaCode               string    `gorm:"column:tel_area_code" description:"手机区号"`
+	IsLdap                    int       `gorm:"column:is_ldap" description:"是否为域用户:0-系统账户;1-域用户"`
 }
 
 // Update 更新用户基础信息