package data_manage import ( "eta/eta_api/utils" "github.com/rdlucklib/rdluck_tools/paging" "time" ) // DictIndex 嘉悦指标表 type DictIndex struct { Id int `description:"主键"` Code string `description:"指标编码"` Name string `description:"指标名称"` Unit string `description:"单位"` Frequency string `description:"更新频率"` Description string `description:"描述"` TableName string `description:"指标数据存储库表"` SourceType string `description:"指标来源,如:wind:万德;manual:手工导入;formula:公式;webisite:网页爬取"` SourceCode string `description:"来源编码"` SourceDescription string `description:"来源说明"` Industry string `description:"品种板块"` Type string `description:"指标类型"` Commodity string `description:"商品名称"` SjbId int `description:"SJB_ID"` UserId int `description:"所属用户"` RowsCount int `description:"指标数据数量"` DateFirst time.Time `description:"指标开始时间"` DateLast time.Time `description:"指标最新时间"` TimeLastUpdate time.Time `description:"最新更新时间"` TimeLastRequest time.Time `description:"下次更新时间"` Priority int `description:"更新优先级"` Status int `description:"指标状态"` ShortName string `description:"指标简称"` UpdateDescription string `description:"更新说明"` ForecastFlag int `description:"预测标识"` ManualFlag int `description:"手动标识"` VariableFlag int `description:"有效标识"` MarketDataFlag int `description:"市场价标识"` CreateUser int `description:"创建用户"` CreateTime time.Time `description:"创建时间"` UpdateUser int `description:"更新用户"` UpdateTime time.Time `description:"更新时间"` } // BridgeJiaYueIndexParams 桥接服务-获取嘉悦指标入参 type BridgeJiaYueIndexParams struct { IndexCode string `json:"index_code" form:"index_code" description:"指标编码"` SourceExtend string `json:"source_extend" form:"source_extend" description:"来源"` IndexCodeRequired int `json:"index_code_required" form:"index_code_required" description:"指标编码是否必填: 0-否; 1-是"` } // BridgeJiaYueIndexDataParams 桥接服务-获取嘉悦指标数据入参 type BridgeJiaYueIndexDataParams struct { BridgeJiaYueIndexParams StartDate string `json:"start_date" form:"start_date" description:"开始日期"` EndDate string `json:"end_date" form:"end_date" description:"结束日期"` } // BridgeJiaYueResultIndexData 桥接服务-获取嘉悦指标数据响应体 type BridgeJiaYueResultIndexData struct { Code int `json:"code" description:"状态码"` Msg string `json:"msg" description:"提示信息"` Data BridgeJiaYueIndexAndData `json:"data" description:"返回数据"` } // BridgeJiaYueIndexAndData 桥接服务-嘉悦指标和数据 type BridgeJiaYueIndexAndData struct { Id int `description:"指标自增ID" json:"id"` IndexCode string `description:"指标编码" json:"index_code"` IndexName string `description:"指标名称" json:"index_name"` Unit string `description:"单位" json:"unit"` Frequency string `description:"频度" json:"frequency"` LastDate time.Time `description:"指标最新时间" json:"last_date"` LastUpdateTime time.Time `description:"最新更新时间" json:"last_update_time"` Status int `description:"指标状态" json:"status"` IndexData []BridgeJiaYueIndexData `description:"指标数据" json:"index_data"` } // BridgeJiaYueIndexData 桥接服务-嘉悦指标数据 type BridgeJiaYueIndexData struct { Val float64 `json:"val"` DataTime time.Time `json:"data_time"` UpdateTime time.Time `json:"update_time"` } // BridgeJiaYueResultFrequencyList 桥接服务-频度列表响应体 type BridgeJiaYueResultFrequencyList struct { Code int `json:"code" description:"状态码"` Msg string `json:"msg" description:"提示信息"` Data []string `json:"data" description:"返回数据"` } // BridgeJiaYueResultIndexPageList 桥接服务-指标分页列表响应体 type BridgeJiaYueResultIndexPageList struct { Code int `json:"code" description:"状态码"` Msg string `json:"msg" description:"提示信息"` Data BridgeJiaYuePageIndexResp `json:"data" description:"返回数据"` } // BridgeJiaYuePageIndexReq 桥接服务-指标分页列表请求体 type BridgeJiaYuePageIndexReq struct { SourceExtend string `json:"source_extend" form:"source_extend" description:"来源"` Keyword string `json:"keyword" form:"keyword" description:"关键词"` Frequency string `json:"frequency" form:"frequency" description:"频度"` PageIndex int `json:"page_index" form:"page_index" description:"当前页码"` PageSize int `json:"page_size" form:"page_size" description:"每页数据量"` SortField int `json:"sort_field" form:"sort_field" description:"排序字段: 1-指标开始时间; 2-指标最新时间; 3-更新时间"` SortRule int `json:"sort_rule" form:"sort_rule" description:"排序方式: 1-正序; 2-倒序"` } // BridgeJiaYuePageIndexResp 桥接服务-指标分页列表响应体 type BridgeJiaYuePageIndexResp struct { Total int `description:"数据总量"` List []DictIndex `description:"列表数据"` } // JiaYueIndexPageListResp 指标分页列表响应体 type JiaYueIndexPageListResp struct { List []*DictIndexItem Paging *paging.PagingItem `description:"分页数据"` } // DictIndexItem 指标信息 type DictIndexItem struct { Id int `description:"主键"` Code string `description:"指标编码"` Name string `description:"指标名称"` Unit string `description:"单位"` Frequency string `description:"频度"` DateFirst string `description:"指标开始时间"` DateLast string `description:"指标最新时间"` TimeLastUpdate string `description:"最新更新时间"` } // FormatDictIndex2Item 格式化数据宝指标信息 func FormatDictIndex2Item(origin DictIndex) (item *DictIndexItem) { item = new(DictIndexItem) item.Id = origin.Id item.Code = origin.SourceCode item.Name = origin.Name item.Unit = origin.Unit item.Frequency = origin.Frequency item.DateFirst = utils.TimeTransferString(utils.FormatDate, origin.DateFirst) item.DateLast = utils.TimeTransferString(utils.FormatDate, origin.DateLast) item.TimeLastUpdate = utils.TimeTransferString(utils.FormatDateTime, origin.TimeLastUpdate) return }