From bdc5dbc37b324b31e0736f84c6b4f2a7f1b28905 Mon Sep 17 00:00:00 2001 From: P3ngSaM <61768364+P3ngSaM@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:37:54 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=96=B0=E5=A2=9E=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=AB=AF=E6=9F=A5=E8=AF=A2esg=E6=8A=A5=E5=91=8A/=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file/file_impl.py | 24 ++++++++++++++++++++++++ file/file_obj.py | 8 +++++++- file/file_routes.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/file/file_impl.py b/file/file_impl.py index 5a84d5f..2c3095c 100644 --- a/file/file_impl.py +++ b/file/file_impl.py @@ -23,3 +23,27 @@ def company_general_rating_certification_by_fid(fid): """ filestream = find_file('评价证书', fid) return filestream + + +def company_esg_rating_report_by_fid(fid): + """ + 根据fid返回文件 + Args: + fid: + Returns: + filestream + """ + filestream = find_file('esg报告', fid) + return filestream + + +def company_esg_rating_certification_by_fid(fid): + """ + 根据fid返回文件 + Args: + fid: + Returns: + filestream + """ + filestream = find_file('ESG评价证书', fid) + return filestream diff --git a/file/file_obj.py b/file/file_obj.py index bbde6c2..2462001 100644 --- a/file/file_obj.py +++ b/file/file_obj.py @@ -1,4 +1,4 @@ -from file.file_impl import company_general_rating_report_by_fid, company_general_rating_certification_by_fid +from file.file_impl import * class TfseFile: @@ -11,3 +11,9 @@ class TfseFile: def get_general_certification(self): return company_general_rating_certification_by_fid(self.fid) + + def get_esg_report(self): + return company_esg_rating_report_by_fid(self.fid) + + def get_esg_certification(self): + return company_esg_rating_certification_by_fid(self.fid) \ No newline at end of file diff --git a/file/file_routes.py b/file/file_routes.py index 6ebb290..a4d3fad 100644 --- a/file/file_routes.py +++ b/file/file_routes.py @@ -38,3 +38,37 @@ def get_certification_route(**kwargs): tfse_file.fid = request.args.get('file_id') response = Response(tfse_file.get_general_certification(), content_type='application/pdf') return response + + +@file_route.route('/get_company_esg_report', methods=['GET']) +@verify_token +@verify_report_view_auth +def get_esg_company_report(**kwargs): + """ + 查看公司ESG评价报告 + Parameters: + - + Returns: + response pdf二进制文件流 + """ + tfse_file = TfseFile() + tfse_file.fid = request.args.get('file_id') + response = Response(tfse_file.get_esg_report(), content_type='application/pdf') + return response + + +@file_route.route('/get_esg_certification', methods=['GET']) +@verify_token +@verify_report_view_auth +def get_esg_certification_route(**kwargs): + """ + 查看公司评价结果证书 + Parameters: + - + Returns: + response pdf二进制文件流 + """ + tfse_file = TfseFile() + tfse_file.fid = request.args.get('file_id') + response = Response(tfse_file.get_esg_certification(), content_type='application/pdf') + return response