update esg模块/变更记录放入经营风险/处理报告表格宽度溢出问题
This commit is contained in:
parent
396888840a
commit
52dbdb5949
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
class EsgModel:
|
||||||
|
"""
|
||||||
|
ESG评价模型
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
初始化数据
|
||||||
|
"""
|
||||||
|
self.cid = None
|
|
@ -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))
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -30,6 +30,8 @@ def management_risk(param):
|
||||||
score['诉讼'] = 10 if param['诉讼'] >= 50 else round(param['诉讼'] * 0.2, 2)
|
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['送达公告'] >= 50 else round(param['送达公告'] * 0.1, 2)
|
||||||
score['股权出质'] = 5 if param['股权出质'] >= 10 else round(param['股权出质'] * 0.5, 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)
|
score['合计'] = round(sum(score.values()), 2)
|
||||||
return score
|
return score
|
||||||
|
|
||||||
|
@ -40,13 +42,9 @@ def peripheral_risk(param):
|
||||||
"""
|
"""
|
||||||
score = dict()
|
score = dict()
|
||||||
score['周边风险'] = dict()
|
score['周边风险'] = dict()
|
||||||
score['变更记录'] = dict()
|
|
||||||
score['周边风险']['高风险'] = 5 if param['周边风险']['高风险'] >= 25 else round(param['周边风险']['高风险'] * 0.2, 2)
|
score['周边风险']['高风险'] = 5 if param['周边风险']['高风险'] >= 25 else round(param['周边风险']['高风险'] * 0.2, 2)
|
||||||
score['周边风险']['警示'] = 5 if param['周边风险']['警示'] >= 50 else round(param['周边风险']['警示'] * 0.1, 2)
|
score['周边风险']['警示'] = 5 if param['周边风险']['警示'] >= 50 else round(param['周边风险']['警示'] * 0.1, 2)
|
||||||
score['周边风险']['合计'] = sum(score['周边风险'].values())
|
score['周边风险']['合计'] = sum(score['周边风险'].values())
|
||||||
score['变更记录']['法人变更'] = 1.5 if param['变更记录']['法人变更'] >= 10 else round(param['变更记录']['法人变更'] * 0.15, 2)
|
score['合计'] = score['周边风险']['合计']
|
||||||
score['变更记录']['主要成员变更'] = 1.5 if param['变更记录']['主要成员变更'] >= 10 else round(param['变更记录']['主要成员变更'] * 0.15, 2)
|
|
||||||
score['变更记录']['合计'] = sum(score['变更记录'].values())
|
|
||||||
score['合计'] = score['周边风险']['合计'] + score['变更记录']['合计']
|
|
||||||
|
|
||||||
return score
|
return score
|
||||||
|
|
|
@ -54,8 +54,9 @@ table_mark = PS(name="table_mark", fontName="SimHei", fontSize=6, leading=16, al
|
||||||
table_style = getSampleStyleSheet()
|
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='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='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='Longs', leading=9, fontSize=6, 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='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
|
||||||
para_style_single = PS(name="para_style_single", fontName="SimHei", fontSize=8, leading=18, alignment=TA_LEFT,
|
para_style_single = PS(name="para_style_single", fontName="SimHei", fontSize=8, leading=18, alignment=TA_LEFT,
|
||||||
spaceBefore=6)
|
spaceBefore=6)
|
||||||
|
@ -116,7 +117,10 @@ def adjust_table_data(list_):
|
||||||
if item_[index] != '报告期' and index == 0:
|
if item_[index] != '报告期' and index == 0:
|
||||||
item_[index] = Paragraph(item_[index], table_style['Longs'])
|
item_[index] = Paragraph(item_[index], table_style['Longs'])
|
||||||
else:
|
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:
|
else:
|
||||||
for index in range(len(item_)):
|
for index in range(len(item_)):
|
||||||
if item_[index] != '报告期' and index == 0:
|
if item_[index] != '报告期' and index == 0:
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
"表名": "表2 公司对外投资"
|
"表名": "表2 公司对外投资"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"单位": "单位:-"
|
"单位": "单位:万元"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"表格": [
|
"表格": [
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
"表名": "表2 公司对外投资"
|
"表名": "表2 公司对外投资"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"单位": "单位:-"
|
"单位": "单位:万元"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"表格": [
|
"表格": [
|
||||||
|
|
Loading…
Reference in New Issue