|
@@ -143,6 +143,8 @@ 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
|
|
@@ -1915,6 +1917,9 @@ 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))
|
|
}
|
|
}
|
|
@@ -2118,3 +2123,73 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
}
|
|
}
|
|
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
|
|
|
|
+}
|