diff --git a/config_jingbo.py b/config_jingbo.py index 9a35fa1..83cd9b9 100644 --- a/config_jingbo.py +++ b/config_jingbo.py @@ -91,129 +91,18 @@ ClassifyId = 1214 ################################################################################################################ 变量定义--线上环境 -server_host = '10.200.32.39' -login_pushreport_url = "http://10.200.32.39/jingbo-api/api/server/login" -upload_url = "http://10.200.32.39/jingbo-api/api/analysis/reportInfo/researchUploadReportSave" -upload_warning_url = "http://10.200.32.39/jingbo-api/api/basicBuiness/crudeOilWarning/save" -query_data_list_item_nos_url = f"http://{server_host}/jingbo-api/api/warehouse/dwDataItem/queryDataListItemNos" -# 上传数据项值 -push_data_value_list_url = f"http://{server_host}/jingbo-api/api/dw/dataValue/pushDataValueList" - -login_data = { - "data": { - "account": "api_dev", - "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", - "tenantHashCode": "8a4577dbd919675758d57999a1e891fe", - "terminal": "API" - }, - "funcModule": "API", - "funcOperation": "获取token" -} - - - -upload_data = { - "funcModule":'研究报告信息', - "funcOperation":'上传原油价格预测报告', - "data":{ - "groupNo":'', # 用户组id - "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋 - "reportType":'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST - "fileName": '', #文件名称 - "fileBase64": '' ,#文件内容base64 - "categoryNo":'yyjgycbg', # 研究报告分类编码 - "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码 - "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋 - "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部 - "productGroupCode":"RAW_MATERIAL" # 商品分类 - } -} - -warning_data = { - "groupNo":'', # 用户组id - "funcModule":'原油特征停更预警', - "funcOperation":'原油特征停更预警', - "data":{ - 'WARNING_TYPE_NAME':'特征数据停更预警', - 'WARNING_CONTENT':'', - 'WARNING_DATE':'' - } -} - -query_data_list_item_nos_data = { - "funcModule": "数据项", - "funcOperation": "查询", - "data": { - "dateStart":"20200101", - "dateEnd":"20241231", - "dataItemNoList":["Brentzdj","Brentzgj"] # 数据项编码,代表 brent最低价和最高价 - } -} - - - -push_data_value_list_data = { - "funcModule": "数据表信息列表", - "funcOperation": "新增", - "data": [ - {"dataItemNo": "91230600716676129", - "dataDate": "20230113", - "dataStatus": "add", - "dataValue": 100.11 - }, - {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", - "dataDate": "20230113", - "dataStatus": "add", - "dataValue": 100.55 - }, - {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", - "dataDate": "20230113", - "dataStatus": "add", - "dataValue": 100.55 - } - ] -} -# 八大维度数据项编码 -bdwd_items = { - 'ciri': '原油大数据预测|FORECAST|PRICE|T', - 'benzhou': '原油大数据预测|FORECAST|PRICE|W', - 'cizhou': '原油大数据预测|FORECAST|PRICE|W_1', - 'gezhou': '原油大数据预测|FORECAST|PRICE|W_2', - 'ciyue': '原油大数据预测|FORECAST|PRICE|M_1', - 'cieryue': '原油大数据预测|FORECAST|PRICE|M_2', - 'cisanyue': '原油大数据预测|FORECAST|PRICE|M_3', - 'cisiyue': '原油大数据预测|FORECAST|PRICE|M_4', -} - - -# 生产环境数据库 -host = 'rm-2zehj3r1n60ttz9x5.mysql.rds.aliyuncs.com' -port = 3306 -dbusername ='jingbo' -password = 'shihua@123' -dbname = 'jingbo' -table_name = 'v_tbl_crude_oil_warning' - - - -# # 变量定义--测试环境 -# server_host = '192.168.100.53' # 内网 -# # server_host = '183.242.74.28' # 外网 -# login_pushreport_url = f"http://{server_host}:8080/jingbo-dev/api/server/login" -# # 上传报告 -# upload_url = f"http://{server_host}:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" -# # 停更预警 -# upload_warning_url = f"http://{server_host}:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save" -# # 查询数据项编码 -# query_data_list_item_nos_url = f"http://{server_host}:8080/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos" +# server_host = '10.200.32.39' +# login_pushreport_url = "http://10.200.32.39/jingbo-api/api/server/login" +# upload_url = "http://10.200.32.39/jingbo-api/api/analysis/reportInfo/researchUploadReportSave" +# upload_warning_url = "http://10.200.32.39/jingbo-api/api/basicBuiness/crudeOilWarning/save" +# query_data_list_item_nos_url = f"http://{server_host}/jingbo-api/api/warehouse/dwDataItem/queryDataListItemNos" # # 上传数据项值 -# push_data_value_list_url = f"http://{server_host}:8080/jingbo-dev/api/dw/dataValue/pushDataValueList" +# push_data_value_list_url = f"http://{server_host}/jingbo-api/api/dw/dataValue/pushDataValueList" # login_data = { # "data": { -# "account": "api_test", -# # "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=", # Shihua@123456 -# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # 123456 +# "account": "api_dev", +# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # "tenantHashCode": "8a4577dbd919675758d57999a1e891fe", # "terminal": "API" # }, @@ -221,45 +110,48 @@ table_name = 'v_tbl_crude_oil_warning' # "funcOperation": "获取token" # } + + # upload_data = { -# "groupNo": '', # 用户组id -# "funcModule": '研究报告信息', -# "funcOperation": '上传原油价格预测报告', -# "data": { -# "ownerAccount": 'arui', # 报告所属用户账号 -# "reportType": 'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST -# "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', # 文件名称 -# "fileBase64": '', # 文件内容base64 -# "categoryNo": 'yyjgycbg', # 研究报告分类编码 -# "smartBusinessClassCode": 'YCJGYCBG', # 分析报告分类编码 -# "reportEmployeeCode": "E40116", # 报告人 -# "reportDeptCode": "D0044", # 报告部门 -# "productGroupCode": "RAW_MATERIAL" # 商品分类 -# } +# "funcModule":'研究报告信息', +# "funcOperation":'上传原油价格预测报告', +# "data":{ +# "groupNo":'', # 用户组id +# "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋 +# "reportType":'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST +# "fileName": '', #文件名称 +# "fileBase64": '' ,#文件内容base64 +# "categoryNo":'yyjgycbg', # 研究报告分类编码 +# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码 +# "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋 +# "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部 +# "productGroupCode":"RAW_MATERIAL" # 商品分类 +# } # } - # warning_data = { -# "groupNo": '', # 用户组id -# "funcModule": '原油特征停更预警', -# "funcOperation": '原油特征停更预警', -# "data": { -# 'WARNING_TYPE_NAME': '特征数据停更预警', -# 'WARNING_CONTENT': '', -# 'WARNING_DATE': '' -# } +# "groupNo":'', # 用户组id +# "funcModule":'原油特征停更预警', +# "funcOperation":'原油特征停更预警', +# "data":{ +# 'WARNING_TYPE_NAME':'特征数据停更预警', +# 'WARNING_CONTENT':'', +# 'WARNING_DATE':'' +# } # } # query_data_list_item_nos_data = { -# "funcModule": "数据项", -# "funcOperation": "查询", +# "funcModule": "数据项", +# "funcOperation": "查询", # "data": { -# "dateStart": "20200101", -# "dateEnd": "20241231", -# "dataItemNoList": ["Brentzdj", "Brentzgj"] # 数据项编码,代表 brent最低价和最高价 +# "dateStart":"20200101", +# "dateEnd":"20241231", +# "dataItemNoList":["Brentzdj","Brentzgj"] # 数据项编码,代表 brent最低价和最高价 # } # } + + # push_data_value_list_data = { # "funcModule": "数据表信息列表", # "funcOperation": "新增", @@ -283,30 +175,138 @@ table_name = 'v_tbl_crude_oil_warning' # } # # 八大维度数据项编码 # bdwd_items = { -# 'ciri': 'yyycbdwdcr', -# 'benzhou': 'yyycbdwdbz', -# 'cizhou': 'yyycbdwdcz', -# 'gezhou': 'yyycbdwdgz', -# 'ciyue': 'yyycbdwdcy', -# 'cieryue': 'yyycbdwdcey', -# 'cisanyue': 'yyycbdwdcsy', -# 'cisiyue': 'yyycbdwdcsiy', +# 'ciri': '原油大数据预测|FORECAST|PRICE|T', +# 'benzhou': '原油大数据预测|FORECAST|PRICE|W', +# 'cizhou': '原油大数据预测|FORECAST|PRICE|W_1', +# 'gezhou': '原油大数据预测|FORECAST|PRICE|W_2', +# 'ciyue': '原油大数据预测|FORECAST|PRICE|M_1', +# 'cieryue': '原油大数据预测|FORECAST|PRICE|M_2', +# 'cisanyue': '原油大数据预测|FORECAST|PRICE|M_3', +# 'cisiyue': '原油大数据预测|FORECAST|PRICE|M_4', # } -# # 北京环境数据库 -# host = '192.168.101.27' +# # 生产环境数据库 +# host = 'rm-2zehj3r1n60ttz9x5.mysql.rds.aliyuncs.com' # port = 3306 -# dbusername = 'root' -# password = '123456' -# dbname = 'jingbo_test' +# dbusername ='jingbo' +# password = 'shihua@123' +# dbname = 'jingbo' # table_name = 'v_tbl_crude_oil_warning' + +# # 变量定义--测试环境 +server_host = '192.168.100.53' # 内网 +# server_host = '183.242.74.28' # 外网 +login_pushreport_url = f"http://{server_host}:8080/jingbo-dev/api/server/login" +# 上传报告 +upload_url = f"http://{server_host}:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" +# 停更预警 +upload_warning_url = f"http://{server_host}:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save" +# 查询数据项编码 +query_data_list_item_nos_url = f"http://{server_host}:8080/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos" +# 上传数据项值 +push_data_value_list_url = f"http://{server_host}:8080/jingbo-dev/api/dw/dataValue/pushDataValueList" + +login_data = { + "data": { + "account": "api_test", + # "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=", # Shihua@123456 + "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # 123456 + "tenantHashCode": "8a4577dbd919675758d57999a1e891fe", + "terminal": "API" + }, + "funcModule": "API", + "funcOperation": "获取token" +} + +upload_data = { + "groupNo": '', # 用户组id + "funcModule": '研究报告信息', + "funcOperation": '上传原油价格预测报告', + "data": { + "ownerAccount": 'arui', # 报告所属用户账号 + "reportType": 'OIL_PRICE_FORECAST', # 报告类型,固定为OIL_PRICE_FORECAST + "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', # 文件名称 + "fileBase64": '', # 文件内容base64 + "categoryNo": 'yyjgycbg', # 研究报告分类编码 + "smartBusinessClassCode": 'YCJGYCBG', # 分析报告分类编码 + "reportEmployeeCode": "E40116", # 报告人 + "reportDeptCode": "D0044", # 报告部门 + "productGroupCode": "RAW_MATERIAL" # 商品分类 + } +} + + +warning_data = { + "groupNo": '', # 用户组id + "funcModule": '原油特征停更预警', + "funcOperation": '原油特征停更预警', + "data": { + 'WARNING_TYPE_NAME': '特征数据停更预警', + 'WARNING_CONTENT': '', + 'WARNING_DATE': '' + } +} + +query_data_list_item_nos_data = { + "funcModule": "数据项", + "funcOperation": "查询", + "data": { + "dateStart": "20200101", + "dateEnd": "20241231", + "dataItemNoList": ["Brentzdj", "Brentzgj"] # 数据项编码,代表 brent最低价和最高价 + } +} + +push_data_value_list_data = { + "funcModule": "数据表信息列表", + "funcOperation": "新增", + "data": [ + {"dataItemNo": "91230600716676129", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.11 + }, + {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.55 + }, + {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.55 + } + ] +} +# 八大维度数据项编码 +bdwd_items = { + 'ciri': 'yyycbdwdcr', + 'benzhou': 'yyycbdwdbz', + 'cizhou': 'yyycbdwdcz', + 'gezhou': 'yyycbdwdgz', + 'ciyue': 'yyycbdwdcy', + 'cieryue': 'yyycbdwdcey', + 'cisanyue': 'yyycbdwdcsy', + 'cisiyue': 'yyycbdwdcsiy', +} + + +# 北京环境数据库 +host = '192.168.101.27' +port = 3306 +dbusername = 'root' +password = '123456' +dbname = 'jingbo_test' +table_name = 'v_tbl_crude_oil_warning' + + # 开关 is_train = True # 是否训练 is_debug = False # 是否调试 -is_eta = True # 是否使用eta接口 +is_eta = False # 是否使用eta接口 is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效 is_timefurture = True # 是否使用时间特征 is_fivemodels = False # 是否使用之前保存的最佳的5个模型 diff --git a/lib/dataread.py b/lib/dataread.py index e10e23e..dce83b2 100644 --- a/lib/dataread.py +++ b/lib/dataread.py @@ -106,6 +106,7 @@ global_config = { 'login_pushreport_url': None, 'login_data': None, 'upload_warning_headers': None, + 'warning_data': None, # ETA配置 'APPID': None, @@ -1170,7 +1171,8 @@ class Config: def upload_warning_url(self): return global_config['upload_warning_url'] @property def upload_warning_data(self): return global_config['upload_warning_data'] - + @property + def warning_data(self): return global_config['warning_data'] # 查询接口 @property def query_data_list_item_nos_url( diff --git a/main_yuanyou.py b/main_yuanyou.py index 6b1584f..98d7182 100644 --- a/main_yuanyou.py +++ b/main_yuanyou.py @@ -340,7 +340,7 @@ def predict_main(): try: if is_weekday: - # if True: + # if True: logger.info('今天是周一,发送特征预警') # 上传预警信息到数据库 warning_data_df = df_zhibiaoliebiao.copy()