Przeglądaj źródła

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

Roc 11 miesięcy temu
rodzic
commit
edc41cb40d

+ 3 - 5
controllers/data_manage/edb_info.go

@@ -3213,11 +3213,9 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
 	if edbInfoListLen > 0 {
 		classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
 
 		for _, v := range classifyList {

+ 16 - 20
controllers/data_manage/my_chart.go

@@ -142,12 +142,11 @@ func (this *MyChartController) ChartList() {
 		}
 		classifyList, err := data_manage.GetChartClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
+
 		for _, v := range classifyList {
 			classifyMap[v.ChartClassifyId] = v
 		}
@@ -1328,12 +1327,11 @@ func (this *MyChartController) MyChartList() {
 		}
 		classifyList, err := data_manage.GetChartClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
+
 		for _, v := range classifyList {
 			classifyMap[v.ChartClassifyId] = v
 		}
@@ -1585,12 +1583,11 @@ func (this *MyChartController) ChartRecommendList() {
 		}
 		classifyList, err := data_manage.GetChartClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
+
 		for _, v := range classifyList {
 			classifyMap[v.ChartClassifyId] = v
 		}
@@ -1683,12 +1680,11 @@ func (this *MyChartController) MyChartSearch() {
 		}
 		classifyList, err := data_manage.GetChartClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
+
 		for _, v := range classifyList {
 			classifyMap[v.ChartClassifyId] = v
 		}

+ 3 - 5
controllers/data_manage/predict_edb_info.go

@@ -1269,11 +1269,9 @@ func (this *PredictEdbInfoController) FilterByEs() {
 	if edbInfoListLen > 0 {
 		classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
 		if err != nil {
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+			return
 		}
 
 		for _, v := range classifyList {

+ 10 - 7
models/data_manage/excel/request/excel_info.go

@@ -97,13 +97,16 @@ type TableDataReq struct {
 
 // EdbInfoData 自定义表格的数据
 type EdbInfoData struct {
-	EdbInfoId    int             `description:"指标ID"`
-	Tag          string          `description:"标签"`
-	EdbName      string          `description:"指标名称"`
-	EdbAliasName string          `description:"指标别名"`
-	Frequency    string          `description:"频度"`
-	Unit         string          `description:"单位"`
-	Data         []ManualDataReq `description:"单元格数据列表"`
+	EdbInfoId        int             `description:"指标ID"`
+	Tag              string          `description:"标签"`
+	EdbName          string          `description:"指标名称"`
+	EdbAliasName     string          `description:"指标别名"`
+	Frequency        string          `description:"频度"`
+	Unit             string          `description:"单位"`
+	ClassifyId       int             `description:"所属分类" json:"-"`
+	IsJoinPermission int             `description:"是否加入权限管控,0:不加入;1:加入;默认:0" json:"-"`
+	HaveOperaAuth    bool            `description:"是否有数据权限,默认:false"`
+	Data             []ManualDataReq `description:"单元格数据列表"`
 }
 
 // ManualDataReq 自定义表格的单元格数据

+ 36 - 1
services/data/excel/excel_info.go

@@ -88,7 +88,7 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int) (excelDet
 	}
 
 	switch excelInfo.Source {
-	case utils.TIME_TABLE: // 自定义表格
+	case utils.TIME_TABLE: // 时间序列表格
 		var tableDataConfig TableDataConfig
 		err = json.Unmarshal([]byte(excelDetail.Content), &tableDataConfig)
 		if err != nil {
@@ -100,6 +100,39 @@ func formatExcelInfo2Detail(excelInfo *excel.ExcelInfo, sysUserId int) (excelDet
 			err = errors.New("获取最新的表格数据失败,Err:" + tmpErr.Error())
 			return
 		}
+
+		if len(result.EdbInfoIdList) > 0 {
+			classifyIdList := make([]int, 0)
+			for _, v := range result.Data {
+				classifyIdList = append(classifyIdList, v.ClassifyId)
+			}
+
+			classifyMap := make(map[int]*data_manage.EdbClassify)
+
+			classifyList, tmpErr := data_manage.GetEdbClassifyByIdList(classifyIdList)
+			if tmpErr != nil {
+				err = errors.New("获取分类列表失败,Err:" + tmpErr.Error())
+				return
+			}
+
+			for _, v := range classifyList {
+				classifyMap[v.ClassifyId] = v
+			}
+
+			// 获取所有有权限的指标和分类
+			permissionEdbIdList, permissionClassifyIdList, tmpErr := data_manage_permission.GetUserEdbAndClassifyPermissionList(sysUserId, 0, 0)
+			if err != nil {
+				err = errors.New("获取所有有权限的指标和分类失败,Err:" + tmpErr.Error())
+				return
+			}
+
+			for i, v := range result.Data {
+				if currClassify, ok := classifyMap[v.ClassifyId]; ok {
+					result.Data[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(v.IsJoinPermission, currClassify.IsJoinPermission, v.EdbInfoId, v.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
+				}
+			}
+		}
+
 		excelDetail.TableData = result
 	case utils.MIXED_TABLE: // 混合表格
 		var result request.MixedTableReq
@@ -782,6 +815,8 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 			tmpEdbInfoData.EdbName = edbInfo.EdbName
 			tmpEdbInfoData.Frequency = edbInfo.Frequency
 			tmpEdbInfoData.Unit = edbInfo.Unit
+			tmpEdbInfoData.ClassifyId = edbInfo.ClassifyId
+			tmpEdbInfoData.IsJoinPermission = edbInfo.IsJoinPermission
 		}
 
 		for index, dateTime := range sortDateTimeList {