Merge branch 'v0.21' into 'master'

更新时间

See merge request root/tfse_admin!31
This commit is contained in:
FECR-IBD 2022-04-18 05:53:55 +00:00
commit 657fed280d
3 changed files with 51 additions and 2 deletions

View File

@ -70,7 +70,7 @@ class CompanyIndexApiImpl(CompanyIndexApi):
db = MongoHelper("tfse_v0.21")
head_info = CompanyIndexApi.HeadInfo()
update_tine = CompanyIndexApi
update_time = CompanyIndexApi.UpdateTime()
basic_info = CompanyIndexApi
financial_data = CompanyIndexApi
operating_risk = CompanyIndexApi
@ -97,3 +97,16 @@ class CompanyIndexApiImpl(CompanyIndexApi):
self.head_info.name = result['企业名称']
self.head_info.industry = result['一级行业']
def get_update_time(self):
""""""
results = self.db.find_all_data_with_single_sort(
"企业数据",
self.update_time.table_map[self.update_time.table],
{"企业ID": self.update_time.cid},
["更新日期"],
{"更新日期": -1}
)
self.update_time.update_time = [result['更新日期'] for result in results]

View File

@ -121,10 +121,30 @@ class CompanyIndexApi(SpecObject):
"industry": "所属行业",
}
class UpdateTime(SpecObject):
"""更新时间"""
table_map = {
"工商信息": "基本工商信息",
"经营风险": "经营风险分析",
"财务分析": "财务要素分析",
"综合信用分析": "综合信用分析",
"ESG评价分析": "ESG评价分析"
}
cid = ValidateAttr(field='cid', type=str, length=8)
table = ValidateAttr(field='table', type=str, in_list=list(table_map.keys()))
update_time = ValidateAttr(field='update_time', type=list)
fields_map = {
"cid": "企业ID",
"table": "table",
"update_time": "update_time"
}
def get_head_info(self):
"""头部信息"""
def get_update_tine(self):
def get_update_time(self):
"""更新时间"""
def get_basic_info(self):

View File

@ -67,6 +67,22 @@ def head_info_route(**kwargs):
return {"info": e.failed_info}, e.status_code
@company_route.route('/update_time', methods=['POST'])
@verify_token
def update_time_route(**kwargs):
"""更新时间"""
try:
req = request.json
impl = CompanyIndexApiImpl()
impl.update_time.cid = req['cid']
impl.update_time.table = req['table']
impl.get_update_time()
result = impl.update_time.dict_to_show(columns=['table', 'update_time'])
return result, 200
except ReturnConditionCheckFailed as e:
return {"info": e.failed_info}, e.status_code
@company_route.route('/index', methods=['POST'])
@verify_token
def index_route(**kwargs):