tfse-admin-api-v0.2/Manage/Macro/Implements/MacroImpl.py

40 lines
1.2 KiB
Python
Raw Normal View History

2022-05-18 15:16:34 +08:00
import time
from Manage.Macro.Objects.MacroObject import IndustryReport
from DBHelper.MongoHelper import MongoHelper
class MacroImpl(IndustryReport):
"""宏观数据类"""
db = MongoHelper("tfse_v0.21")
def upload_macroscopic_report(self, file):
"""宏观报告上传"""
file_name = self.industry + '宏观报告'
self.report_fid = self.db.upload_file('文件', '行业分析报告', file_name, file)
self.title = file_name
self.upload_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
insert = self.dict_keys_toggle()
self.db.insert_single_data(
'行业数据',
'行业报告',
insert
)
return self.report_fid
def search_macroscopic_report(self):
"""根据行业名称查询宏观报告"""
result = self.db.find_all_data(
'行业数据',
'行业报告',
{'一级行业': self.industry},
['一级行业', '报告标题', '上传日期', '报告fid']
)
if result:
for item in result:
item['报告fid'] = '/file/get_industry_report?file_id={}'.format(item['报告fid'])
return result