123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- )
- type UpdatesStatisticalItem struct {
- Total int
- Source int
- EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
- }
- func GetUpdatesStatistical(condition string, pars []interface{}) (list []*UpdatesStatisticalItem, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT COUNT(1) AS total,source,edb_type FROM edb_info
- WHERE 1=1 `
- sql += condition
- sql += ` GROUP BY source `
- _, err = o.Raw(sql, pars).QueryRows(&list)
- return
- }
- type UpdatesStatisticalResp struct {
- ThsUpdate int `description:"同花顺已更新"`
- ThsNotUpdate int `description:"同花顺未更新"`
- WindUpdate int `description:"wind已更新"`
- WindNotUpdate int `description:"wind未更新"`
- PbUpdate int `description:"彭博已更新"`
- PbNotUpdate int `description:"彭博未更新"`
- PbFinanceUpdate int `description:"彭博财务已更新"`
- PbFinanceNotUpdate int `description:"彭博财务未更新"`
- LzUpdate int `description:"隆众已更新"`
- LzNotUpdate int `description:"隆众未更新"`
- SmmUpdate int `description:"Smm已更新"`
- SmmNotUpdate int `description:"Smm未更新"`
- MysteelUpdate int `description:"钢联已更新"`
- MysteelNotUpdate int `description:"钢联未更新"`
- ZzUpdate int `description:"郑商所已更新"`
- ZzNotUpdate int `description:"郑商所未更新"`
- DlUpdate int `description:"大商所已更新"`
- DlNotUpdate int `description:"大商所未更新"`
- ShUpdate int `description:"上期所已更新"`
- ShNotUpdate int `description:"上期所未更新"`
- CffexUpdate int `description:"中金所已更新"`
- CffexNotUpdate int `description:"中金所未更新"`
- ShfeUpdate int `description:"上期能源已更新"`
- ShfeNotUpdate int `description:"上期能源未更新"`
- GieUpdate int `description:"欧洲天然气已更新"`
- GieNotUpdate int `description:"欧洲天然气未更新"`
- CalculateUpdate int `description:"计算指标已更新"`
- CalculateNotUpdate int `description:"计算指标未更新"`
- ManualUpdate int `description:"手工指标已更新"`
- ManualNotUpdate int `description:"手工指标未更新"`
- LtUpdate int `description:"路透已更新"`
- LtNotUpdate int `description:"路透未更新"`
- CoalUpdate int `description:"煤炭网已更新"`
- CoalNotUpdate int `description:"煤炭网未更新"`
- GoogleTravelUpdate int `description:"谷歌出行已更新"`
- GoogleTravelNotUpdate int `description:"谷歌出行未更新"`
- EiaSteoUpdate int `description:"eia steo报告已更新"`
- EiaSteoNotUpdate int `description:"eia steo报告未更新"`
- UNUpdate int `description:"UN报告已更新"`
- UNNotUpdate int `description:"UN报告未更新"`
- SciUpdate int `description:"卓创数据已更新"`
- SciNotUpdate int `description:"卓创数据未更新"`
- BaiinfoUpdate int `description:"百川盈孚数据已更新"`
- BaiinfoNotUpdate int `description:"百川盈孚数据未更新"`
- NationalStatisticsUpdate int `description:"国家统计局数据已更新"`
- NationalStatisticsNotUpdate int `description:"国家统计局数据未更新"`
- FubaoUpdate int `description:"富宝已更新"`
- FubaoNotUpdate int `description:"富宝未更新"`
- }
- /*
- DATA_SOURCE_THS = iota + 1 //同花顺
- DATA_SOURCE_WIND //wind
- DATA_SOURCE_PB //彭博
- DATA_SOURCE_CALCULATE //指标运算
- DATA_SOURCE_CALCULATE_LJZZY //累计值转月
- DATA_SOURCE_CALCULATE_TBZ //同比值
- DATA_SOURCE_CALCULATE_TCZ //同差值
- DATA_SOURCE_CALCULATE_NSZYDPJJS //N数值移动平均计算
- DATA_SOURCE_MANUAL //手工指标
- DATA_SOURCE_LZ //隆众
- DATA_SOURCE_YS //有色
- DATA_SOURCE_CALCULATE_HBZ //环比值->12
- DATA_SOURCE_CALCULATE_HCZ //环差值->13
- DATA_SOURCE_CALCULATE_BP //变频->14
- DATA_SOURCE_GL //钢联->15
- */
- func GetUpdatesList(condition string, pars []interface{}, startSize, pageSize int) (list []*EdbInfoView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM edb_info
- WHERE 1=1 `
- sql += condition
- sql += ` LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
- return
- }
- // GetAllUpdatesList 获取所有待更新的指标
- func GetAllUpdatesList() (list []*EdbInfoView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM edb_info
- WHERE 1=1 AND is_update=? AND no_update=? AND edb_info_type = ? ORDER BY edb_type ASC `
- _, err = o.Raw(sql, 1, 0, 0).QueryRows(&list)
- return
- }
- func GetUpdatesListTotal(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT COUNT(1) AS count FROM edb_info
- WHERE 1=1 `
- sql += condition
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- type UpdatesListResp struct {
- List []*EdbInfoView
- Total int
- Paging *paging.PagingItem
- }
|