From 52dbdb5949f9aecd1b0c5136a7234f9aa1f9d443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A3=AE?= Date: Fri, 21 Jan 2022 16:50:26 +0800 Subject: [PATCH] =?UTF-8?q?update=20esg=E6=A8=A1=E5=9D=97/=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E8=AE=B0=E5=BD=95=E6=94=BE=E5=85=A5=E7=BB=8F=E8=90=A5?= =?UTF-8?q?=E9=A3=8E=E9=99=A9/=E5=A4=84=E7=90=86=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=AE=BD=E5=BA=A6=E6=BA=A2=E5=87=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Esg/EsgModel.py | 10 ++++++++++ Esg/__init__.py | 0 Esg/db.py | 14 ++++++++++++++ Esg/routes.py | 18 ++++++++++++++++++ Esg/scripts/__init__.py | 0 Rating/scripts/risk_score.py | 8 +++----- Report/scripts/PdfStyle.py | 10 +++++++--- Report/static/ReportTemplates/信息技术业.json | 2 +- Report/static/ReportTemplates/制造业.json | 2 +- 9 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 Esg/EsgModel.py create mode 100644 Esg/__init__.py create mode 100644 Esg/db.py create mode 100644 Esg/routes.py create mode 100644 Esg/scripts/__init__.py diff --git a/Esg/EsgModel.py b/Esg/EsgModel.py new file mode 100644 index 0000000..b71d7bc --- /dev/null +++ b/Esg/EsgModel.py @@ -0,0 +1,10 @@ + +class EsgModel: + """ + ESG评价模型 + """ + def __init__(self): + """ + 初始化数据 + """ + self.cid = None diff --git a/Esg/__init__.py b/Esg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Esg/db.py b/Esg/db.py new file mode 100644 index 0000000..1179e09 --- /dev/null +++ b/Esg/db.py @@ -0,0 +1,14 @@ +""" +Mongo_tfse +""" + +import pymongo + +DB_HOST = '116.63.130.34' +DB_USER = 'root' +DB_PASS = 'sromitdTW569kC#M' +DB_PORT = 27018 + +client = pymongo.MongoClient('mongodb://{}:{}@{}:{}'.format(DB_USER, DB_PASS, DB_HOST, DB_PORT)) + + diff --git a/Esg/routes.py b/Esg/routes.py new file mode 100644 index 0000000..d0b8b70 --- /dev/null +++ b/Esg/routes.py @@ -0,0 +1,18 @@ +from flask import Blueprint, request +from common.scripts import verify_token + +esg_route = Blueprint('esg', __name__) + + +@esg_route.route('/questionnaire_data_fill', methods=['POST']) +@verify_token +def data_fill(): + """ + ESG问卷填报数据保存 + Parameters: + cid str 企业ID + Returns: + result: 保存结构 + """ + pass + diff --git a/Esg/scripts/__init__.py b/Esg/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Rating/scripts/risk_score.py b/Rating/scripts/risk_score.py index 54130d7..559fe0c 100644 --- a/Rating/scripts/risk_score.py +++ b/Rating/scripts/risk_score.py @@ -30,6 +30,8 @@ def management_risk(param): score['诉讼'] = 10 if param['诉讼'] >= 50 else round(param['诉讼'] * 0.2, 2) score['送达公告'] = 5 if param['送达公告'] >= 50 else round(param['送达公告'] * 0.1, 2) score['股权出质'] = 5 if param['股权出质'] >= 10 else round(param['股权出质'] * 0.5, 2) + score['法人变更'] = 1.5 if param['法人变更'] >= 10 else round(param['法人变更'] * 0.15, 2) + score['主要成员变更'] = 1.5 if param['主要成员变更'] >= 10 else round(param['主要成员变更'] * 0.15, 2) score['合计'] = round(sum(score.values()), 2) return score @@ -40,13 +42,9 @@ def peripheral_risk(param): """ score = dict() score['周边风险'] = dict() - score['变更记录'] = dict() score['周边风险']['高风险'] = 5 if param['周边风险']['高风险'] >= 25 else round(param['周边风险']['高风险'] * 0.2, 2) score['周边风险']['警示'] = 5 if param['周边风险']['警示'] >= 50 else round(param['周边风险']['警示'] * 0.1, 2) score['周边风险']['合计'] = sum(score['周边风险'].values()) - score['变更记录']['法人变更'] = 1.5 if param['变更记录']['法人变更'] >= 10 else round(param['变更记录']['法人变更'] * 0.15, 2) - score['变更记录']['主要成员变更'] = 1.5 if param['变更记录']['主要成员变更'] >= 10 else round(param['变更记录']['主要成员变更'] * 0.15, 2) - score['变更记录']['合计'] = sum(score['变更记录'].values()) - score['合计'] = score['周边风险']['合计'] + score['变更记录']['合计'] + score['合计'] = score['周边风险']['合计'] return score diff --git a/Report/scripts/PdfStyle.py b/Report/scripts/PdfStyle.py index aa6aa62..e3132ea 100644 --- a/Report/scripts/PdfStyle.py +++ b/Report/scripts/PdfStyle.py @@ -54,8 +54,9 @@ table_mark = PS(name="table_mark", fontName="SimHei", fontSize=6, leading=16, al table_style = getSampleStyleSheet() table_style.add(ParagraphStyle(fontName='SimHei', name='Song', leading=12, fontSize=8, spaceBefore=2, alignment=TA_CENTER)) table_style.add(ParagraphStyle(fontName='SimHei', name='Long', leading=12, fontSize=8, spaceBefore=2, alignment=TA_LEFT)) -table_style.add(ParagraphStyle(fontName='SimHei', name='Longs', leading=9, fontSize=7, spaceBefore=2, alignment=TA_LEFT)) -table_style.add(ParagraphStyle(fontName='SimHei', name='Songs', leading=9, fontSize=7, spaceBefore=2, alignment=TA_CENTER)) +table_style.add(ParagraphStyle(fontName='SimHei', name='Longs', leading=9, fontSize=6, spaceBefore=2, alignment=TA_LEFT)) +table_style.add(ParagraphStyle(fontName='SimHei', name='Songs', leading=9, fontSize=6, spaceBefore=2, alignment=TA_CENTER)) +table_style.add(ParagraphStyle(fontName='SimHei', name='Song_small', leading=7, fontSize=5, spaceBefore=2, alignment=TA_CENTER)) # para para_style_single = PS(name="para_style_single", fontName="SimHei", fontSize=8, leading=18, alignment=TA_LEFT, spaceBefore=6) @@ -116,7 +117,10 @@ def adjust_table_data(list_): if item_[index] != '报告期' and index == 0: item_[index] = Paragraph(item_[index], table_style['Longs']) else: - item_[index] = Paragraph(item_[index], table_style['Songs']) + if index == 5 and len(item_[index]) > 10: + item_[index] = Paragraph(item_[index], table_style['Song_small']) + else: + item_[index] = Paragraph(item_[index], table_style['Songs']) else: for index in range(len(item_)): if item_[index] != '报告期' and index == 0: diff --git a/Report/static/ReportTemplates/信息技术业.json b/Report/static/ReportTemplates/信息技术业.json index f5aef62..47d7549 100644 --- a/Report/static/ReportTemplates/信息技术业.json +++ b/Report/static/ReportTemplates/信息技术业.json @@ -231,7 +231,7 @@ "表名": "表2 公司对外投资" }, { - "单位": "单位:-" + "单位": "单位:万元" }, { "表格": [ diff --git a/Report/static/ReportTemplates/制造业.json b/Report/static/ReportTemplates/制造业.json index 07af3c7..fe8caf3 100644 --- a/Report/static/ReportTemplates/制造业.json +++ b/Report/static/ReportTemplates/制造业.json @@ -231,7 +231,7 @@ "表名": "表2 公司对外投资" }, { - "单位": "单位:-" + "单位": "单位:万元" }, { "表格": [