123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- package utils
- import (
- "io/fs"
- "time"
- )
- const (
- FormatTime = "15:04:05"
- FormatDate = "2006-01-02"
- FormatDateUnSpace = "20060102"
- FormatDateTime = "2006-01-02 15:04:05"
- HlbFormatDateTime = "2006-01-02_15:04:05.999"
- FormatDateTimeUnSpace = "20060102150405"
- FormatShortDateTimeUnSpace = "060102150405"
- FormatYearMonthDate = "2006-01"
- FormatYearMonthUnSpace = "200601"
- PageSize15 = 15
- PageSize5 = 5
- PageSize10 = 10
- PageSize20 = 20
- PageSize30 = 30
- )
- const DateTypeNYears = 20
- const (
- DATA_SOURCE_THS = iota + 1
- DATA_SOURCE_WIND
- DATA_SOURCE_PB
- DATA_SOURCE_CALCULATE
- DATA_SOURCE_CALCULATE_LJZZY
- DATA_SOURCE_CALCULATE_TBZ
- DATA_SOURCE_CALCULATE_TCZ
- DATA_SOURCE_CALCULATE_NSZYDPJJS
- DATA_SOURCE_MANUAL
- DATA_SOURCE_LZ
- DATA_SOURCE_YS
- DATA_SOURCE_CALCULATE_HBZ
- DATA_SOURCE_CALCULATE_HCZ
- DATA_SOURCE_CALCULATE_BP
- DATA_SOURCE_GL
- DATA_SOURCE_ZZ
- DATA_SOURCE_DL
- DATA_SOURCE_SH
- DATA_SOURCE_CFFEX
- DATA_SOURCE_SHFE
- DATA_SOURCE_GIE
- DATA_SOURCE_CALCULATE_TIME_SHIFT
- DATA_SOURCE_CALCULATE_ZJPJ
- DATA_SOURCE_CALCULATE_LJZTBPJ
- DATA_SOURCE_LT
- DATA_SOURCE_COAL
- DATA_SOURCE_PYTHON
- DATA_SOURCE_PB_FINANCE
- DATA_SOURCE_GOOGLE_TRAVEL
- DATA_SOURCE_PREDICT
- DATA_SOURCE_PREDICT_CALCULATE
- DATA_SOURCE_PREDICT_CALCULATE_TBZ
- DATA_SOURCE_PREDICT_CALCULATE_TCZ
- DATA_SOURCE_MYSTEEL_CHEMICAL
- DATA_SOURCE_CALCULATE_CJJX
- DATA_SOURCE_EIA_STEO
- DATA_SOURCE_CALCULATE_NHCC
- DATA_SOURCE_COM_TRADE
- DATA_SOURCE_PREDICT_CALCULATE_NSZYDPJJS
- DATA_SOURCE_CALCULATE_ADJUST
- DATA_SOURCE_SCI
- DATA_SOURCE_PREDICT_CALCULATE_LJZZY
- DATA_SOURCE_PREDICT_CALCULATE_HBZ
- DATA_SOURCE_PREDICT_CALCULATE_HCZ
- DATA_SOURCE_PREDICT_CALCULATE_BP
- DATA_SOURCE_PREDICT_CALCULATE_TIME_SHIFT
- DATA_SOURCE_PREDICT_CALCULATE_ZJPJ
- DATA_SOURCE_PREDICT_CALCULATE_LJZTBPJ
- DATA_SOURCE_PREDICT_CALCULATE_CJJX
- DATA_SOURCE_PREDICT_CALCULATE_NHCC
- DATA_SOURCE_CALCULATE_JP
- DATA_SOURCE_CALCULATE_NH
- DATA_SOURCE_CALCULATE_KSZS
- DATA_SOURCE_PREDICT_CALCULATE_JP
- DATA_SOURCE_PREDICT_CALCULATE_NH
- DATA_SOURCE_PREDICT_CALCULATE_KSZS
- DATA_SOURCE_BAIINFO
- DATA_SOURCE_STOCK_PLANT
- DATA_SOURCE_CALCULATE_CORRELATION
- DATA_SOURCE_NATIONAL_STATISTICS
- DATA_SOURCE_CALCULATE_LJZZJ
- DATA_SOURCE_CALCULATE_LJZ
- DATA_SOURCE_CALCULATE_LJZNCZJ
- DATA_SOURCE_PREDICT_CALCULATE_LJZZJ
- DATA_SOURCE_PREDICT_CALCULATE_LJZ
- DATA_SOURCE_PREDICT_CALCULATE_LJZNCZJ
- DATA_SOURCE_CALCULATE_STANDARD_DEVIATION
- DATA_SOURCE_CALCULATE_PERCENTILE
- DATA_SOURCE_PREDICT_CALCULATE_STANDARD_DEVIATION
- DATA_SOURCE_PREDICT_CALCULATE_PERCENTILE
- DATA_SOURCE_FUBAO
- DATA_SOURCE_CALCULATE_ZSXY
- DATA_SOURCE_PREDICT_CALCULATE_ZSXY
- DATA_SOURCE_CALCULATE_ZDYFX
- DATA_SOURCE_CALCULATE_RJZ
- DATA_SOURCE_GFEX = 78
- DATA_SOURCE_ICPI = 79
- )
- const (
- DATA_SUB_SOURCE_EDB = iota
- DATA_SUB_SOURCE_DATE
- )
- const (
- DATA_SOURCE_NAME_THS = `同花顺`
- DATA_SOURCE_NAME_WIND = `wind`
- DATA_SOURCE_NAME_PB = `彭博`
- DATA_SOURCE_NAME_CALCULATE = `指标运算`
- DATA_SOURCE_NAME_CALCULATE_LJZZY = `累计值转月值`
- DATA_SOURCE_NAME_CALCULATE_TBZ = `同比值`
- DATA_SOURCE_NAME_CALCULATE_TCZ = `同差值`
- DATA_SOURCE_NAME_CALCULATE_NSZYDPJJS = `N数值移动平均计算`
- DATA_SOURCE_NAME_MANUAL = `手工数据`
- DATA_SOURCE_NAME_LZ = `隆众`
- DATA_SOURCE_NAME_YS = `SMM`
- DATA_SOURCE_NAME_CALCULATE_HBZ = `环比值`
- DATA_SOURCE_NAME_CALCULATE_HCZ = `环差值`
- DATA_SOURCE_NAME_CALCULATE_BP = `升频`
- DATA_SOURCE_NAME_GL = `钢联`
- DATA_SOURCE_NAME_ZZ = `郑商所`
- DATA_SOURCE_NAME_DL = `大商所`
- DATA_SOURCE_NAME_SH = `上期所`
- DATA_SOURCE_NAME_CFFEX = `中金所`
- DATA_SOURCE_NAME_SHFE = `上期能源`
- DATA_SOURCE_NAME_GIE = `欧洲天然气`
- DATA_SOURCE_NAME_CALCULATE_TIME_SHIFT = `时间移位`
- DATA_SOURCE_NAME_CALCULATE_ZJPJ = `直接拼接`
- DATA_SOURCE_NAME_CALCULATE_LJZTBPJ = `累计值同比拼接`
- DATA_SOURCE_NAME_LT = `路透`
- DATA_SOURCE_NAME_COAL = `中国煤炭网`
- DATA_SOURCE_NAME_PYTHON = `代码运算`
- DATA_SOURCE_NAME_PB_FINANCE = `彭博财务`
- DATA_SOURCE_NAME_GOOGLE_TRAVEL = `our world in data`
- DATA_SOURCE_NAME_PREDICT = `预测指标`
- DATA_SOURCE_NAME_PREDICT_CALCULATE = `预测指标运算`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_TBZ = `预测同比`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_TCZ = `预测同差`
- DATA_SOURCE_NAME_MYSTEEL_CHEMICAL = `钢联化工`
- DATA_SOURCE_NAME_CALCULATE_CJJX = `超季节性`
- DATA_SOURCE_NAME_EIA_STEO = `EIA STERO报告`
- DATA_SOURCE_NAME_CALCULATE_NHCC = `拟合残差`
- DATA_SOURCE_NAME_COM_TRADE = `UN`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_NSZYDPJJS = `预测N数值移动平均计算`
- DATA_SOURCE_NAME_CALCULATE_ADJUST = `数据调整`
- DATA_SOURCE_NAME_SCI = `SCI`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_LJZZY = `预测累计值转月值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_HBZ = `预测环比值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_HCZ = `预测环差值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_BP = `预测升频`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_TIME_SHIFT = `预测时间移位`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_ZJPJ = `预测直接拼接`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_LJZTBPJ = `预测累计值同比拼接`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_CJJX = `预测超季节性`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_NHCC = `预测拟合残差`
- DATA_SOURCE_NAME_CALCULATE_JP = `降频`
- DATA_SOURCE_NAME_CALCULATE_NH = `年化`
- DATA_SOURCE_NAME_CALCULATE_KSZS = `扩散指数`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_JP = `预测降频`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_NH = `预测年化`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_KSZS = `预测扩散指数`
- DATA_SOURCE_NAME_BAIINFO = `百川盈孚`
- DATA_SOURCE_NAME_STOCK_PLANT = `存量装置`
- DATA_SOURCE_NAME_CALCULATE_CORRELATION = `相关性计算`
- DATA_SOURCE_NAME_NATIONAL_STATISTICS = `国家统计局`
- DATA_SOURCE_NAME_CALCULATE_LJZZJ = `累计值转季值`
- DATA_SOURCE_NAME_CALCULATE_LJZ = `累计值`
- DATA_SOURCE_NAME_CALCULATE_LJZNCZJ = `年初至今累计值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_LJZZJ = `预测累计值转季值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_LJZ = `预测累计值`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_LJZNCZJ = `预测年初至今累计值`
- DATA_SOURCE_NAME_CALCULATE_STANDARD_DEVIATION = `标准差`
- DATA_SOURCE_NAME_CALCULATE_PERCENTILE = `百分位`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_STANDARD_DEVIATION = `预测标准差`
- DATA_SOURCE_NAME_PREDICT_CALCULATE_PERCENTILE = `预测百分位`
- DATA_SOURCE_NAME_FUBAO = `富宝数据`
- )
- var (
- BASE_START_DATE = time.Now().AddDate(-30, 0, 0).Format(FormatDate)
- BASE_END_DATE = time.Now().AddDate(4, 0, 0).Format(FormatDate)
- BASE_START_DATE_UnSpace = time.Now().AddDate(-30, 0, 0).Format(FormatDateUnSpace)
- BASE_END_DATE_UnSpace = time.Now().AddDate(4, 0, 0).Format(FormatDateUnSpace)
- )
- const (
- DATA_PREFIX = "hz_data"
- CHART_PREFIX = "hz_chart"
- )
- const (
- DATA_REFRESH = 7
- DATA_END_DATE_LIMIT = 4
- )
- const (
- CACHE_EDB_DATA_ADD = "CACHE_EDB_DATA_ADD_"
- CACHE_EDB_DATA_REFRESH = "CACHE_EDB_DATA_REFRESH_"
- CACHE_WIND_URL = "CACHE_WIND_URL"
- CACHE_CHART_INFO_DATA = "chart:info:data:"
- CACHE_STOCK_PLANT_CALCULATE = "CACHE_STOCK_PLANT_CALCULATE_"
- )
- var MonthQuarterMap = map[int]int{
- 1: 1,
- 2: 1,
- 3: 1,
- 4: 2,
- 5: 2,
- 6: 2,
- 7: 3,
- 8: 3,
- 9: 3,
- 10: 4,
- 11: 4,
- 12: 4,
- }
- var FrequencyDaysMap = map[string]int{
- "天": 1, "周": 7, "月": 30, "季": 90, "年": 365,
- }
- const (
- ROLE_TYPE_ADMIN = "管理员"
- ROLE_TYPE_FICC_ADMIN = "ficc管理员"
- ROLE_TYPE_FICC_SELLER = "ficc销售"
- ROLE_TYPE_RAI_ADMIN = "权益管理员"
- ROLE_TYPE_RAI_SELLER = "权益销售"
- ROLE_TYPE_FICC_GROUP = "ficc销售组长"
- ROLE_TYPE_FICC_MANAGER = "ficc销售主管"
- ROLE_TYPE_RAI_GROUP = "权益组长"
- ROLE_TYPE_FICC_DEPARTMENT = "ficc部门经理"
- ROLE_TYPE_RAI_DEPARTMENT = "权益部门经理"
- ROLE_TYPE_FICC_RESEARCHR = "ficc研究员"
- ROLE_TYPE_RAI_RESEARCHR = "权益研究员"
- ROLE_NAME_FICC_DIRECTOR = "ficc销售经理"
- ROLE_TYPE_CODE_ADMIN = "admin"
- ROLE_TYPE_CODE_FICC_ADMIN = "ficc_admin"
- ROLE_TYPE_CODE_FICC_SELLER = "ficc_seller"
- ROLE_TYPE_CODE_RAI_ADMIN = "rai_admin"
- ROLE_TYPE_CODE_RAI_SELLER = "rai_seller"
- ROLE_TYPE_CODE_FICC_GROUP = "ficc_group"
- ROLE_TYPE_CODE_RAI_GROUP = "rai_group"
- ROLE_TYPE_CODE_FICC_DEPARTMENT = "ficc_department"
- ROLE_TYPE_CODE_RAI_DEPARTMENT = "rai_department"
- ROLE_TYPE_CODE_FICC_RESEARCHR = "ficc_researcher"
- ROLE_TYPE_CODE_RESEARCHR = "researcher"
- ROLE_TYPE_CODE_RAI_RESEARCHR = "rai_researcher"
- ROLE_TYPE_CODE_COMPLIANCE = "compliance"
- ROLE_TYPE_CODE_FINANCE = "finance"
- ROLE_TYPE_CODE_FICC_TEAM = "ficc_team"
- )
- const (
- COMPANY_PRODUCT_FICC_ID = 1
- COMPANY_PRODUCT_FICC_NAME = "ficc"
- COMPANY_PRODUCT_RAI_ID = 2
- COMPANY_PRODUCT_RAI_NAME = "权益"
- )
- const (
- ZhLangVersion = "zh"
- EnLangVersion = "en"
- )
- const (
- CACHE_ACCESS_TOKEN_LOGIN = "eta_forum_admin:login:"
- CACHE_ACCESS_TOKEN_LOGIN_NO_TRUST = "eta_forum_admin:login:no_trust:"
- CACHE_CHART_CLASSIFY = "eta_forum_admin:chart:classify"
- LoginCacheTime = 600
- CACHE_KEY_ADMIN_OPERATE_RECORD = "eta_forum_admin:list:admin_operate_record"
- )
- const (
- UserLoginSalt = "MiQM9yusNA9T2uIH"
- DesKeySalt = "JMCqSoUrTAmyNNIRb0TtlrPk"
- )
- const (
- CACHE_CRM_AUTH_CODE_PREFIX = "eta_forum:crm_auth_code:"
- CACHE_FORUM_AUTH_CODE_PREFIX = "eta_forum:forum_auth_code:"
- )
- const (
- CHART_TYPE_CURVE = 1
- CHART_TYPE_SEASON = 2
- CHART_TYPE_BAR = 7
- CHART_TYPE_SECTION_SCATTER = 10
- CHART_TYPE_RADAR = 11
- CHART_TYPE_SECTION_COMBINE = 14
- )
- const (
- CHART_SOURCE_DEFAULT = 1
- CHART_SOURCE_FUTURE_GOOD = 2
- CHART_SOURCE_CORRELATION = 3
- CHART_SOURCE_ROLLING_CORRELATION = 4
- CHART_SOURCE_FUTURE_GOOD_PROFIT = 5
- CHART_SOURCE_LINE_EQUATION = 6
- CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION = 7
- CHART_SOURCE_LINE_FEATURE_PERCENTILE = 8
- CHART_SOURCE_LINE_FEATURE_FREQUENCY = 9
- CHART_SOURCE_CROSS_HEDGING = 10
- )
- var DataSourceEnMap = map[int]string{
- DATA_SOURCE_WIND: "Wind",
- DATA_SOURCE_THS: "iFind",
- DATA_SOURCE_PB: "Bloomberg",
- DATA_SOURCE_PB_FINANCE: "Bloomberg Finance",
- DATA_SOURCE_LT: "Reuters",
- DATA_SOURCE_MANUAL: "Horizon Insights",
- DATA_SOURCE_LZ: "OilChem",
- DATA_SOURCE_YS: "SMM",
- DATA_SOURCE_GL: "MySteel",
- DATA_SOURCE_ZZ: "Zhengzhou Commodity Exchange",
- DATA_SOURCE_DL: "Dalian Commodity Exchange",
- DATA_SOURCE_SH: "Shanghai Futures Exchange",
- DATA_SOURCE_CFFEX: "China Financial Futures Exchange",
- DATA_SOURCE_SHFE: "Shanghai International Energy Exchange",
- DATA_SOURCE_GIE: "Eurostat",
- DATA_SOURCE_COAL: "China Coal Transport & Distribution Association",
- DATA_SOURCE_GOOGLE_TRAVEL: "Our World in Data",
- DATA_SOURCE_EIA_STEO: "Energy Information Administration",
- DATA_SOURCE_COM_TRADE: "United Nations",
- DATA_SOURCE_SCI: "Sublime China Information",
- DATA_SOURCE_BAIINFO: "BAIINFO",
- DATA_SOURCE_MYSTEEL_CHEMICAL: "Horizon Insights",
- DATA_SOURCE_FUBAO: "FuBao",
- }
- const BusinessCodeSalt = "dr7WY0OZgGR7upw1"
- const HzCompanyName = "弘则研究"
- const HzBusinessCodeRelease = "E2023080900"
- const DIR_MOD fs.FileMode = 0766
- const (
- STORAGESOURCE_OSS_NAME = "oss"
- STORAGESOURCE_MINIO_NAME = "minio"
- STORAGESOURCE_S3_NAME = "s3"
- )
- const (
- COMPANY_CLASSIFY_FICC = "ficc"
- COMPANY_CLASSIFY_RAI = "权益"
- COMPANY_CLASSIFY_PARTNER = "合作伙伴"
- )
|