2022-02-14 14:54:21 +08:00
|
|
|
from flask import Blueprint, request, Response
|
|
|
|
|
2022-03-01 15:41:58 +08:00
|
|
|
from file.file_obj import CreditRatingReportFile, CreditRatingCertificationFile, IndustryReportFile, \
|
|
|
|
CreditEsgReportFile, CreditESGCertificationFile
|
2022-02-14 14:54:21 +08:00
|
|
|
from user.user_auth import verify_token, authority_scope
|
|
|
|
|
|
|
|
file_route = Blueprint('file', __name__)
|
|
|
|
|
|
|
|
|
|
|
|
@file_route.route('/get_company_report', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@authority_scope(['admin', 'developer', 'analysts', 'operator', 'guest'])
|
|
|
|
def get_company_report_route(**kwargs):
|
|
|
|
"""
|
|
|
|
查看公司综合信用评价报告
|
|
|
|
"""
|
|
|
|
file = CreditRatingReportFile()
|
|
|
|
file.file_id = request.args.get('file_id')
|
|
|
|
file_stream = file.get_file()
|
|
|
|
if file_stream is not False:
|
|
|
|
return Response(file_stream, content_type='application/pdf')
|
|
|
|
else:
|
|
|
|
return {"info": "未找到文件"}, 404
|
|
|
|
|
|
|
|
|
2022-03-01 15:41:58 +08:00
|
|
|
@file_route.route('/get_company_esg_report', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@authority_scope(['admin', 'developer', 'analysts', 'operator', 'guest'])
|
2022-03-02 11:30:41 +08:00
|
|
|
def get_company_esg_report_route(**kwargs):
|
2022-03-01 15:41:58 +08:00
|
|
|
"""
|
|
|
|
查看公司ESG评价报告
|
|
|
|
"""
|
|
|
|
file = CreditEsgReportFile()
|
|
|
|
file.file_id = request.args.get('file_id')
|
|
|
|
file_stream = file.get_file()
|
|
|
|
if file_stream is not False:
|
|
|
|
return Response(file_stream, content_type='application/pdf')
|
|
|
|
else:
|
|
|
|
return {"info": "未找到文件"}, 404
|
|
|
|
|
|
|
|
|
2022-02-14 14:54:21 +08:00
|
|
|
@file_route.route('/get_certification', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@authority_scope(['admin', 'developer', 'analysts', 'operator', 'guest'])
|
|
|
|
def get_certification_route(**kwargs):
|
|
|
|
"""
|
|
|
|
查看公司综合信用评价证书
|
|
|
|
"""
|
|
|
|
file = CreditRatingCertificationFile()
|
|
|
|
file.file_id = request.args.get('file_id')
|
|
|
|
file_stream = file.get_file()
|
|
|
|
if file_stream is not False:
|
|
|
|
return Response(file_stream, content_type='application/pdf')
|
|
|
|
else:
|
|
|
|
return {"info": "未找到文件"}, 404
|
|
|
|
|
|
|
|
|
2022-03-01 15:41:58 +08:00
|
|
|
@file_route.route('/get_esg_certification', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@authority_scope(['admin', 'developer', 'analysts', 'operator', 'guest'])
|
2022-03-02 11:30:41 +08:00
|
|
|
def get_esg_certification_route(**kwargs):
|
2022-03-01 15:41:58 +08:00
|
|
|
"""
|
|
|
|
查看公司ESG评价证书
|
|
|
|
"""
|
|
|
|
file = CreditESGCertificationFile()
|
|
|
|
file.file_id = request.args.get('file_id')
|
|
|
|
file_stream = file.get_file()
|
|
|
|
if file_stream is not False:
|
|
|
|
return Response(file_stream, content_type='application/pdf')
|
|
|
|
else:
|
|
|
|
return {"info": "未找到文件"}, 404
|
|
|
|
|
|
|
|
|
2022-02-14 14:54:21 +08:00
|
|
|
@file_route.route('/get_industry_report', methods=['GET'])
|
|
|
|
@verify_token
|
|
|
|
@authority_scope(['admin', 'developer', 'analysts', 'operator', 'guest'])
|
|
|
|
def get_industry_report_route(**kwargs):
|
|
|
|
"""
|
|
|
|
查看行业报告
|
|
|
|
"""
|
|
|
|
file = IndustryReportFile()
|
|
|
|
file.file_id = request.args.get('file_id')
|
|
|
|
file_stream = file.get_file()
|
|
|
|
if file_stream is not False:
|
|
|
|
return Response(file_stream, content_type='application/pdf')
|
|
|
|
else:
|
|
|
|
return {"info": "未找到文件"}, 404
|