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 公司对外投资" }, { - "单位": "单位:-" + "单位": "单位:万元" }, { "表格": [