From 12710ae39cd9cec6cb4fe96aaa0a617bf34cebb3 Mon Sep 17 00:00:00 2001 From: workpc Date: Tue, 1 Apr 2025 19:08:10 +0800 Subject: [PATCH] =?UTF-8?q?2025=E5=B9=B44=E6=9C=881=E6=97=A5=E5=8F=91?= =?UTF-8?q?=E7=89=88=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_jingbo.py | 221 ++++++++++++++++++++++++++--------- config_jingbo_yuedu.py | 215 +++++++++++++++++++++++++--------- config_jingbo_zhoudu.py | 209 +++++++++++++++++++++++++-------- lib/dataread.py | 3 +- main_yuanyou.py | 5 + main_yuanyou_yuedu.py | 4 +- main_yuanyou_zhoudu.py | 4 +- models/nerulforcastmodels.py | 28 +++-- 8 files changed, 516 insertions(+), 173 deletions(-) diff --git a/config_jingbo.py b/config_jingbo.py index b81d713..9a35fa1 100644 --- a/config_jingbo.py +++ b/config_jingbo.py @@ -89,24 +89,20 @@ data = { ClassifyId = 1214 -# 变量定义--测试环境 -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" }, @@ -114,45 +110,48 @@ login_data = { "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": "新增", @@ -176,26 +175,134 @@ push_data_value_list_data = { } # 八大维度数据项编码 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 # 是否调试 @@ -205,9 +312,9 @@ is_timefurture = True # 是否使用时间特征 is_fivemodels = False # 是否使用之前保存的最佳的5个模型 is_edbcode = False # 特征使用edbcoding列表中的 is_edbnamelist = False # 自定义特征,对应上面的edbnamelist -is_update_eta = False # 预测结果上传到eta +is_update_eta = True # 预测结果上传到eta is_update_report = True # 是否上传报告 -is_update_warning_data = False # 是否上传预警数据 +is_update_warning_data = True # 是否上传预警数据 is_update_predict_value = True # 是否上传预测值到市场信息平台 is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 ,0 为不删除,0.6 表示删除相关性小于0.6的特征 is_del_tow_month = True # 是否删除两个月不更新的特征 diff --git a/config_jingbo_yuedu.py b/config_jingbo_yuedu.py index 0571968..2dd952f 100644 --- a/config_jingbo_yuedu.py +++ b/config_jingbo_yuedu.py @@ -89,21 +89,20 @@ data = { ClassifyId = 1214 -# 变量定义--测试环境 -server_host = '192.168.100.53:8080' # 内网 -# server_host = '183.242.74.28' # 外网 -login_pushreport_url = f"http://{server_host}/jingbo-dev/api/server/login" -upload_url = f"http://{server_host}/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" -upload_warning_url = f"http://{server_host}/jingbo-dev/api/basicBuiness/crudeOilWarning/save" -query_data_list_item_nos_url = f"http://{server_host}/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}/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" }, @@ -111,45 +110,48 @@ login_data = { "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": "新增", @@ -173,26 +175,135 @@ push_data_value_list_data = { } # 八大维度数据项编码 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:8080' # 内网 +# # server_host = '183.242.74.28' # 外网 +# login_pushreport_url = f"http://{server_host}/jingbo-dev/api/server/login" +# upload_url = f"http://{server_host}/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" +# upload_warning_url = f"http://{server_host}/jingbo-dev/api/basicBuiness/crudeOilWarning/save" +# query_data_list_item_nos_url = f"http://{server_host}/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos" +# # 上传数据项值 +# push_data_value_list_url = f"http://{server_host}/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 # 是否调试 diff --git a/config_jingbo_zhoudu.py b/config_jingbo_zhoudu.py index 654bed9..c02ff4f 100644 --- a/config_jingbo_zhoudu.py +++ b/config_jingbo_zhoudu.py @@ -89,22 +89,20 @@ data = { ClassifyId = 1214 -# 变量定义--测试环境 -server_host = '192.168.100.53:8080' # 内网 -# server_host = '183.242.74.28' # 外网 -login_pushreport_url = f"http://{server_host}/jingbo-dev/api/server/login" -upload_url = f"http://{server_host}/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" -upload_warning_url = f"http://{server_host}/jingbo-dev/api/basicBuiness/crudeOilWarning/save" -query_data_list_item_nos_url = f"http://{server_host}/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}/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" }, @@ -112,43 +110,48 @@ login_data = { "funcOperation": "获取token" } + + upload_data = { - "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 = { - "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": "新增", @@ -172,26 +175,132 @@ push_data_value_list_data = { } # 八大维度数据项编码 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:8080' # 内网 +# # server_host = '183.242.74.28' # 外网 + +# login_pushreport_url = f"http://{server_host}/jingbo-dev/api/server/login" +# upload_url = f"http://{server_host}/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" +# upload_warning_url = f"http://{server_host}/jingbo-dev/api/basicBuiness/crudeOilWarning/save" +# query_data_list_item_nos_url = f"http://{server_host}/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos" +# # 上传数据项值 +# push_data_value_list_url = f"http://{server_host}/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 = { +# "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 = { +# "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 # 是否调试 diff --git a/lib/dataread.py b/lib/dataread.py index 9923b3a..e10e23e 100644 --- a/lib/dataread.py +++ b/lib/dataread.py @@ -2353,7 +2353,8 @@ def get_bdwd_predict_data(): df2['date'] = df2['date'].dt.strftime('%Y-%m-%d') # df = pd.merge(df, df2, how='left', on='date') # 更改列名: - df2.rename(columns={'yyycbdwdbz':'本周','yyycbdwdcey':'次二月','yyycbdwdcr':'次日','yyycbdwdcsiy':'次四月','yyycbdwdcsy':'次三月','yyycbdwdcy':'次月','yyycbdwdcz':'次周','yyycbdwdgz':'隔周',}, inplace=True) + # df2.rename(columns={'yyycbdwdbz':'本周','yyycbdwdcey':'次二月','yyycbdwdcr':'次日','yyycbdwdcsiy':'次四月','yyycbdwdcsy':'次三月','yyycbdwdcy':'次月','yyycbdwdcz':'次周','yyycbdwdgz':'隔周',}, inplace=True) + df2.rename(columns={'原油大数据预测|FORECAST|PRICE|W':'本周','原油大数据预测|FORECAST|PRICE|M_2':'次二月','原油大数据预测|FORECAST|PRICE|T':'次日','原油大数据预测|FORECAST|PRICE|M_4':'次四月','原油大数据预测|FORECAST|PRICE|M_3':'次三月','原油大数据预测|FORECAST|PRICE|M_1':'次月','原油大数据预测|FORECAST|PRICE|W_1':'次周','原油大数据预测|FORECAST|PRICE|W_2':'隔周',}, inplace=True) # 更改显示顺序 df2 = df2[['date','次日','本周','次周','隔周','次月','次二月','次三月','次四月']] print(df2) diff --git a/main_yuanyou.py b/main_yuanyou.py index f51df4c..6b1584f 100644 --- a/main_yuanyou.py +++ b/main_yuanyou.py @@ -51,6 +51,7 @@ global_config.update({ 'login_pushreport_url': login_pushreport_url, 'login_data': login_data, 'upload_url': upload_url, + 'upload_data': upload_data, 'upload_warning_url': upload_warning_url, 'warning_data': warning_data, @@ -99,6 +100,9 @@ def push_market_value(): # 取模型前十 top_models = top_models_df['模型(Model)'].head(10).tolist() + # 去掉FDBformer + if 'FEDformer' in top_models: + top_models.remove('FEDformer') # 计算前十模型的均值 predictdata_df['top_models_mean'] = predictdata_df[top_models].mean(axis=1) @@ -449,3 +453,4 @@ if __name__ == '__main__': # predict_main() predict_main() + # push_market_value() diff --git a/main_yuanyou_yuedu.py b/main_yuanyou_yuedu.py index 1e2475a..64fe5f1 100644 --- a/main_yuanyou_yuedu.py +++ b/main_yuanyou_yuedu.py @@ -98,7 +98,9 @@ def push_market_value(): # 取模型前十 top_models = top_models_df['模型(Model)'].head(10).tolist() - + # 去掉FDBformer + if 'FEDformer' in top_models: + top_models.remove('FEDformer') # 计算前十模型的均值 predictdata_df['top_models_mean'] = predictdata_df[top_models].mean(axis=1) diff --git a/main_yuanyou_zhoudu.py b/main_yuanyou_zhoudu.py index aaffb87..c000419 100644 --- a/main_yuanyou_zhoudu.py +++ b/main_yuanyou_zhoudu.py @@ -97,7 +97,9 @@ def push_market_value(): # 取模型前十 top_models = top_models_df['模型(Model)'].head(10).tolist() - + # 去掉FDBformer + if 'FEDformer' in top_models: + top_models.remove('FEDformer') # 计算前十模型的均值 predictdata_df['top_models_mean'] = predictdata_df[top_models].mean(axis=1) diff --git a/models/nerulforcastmodels.py b/models/nerulforcastmodels.py index b7d75ad..3399d85 100644 --- a/models/nerulforcastmodels.py +++ b/models/nerulforcastmodels.py @@ -243,6 +243,8 @@ def ex_Model(df, horizon, input_size, train_steps, val_check_steps, early_stop_p dates = df_predict['ds'].dt.strftime('%Y-%m-%d') for m in modelsindex.keys(): + if m == 'FEDformer': + continue list = [] for date, value in zip(dates, df_predict[m].round(2)): list.append({'Date': date, 'Value': value}) @@ -2264,8 +2266,12 @@ def brent_export_pdf(num_indicators=475, num_models=21, num_dayindicator=202, in config.dataset, 'model_evaluation.csv'), encoding='utf-8') # 按评估指标排序,取前五 fivemodels_list = eval_df['模型(Model)'].values # 列表形式,后面当作列名索引使用 + eval_models_list = fivemodels_list.tolist() + # 去掉FEDformer + if 'FEDformer' in eval_models_list: + eval_models_list.remove('FEDformer') # 取 fivemodels_list 和 ds 列 - df = df[['ds'] + fivemodels_list.tolist()] + df = df[['ds'] + eval_models_list] # 拼接预测日期对应的真实值 df = pd.merge(df, df_true, on='ds', how='left') # 删除全部为nan的列 @@ -2496,16 +2502,16 @@ def brent_export_pdf(num_indicators=475, num_models=21, num_dayindicator=202, in config.dataset, reportname), pagesize=letter) doc.build(content) # pdf 上传到数字化信息平台 - # try: - # if config.is_update_report: - # with open(os.path.join(config.dataset, reportname), 'rb') as f: - # base64_data = base64.b64encode(f.read()).decode('utf-8') - # config.upload_data["data"]["fileBase64"] = base64_data - # config.upload_data["data"]["fileName"] = reportname - # token = get_head_auth_report() - # upload_report_data(token, config.upload_data) - # except TimeoutError as e: - # print(f"请求超时: {e}") + try: + if config.is_update_report: + with open(os.path.join(config.dataset, reportname), 'rb') as f: + base64_data = base64.b64encode(f.read()).decode('utf-8') + config.upload_data["data"]["fileBase64"] = base64_data + config.upload_data["data"]["fileName"] = reportname + token = get_head_auth_report() + upload_report_data(token, config.upload_data) + except TimeoutError as e: + print(f"请求超时: {e}") @exception_logger