|
@@ -2135,7 +2135,25 @@ func (this *EdbInfoController) EdbInfoList() {
|
|
|
button := data.GetEdbOpButton(this.SysUser, edbInfoItem.SysUserId, edbInfoItem.EdbType, edbInfoItem.EdbInfoType)
|
|
|
button.AddButton = false
|
|
|
edbInfoItem.Button = button
|
|
|
- edbInfoItem.HaveOperaAuth = true
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+ currClassify, err := data_manage.GetEdbClassifyById(edbInfoItem.EdbInfoId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取当前分类信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if currClassify != nil {
|
|
|
+ haveOperaAuth, err := data.CheckEdbPermission(edbInfoItem.IsJoinPermission, currClassify.IsJoinPermission, this.SysUser.AdminId, edbInfoItem.EdbInfoId, edbInfoItem.ClassifyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = err.Error()
|
|
|
+ br.ErrMsg = "校验指标权限失败,err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbInfoItem.HaveOperaAuth = haveOperaAuth
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
edbInfoItem.IsEnEdb = data.CheckIsEnEdb(edbInfoItem.EdbNameEn, edbInfoItem.Unit, edbInfoItem.UnitEn)
|
|
@@ -3135,9 +3153,42 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
|
|
|
edbInfoListLen := len(edbInfoList)
|
|
|
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|
|
|
edbInfoList[i].EdbNameAlias = edbInfoList[i].EdbName
|
|
|
- edbInfoList[i].HaveOperaAuth = true
|
|
|
+ classifyIdList = append(classifyIdList, edbInfoList[i].ClassifyId)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ classifyMap := make(map[int]*data_manage.EdbClassify)
|
|
|
+ if edbInfoListLen > 0 {
|
|
|
+ classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
|
|
|
+ if err != nil {
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyMap[v.ClassifyId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ permissionEdbIdList, permissionClassifyIdList, err := data.GetUserEdbAndClassifyPermissionList(this.SysUser.AdminId, 0, 0)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取所有有权限的指标和分类失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for i := 0; i < edbInfoListLen; i++ {
|
|
|
+ tmpEdbInfo := edbInfoList[i]
|
|
|
+ if currClassify, ok := classifyMap[tmpEdbInfo.ClassifyId]; ok {
|
|
|
+ edbInfoList[i].HaveOperaAuth = data.CheckEdbPermissionByPermissionIdList(tmpEdbInfo.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfo.EdbInfoId, tmpEdbInfo.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|
|
@@ -3367,6 +3418,11 @@ func (this *ChartInfoController) EdbInfoData() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ fullEdb := new(data_manage.EdbInfoFullClassify)
|
|
|
+ resp := new(data_manage.EdbInfoDataFullClassifyResp)
|
|
|
+ dataList := make([]*data_manage.EdbDataList, 0)
|
|
|
+
|
|
|
edbInfoId, _ := this.GetInt("EdbInfoId")
|
|
|
if edbInfoId <= 0 {
|
|
|
br.Msg = "参数错误"
|
|
@@ -3396,21 +3452,8 @@ func (this *ChartInfoController) EdbInfoData() {
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- maxYear := 0
|
|
|
- if edbInfo.LatestDate != "" {
|
|
|
- latestDateT, _ := time.Parse(utils.FormatDate, edbInfo.LatestDate)
|
|
|
- maxYear = latestDateT.Year()
|
|
|
- }
|
|
|
- dataList := make([]*data_manage.EdbDataList, 0)
|
|
|
- startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, maxYear)
|
|
|
- dataList, err = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.SubSource, edbInfoId, startDate, endDate)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- fullEdb := new(data_manage.EdbInfoFullClassify)
|
|
|
- resp := new(data_manage.EdbInfoDataFullClassifyResp)
|
|
|
+
|
|
|
+
|
|
|
classifyList, err, errMsg := data.GetFullClassifyByClassifyId(edbInfo.ClassifyId)
|
|
|
if err != nil {
|
|
|
br.Msg = err.Error()
|
|
@@ -3419,9 +3462,41 @@ func (this *ChartInfoController) EdbInfoData() {
|
|
|
}
|
|
|
fullEdb.EdbInfo = edbInfo
|
|
|
fullEdb.ClassifyList = classifyList
|
|
|
- fullEdb.HaveOperaAuth = true
|
|
|
+
|
|
|
+ var currClassifyItem *data_manage.EdbClassifyIdItems
|
|
|
+ for _, v := range classifyList {
|
|
|
+ if v.ClassifyId == edbInfo.ClassifyId {
|
|
|
+ currClassifyItem = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if currClassifyItem != nil {
|
|
|
+ haveOperaAuth, err := data.CheckEdbPermission(edbInfo.IsJoinPermission, currClassifyItem.IsJoinPermission, sysUser.AdminId, edbInfo.EdbInfoId, edbInfo.ClassifyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = err.Error()
|
|
|
+ br.ErrMsg = "校验指标权限失败,err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fullEdb.HaveOperaAuth = haveOperaAuth
|
|
|
+ }
|
|
|
resp.EdbInfo = fullEdb
|
|
|
- resp.DataList = dataList
|
|
|
+
|
|
|
+
|
|
|
+ if fullEdb.HaveOperaAuth {
|
|
|
+ maxYear := 0
|
|
|
+ if edbInfo.LatestDate != "" {
|
|
|
+ latestDateT, _ := time.Parse(utils.FormatDate, edbInfo.LatestDate)
|
|
|
+ maxYear = latestDateT.Year()
|
|
|
+ }
|
|
|
+ startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, maxYear)
|
|
|
+ dataList, err = data_manage.GetEdbDataList(edbInfo.Source, edbInfo.SubSource, edbInfoId, startDate, endDate)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.DataList = dataList
|
|
|
+ }
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
@@ -4526,9 +4601,42 @@ func (this *EdbInfoController) AllEdbInfoByEs() {
|
|
|
|
|
|
edbInfoListLen := len(edbInfoList)
|
|
|
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|
|
|
edbInfoList[i].EdbNameAlias = edbInfoList[i].EdbName
|
|
|
- edbInfoList[i].HaveOperaAuth = true
|
|
|
+ classifyIdList = append(classifyIdList, edbInfoList[i].ClassifyId)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ classifyMap := make(map[int]*data_manage.EdbClassify)
|
|
|
+ if edbInfoListLen > 0 {
|
|
|
+ classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
|
|
|
+ if err != nil {
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyMap[v.ClassifyId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ permissionEdbIdList, permissionClassifyIdList, err := data.GetUserEdbAndClassifyPermissionList(this.SysUser.AdminId, 0, 0)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取所有有权限的指标和分类失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for i := 0; i < edbInfoListLen; i++ {
|
|
|
+ tmpEdbInfo := edbInfoList[i]
|
|
|
+ if currClassify, ok := classifyMap[tmpEdbInfo.ClassifyId]; ok {
|
|
|
+ edbInfoList[i].HaveOperaAuth = data.CheckEdbPermissionByPermissionIdList(tmpEdbInfo.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfo.EdbInfoId, tmpEdbInfo.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|
|
@@ -5051,10 +5159,43 @@ func (this *EdbInfoController) EdbChartList() {
|
|
|
if len(list) == 0 {
|
|
|
list = make([]*data_manage.EdbInfoList, 0)
|
|
|
} else {
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
for _, v := range list {
|
|
|
- v.HaveOperaAuth = true
|
|
|
+ classifyIdList = append(classifyIdList, v.ClassifyId)
|
|
|
v.Button = data.GetEdbOpButton(sysUser, v.SysUserId, v.EdbType, v.EdbInfoType)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+
|
|
|
+ classifyMap := make(map[int]*data_manage.EdbClassify)
|
|
|
+ classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
|
|
|
+ if err != nil {
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyMap[v.ClassifyId] = v
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ permissionEdbIdList, permissionClassifyIdList, err := data.GetUserEdbAndClassifyPermissionList(this.SysUser.AdminId, 0, 0)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取所有有权限的指标和分类失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ if currClassify, ok := classifyMap[v.ClassifyId]; ok {
|
|
|
+ v.HaveOperaAuth = data.CheckEdbPermissionByPermissionIdList(v.IsJoinPermission, currClassify.IsJoinPermission, v.EdbInfoId, v.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
page = paging.GetPaging(currentIndex, pageSize, int(dataCount))
|
|
|
}
|
|
|
|