Browse Source

Merge remote-tracking branch 'origin/eta/1.7.6' into debug

# Conflicts:
#	models/db.go
Roc 11 months ago
parent
commit
ff7323fcb3

+ 6 - 11
controllers/data_manage/data_manage_permission.go

@@ -78,11 +78,11 @@ func (c *DataMangePermissionController) SetPermissionEdbChart() {
 }
 
 // SetPermissionEdbChartClassifyIsPermission
-// @Title 指标/图表分类权限设置接口
-// @Description 指标/图表分类权限设置接口
+// @Title 指标/图表分类是否涉密设置接口
+// @Description 指标/图表分类是否涉密设置接口
 // @Param	request	body data_manage.MoveEdbChartReq true "type json string"
 // @Success 200 {object} data_manage.ChartListResp
-// @router /edb_chart/permission/classify [post]
+// @router /edb_chart/permission/classify/is_permission/set [post]
 func (c *DataMangePermissionController) SetPermissionEdbChartClassifyIsPermission() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
@@ -97,7 +97,7 @@ func (c *DataMangePermissionController) SetPermissionEdbChartClassifyIsPermissio
 		return
 	}
 
-	var req data_manage.SetPermissionEdbChartReq
+	var req data_manage.SetDataIsPermissionReq
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
 	if err != nil {
 		br.Msg = "参数解析异常!"
@@ -118,13 +118,7 @@ func (c *DataMangePermissionController) SetPermissionEdbChartClassifyIsPermissio
 		return
 	}
 
-	if !req.IsSelectAll && len(req.DataIdList) <= 0 {
-		br.Msg = "请勾选数据项"
-		br.IsSendEmail = false
-		return
-	}
-
-	err, errMsg := data.SetPermissionEdbChart(req.Source, req.SubSource, req.UserId, req.UserList, req.IsSelectAll, req.DataIdList, req.NoDataIdList, req.Keyword, req.ClassifyId)
+	err, errMsg := data.SetDataIsPermission(req.Source, req.SubSource, req.ClassifyIdList)
 	if err != nil {
 		//br.Success = true
 		br.Msg = "移动失败"
@@ -134,6 +128,7 @@ func (c *DataMangePermissionController) SetPermissionEdbChartClassifyIsPermissio
 		br.ErrMsg = "移动失败,Err:" + err.Error()
 		return
 	}
+
 	br.Ret = 200
 	br.IsAddLog = true
 	br.Success = true

+ 1 - 0
controllers/data_manage/edb_classify.go

@@ -919,6 +919,7 @@ func (this *EdbClassifyController) SimpleList() {
 			v.Button = button
 			v.Children = make([]*data_manage.EdbClassifyItems, 0)
 			v.ParentId = parentId
+			v.HaveOperaAuth = true
 			nodeAll = append(nodeAll, v)
 		}
 	}

+ 5 - 0
controllers/data_manage/edb_info.go

@@ -2135,6 +2135,7 @@ func (this *EdbInfoController) EdbInfoList() {
 	button := data.GetEdbOpButton(this.SysUser, edbInfoItem.SysUserId, edbInfoItem.EdbType, edbInfoItem.EdbInfoType)
 	button.AddButton = false
 	edbInfoItem.Button = button
+	edbInfoItem.HaveOperaAuth = true
 
 	//是否展示英文标识
 	edbInfoItem.IsEnEdb = data.CheckIsEnEdb(edbInfoItem.EdbNameEn, edbInfoItem.Unit, edbInfoItem.UnitEn)
@@ -3136,6 +3137,7 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
 
 	for i := 0; i < edbInfoListLen; i++ {
 		edbInfoList[i].EdbNameAlias = edbInfoList[i].EdbName
+		edbInfoList[i].HaveOperaAuth = true
 	}
 
 	for i := 0; i < edbInfoListLen; i++ {
@@ -3417,6 +3419,7 @@ func (this *ChartInfoController) EdbInfoData() {
 	}
 	fullEdb.EdbInfo = edbInfo
 	fullEdb.ClassifyList = classifyList
+	fullEdb.HaveOperaAuth = true
 	resp.EdbInfo = fullEdb
 	resp.DataList = dataList
 	br.Ret = 200
@@ -4525,6 +4528,7 @@ func (this *EdbInfoController) AllEdbInfoByEs() {
 
 	for i := 0; i < edbInfoListLen; i++ {
 		edbInfoList[i].EdbNameAlias = edbInfoList[i].EdbName
+		edbInfoList[i].HaveOperaAuth = true
 	}
 
 	for i := 0; i < edbInfoListLen; i++ {
@@ -5048,6 +5052,7 @@ func (this *EdbInfoController) EdbChartList() {
 		list = make([]*data_manage.EdbInfoList, 0)
 	} else {
 		for _, v := range list {
+			v.HaveOperaAuth = true
 			v.Button = data.GetEdbOpButton(sysUser, v.SysUserId, v.EdbType, v.EdbInfoType)
 		}
 		page = paging.GetPaging(currentIndex, pageSize, int(dataCount))

+ 2 - 0
controllers/data_manage/edb_info_calculate.go

@@ -235,6 +235,8 @@ func (this *ChartInfoController) CalculateDetail() {
 		br.ErrMsg = errMsg
 		return
 	}
+
+	fullEdb.HaveOperaAuth = true
 	fullEdb.EdbInfo = edbInfo
 	fullEdb.ClassifyList = classifyList
 

+ 2 - 0
models/data_manage/chart_classify.go

@@ -20,6 +20,7 @@ type ChartClassify struct {
 	UniqueCode        string    `description:"唯一编码"`
 	Sort              int       `description:"排序字段,越小越靠前,默认值:10"`
 	Source            int       `description:"1:ETA图库;2:商品价格曲线"`
+	IsJoinPermission  int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
 }
 
 func AddChartClassify(item *ChartClassify) (lastId int64, err error) {
@@ -148,6 +149,7 @@ type ChartClassifyItems struct {
 	SeasonEndDate       string `description:"季节性图开始日期"`
 	Children            []*ChartClassifyItems
 	Button              ChartClassifyItemsButton `description:"按钮权限"`
+	IsJoinPermission    int                      `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
 }
 
 // ChartClassifyItemsButton 操作按钮

+ 175 - 1
models/data_manage/data_manage_permission.go

@@ -8,6 +8,65 @@ import (
 	"time"
 )
 
+// SetDataIsPermissionReq
+// @Description: 设置数据分类权限请求
+type SetDataIsPermissionReq struct {
+	Source         int   `description:"来源id"`
+	SubSource      int   `description:"子来源id"`
+	ClassifyIdList []int `description:"指标/图表/表格分类唯一id列表,如果为空,说明要给这些指标移除权限管控"`
+}
+
+// SetIsPermissionEdbChartByEdbClassifyIdList
+// @Description: 设置指标分类是否涉密
+// @author: Roc
+// @datetime 2024-03-27 14:15:42
+// @param classifyIdList []int
+func SetIsPermissionEdbChartByEdbClassifyIdList(classifyIdList []int) (err error) {
+	num := len(classifyIdList)
+	if num <= 0 {
+		return
+	}
+	o, err := orm.NewOrmUsingDB("data").Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = o.Rollback()
+		} else {
+			_ = o.Commit()
+		}
+	}()
+
+	//// 获取已经配置涉密的分类权限
+	//edbClassifyList := make([]*EdbClassify, 0)
+	//sql := `SELECT * FROM edb_classify WHERE is_join_permission = ? `
+	//_, err = o.Raw(sql, 1).QueryRows(&edbClassifyList)
+	//if err != nil {
+	//	return
+	//}
+	//edbClassifyMap := make(map[int]*EdbClassify)
+	//for _, v := range edbClassifyList {
+	//	edbClassifyMap[v.ClassifyId] = v
+	//}
+
+	// 分类不选的情况下,说明是要给这些分类移除权限管控
+	if len(classifyIdList) <= 0 {
+		// 将所有的分类设置为不涉密
+		sql := `UPDATE edb_classify SET is_join_permission=?,modify_time=now() WHERE is_join_permission = 1 `
+		_, err = o.Raw(sql, 0, 1).Exec()
+		return
+	} else {
+		// 将对应的分类设置为涉密
+		sql := `UPDATE edb_classify SET is_join_permission=?,modify_time=now() WHERE classify_id in (` + utils.GetOrmInReplace(num) + `) `
+		_, err = o.Raw(sql, 1, classifyIdList).Exec()
+	}
+
+	// TODO 判断是否要记录移除的分类,用于发送通知给客户
+
+	return
+}
+
 // SetPermissionEdbChartReq
 // @Description: 设置数据权限请求
 type SetPermissionEdbChartReq struct {
@@ -22,6 +81,8 @@ type SetPermissionEdbChartReq struct {
 	Keyword      string   `description:"关键字"`
 }
 
+// EdbInfoPermission
+// @Description: 指标权限表
 type EdbInfoPermission struct {
 	PermissionId int64     `json:"permission_id" orm:"column(permission_id);pk"`
 	EdbInfoId    int32     `json:"edb_info_id"` // 指标id
@@ -30,6 +91,8 @@ type EdbInfoPermission struct {
 	CreateTime   time.Time `json:"create_time"` // 关系建立时间
 }
 
+// EdbClassifyPermission
+// @Description: 指标分类权限表
 type EdbClassifyPermission struct {
 	PermissionId  int64     `json:"permission_id" orm:"column(permission_id);pk"`
 	EdbClassifyId int32     `json:"edb_classify_id"` // 分类id
@@ -38,7 +101,13 @@ type EdbClassifyPermission struct {
 	CreateTime    time.Time `json:"create_time"`     // 关系建立时间
 }
 
-// SetPermissionEdbChartByEdbIdList 根据指标ID列表设置指标的用户权限
+// SetPermissionEdbChartByEdbIdList
+// @Description: 根据指标ID列表设置指标的用户权限
+// @author: Roc
+// @datetime 2024-03-27 14:03:42
+// @param edbIdList []string
+// @param userIdList []int
+// @return err error
 func SetPermissionEdbChartByEdbIdList(edbIdList []string, userIdList []int) (err error) {
 	edbNum := len(edbIdList)
 	if edbNum <= 0 {
@@ -136,3 +205,108 @@ func SetPermissionEdbChartByEdbIdList(edbIdList []string, userIdList []int) (err
 
 	return
 }
+
+// SetPermissionEdbChartClassifyIdByClassifyIdList
+// @Description: 根据指标分类ID列表设置分类的用户权限
+// @author: Roc
+// @datetime 2024-03-27 14:03:42
+// @param edbIdList []string
+// @param userIdList []int
+// @return err error
+func SetPermissionEdbChartClassifyIdByClassifyIdList(edbIdList []string, userIdList []int) (err error) {
+	edbNum := len(edbIdList)
+	if edbNum <= 0 {
+		return
+	}
+	o, err := orm.NewOrmUsingDB("data").Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = o.Rollback()
+		} else {
+			_ = o.Commit()
+		}
+	}()
+
+	// 获取已经配置的指标权限用户
+	edbInfoPermissionList := make([]*EdbInfoPermission, 0)
+	sql := `SELECT * FROM edb_info_permission WHERE edb_info_id in (` + utils.GetOrmInReplace(edbNum) + `) `
+	_, err = o.Raw(sql, edbIdList).QueryRows(&edbInfoPermissionList)
+	if err != nil {
+		return
+	}
+	edbInfoPermissionMap := make(map[string]*EdbInfoPermission)
+	for _, v := range edbInfoPermissionList {
+		edbInfoPermissionMap[fmt.Sprint(v.EdbInfoId, "_", v.SysUserId)] = v
+	}
+
+	// 用户不选的情况下,说明是要给这些指标移除权限管控
+	if len(userIdList) <= 0 {
+		// 标记指标为不纳入权限管控
+		sql = `UPDATE edb_info SET is_join_permission=?,modify_time=now() WHERE edb_info_id in (` + utils.GetOrmInReplace(edbNum) + `) `
+		_, err = o.Raw(sql, 0, edbIdList).Exec()
+		return
+	} else {
+		// 标记指标为纳入权限管控
+		sql = `UPDATE edb_info SET is_join_permission=?,modify_time=now() WHERE edb_info_id in (` + utils.GetOrmInReplace(edbNum) + `) `
+		_, err = o.Raw(sql, 1, edbIdList).Exec()
+	}
+
+	// 待添加的配置项
+	addList := make([]*EdbInfoPermission, 0)
+
+	// 遍历待配置的指标和用户,筛选出需要添加的配置项
+	for _, edbInfoIdStr := range edbIdList {
+		edbInfoId, tmpErr := strconv.ParseInt(edbInfoIdStr, 10, 64)
+		if tmpErr != nil {
+			err = tmpErr
+			return
+		}
+		for _, userId := range userIdList {
+			key := fmt.Sprint(edbInfoId, "_", userId)
+			if _, ok := edbInfoPermissionMap[key]; ok {
+				// 如果存在那么就移除,说明不需要处理了
+				delete(edbInfoPermissionMap, key)
+			} else {
+				// 如果不存在,那么就提那家
+				addList = append(addList, &EdbInfoPermission{
+					//PermissionId: 0,
+					EdbInfoId:  int32(edbInfoId),
+					SysUserId:  int32(userId),
+					ModifyTime: time.Now(),
+					CreateTime: time.Now(),
+				})
+			}
+		}
+	}
+
+	// 添加待配置项
+	if len(addList) > 0 {
+		_, err = o.InsertMulti(500, addList)
+		if err != nil {
+			return
+		}
+	}
+
+	// 移除废弃的配置项
+	{
+		// 获取移除的配置项
+		deletePermissionIdList := make([]int64, 0)
+		for _, v := range edbInfoPermissionMap {
+			deletePermissionIdList = append(deletePermissionIdList, v.PermissionId)
+		}
+
+		deletePermissionIdNum := len(deletePermissionIdList)
+		if deletePermissionIdNum > 0 {
+			sql = "DELETE FROM edb_info_permission WHERE permission_id in (" + utils.GetOrmInReplace(deletePermissionIdNum) + ")"
+			_, err = o.Raw(sql, deletePermissionIdList).Exec()
+			if err != nil {
+				return
+			}
+		}
+	}
+
+	return
+}

+ 41 - 37
models/data_manage/edb_classify.go

@@ -9,19 +9,20 @@ import (
 )
 
 type EdbClassify struct {
-	ClassifyId      int       `orm:"column(classify_id);pk"`
-	ClassifyType    uint8     `description:"分类类型,0:普通指标分类,1:预测指标分类"`
-	ClassifyName    string    `description:"分类名称"`
-	ParentId        int       `description:"父级id"`
-	RootId          int       `description:"顶级id"`
-	HasData         int       `description:"是否含有指标数据"`
-	CreateTime      time.Time `description:"创建时间"`
-	ModifyTime      time.Time `description:"修改时间"`
-	SysUserId       int       `description:"创建人id"`
-	SysUserRealName string    `description:"创建人姓名"`
-	Level           int       `description:"层级"`
-	UniqueCode      string    `description:"唯一编码"`
-	Sort            int       `description:"排序字段,越小越靠前,默认值:10"`
+	ClassifyId       int       `orm:"column(classify_id);pk"`
+	ClassifyType     uint8     `description:"分类类型,0:普通指标分类,1:预测指标分类"`
+	ClassifyName     string    `description:"分类名称"`
+	ParentId         int       `description:"父级id"`
+	RootId           int       `description:"顶级id"`
+	HasData          int       `description:"是否含有指标数据"`
+	CreateTime       time.Time `description:"创建时间"`
+	ModifyTime       time.Time `description:"修改时间"`
+	SysUserId        int       `description:"创建人id"`
+	SysUserRealName  string    `description:"创建人姓名"`
+	Level            int       `description:"层级"`
+	UniqueCode       string    `description:"唯一编码"`
+	Sort             int       `description:"排序字段,越小越靠前,默认值:10"`
+	IsJoinPermission int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
 }
 
 func AddEdbClassify(item *EdbClassify) (lastId int64, err error) {
@@ -179,33 +180,36 @@ func GetAllEdbClassifyByType(classifyType int) (items []*EdbClassifyItems, err e
 }
 
 type EdbClassifyItems struct {
-	ClassifyId      int `description:"分类id"`
-	EdbInfoId       int `description:"指标id"`
-	ClassifyName    string
-	ClassifyNameEn  string
-	ParentId        int
-	RootId          int    `description:"顶级id"`
-	Level           int    `description:"层级"`
-	Sort            int    `description:"排序字段,越小越靠前,默认值:10"`
-	UniqueCode      string `description:"唯一编码"`
-	Source          int    `description:"来源id"`
-	SourceName      string `description:"来源名称"`
-	SysUserId       int    `description:"创建人id"`
-	SysUserRealName string `description:"创建人姓名"`
-	StartDate       string
-	EdbCode         string
-	EdbType         int `description:"指标类型:1:基础指标,2:计算指标"`
-	Children        []*EdbClassifyItems
-	Button          EdbClassifyItemsButton `description:"操作权限"`
+	ClassifyId       int `description:"分类id"`
+	EdbInfoId        int `description:"指标id"`
+	ClassifyName     string
+	ClassifyNameEn   string
+	ParentId         int
+	RootId           int    `description:"顶级id"`
+	Level            int    `description:"层级"`
+	Sort             int    `description:"排序字段,越小越靠前,默认值:10"`
+	UniqueCode       string `description:"唯一编码"`
+	Source           int    `description:"来源id"`
+	SourceName       string `description:"来源名称"`
+	SysUserId        int    `description:"创建人id"`
+	SysUserRealName  string `description:"创建人姓名"`
+	StartDate        string
+	EdbCode          string
+	EdbType          int `description:"指标类型:1:基础指标,2:计算指标"`
+	Children         []*EdbClassifyItems
+	Button           EdbClassifyItemsButton `description:"操作权限"`
+	IsJoinPermission int                    `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
+	HaveOperaAuth    bool                   `description:"是否有数据权限"`
 }
 
 type EdbClassifyIdItems struct {
-	ClassifyId   int `description:"分类id"`
-	ClassifyName string
-	UniqueCode   string `description:"唯一编码"`
-	ParentId     int    `description:"父级分类id"`
-	Level        int    `description:"层级"`
-	RootId       int    `description:"顶级分类id"`
+	ClassifyId    int `description:"分类id"`
+	ClassifyName  string
+	UniqueCode    string `description:"唯一编码"`
+	ParentId      int    `description:"父级分类id"`
+	Level         int    `description:"层级"`
+	RootId        int    `description:"顶级分类id"`
+	HaveOperaAuth bool   `description:"是否有该数据权限,默认:false"`
 }
 
 type EdbClassifyItemList []*EdbClassifyItems

+ 7 - 4
models/data_manage/edb_info.go

@@ -64,6 +64,7 @@ type EdbInfoFullClassify struct {
 	*EdbInfo
 	CorrelationStr string `description:"相关性系数字符串"`
 	ClassifyList   []*EdbClassifyIdItems
+	HaveOperaAuth  bool `description:"是否有数据权限,默认:false"`
 }
 
 func AddEdbInfo(item *EdbInfo) (lastId int64, err error) {
@@ -352,6 +353,7 @@ type EdbInfoList struct {
 	IndicatorCode    string                  `description:"指标代码"`
 	StockCode        string                  `description:"证券代码"`
 	NoUpdate         int8                    `description:"是否停止更新,0:继续更新;1:停止更新"`
+	HaveOperaAuth    bool                    `description:"是否有数据权限,默认:false"`
 }
 
 type EdbDataInsertConfigItem struct {
@@ -1631,10 +1633,11 @@ type EdbChartClassifyResp struct {
 }
 
 type EdbChartClassify struct {
-	ClassifyId   int
-	ClassifyName string
-	ParentId     int
-	Child        []*EdbChartClassify
+	ClassifyId       int
+	ClassifyName     string
+	ParentId         int
+	IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
+	Child            []*EdbChartClassify
 }
 
 // EdbInfoDataSeasonalResp 指标季节性数据返回

+ 2 - 0
models/data_manage/excel/excel_classify.go

@@ -20,6 +20,7 @@ type ExcelClassify struct {
 	IsDelete          int       `description:"排序字段,越小越靠前,默认值:10"`
 	CreateTime        time.Time `description:"创建时间"`
 	ModifyTime        time.Time `description:"修改时间"`
+	IsJoinPermission  int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
 }
 
 // AddExcelClassify 添加excel分类
@@ -95,6 +96,7 @@ type ExcelClassifyItems struct {
 	SysUserRealName   string `description:"创建人姓名"`
 	StartDate         string `description:"自定义开始日期"`
 	Children          []*ExcelClassifyItems
+	IsJoinPermission  int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
 }
 
 func GetExcelClassifyByCondition(condition string, pars []interface{}) (item *ExcelClassify, err error) {

+ 14 - 0
models/db.go

@@ -190,6 +190,9 @@ func init() {
 	// 语音识别
 	initSpeechRecognition()
 
+	// 初始化数据资产权限的一些表
+	initDataMangePerMission()
+
 	// 初始化部分数据表变量(直接init会有顺序问题=_=!)
 	data_manage.InitEdbSourceVar()
 }
@@ -567,3 +570,14 @@ func initSpeechRecognition() {
 		new(speech_recognition.SpeechRecognitionTagMapping), // 语音识别-标签关联表
 	)
 }
+
+// initDataMangePerMission
+// @Description: 初始化数据资产权限的一些表
+// @author: Roc
+// @datetime 2024-03-27 14:03:11
+func initDataMangePerMission() {
+	orm.RegisterModel(
+		new(data_manage.EdbInfoPermission),     // 指标权限表
+		new(data_manage.EdbClassifyPermission), // 指标分类权限表
+	)
+}

+ 1 - 1
routers/commentsRouter.go

@@ -2440,7 +2440,7 @@ func init() {
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:DataMangePermissionController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:DataMangePermissionController"],
         beego.ControllerComments{
             Method: "SetPermissionEdbChartClassifyIsPermission",
-            Router: `/edb_chart/permission/classify`,
+            Router: `/edb_chart/permission/classify/is_permission/set`,
             AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,

+ 1 - 0
routers/router.go

@@ -164,6 +164,7 @@ func init() {
 				&data_manage.BaseFromNationalStatisticsController{},
 				&data_manage.JiaYueEdbSourceController{},
 				&data_manage.ChartThemeController{},
+				&data_manage.DataMangePermissionController{},
 			),
 		),
 		web.NSNamespace("/my_chart",

+ 233 - 0
services/data/data_manage_permission.go

@@ -0,0 +1,233 @@
+package data
+
+import (
+	"eta/eta_api/models/data_manage"
+)
+
+// SetPermissionEdbChart
+// @Description:  单独给资产(指标、图表、ETA表格)设置权限
+// @author: Roc
+// @datetime 2024-03-27 10:52:32
+// @param source int
+// @param subSource int
+// @param userId int
+// @param userList []int
+// @param isSelectAll bool
+// @param dataId []string
+// @param noDataId []string
+// @param keyword string
+// @param classify string
+// @return err error
+// @return errMsg string
+func SetPermissionEdbChart(source, subSource, userId int, userList []int, isSelectAll bool, dataId, noDataId []string, keyword, classify string) (err error, errMsg string) {
+	// TODO 消息通知
+
+	// 如果勾选全部数据,那么
+	if isSelectAll {
+		// 找出不要的指标ID列表
+		noDataIdMap := make(map[string]string, 0)
+		for _, v := range noDataId {
+			noDataIdMap[v] = v
+		}
+
+		// 需要转义的指标/图表ID列表
+		dataId = make([]string, 0)
+		// 获取所有指标/图表
+		list, _, tmpErr := GetMoveEdbChartList(source, subSource, userId, keyword, classify, 0, 100000)
+		if tmpErr != nil {
+			err = tmpErr
+			return
+		}
+		for _, v := range list {
+			if _, ok := noDataIdMap[v.DataId]; !ok {
+				dataId = append(dataId, v.DataId)
+			}
+		}
+	}
+
+	if len(userList) <= 0 {
+		// 说明是取消权限管控
+	}
+
+	switch source {
+	case 3, 4: //ETA指标库、ETA预测指标
+		//tmpList, tmpErr := data_manage.GetEdbInfoListGroupByUserId(dataId)
+		//if tmpErr != nil {
+		//	err = tmpErr
+		//	return
+		//}
+		//if len(tmpList) > 0 {
+		//}
+		// 重新设置权限
+		err = data_manage.SetPermissionEdbChartByEdbIdList(dataId, userList)
+	//case 5: //图库
+	//	tmpList, tmpErr := data_manage.GetChartInfoListGroupByUserId(dataId)
+	//	if tmpErr != nil {
+	//		err = tmpErr
+	//		return
+	//	}
+	//	if len(tmpList) > 0 {
+	//		for _, v := range tmpList {
+	//			if v.SysUserId == newUserId {
+	//				errMsg = "新创建人不可和原创建人一致"
+	//				err = errors.New(errMsg)
+	//				return
+	//			}
+	//		}
+	//		// 修改创建人
+	//		err = data_manage.ModifyChartInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
+	//	}
+	//case 6: // ETA表格
+	//	tmpList, tmpErr := excel.GetNoContentExcelListGroupByUserId(dataId)
+	//	if tmpErr != nil {
+	//		err = tmpErr
+	//		return
+	//	}
+	//	if len(tmpList) > 0 {
+	//		for _, v := range tmpList {
+	//			if v.SysUserId == newUserId {
+	//				errMsg = "新创建人不可和原创建人一致"
+	//				err = errors.New(errMsg)
+	//				return
+	//			}
+	//		}
+	//		// 修改创建人
+	//		err = excel.ModifyExcelInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
+	//	}
+	default:
+		return
+	}
+
+	return
+}
+
+// SetDataIsPermission
+// @Description:  设置资产(指标、图表、ETA表格)分类是否涉密
+// @author: Roc
+// @datetime 2024-03-27 10:52:32
+// @param source int
+// @param subSource int
+// @param dataId []string
+// @return err error
+// @return errMsg string
+func SetDataIsPermission(source, subSource int, classifyIdList []int) (err error, errMsg string) {
+	// TODO 消息通知
+
+	switch source {
+	case 3, 4: //ETA指标库、ETA预测指标
+		//tmpList, tmpErr := data_manage.GetEdbInfoListGroupByUserId(dataId)
+		//if tmpErr != nil {
+		//	err = tmpErr
+		//	return
+		//}
+		//if len(tmpList) > 0 {
+		//}
+		// 重新设置权限
+		err = data_manage.SetIsPermissionEdbChartByEdbClassifyIdList(classifyIdList)
+	//case 5: //图库
+
+	//case 6: // ETA表格
+
+	default:
+		return
+	}
+
+	return
+}
+
+// SetPermissionEdbChartClassify
+// @Description:  单独给资产(指标、图表、ETA表格)分类设置权限
+// @author: Roc
+// @datetime 2024-03-27 10:52:32
+// @param source int
+// @param subSource int
+// @param userId int
+// @param userList []int
+// @param isSelectAll bool
+// @param dataId []string
+// @param noDataId []string
+// @param keyword string
+// @param classify string
+// @return err error
+// @return errMsg string
+func SetPermissionEdbChartClassify(source, subSource, userId int, userList []int, isSelectAll bool, dataId, noDataId []string, keyword, classify string) (err error, errMsg string) {
+	// TODO 消息通知
+
+	// 如果勾选全部数据,那么
+	if isSelectAll {
+		// 找出不要的指标ID列表
+		noDataIdMap := make(map[string]string, 0)
+		for _, v := range noDataId {
+			noDataIdMap[v] = v
+		}
+
+		// 需要转义的指标/图表ID列表
+		dataId = make([]string, 0)
+		// 获取所有指标/图表
+		list, _, tmpErr := GetMoveEdbChartList(source, subSource, userId, keyword, classify, 0, 100000)
+		if tmpErr != nil {
+			err = tmpErr
+			return
+		}
+		for _, v := range list {
+			if _, ok := noDataIdMap[v.DataId]; !ok {
+				dataId = append(dataId, v.DataId)
+			}
+		}
+	}
+
+	if len(userList) <= 0 {
+		// 说明是取消权限管控
+	}
+
+	switch source {
+	case 3, 4: //ETA指标库、ETA预测指标
+		//tmpList, tmpErr := data_manage.GetEdbInfoListGroupByUserId(dataId)
+		//if tmpErr != nil {
+		//	err = tmpErr
+		//	return
+		//}
+		//if len(tmpList) > 0 {
+		//}
+		// 重新设置权限
+		err = data_manage.SetPermissionEdbChartByEdbIdList(dataId, userList)
+	//case 5: //图库
+	//	tmpList, tmpErr := data_manage.GetChartInfoListGroupByUserId(dataId)
+	//	if tmpErr != nil {
+	//		err = tmpErr
+	//		return
+	//	}
+	//	if len(tmpList) > 0 {
+	//		for _, v := range tmpList {
+	//			if v.SysUserId == newUserId {
+	//				errMsg = "新创建人不可和原创建人一致"
+	//				err = errors.New(errMsg)
+	//				return
+	//			}
+	//		}
+	//		// 修改创建人
+	//		err = data_manage.ModifyChartInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
+	//	}
+	//case 6: // ETA表格
+	//	tmpList, tmpErr := excel.GetNoContentExcelListGroupByUserId(dataId)
+	//	if tmpErr != nil {
+	//		err = tmpErr
+	//		return
+	//	}
+	//	if len(tmpList) > 0 {
+	//		for _, v := range tmpList {
+	//			if v.SysUserId == newUserId {
+	//				errMsg = "新创建人不可和原创建人一致"
+	//				err = errors.New(errMsg)
+	//				return
+	//			}
+	//		}
+	//		// 修改创建人
+	//		err = excel.ModifyExcelInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
+	//	}
+	default:
+		return
+	}
+
+	return
+}

+ 0 - 102
services/data/data_manage_persmission.go

@@ -1,102 +0,0 @@
-package data
-
-import (
-	"eta/eta_api/models/data_manage"
-)
-
-// SetPermissionEdbChart
-// @Description:  单独给资产(指标、图表、ETA表格)设置权限
-// @author: Roc
-// @datetime 2024-03-27 10:52:32
-// @param source int
-// @param subSource int
-// @param userId int
-// @param userList []int
-// @param isSelectAll bool
-// @param dataId []string
-// @param noDataId []string
-// @param keyword string
-// @param classify string
-// @return err error
-// @return errMsg string
-func SetPermissionEdbChart(source, subSource, userId int, userList []int, isSelectAll bool, dataId, noDataId []string, keyword, classify string) (err error, errMsg string) {
-	// TODO 消息通知
-
-	// 如果勾选全部数据,那么
-	if isSelectAll {
-		// 找出不要的指标ID列表
-		noDataIdMap := make(map[string]string, 0)
-		for _, v := range noDataId {
-			noDataIdMap[v] = v
-		}
-
-		// 需要转义的指标/图表ID列表
-		dataId = make([]string, 0)
-		// 获取所有指标/图表
-		list, _, tmpErr := GetMoveEdbChartList(source, subSource, userId, keyword, classify, 0, 100000)
-		if tmpErr != nil {
-			err = tmpErr
-			return
-		}
-		for _, v := range list {
-			if _, ok := noDataIdMap[v.DataId]; !ok {
-				dataId = append(dataId, v.DataId)
-			}
-		}
-	}
-
-	if len(userList) <= 0 {
-		// 说明是取消权限管控
-	}
-
-	switch source {
-	case 3, 4: //ETA指标库、ETA预测指标
-		tmpList, tmpErr := data_manage.GetEdbInfoListGroupByUserId(dataId)
-		if tmpErr != nil {
-			err = tmpErr
-			return
-		}
-		if len(tmpList) > 0 {
-			// 修改创建人
-			err = data_manage.SetPermissionEdbChartByEdbIdList(dataId, userList)
-		}
-	//case 5: //图库
-	//	tmpList, tmpErr := data_manage.GetChartInfoListGroupByUserId(dataId)
-	//	if tmpErr != nil {
-	//		err = tmpErr
-	//		return
-	//	}
-	//	if len(tmpList) > 0 {
-	//		for _, v := range tmpList {
-	//			if v.SysUserId == newUserId {
-	//				errMsg = "新创建人不可和原创建人一致"
-	//				err = errors.New(errMsg)
-	//				return
-	//			}
-	//		}
-	//		// 修改创建人
-	//		err = data_manage.ModifyChartInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
-	//	}
-	//case 6: // ETA表格
-	//	tmpList, tmpErr := excel.GetNoContentExcelListGroupByUserId(dataId)
-	//	if tmpErr != nil {
-	//		err = tmpErr
-	//		return
-	//	}
-	//	if len(tmpList) > 0 {
-	//		for _, v := range tmpList {
-	//			if v.SysUserId == newUserId {
-	//				errMsg = "新创建人不可和原创建人一致"
-	//				err = errors.New(errMsg)
-	//				return
-	//			}
-	//		}
-	//		// 修改创建人
-	//		err = excel.ModifyExcelInfoUserIdByCodeList(dataId, adminInfo.AdminId, adminInfo.RealName)
-	//	}
-	default:
-		return
-	}
-
-	return
-}

+ 3 - 0
services/data/edb_info.go

@@ -2851,6 +2851,7 @@ func GetEdbMenuTreeRecursive(list []*data_manage.EdbClassifyItems, parentId int)
 		t.ClassifyId = v.ClassifyId
 		t.ClassifyName = v.ClassifyName
 		t.ParentId = v.ParentId
+		t.IsJoinPermission = v.IsJoinPermission
 		if v.ParentId == parentId {
 			t.Child = GetEdbMenuTreeRecursive(list, v.ClassifyId)
 			res = append(res, t)
@@ -2867,6 +2868,7 @@ func GetChartMenuTreeRecursive(list []*data_manage.ChartClassifyItems, parentId
 		t.ClassifyId = v.ChartClassifyId
 		t.ClassifyName = v.ChartClassifyName
 		t.ParentId = v.ParentId
+		t.IsJoinPermission = v.ParentId
 		if v.ParentId == parentId {
 			t.Child = GetChartMenuTreeRecursive(list, v.ChartClassifyId)
 			res = append(res, t)
@@ -2889,6 +2891,7 @@ func GetExcelMenuTreeRecursive(list []*excel.ExcelClassifyItems, parentId int) [
 		t.ClassifyId = v.ExcelClassifyId
 		t.ClassifyName = v.ExcelClassifyName
 		t.ParentId = v.ParentId
+		t.IsJoinPermission = v.IsJoinPermission
 		if v.ParentId == parentId {
 			t.Child = GetExcelMenuTreeRecursive(list, v.ExcelClassifyId)
 			res = append(res, t)