sync_index.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. package models
  2. import (
  3. "errors"
  4. "eta/eta_data_init/utils"
  5. "fmt"
  6. "github.com/beego/beego/v2/client/orm"
  7. "strings"
  8. "time"
  9. )
  10. type EdbClassifyItem struct {
  11. ClassifyID int64 `orm:"column(classify_id);pk"`
  12. ClassifyType uint32
  13. ClassifyName string
  14. ParentID int64
  15. HasData int32
  16. CreateTime time.Time
  17. ModifyTime time.Time
  18. SysUserID int64
  19. SysUserRealName string
  20. Level int64
  21. UniqueCode string
  22. Sort uint32
  23. RootID int64
  24. LastModifyUserID uint32
  25. LastModifyUserName string
  26. }
  27. // GetAllEdbClassifyListByCondition
  28. // @Description: 获取分类列表
  29. // @author: Roc
  30. // @datetime 2024-02-29 10:55:38
  31. // @param condition string
  32. // @param pars []interface{}
  33. // @return item []*EdbInfoUpdateLog
  34. // @return err error
  35. func GetAllEdbClassifyListByCondition(condition string, pars []interface{}) (item []*EdbClassifyItem, err error) {
  36. o := orm.NewOrmUsingDB("data")
  37. sql := ` SELECT * FROM edb_classify WHERE 1=1 `
  38. if condition != "" {
  39. sql += condition
  40. }
  41. sql += ` ORDER BY classify_id ASC `
  42. _, err = o.Raw(sql, pars).QueryRows(&item)
  43. return
  44. }
  45. type EdbInfoItem struct {
  46. CalculateFormula string `json:"calculate_formula"`
  47. Calendar string `json:"calendar"`
  48. ChartImage string `json:"chart_image"`
  49. ClassifyId int `json:"classify_id"`
  50. CreateTime string `json:"create_time"`
  51. DataDateType string `json:"data_date_type"`
  52. DataUpdateTime string `json:"data_update_time"`
  53. EdbCode string `json:"edb_code"`
  54. EdbInfoId int `json:"edb_info_id"`
  55. EdbInfoType int `json:"edb_info_type"`
  56. EdbName string `json:"edb_name"`
  57. EdbNameEn string `json:"edb_name_en"`
  58. EdbNameSource string `json:"edb_name_source"`
  59. EdbType int `json:"edb_type"`
  60. EmptyType int `json:"empty_type"`
  61. EndDate string `json:"end_date"`
  62. EndValue float64 `json:"end_value"`
  63. ErDataUpdateDate string `json:"er_data_update_date"`
  64. Extra string `json:"extra"`
  65. Frequency string `json:"frequency"`
  66. IndicatorCode string `json:"indicator_code"`
  67. IsUpdate int `json:"is_update"`
  68. LatestDate string `json:"latest_date"`
  69. LatestValue float64 `json:"latest_value"`
  70. ManualSave int `json:"manual_save"`
  71. MaxEmptyType int `json:"max_empty_type"`
  72. MaxValue float64 `json:"max_value"`
  73. MinValue float64 `json:"min_value"`
  74. ModifyTime string `json:"modify_time"`
  75. MoveFrequency string `json:"move_frequency"`
  76. MoveType int `json:"move_type"`
  77. NoUpdate int `json:"no_update"`
  78. ServerUrl string `json:"server_url"`
  79. Sort int `json:"sort"`
  80. Source int `json:"source"`
  81. SourceIndexName string `json:"source_index_name"`
  82. SourceName string `json:"source_name"`
  83. StartDate string `json:"start_date"`
  84. StockCode string `json:"stock_code"`
  85. SubSource int `json:"sub_source"`
  86. SubSourceName string `json:"sub_source_name"`
  87. SysUserId int `json:"sys_user_id"`
  88. SysUserRealName string `json:"sys_user_real_name"`
  89. TerminalCode string `json:"terminal_code"`
  90. UniqueCode string `json:"unique_code"`
  91. Unit string `json:"unit"`
  92. UnitEn string `json:"unit_en"`
  93. }
  94. // GetAllEdbInfoListByCondition
  95. // @Description: 获取所有的指标
  96. // @author: Roc
  97. // @datetime 2024-02-29 10:55:38
  98. // @param condition string
  99. // @param pars []interface{}
  100. // @return item []*EdbInfoUpdateLog
  101. // @return err error
  102. func GetAllEdbInfoListByCondition(condition string, pars []interface{}) (item []*EdbInfoItem, err error) {
  103. o := orm.NewOrmUsingDB("data")
  104. sql := ` SELECT * FROM edb_info WHERE 1=1 `
  105. if condition != "" {
  106. sql += condition
  107. }
  108. sql += ` ORDER BY edb_info_id ASC `
  109. _, err = o.Raw(sql, pars).QueryRows(&item)
  110. return
  111. }
  112. type EdbData struct {
  113. EdbDataId int32 `orm:"column(edb_data_id);pk" json:"edb_data_id"`
  114. EdbInfoId int32 `json:"edb_info_id"` // 指标id
  115. EdbCode string `json:"edb_code"` // 指标编码
  116. //DataTime time.Time `json:"data_time"` // 数据日期
  117. DataTime string `json:"data_time"` // 数据日期
  118. Value float64 `json:"value"` // 数据值
  119. //CreateTime time.Time `json:"create_time"` // 创建时间
  120. //ModifyTime time.Time `json:"modify_time"` // 修改时间
  121. CreateTime string `json:"create_time"` // 创建时间
  122. ModifyTime string `json:"modify_time"` // 修改时间
  123. DataTimestamp int64 `json:"data_timestamp"` // 数据日期时间戳
  124. }
  125. // GetAllEdbDataListByCondition
  126. // @Description: 根据指标id和表名获取指标数据
  127. // @author: Roc
  128. // @datetime 2024-03-14 13:22:01
  129. // @param tableName string
  130. // @param edbInfoId int
  131. // @return item []*EdbData
  132. // @return err error
  133. func GetAllEdbDataListByCondition(tableName string, edbInfoId int) (item []*EdbData, err error) {
  134. if tableName == `` {
  135. err = errors.New("错误的表名")
  136. return
  137. }
  138. o := orm.NewOrmUsingDB("data")
  139. sql := fmt.Sprintf(` SELECT * FROM %s WHERE 1=1 and edb_info_id = ? `, tableName)
  140. sql += ` ORDER BY edb_data_id ASC `
  141. _, err = o.Raw(sql, edbInfoId).QueryRows(&item)
  142. return
  143. }
  144. type BaseFromMysteelChemicalIndexItem struct {
  145. BaseFromMysteelChemicalIndexId int32 `json:"base_from_mysteel_chemical_index_id"`
  146. BaseFromMysteelChemicalClassifyId int32 `json:"base_from_mysteel_chemical_classify_id"` // 钢联化工指标分类id
  147. IndexCode string `json:"index_code"` // 指标编码
  148. IndexName string `json:"index_name"` // 指标名称
  149. Unit string `json:"unit"` // 单位
  150. Source string `json:"source"` // 数据来源
  151. Frequency string `json:"frequency"` // 频度
  152. StartDate string `json:"start_date"` // 开始日期
  153. EndDate string `json:"end_date"` // 结束日期
  154. Describe string `json:"describe"` // 指标描述
  155. UpdateWeek string `json:"update_week"` // 更新周期
  156. UpdateTime string `json:"update_time"` // 更新时间,多个时间点用英文,隔开
  157. UpdateTime2 string `json:"update_time2"` // 更新时间2
  158. SysUserId int32 `json:"sys_user_id"` // 创建人id
  159. SysUserRealName string `json:"sys_user_real_name"` // 创建人姓名
  160. CreateTime string `json:"create_time"` // 创建时间
  161. ModifyTime string `json:"modify_time"` // 修改时间
  162. FilePath string `json:"file_path"` // 文件存储路径
  163. Sort int32 `json:"sort"` // 排序
  164. MergeFilePath string `json:"merge_file_path"`
  165. FileIndex int32 `json:"file_index"`
  166. MergeUpdateWeek string `json:"merge_update_week"` // 合并文件的更新周
  167. MergeFilePathWeek string `json:"merge_file_path_week"` // 更新文件
  168. UpdateDate string `json:"update_date"` // 更新日期
  169. IsRefresh int32 `json:"is_refresh"` // 0:不需要及时刷新,1:需要及时刷新
  170. IsStop int32 `json:"is_stop"` // 是否停更:1:停更,0:未停更
  171. TerminalCode string `json:"terminal_code"` // 所属终端编码
  172. EndValue float64 `json:"end_value"` // 指标的最新值
  173. }
  174. // GetBaseFromMysteelChemicalIndexItemByCode
  175. // @Description: 根据指标编码获取钢联指标详情
  176. // @author: Roc
  177. // @datetime 2024-03-11 16:42:56
  178. // @param edbCode string
  179. // @return item *BaseFromMysteelChemicalIndexItem
  180. // @return err error
  181. func GetBaseFromMysteelChemicalIndexItemByCode(edbCode string) (item *BaseFromMysteelChemicalIndexItem, err error) {
  182. o := orm.NewOrmUsingDB("data")
  183. sql := ` SELECT * FROM base_from_mysteel_chemical_index WHERE index_code = ?`
  184. err = o.Raw(sql, edbCode).QueryRow(&item)
  185. return
  186. }
  187. type BaseFromSmmIndexItem struct {
  188. BaseFromSmmIndexId int32 `json:"base_from_smm_index_id"`
  189. ClassifyId int32 `json:"classify_id"` // Smm原始数据指标分类id
  190. Interface string `json:"interface"`
  191. Name string `json:"name"`
  192. IndexCode string `json:"index_code"` // 指标编码
  193. IndexName string `json:"index_name"` // 指标名称
  194. Type1 string `json:"type_1"` // 类型1
  195. Type2 string `json:"type_2"` // 类型2
  196. Type3 string `json:"type_3"` // 类型3
  197. Frequency string `json:"frequency"` // 频度
  198. Unit string `json:"unit"` // 单位
  199. ApiStartTime string `json:"api_start_time"` // 接口开始日期
  200. ApiUpdateTime string `json:"api_update_time"` // 接口更新日期
  201. StartTime string `json:"start_time"` // 开始日期
  202. FinishTime string `json:"finish_time"` // 完成日期
  203. CreateTime string `json:"create_time"`
  204. ModifyTime string `json:"modify_time"`
  205. StartDate string `json:"start_date"`
  206. EndDate string `json:"end_date"`
  207. IsGet int32 `json:"is_get"` // 0:未获取数据,1:已获取数据
  208. Sort int32 `json:"sort"` // 排序
  209. BaseFileName string `json:"base_file_name"` // 文件目录
  210. RenameFileName string `json:"rename_file_name"` // 重命名文件目录
  211. TerminalCode string `json:"terminal_code"` // 所属终端编码
  212. DataState string `json:"data_state"` // 指标数据状态 normal/空白-正常更新 ceased-已停更irregular-更新依赖外部会有不定期延迟
  213. ReleaseTime string `json:"release_time"` // 预计发布时间
  214. IsStop int32 `json:"is_stop"` // 是否停更:1:停更,0:未停更
  215. EndValue float64 `json:"end_value"` // 指标的最新值
  216. }
  217. // GetBaseFromSmmIndexItemItemByCode
  218. // @Description: 根据指标编码获取指标信息
  219. // @author: Roc
  220. // @datetime 2024-03-11 16:41:02
  221. // @param source int
  222. // @param edbCode string
  223. // @return item *BaseFromSmmIndexItem
  224. // @return err error
  225. func GetBaseFromSmmIndexItemItemByCode(edbCode string) (item *BaseFromSmmIndexItem, err error) {
  226. o := orm.NewOrmUsingDB("data")
  227. sql := ` SELECT * FROM base_from_smm_index WHERE index_code=? `
  228. err = o.Raw(sql, edbCode).QueryRow(&item)
  229. return
  230. }
  231. // GetEdbDataTableName 指标数据->存储表
  232. func GetEdbDataTableName(source, subSource int) (tableName string) {
  233. switch source {
  234. case utils.DATA_SOURCE_THS:
  235. tableName = "edb_data_ths"
  236. if subSource == utils.DATA_SUB_SOURCE_DATE {
  237. tableName = "edb_data_ths_ds"
  238. } else {
  239. tableName = "edb_data_ths"
  240. }
  241. case utils.DATA_SOURCE_WIND:
  242. if subSource == utils.DATA_SUB_SOURCE_DATE {
  243. tableName = "edb_data_wind_wsd"
  244. } else {
  245. tableName = "edb_data_wind"
  246. }
  247. case utils.DATA_SOURCE_PB, utils.DATA_SOURCE_PB_FINANCE: //彭博经济数据、彭博财务数据
  248. tableName = "edb_data_pb"
  249. case utils.DATA_SOURCE_CALCULATE:
  250. tableName = "edb_data_calculate"
  251. case utils.DATA_SOURCE_CALCULATE_LJZZY:
  252. tableName = "edb_data_calculate_ljzzy"
  253. case utils.DATA_SOURCE_CALCULATE_TBZ:
  254. tableName = "edb_data_calculate_tbz"
  255. case utils.DATA_SOURCE_CALCULATE_TCZ:
  256. tableName = "edb_data_calculate_tcz"
  257. case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS:
  258. tableName = "edb_data_calculate_nszydpjjs"
  259. case utils.DATA_SOURCE_MANUAL:
  260. tableName = "edb_data_manual"
  261. case utils.DATA_SOURCE_LZ:
  262. tableName = "edb_data_lz"
  263. case utils.DATA_SOURCE_YS:
  264. tableName = "edb_data_ys"
  265. case utils.DATA_SOURCE_CALCULATE_HBZ:
  266. tableName = "edb_data_calculate_hbz"
  267. case utils.DATA_SOURCE_CALCULATE_HCZ:
  268. tableName = "edb_data_calculate_hcz"
  269. case utils.DATA_SOURCE_CALCULATE_BP:
  270. tableName = "edb_data_calculate_bp"
  271. case utils.DATA_SOURCE_GL:
  272. tableName = "edb_data_gl"
  273. case utils.DATA_SOURCE_ZZ:
  274. tableName = "edb_data_zz"
  275. case utils.DATA_SOURCE_DL:
  276. tableName = "edb_data_dl"
  277. case utils.DATA_SOURCE_SH:
  278. tableName = "edb_data_sh"
  279. case utils.DATA_SOURCE_CFFEX:
  280. tableName = "edb_data_cffex"
  281. case utils.DATA_SOURCE_SHFE:
  282. tableName = "edb_data_ine"
  283. case utils.DATA_SOURCE_GIE:
  284. tableName = "edb_data_gie"
  285. case utils.DATA_SOURCE_CALCULATE_ZJPJ:
  286. tableName = "edb_data_calculate_zjpj"
  287. case utils.DATA_SOURCE_CALCULATE_TIME_SHIFT:
  288. tableName = "edb_data_calculate_time_shift"
  289. case utils.DATA_SOURCE_CALCULATE_LJZTBPJ:
  290. tableName = "edb_data_calculate_ljztbpj"
  291. case utils.DATA_SOURCE_LT:
  292. tableName = "edb_data_lt"
  293. case utils.DATA_SOURCE_COAL:
  294. tableName = "edb_data_coal"
  295. case utils.DATA_SOURCE_PYTHON:
  296. tableName = "edb_data_python"
  297. case utils.DATA_SOURCE_GOOGLE_TRAVEL:
  298. tableName = "edb_data_google_travel"
  299. case utils.DATA_SOURCE_PREDICT_CALCULATE:
  300. tableName = "edb_data_predict_calculate"
  301. case utils.DATA_SOURCE_PREDICT_CALCULATE_TBZ:
  302. tableName = "edb_data_predict_calculate_tbz"
  303. case utils.DATA_SOURCE_PREDICT_CALCULATE_TCZ:
  304. tableName = "edb_data_predict_calculate_tcz"
  305. case utils.DATA_SOURCE_MYSTEEL_CHEMICAL:
  306. tableName = "edb_data_mysteel_chemical"
  307. case utils.DATA_SOURCE_CALCULATE_CJJX:
  308. tableName = "edb_data_calculate_cjjx"
  309. case utils.DATA_SOURCE_EIA_STEO:
  310. tableName = "edb_data_eia_steo"
  311. case utils.DATA_SOURCE_CALCULATE_NHCC:
  312. tableName = "edb_data_calculate_nhcc"
  313. case utils.DATA_SOURCE_COM_TRADE:
  314. tableName = "edb_data_com_trade"
  315. case utils.DATA_SOURCE_PREDICT_CALCULATE_NSZYDPJJS:
  316. tableName = "edb_data_predict_calculate_nszydpjjs"
  317. case utils.DATA_SOURCE_CALCULATE_ADJUST:
  318. tableName = "edb_data_calculate_adjust"
  319. case utils.DATA_SOURCE_SCI:
  320. tableName = "edb_data_sci"
  321. case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZY:
  322. tableName = "edb_data_predict_calculate_ljzzy"
  323. case utils.DATA_SOURCE_PREDICT_CALCULATE_TIME_SHIFT:
  324. tableName = "edb_data_predict_calculate_time_shift"
  325. case utils.DATA_SOURCE_PREDICT_CALCULATE_ZJPJ:
  326. tableName = "edb_data_predict_calculate_zjpj"
  327. case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZTBPJ:
  328. tableName = "edb_data_predict_calculate_ljztbpj"
  329. case utils.DATA_SOURCE_PREDICT_CALCULATE_NHCC:
  330. tableName = "edb_data_predict_calculate_nhcc"
  331. case utils.DATA_SOURCE_PREDICT_CALCULATE_CJJX:
  332. tableName = "edb_data_predict_calculate_cjjx"
  333. case utils.DATA_SOURCE_PREDICT_CALCULATE_HBZ:
  334. tableName = "edb_data_predict_calculate_hbz"
  335. case utils.DATA_SOURCE_PREDICT_CALCULATE_HCZ:
  336. tableName = "edb_data_predict_calculate_hcz"
  337. case utils.DATA_SOURCE_PREDICT_CALCULATE_BP:
  338. tableName = "edb_data_predict_calculate_bp"
  339. case utils.DATA_SOURCE_CALCULATE_JP:
  340. tableName = "edb_data_calculate_jp"
  341. case utils.DATA_SOURCE_CALCULATE_NH:
  342. tableName = "edb_data_calculate_nh"
  343. case utils.DATA_SOURCE_CALCULATE_KSZS:
  344. tableName = "edb_data_calculate_kszs"
  345. case utils.DATA_SOURCE_PREDICT_CALCULATE_JP:
  346. tableName = "edb_data_predict_calculate_jp"
  347. case utils.DATA_SOURCE_PREDICT_CALCULATE_NH:
  348. tableName = "edb_data_predict_calculate_nh"
  349. case utils.DATA_SOURCE_PREDICT_CALCULATE_KSZS:
  350. tableName = "edb_data_predict_calculate_kszs"
  351. case utils.DATA_SOURCE_BAIINFO:
  352. tableName = "edb_data_baiinfo"
  353. case utils.DATA_SOURCE_STOCK_PLANT:
  354. tableName = "edb_data_stock_plant"
  355. case utils.DATA_SOURCE_CALCULATE_CORRELATION:
  356. tableName = "edb_data_calculate_correlation"
  357. case utils.DATA_SOURCE_NATIONAL_STATISTICS:
  358. tableName = "edb_data_national_statistics"
  359. case utils.DATA_SOURCE_CALCULATE_LJZZJ: //累计值转季 -> 61
  360. tableName = "edb_data_calculate_ljzzj"
  361. case utils.DATA_SOURCE_CALCULATE_LJZ: //累计值 -> 62
  362. tableName = "edb_data_calculate_ljz"
  363. case utils.DATA_SOURCE_CALCULATE_LJZNCZJ: //累计值(年初至今) -> 63
  364. tableName = "edb_data_calculate_ljznczj"
  365. case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZJ: // 预测指标 - 累计值 -> 65
  366. tableName = "edb_data_predict_calculate_ljzzj"
  367. case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZ: //预测指标 - 累计值转季->64
  368. tableName = "edb_data_predict_calculate_ljz"
  369. case utils.DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ: //预测指标 - 累计值(年初至今) -> 66
  370. tableName = "edb_data_predict_calculate_ljznczj"
  371. case utils.DATA_SOURCE_CALCULATE_STANDARD_DEVIATION: //标准差->67
  372. tableName = "edb_data_calculate_standard_deviation"
  373. case utils.DATA_SOURCE_CALCULATE_PERCENTILE: //百分位->68
  374. tableName = "edb_data_calculate_percentile"
  375. case utils.DATA_SOURCE_PREDICT_CALCULATE_STANDARD_DEVIATION: //预测标准差->69
  376. tableName = "edb_data_predict_ccalculate_standard_deviation"
  377. case utils.DATA_SOURCE_PREDICT_CALCULATE_PERCENTILE: //预测百分位->70
  378. tableName = "edb_data_predict_ccalculate_percentile"
  379. case utils.DATA_SOURCE_FUBAO: //富宝-71
  380. tableName = "edb_data_fubao"
  381. case utils.DATA_SOURCE_CALCULATE_ZSXY:
  382. tableName = "edb_data_calculate_zsxy" // 指数修匀->72
  383. case utils.DATA_SOURCE_PREDICT_CALCULATE_ZSXY:
  384. tableName = "edb_data_predict_calculate_zsxy" // 预测指数修匀->73
  385. case utils.DATA_SOURCE_CALCULATE_ZDYFX:
  386. tableName = "edb_data_calculate_zdyfx" // 自定义分析->74
  387. case utils.DATA_SOURCE_CALCULATE_RJZ: //日均值->75
  388. tableName = "edb_data_calculate_rjz"
  389. case utils.DATA_SOURCE_GFEX: //广州期货交易所->78
  390. tableName = "edb_data_gz"
  391. case utils.DATA_SOURCE_ICPI: //ICPI消费价格指数->79
  392. tableName = "edb_data_icpi"
  393. default:
  394. edbSource := EdbSourceIdMap[source]
  395. if edbSource != nil {
  396. tableName = edbSource.TableName
  397. }
  398. }
  399. return
  400. }
  401. // GetSourceAndSubSourceTableName 存储表->指标数据
  402. func GetSourceAndSubSourceTableName(tableName, edbCode string) (source, subSource int) {
  403. switch tableName {
  404. case "edb_data_ths":
  405. source = utils.DATA_SOURCE_THS
  406. case "edb_data_ths_ds":
  407. source = utils.DATA_SOURCE_THS
  408. subSource = utils.DATA_SUB_SOURCE_DATE
  409. case "edb_data_wind":
  410. source = utils.DATA_SOURCE_WIND
  411. case "edb_data_wind_wsd":
  412. source = utils.DATA_SOURCE_WIND
  413. subSource = utils.DATA_SUB_SOURCE_DATE
  414. case "edb_data_pb":
  415. source = utils.DATA_SOURCE_PB
  416. // 彭博财务
  417. if strings.Contains(edbCode, "&&") {
  418. source = utils.DATA_SOURCE_PB_FINANCE
  419. }
  420. case "edb_data_calculate":
  421. source = utils.DATA_SOURCE_CALCULATE
  422. case "edb_data_calculate_ljzzy":
  423. source = utils.DATA_SOURCE_CALCULATE_LJZZY
  424. case "edb_data_calculate_tbz":
  425. source = utils.DATA_SOURCE_CALCULATE_TBZ
  426. case "edb_data_calculate_tcz":
  427. source = utils.DATA_SOURCE_CALCULATE_TCZ
  428. case "edb_data_calculate_nszydpjjs":
  429. source = utils.DATA_SOURCE_CALCULATE_NSZYDPJJS
  430. case "edb_data_manual":
  431. source = utils.DATA_SOURCE_MANUAL
  432. case "edb_data_lz":
  433. source = utils.DATA_SOURCE_LZ
  434. case "edb_data_ys":
  435. source = utils.DATA_SOURCE_YS
  436. case "edb_data_calculate_hbz":
  437. source = utils.DATA_SOURCE_CALCULATE_HBZ
  438. case "edb_data_calculate_hcz":
  439. source = utils.DATA_SOURCE_CALCULATE_HCZ
  440. case "edb_data_calculate_bp":
  441. source = utils.DATA_SOURCE_CALCULATE_BP
  442. case "edb_data_gl":
  443. source = utils.DATA_SOURCE_GL
  444. case "edb_data_zz":
  445. source = utils.DATA_SOURCE_ZZ
  446. case "edb_data_dl":
  447. source = utils.DATA_SOURCE_DL
  448. case "edb_data_sh":
  449. source = utils.DATA_SOURCE_SH
  450. case "edb_data_cffex":
  451. source = utils.DATA_SOURCE_CFFEX
  452. case "edb_data_ine":
  453. source = utils.DATA_SOURCE_SHFE
  454. case "edb_data_gie":
  455. source = utils.DATA_SOURCE_GIE
  456. case "edb_data_calculate_zjpj":
  457. source = utils.DATA_SOURCE_CALCULATE_ZJPJ
  458. case "edb_data_calculate_time_shift":
  459. source = utils.DATA_SOURCE_CALCULATE_TIME_SHIFT
  460. case "edb_data_calculate_ljztbpj":
  461. source = utils.DATA_SOURCE_CALCULATE_LJZTBPJ
  462. case "edb_data_lt":
  463. source = utils.DATA_SOURCE_LT
  464. case "edb_data_coal":
  465. source = utils.DATA_SOURCE_COAL
  466. case "edb_data_python":
  467. source = utils.DATA_SOURCE_PYTHON
  468. case "edb_data_google_travel":
  469. source = utils.DATA_SOURCE_GOOGLE_TRAVEL
  470. case "edb_data_predict_calculate":
  471. source = utils.DATA_SOURCE_PREDICT_CALCULATE
  472. case "edb_data_predict_calculate_tbz":
  473. source = utils.DATA_SOURCE_PREDICT_CALCULATE_TBZ
  474. case "edb_data_predict_calculate_tcz":
  475. source = utils.DATA_SOURCE_PREDICT_CALCULATE_TCZ
  476. case "edb_data_mysteel_chemical":
  477. source = utils.DATA_SOURCE_MYSTEEL_CHEMICAL
  478. case "edb_data_calculate_cjjx":
  479. source = utils.DATA_SOURCE_CALCULATE_CJJX
  480. case "edb_data_eia_steo":
  481. source = utils.DATA_SOURCE_EIA_STEO
  482. case "edb_data_calculate_nhcc":
  483. source = utils.DATA_SOURCE_CALCULATE_NHCC
  484. case "edb_data_com_trade":
  485. source = utils.DATA_SOURCE_COM_TRADE
  486. case "edb_data_predict_calculate_nszydpjjs":
  487. source = utils.DATA_SOURCE_PREDICT_CALCULATE_NSZYDPJJS
  488. case "edb_data_calculate_adjust":
  489. source = utils.DATA_SOURCE_CALCULATE_ADJUST
  490. case "edb_data_sci":
  491. source = utils.DATA_SOURCE_SCI
  492. case "edb_data_predict_calculate_ljzzy":
  493. source = utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZY
  494. case "edb_data_predict_calculate_time_shift":
  495. source = utils.DATA_SOURCE_PREDICT_CALCULATE_TIME_SHIFT
  496. case "edb_data_predict_calculate_zjpj":
  497. source = utils.DATA_SOURCE_PREDICT_CALCULATE_ZJPJ
  498. case "edb_data_predict_calculate_ljztbpj":
  499. source = utils.DATA_SOURCE_PREDICT_CALCULATE_LJZTBPJ
  500. case "edb_data_predict_calculate_nhcc":
  501. source = utils.DATA_SOURCE_PREDICT_CALCULATE_NHCC
  502. case "edb_data_predict_calculate_cjjx":
  503. source = utils.DATA_SOURCE_PREDICT_CALCULATE_CJJX
  504. case "edb_data_predict_calculate_hbz":
  505. source = utils.DATA_SOURCE_PREDICT_CALCULATE_HBZ
  506. case "edb_data_predict_calculate_hcz":
  507. source = utils.DATA_SOURCE_PREDICT_CALCULATE_HCZ
  508. case "edb_data_predict_calculate_bp":
  509. source = utils.DATA_SOURCE_PREDICT_CALCULATE_BP
  510. case "edb_data_calculate_jp":
  511. source = utils.DATA_SOURCE_CALCULATE_JP
  512. case "edb_data_calculate_nh":
  513. source = utils.DATA_SOURCE_CALCULATE_NH
  514. case "edb_data_calculate_kszs":
  515. source = utils.DATA_SOURCE_CALCULATE_KSZS
  516. case "edb_data_predict_calculate_jp":
  517. source = utils.DATA_SOURCE_PREDICT_CALCULATE_JP
  518. case "edb_data_predict_calculate_nh":
  519. source = utils.DATA_SOURCE_PREDICT_CALCULATE_NH
  520. case "edb_data_predict_calculate_kszs":
  521. source = utils.DATA_SOURCE_PREDICT_CALCULATE_KSZS
  522. case "edb_data_baiinfo":
  523. source = utils.DATA_SOURCE_BAIINFO
  524. case "edb_data_stock_plant":
  525. source = utils.DATA_SOURCE_STOCK_PLANT
  526. case "edb_data_calculate_correlation":
  527. source = utils.DATA_SOURCE_CALCULATE_CORRELATION
  528. case "edb_data_national_statistics":
  529. source = utils.DATA_SOURCE_NATIONAL_STATISTICS
  530. case "edb_data_calculate_ljzzj": //累计值转季 -> 61
  531. source = utils.DATA_SOURCE_CALCULATE_LJZZJ
  532. case "edb_data_calculate_ljz": //累计值 -> 62
  533. source = utils.DATA_SOURCE_CALCULATE_LJZ
  534. case "edb_data_calculate_ljznczj": //累计值(年初至今) -> 63
  535. source = utils.DATA_SOURCE_CALCULATE_LJZNCZJ
  536. case "edb_data_predict_calculate_ljzzj": // 预测指标 - 累计值 -> 65
  537. source = utils.DATA_SOURCE_PREDICT_CALCULATE_LJZZJ
  538. case "edb_data_predict_calculate_ljz": //预测指标 - 累计值转季->64
  539. source = utils.DATA_SOURCE_PREDICT_CALCULATE_LJZ
  540. case "edb_data_predict_calculate_ljznczj": //预测指标 - 累计值(年初至今) -> 66
  541. source = utils.DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ
  542. case "edb_data_calculate_standard_deviation": //标准差->67
  543. source = utils.DATA_SOURCE_CALCULATE_STANDARD_DEVIATION
  544. case "edb_data_calculate_percentile": //百分位->68
  545. source = utils.DATA_SOURCE_CALCULATE_PERCENTILE
  546. case "edb_data_predict_ccalculate_standard_deviation": //预测标准差->69
  547. source = utils.DATA_SOURCE_PREDICT_CALCULATE_STANDARD_DEVIATION
  548. case "edb_data_predict_ccalculate_percentile": //预测百分位->70
  549. source = utils.DATA_SOURCE_PREDICT_CALCULATE_PERCENTILE
  550. case "edb_data_fubao":
  551. source = utils.DATA_SOURCE_FUBAO
  552. case "edb_data_calculate_zsxy":
  553. source = utils.DATA_SOURCE_CALCULATE_ZSXY // 指数修匀->72
  554. case "edb_data_predict_calculate_zsxy":
  555. source = utils.DATA_SOURCE_PREDICT_CALCULATE_ZSXY // 预测指数修匀->73
  556. case "edb_data_calculate_zdyfx":
  557. source = utils.DATA_SOURCE_CALCULATE_ZDYFX // 自定义分析->74
  558. case "edb_data_calculate_rjz": //日均值75
  559. source = utils.DATA_SOURCE_CALCULATE_RJZ
  560. default:
  561. edbSource := EdbTableNameSourceMap[tableName]
  562. if edbSource != nil {
  563. source = edbSource.EdbSourceId
  564. }
  565. }
  566. return
  567. }