2022-04-27 17:15:36 +08:00
|
|
|
from flask import Blueprint, request, Response
|
|
|
|
|
2022-04-29 15:08:11 +08:00
|
|
|
from Implements.Company.IndexImpl import CompanyIndexImpl
|
|
|
|
from Implements.Industry.IndustryImpl import IndustryReportRecordImpl
|
2022-04-27 17:15:36 +08:00
|
|
|
from Implements.Others.TFSEFileImpl import TFSEFileImpl
|
|
|
|
from Utils.AuthUtil import verify_token, verify_report_view_auth
|
|
|
|
|
|
|
|
|
|
|
|
file_route = Blueprint('file', __name__)
|
|
|
|
|
|
|
|
|
2022-04-29 11:27:24 +08:00
|
|
|
@file_route.route('/get_cc_rating_report', methods=['GET'])
|
2022-04-27 17:15:36 +08:00
|
|
|
@verify_token
|
2022-04-29 11:27:24 +08:00
|
|
|
@verify_report_view_auth
|
2022-04-29 11:34:29 +08:00
|
|
|
def get_cc_rating_report_route(**kwargs):
|
2022-04-29 11:27:24 +08:00
|
|
|
"""获取综信报告"""
|
2022-04-27 17:15:36 +08:00
|
|
|
impl = TFSEFileImpl()
|
2022-04-29 11:27:24 +08:00
|
|
|
impl.file_bucket = '综信报告'
|
|
|
|
impl.file_id = request.args.get('file_id')
|
|
|
|
impl.get_pdf()
|
2022-04-29 11:34:29 +08:00
|
|
|
return impl.dict_to_return()
|
2022-04-29 11:27:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
@file_route.route('/get_cc_rating_certificate', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@verify_report_view_auth
|
2022-04-29 11:34:29 +08:00
|
|
|
def get_cc_rating_certificate_route(**kwargs):
|
2022-04-29 11:27:24 +08:00
|
|
|
"""获取综信证书"""
|
|
|
|
impl = TFSEFileImpl()
|
|
|
|
impl.file_bucket = '综信证书'
|
|
|
|
impl.file_id = request.args.get('file_id')
|
|
|
|
impl.get_pdf()
|
|
|
|
if impl.file_body:
|
|
|
|
return impl.dict_to_return()
|
|
|
|
else:
|
|
|
|
return {"info": "文件不存在"}, 200
|
|
|
|
|
|
|
|
|
|
|
|
@file_route.route('/get_esg_rating_report', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@verify_report_view_auth
|
2022-04-29 11:34:29 +08:00
|
|
|
def get_esg_rating_report_route(**kwargs):
|
2022-04-29 11:27:24 +08:00
|
|
|
"""获取ESG评价报告"""
|
|
|
|
impl = TFSEFileImpl()
|
|
|
|
impl.file_bucket = 'ESG报告'
|
|
|
|
impl.file_id = request.args.get('file_id')
|
|
|
|
impl.get_pdf()
|
|
|
|
if impl.file_body:
|
|
|
|
return impl.dict_to_return()
|
|
|
|
else:
|
|
|
|
return {"info": "文件不存在"}, 200
|
|
|
|
|
|
|
|
|
|
|
|
@file_route.route('/get_esg_rating_certificate', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@verify_report_view_auth
|
2022-04-29 11:34:29 +08:00
|
|
|
def get_esg_rating_certificate_route(**kwargs):
|
2022-04-29 11:27:24 +08:00
|
|
|
"""获取ESG评价证书"""
|
|
|
|
impl = TFSEFileImpl()
|
|
|
|
impl.file_bucket = 'ESG证书'
|
2022-04-27 17:15:36 +08:00
|
|
|
impl.file_id = request.args.get('file_id')
|
|
|
|
impl.get_pdf()
|
|
|
|
if impl.file_body:
|
|
|
|
return impl.dict_to_return()
|
|
|
|
else:
|
|
|
|
return {"info": "文件不存在"}, 200
|
2022-04-29 15:08:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
@file_route.route('/get_industry_report', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
def get_industry_report_route(**kwargs):
|
|
|
|
"""获取行业报告"""
|
|
|
|
company_impl = CompanyIndexImpl()
|
|
|
|
company_impl.cid = kwargs['cid']
|
|
|
|
company_impl.get_industry_type()
|
|
|
|
|
|
|
|
industry_impl = IndustryReportRecordImpl()
|
|
|
|
industry_impl.industry = company_impl.industry
|
|
|
|
industry_impl.get_latest_fid()
|
|
|
|
|
|
|
|
file_impl = TFSEFileImpl()
|
|
|
|
file_impl.file_bucket = '行业分析报告'
|
|
|
|
file_impl.file_id = industry_impl.fid
|
|
|
|
file_impl.get_pdf()
|
|
|
|
if file_impl.file_body:
|
|
|
|
return file_impl.dict_to_return()
|
|
|
|
else:
|
|
|
|
return {"info": "文件不存在"}, 200
|