|
@@ -3,6 +3,7 @@ package excel
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
+ "eta/eta_api/models"
|
|
|
"eta/eta_api/models/data_manage"
|
|
|
"eta/eta_api/models/data_manage/excel"
|
|
|
"eta/eta_api/models/data_manage/excel/request"
|
|
@@ -528,3 +529,55 @@ func GetExcelEdbBatchRefreshKey(source string, reportId, chapterId int) string {
|
|
|
|
|
|
return fmt.Sprint("batch_refresh_excel_edb:", source, ":", reportId, ":", chapterId)
|
|
|
}
|
|
|
+
|
|
|
+// GetEdbSourceByEdbInfoIdList 获取关联指标的来源
|
|
|
+func GetEdbSourceByEdbInfoIdList(edbInfoIdList []int) (sourceNameList, sourceNameEnList []string,err error) {
|
|
|
+ sourceNameList = make([]string, 0)
|
|
|
+ sourceNameEnList = make([]string, 0)
|
|
|
+ sourceMap := make(map[int]string)
|
|
|
+ edbInfoList, tmpErr := data_manage.GetEdbInfoByIdList(edbInfoIdList)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range edbInfoList {
|
|
|
+ // 指标类型:1:基础指标,2:计算指标
|
|
|
+ if v.EdbType == 2 {
|
|
|
+ //sourceMap[0] = "弘则研究"
|
|
|
+ baseEdbInfoArr, _, _ := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
|
|
|
+ for _, baseEdbInfo := range baseEdbInfoArr {
|
|
|
+ if baseEdbInfo.EdbInfoType == 0 { //普通指标才参与,预测指标不参与
|
|
|
+ sourceMap[baseEdbInfo.Source] = baseEdbInfo.SourceName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sourceMap[v.Source] = v.SourceName
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for source, sourceName := range sourceMap {
|
|
|
+ if utils.InArrayByInt([]int{utils.DATA_SOURCE_MANUAL, utils.DATA_SOURCE_MYSTEEL_CHEMICAL}, source) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ sourceNameList = append(sourceNameList, sourceName)
|
|
|
+
|
|
|
+ sourceNameEn, ok := utils.DataSourceEnMap[source]
|
|
|
+ if !ok {
|
|
|
+ sourceNameEn = sourceName
|
|
|
+ }
|
|
|
+ sourceNameEnList = append(sourceNameEnList, sourceNameEn)
|
|
|
+ }
|
|
|
+ //sourceNameList = append(sourceNameList, utils.ChartDefaultNameCn)
|
|
|
+ //sourceNameEnList = append(sourceNameEnList, utils.ChartDefaultNameEn)
|
|
|
+
|
|
|
+ // 图表来源
|
|
|
+ conf, e := models.GetBusinessConf()
|
|
|
+ if e != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if conf[models.BusinessConfCompanyName] != "" {
|
|
|
+ sourceNameList = append(sourceNameList, conf[models.BusinessConfCompanyName])
|
|
|
+ sourceNameEnList = append(sourceNameEnList, conf[models.BusinessConfCompanyName])
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|