|
@@ -143,8 +143,6 @@ func GetEsBaseFromIndexByTableName(tableName string) EsBaseFromIndex {
|
|
return &BaseFromBloombergIndex{}
|
|
return &BaseFromBloombergIndex{}
|
|
case "base_from_mtjh_mapping":
|
|
case "base_from_mtjh_mapping":
|
|
return &BaseFromMtjhMapping{}
|
|
return &BaseFromMtjhMapping{}
|
|
- case "base_from_kpler_index":
|
|
|
|
- return &BaseFromKplerIndex{}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|
|
@@ -1917,9 +1915,6 @@ func GetBaseIndexDataTableName(source, subSource int) (indexTable, dataTable str
|
|
case utils.DATA_SOURCE_BLOOMBERG:
|
|
case utils.DATA_SOURCE_BLOOMBERG:
|
|
indexTable = "base_from_bloomberg_index"
|
|
indexTable = "base_from_bloomberg_index"
|
|
dataTable = "base_from_bloomberg_data"
|
|
dataTable = "base_from_bloomberg_data"
|
|
- case utils.DATA_SOURCE_KPLER:
|
|
|
|
- indexTable = "base_from_kpler_index"
|
|
|
|
- dataTable = "base_from_kpler_data"
|
|
|
|
default:
|
|
default:
|
|
utils.FileLog.Info(fmt.Sprintf("数据源无对应表名, source: %d, sub: %d", source, subSource))
|
|
utils.FileLog.Info(fmt.Sprintf("数据源无对应表名, source: %d, sub: %d", source, subSource))
|
|
}
|
|
}
|
|
@@ -2122,89 +2117,4 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
items = append(items, itemsOnce...)
|
|
items = append(items, itemsOnce...)
|
|
}
|
|
}
|
|
return
|
|
return
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-type BaseFromKplerIndex struct {
|
|
|
|
- BaseFromKplerIndexId int `orm:"column(base_from_kpler_index_id);pk" gorm:"primaryKey"`
|
|
|
|
- ClassifyId int
|
|
|
|
- IndexCode string
|
|
|
|
- IndexName string
|
|
|
|
- Frequency string
|
|
|
|
- Unit string
|
|
|
|
- Sort int
|
|
|
|
- StartDate time.Time `description:"开始日期"`
|
|
|
|
- EndDate time.Time `description:"结束日期"`
|
|
|
|
- EndValue float64
|
|
|
|
- CreateTime time.Time
|
|
|
|
- ModifyTime time.Time
|
|
|
|
- BaseFileName string `description:"文件目录"`
|
|
|
|
- TerminalCode string `description:"所属终端编码"`
|
|
|
|
- ApiQueryUrl string `description:"API查询URL"`
|
|
|
|
- ProductNames string `description:"产品名称"`
|
|
|
|
- FromZoneId string `description:"区域ID"`
|
|
|
|
- FromZoneName string `description:"区域名称"`
|
|
|
|
- ToZoneId string `description:"区域ID"`
|
|
|
|
- ToZoneName string `description:"区域名称"`
|
|
|
|
- FlowDirection string `description:"流向"`
|
|
|
|
- Granularity string `description:"粒度"`
|
|
|
|
- Split string `description:"拆分类型"`
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func (m *BaseFromKplerIndex) SourceInfo() (int, int, string) {
|
|
|
|
- return utils.DATA_SOURCE_KPLER, 0, "Kpler"
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func (m *BaseFromKplerIndex) EsCols() SearchEsCols {
|
|
|
|
- return SearchEsCols{
|
|
|
|
- PrimaryId: "kpler_index_id",
|
|
|
|
- IndexCode: "index_code",
|
|
|
|
- IndexName: "index_name",
|
|
|
|
- ClassifyId: "classify_id",
|
|
|
|
- Unit: "unit",
|
|
|
|
- Frequency: "frequency",
|
|
|
|
- StartDate: "start_date",
|
|
|
|
- EndDate: "end_date",
|
|
|
|
- LatestValue: "end_value",
|
|
|
|
- CreateTime: "create_time",
|
|
|
|
- ModifyTime: "modify_time",
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func (m *BaseFromKplerIndex) Format2SearchDataSource(origin *BaseFromKplerIndex) (item *SearchDataSource) {
|
|
|
|
- if origin == nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- source, subSource, sourceName := m.SourceInfo()
|
|
|
|
- item = new(SearchDataSource)
|
|
|
|
- item.PrimaryId = origin.BaseFromKplerIndexId
|
|
|
|
- item.IndexCode = origin.IndexCode
|
|
|
|
- item.IndexName = origin.IndexName
|
|
|
|
- item.ClassifyId = origin.ClassifyId
|
|
|
|
- item.Unit = origin.Unit
|
|
|
|
- item.Frequency = origin.Frequency
|
|
|
|
- item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
|
- item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
|
- item.LatestValue = fmt.Sprint(origin.EndValue)
|
|
|
|
- item.Source = source
|
|
|
|
- item.SubSource = subSource
|
|
|
|
- item.SourceName = sourceName
|
|
|
|
- item.CreateTime = utils.TimeTransferString(utils.FormatDateTime, origin.CreateTime)
|
|
|
|
- item.ModifyTime = utils.TimeTransferString(utils.FormatDateTime, origin.ModifyTime)
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-func (m *BaseFromKplerIndex) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*BaseFromKplerIndex, err error) {
|
|
|
|
- o := global.DbMap[utils.DbNameIndex]
|
|
|
|
- fields := strings.Join(fieldArr, ",")
|
|
|
|
- if len(fieldArr) == 0 {
|
|
|
|
- fields = `*`
|
|
|
|
- }
|
|
|
|
- order := `ORDER BY create_time DESC`
|
|
|
|
- if orderRule != "" {
|
|
|
|
- order = ` ORDER BY ` + orderRule
|
|
|
|
- }
|
|
|
|
- sql := fmt.Sprintf(`SELECT %s FROM base_from_kpler_index WHERE 1=1 %s %s`, fields, condition, order)
|
|
|
|
- err = o.Raw(sql, pars...).Find(&items).Error
|
|
|
|
- return
|
|
|
|
}
|
|
}
|