|
@@ -1770,6 +1770,9 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
keyWord := this.GetString("KeyWord")
|
|
|
+ if keyWord == `` {
|
|
|
+ keyWord = this.GetString("Keyword")
|
|
|
+ }
|
|
|
keyWord = strings.TrimSpace(keyWord) //移除字符串首尾空格
|
|
|
filterSource, _ := this.GetInt("FilterSource")
|
|
|
if filterSource <= 0 {
|
|
@@ -1780,111 +1783,27 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
|
|
|
frequency := this.GetString("Frequency") //频度
|
|
|
|
|
|
- // 指标类型数组:1-基础指标;2-计算指标;3-预测指标
|
|
|
- edbTypeList := make([]int, 0)
|
|
|
- edbInfoType := -1 // 指标范围
|
|
|
edbTypeStr := this.GetString("EdbType", "0") // 指标类型:0-基础和计算;1-基础指标;2-计算指标;3-预测指标
|
|
|
|
|
|
- // 搜索用户id
|
|
|
- searchUserId := this.SysUser.AdminId
|
|
|
- {
|
|
|
- if edbTypeStr == `` || edbTypeStr == `0` {
|
|
|
- edbTypeList = []int{1, 2}
|
|
|
- edbInfoType = 0
|
|
|
- } else if edbTypeStr == `1` { // 数据查看(基础指标),不应该固定创建人的
|
|
|
- edbTypeList = []int{1}
|
|
|
- edbInfoType = 0
|
|
|
- searchUserId = 0
|
|
|
- } else {
|
|
|
- var hasEdb, hasPredictEdb bool
|
|
|
- tmpEdbTypeList := strings.Split(edbTypeStr, `,`)
|
|
|
- for _, v := range tmpEdbTypeList {
|
|
|
- edbType, err := strconv.Atoi(v)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "EdbType异常"
|
|
|
- br.ErrMsg = "EdbType异常,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 指标类型
|
|
|
- switch edbType {
|
|
|
- case 1, 2:
|
|
|
- hasEdb = true
|
|
|
- edbTypeList = append(edbTypeList, edbType)
|
|
|
- case 3:
|
|
|
- hasPredictEdb = true
|
|
|
- edbTypeList = []int{1, 2}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 只有数据查看和指标加工
|
|
|
- if hasEdb && !hasPredictEdb {
|
|
|
- edbInfoType = 0
|
|
|
- } else if !hasEdb && hasPredictEdb {
|
|
|
- // 只有预测指标
|
|
|
- edbInfoType = 1
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
edbAuth, _ := this.GetInt("EdbAuth", 0) // 指标权限范围,0-全部;1-我的;2-公共
|
|
|
|
|
|
edbCollect, _ := this.GetInt("EdbCollect", 0) // 指标收藏状态:0-全部;1-已收藏
|
|
|
|
|
|
- // 筛选分类id列表
|
|
|
- searchClassifyIdList := make([]int, 0)
|
|
|
- searchPublicClassifyIdList := make([]int, 0)
|
|
|
// 父级分类id
|
|
|
classifyId, _ := this.GetInt("ClassifyId")
|
|
|
- if classifyId > 0 {
|
|
|
- switch edbAuth {
|
|
|
- case 1: // 1-我的;2-公共
|
|
|
- allChildClassifyItemList, err, _ := data.GetAllChildClassifyByParentId(classifyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取指标分类信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- searchClassifyIdList = append(searchClassifyIdList, classifyId)
|
|
|
- for _, v := range allChildClassifyItemList {
|
|
|
- searchClassifyIdList = append(searchClassifyIdList, v.ClassifyId)
|
|
|
- }
|
|
|
- case 2: // 1-我的;2-公共
|
|
|
- obj := data_manage.EdbPublicClassify{}
|
|
|
- allChildClassifyItemList, err, _ := obj.GetAllChildClassifyByParentId(classifyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取指标分类信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- searchPublicClassifyIdList = append(searchPublicClassifyIdList, classifyId)
|
|
|
- for _, v := range allChildClassifyItemList {
|
|
|
- searchPublicClassifyIdList = append(searchPublicClassifyIdList, v.EdbPublicClassifyId)
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
var edbInfoList []*data_manage.EdbInfoList
|
|
|
var err error
|
|
|
|
|
|
- // 无权限指标 和 无权限指标分类id(只考虑)
|
|
|
- noPermissionEdbInfoIdList, noPermissionEdbClassifyIdList, err := data_manage_permission.GetUserAllEdbAndClassifyNoPermissionListV2(this.SysUser.AdminId)
|
|
|
+ // 获取es搜索参数
|
|
|
+ source, frequency, noPermissionEdbInfoIdList, noPermissionEdbClassifyIdList, collectEdbInfoIdList, searchClassifyIdList, searchPublicClassifyIdList, edbTypeList, edbInfoType, edbAuth, searchUserId, err, errMsg := data.GetGeneralEdbEsSearchParams(edbTypeStr, this.SysUser.AdminId, edbAuth, edbCollect, classifyId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 收藏的指标id
|
|
|
- collectEdbInfoIdList := make([]int, 0)
|
|
|
- if edbCollect == 1 {
|
|
|
- collectEdbInfoIdList, err = data_manage.GetUserAllCollectEdbInfoIdList(this.SysUser.AdminId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取收藏指标配置数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ if errMsg != `` {
|
|
|
+ br.Msg = errMsg
|
|
|
}
|
|
|
+ br.ErrMsg = "获取失败:" + err.Error()
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
sortMap := make(map[string]string)
|