|
@@ -11,21 +11,21 @@ import (
|
|
|
|
|
|
// SearchDataSource 数据源ES搜索
|
|
|
type SearchDataSource struct {
|
|
|
- PrimaryId int `description:"主键ID"`
|
|
|
- IndexCode string `description:"指标编码"`
|
|
|
- IndexName string `description:"指标名称"`
|
|
|
- ClassifyId int `description:"分类ID"`
|
|
|
- Unit string `description:"单位"`
|
|
|
- Frequency string `description:"频度"`
|
|
|
- StartDate string `description:"开始日期"`
|
|
|
- EndDate string `description:"结束日期"`
|
|
|
- LatestValue float64 `description:"最新值"`
|
|
|
- Source int `description:"来源"`
|
|
|
- SourceName string `description:"数据源名称"`
|
|
|
- SubSource int `description:"子来源"`
|
|
|
- IsDeleted int `description:"是否已删除:0-正常;1-已删除"`
|
|
|
- CreateTime string `description:"创建时间"`
|
|
|
- ModifyTime string `description:"修改时间"`
|
|
|
+ PrimaryId int `description:"主键ID"`
|
|
|
+ IndexCode string `description:"指标编码"`
|
|
|
+ IndexName string `description:"指标名称"`
|
|
|
+ ClassifyId int `description:"分类ID"`
|
|
|
+ Unit string `description:"单位"`
|
|
|
+ Frequency string `description:"频度"`
|
|
|
+ StartDate string `description:"开始日期"`
|
|
|
+ EndDate string `description:"结束日期"`
|
|
|
+ LatestValue string `description:"最新值(部分数据源如中国煤炭网存在97%这种数据...)"`
|
|
|
+ Source int `description:"来源"`
|
|
|
+ SourceName string `description:"数据源名称"`
|
|
|
+ SubSource int `description:"子来源"`
|
|
|
+ IsDeleted int `description:"是否已删除:0-正常;1-已删除"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ ModifyTime string `description:"修改时间"`
|
|
|
}
|
|
|
|
|
|
// SearchDataSourceItem 数据源ES搜索
|
|
@@ -197,7 +197,7 @@ func (m *BaseFromRzdIndex) Format2SearchDataSource(origin *BaseFromRzdIndex) (it
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -273,7 +273,7 @@ func (m *BaseFromHisugarIndex) Format2SearchDataSource(origin *BaseFromHisugarIn
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -347,7 +347,7 @@ func (m *BaseFromLyIndex) Format2SearchDataSource(origin *BaseFromLyIndex) (item
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -424,7 +424,7 @@ func (m *BaseFromSciHqIndex) Format2SearchDataSource(origin *BaseFromSciHqIndex)
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -497,7 +497,7 @@ func (m *BaseFromOilchemIndex) Format2SearchDataSource(origin *BaseFromOilchemIn
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -580,7 +580,7 @@ func (m *BaseFromThsHfIndex) Format2SearchDataSource(origin *BaseFromThsHfIndex)
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDateTime, origin.StartDate) // 高频这里是到时分秒
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDateTime, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -653,7 +653,7 @@ func (m *BaseFromCcfIndex) Format2SearchDataSource(origin *BaseFromCcfIndex) (it
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -726,7 +726,7 @@ func (m *BaseFromUsdaFasIndex) Format2SearchDataSource(origin *BaseFromUsdaFasIn
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -799,7 +799,7 @@ func (m *BaseFromMysteelChemicalIndex) Format2SearchDataSource(origin *BaseFromM
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -872,7 +872,7 @@ func (m *BaseFromSmmIndex) Format2SearchDataSource(origin *BaseFromSmmIndex) (it
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -945,7 +945,7 @@ func (m *BaseFromBaiinfoIndex) Format2SearchDataSource(origin *BaseFromBaiinfoIn
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1018,7 +1018,7 @@ func (m *BaseFromSciIndex) Format2SearchDataSource(origin *BaseFromSciIndex) (it
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1052,7 +1052,7 @@ type BaseFromCoalmineMapping struct {
|
|
|
Frequency string `description:"频度"`
|
|
|
StartDate time.Time `description:"开始日期"`
|
|
|
EndDate time.Time `description:"结束日期"`
|
|
|
- LatestValue float64 `description:"最新值"`
|
|
|
+ LatestValue string `description:"最新值"`
|
|
|
CreateTime time.Time `description:"创建时间"`
|
|
|
ModifyTime time.Time `description:"更新时间"`
|
|
|
}
|
|
@@ -1164,7 +1164,7 @@ func (m *BaseFromEiaSteoIndex) Format2SearchDataSource(origin *BaseFromEiaSteoIn
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1237,7 +1237,7 @@ func (m *BaseFromIcpiIndex) Format2SearchDataSource(origin *BaseFromIcpiIndex) (
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1310,7 +1310,7 @@ func (m *BaseFromYongyiIndex) Format2SearchDataSource(origin *BaseFromYongyiInde
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1383,7 +1383,7 @@ func (m *BaseFromFenweiIndex) Format2SearchDataSource(origin *BaseFromFenweiInde
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1456,7 +1456,7 @@ func (m *BaseFromSci99Index) Format2SearchDataSource(origin *BaseFromSci99Index)
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1528,7 +1528,7 @@ func (m *BaseFromGlIndex) Format2SearchDataSource(origin *BaseFromGlIndex) (item
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1601,7 +1601,7 @@ func (m *BaseFromManualEdb) Format2SearchDataSource(origin *BaseFromManualEdb) (
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1674,7 +1674,7 @@ func (m *BaseFromBusinessIndex) Format2SearchDataSource(origin *BaseFromBusiness
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1747,7 +1747,7 @@ func (m *BaseFromBloombergIndex) Format2SearchDataSource(origin *BaseFromBloombe
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1820,7 +1820,7 @@ func (m *BaseFromMtjhMapping) Format2SearchDataSource(origin *BaseFromMtjhMappin
|
|
|
item.Frequency = origin.Frequency
|
|
|
item.StartDate = utils.TimeTransferString(utils.FormatDate, origin.StartDate)
|
|
|
item.EndDate = utils.TimeTransferString(utils.FormatDate, origin.EndDate)
|
|
|
- item.LatestValue = origin.LatestValue
|
|
|
+ item.LatestValue = fmt.Sprint(origin.LatestValue)
|
|
|
item.Source = source
|
|
|
item.SubSource = subSource
|
|
|
item.SourceName = sourceName
|
|
@@ -1846,9 +1846,9 @@ func (m *BaseFromMtjhMapping) GetItemsByCondition(condition string, pars []inter
|
|
|
|
|
|
// BaseIndexDataMinMax 数据源极值信息
|
|
|
type BaseIndexDataMinMax struct {
|
|
|
- MinDate string `description:"最小日期"`
|
|
|
- MaxDate string `description:"最大日期"`
|
|
|
- LatestValue float64 `description:"最新值"`
|
|
|
+ MinDate string `description:"最小日期"`
|
|
|
+ MaxDate string `description:"最大日期"`
|
|
|
+ LatestValue string `description:"最新值"`
|
|
|
//MinValue float64 `description:"最小值"`
|
|
|
//MaxValue float64 `description:"最大值"`
|
|
|
}
|
|
@@ -1945,7 +1945,7 @@ func getCoalmineDataTableName(indexCode string) string {
|
|
|
func GetBaseIndexDataMinMax(source, subSource int, indexCode string) (item *BaseIndexDataMinMax, err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
var sql string
|
|
|
- var latestVal float64
|
|
|
+ var latestVal string
|
|
|
|
|
|
// 煤炭江湖
|
|
|
if source == utils.DATA_SOURCE_MTJH {
|
|
@@ -2077,7 +2077,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
|
itemsOnce := make([]*BaseFromCoalmineIndexBase, 0)
|
|
|
if len(jsmCodes) > 0 {
|
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_jsm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(jsmCodes)))
|
|
|
- _, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
|
|
|
+ _, err = o.Raw(sql, jsmCodes).QueryRows(&itemsOnce)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -2085,7 +2085,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
|
}
|
|
|
if len(companyCodes) > 0 {
|
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_company_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(companyCodes)))
|
|
|
- _, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
|
|
|
+ _, err = o.Raw(sql, companyCodes).QueryRows(&itemsOnce)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -2093,7 +2093,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
|
}
|
|
|
if len(firmCodes) > 0 {
|
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_firm_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(firmCodes)))
|
|
|
- _, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
|
|
|
+ _, err = o.Raw(sql, firmCodes).QueryRows(&itemsOnce)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -2101,7 +2101,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
|
}
|
|
|
if len(coastalCodes) > 0 {
|
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_coastal_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(coastalCodes)))
|
|
|
- _, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
|
|
|
+ _, err = o.Raw(sql, coastalCodes).QueryRows(&itemsOnce)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -2109,7 +2109,7 @@ func GetCoalmineBaseInfoFromDataTable(codes []string) (items []*BaseFromCoalmine
|
|
|
}
|
|
|
if len(inlandCodes) > 0 {
|
|
|
sql = fmt.Sprintf(`SELECT * FROM base_from_coalmine_inland_index WHERE index_code IN (%s) GROUP BY index_code`, utils.GetOrmInReplace(len(inlandCodes)))
|
|
|
- _, err = o.Raw(sql, codes).QueryRows(&itemsOnce)
|
|
|
+ _, err = o.Raw(sql, inlandCodes).QueryRows(&itemsOnce)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|