tfse-admin-api-v0.2/Manage/Ratings/Objects/EsgObject.py

130 lines
6.8 KiB
Python
Raw Normal View History

2022-05-13 16:55:12 +08:00
from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr, Validate
RATING_RESULT = ["AAA", "AA+", "AA", "AA-", "A+", "A", "A-", "BBB+", "BBB", "BBB-", "BB+", "BB", "BB-", "B+", "B", "B-", "CCC", "CC", None]
class EnvironmentalScore(SpecObject):
"""环境得分"""
carbon_dioxide = ValidateAttr(field='carbon_dioxide', type=[float, int])
energy_consumption = ValidateAttr(field='energy_consumption', type=[float, int])
water_consumption = ValidateAttr(field='water_consumption', type=[float, int])
income_ratio = ValidateAttr(field='income_ratio', type=[float, int])
greenhouse_gas = ValidateAttr(field='greenhouse_gas', type=[float, int])
energy_saving = ValidateAttr(field='energy_saving', type=[float, int])
water_saving = ValidateAttr(field='water_saving', type=[float, int])
green_business = ValidateAttr(field='green_business', type=[float, int])
punish = ValidateAttr(field='punish', type=[float, int, str])
negative_effects = ValidateAttr(field='negative_effects', type=[float, int])
beneficial_influence = ValidateAttr(field='beneficial_influence', type=[float, int])
clean_energy = ValidateAttr(field='clean_energy', type=[float, int])
total = ValidateAttr(field='total', type=[float, int])
fields_map = {
"carbon_dioxide": "单位收入二氧化碳排放",
"energy_consumption": "单位收入的能耗",
"water_consumption": "单位收入的耗水",
"income_ratio": "绿色业务收入占比(%",
"greenhouse_gas": "公司是否有温室气体减排目标",
"energy_saving": "企业是否有节能目标",
"water_saving": "企业是否有节约用水目标",
"green_business": "是否有绿色业务",
"punish": "近三年是否被环境或水务等监管部门处罚",
"negative_effects": "国家双碳目标对企业业务是否有不利影响",
"beneficial_influence": "国家双碳目标对企业业务是否有有利影响",
"clean_energy": "企业是否使用风电、光电、水电等清洁能源,是否使用清洁交通工具",
"total": "合计"
}
class SocialScore(SpecObject):
"""社会得分"""
resign = ValidateAttr(field="resign", type=[float, int])
salary_increase = ValidateAttr(field="salary_increase", type=[float, int])
work_length = ValidateAttr(field="work_length", type=[float, int])
labor_disputes = ValidateAttr(field="labor_disputes", type=[float, int])
security_incident = ValidateAttr(field="security_incident", type=[float, int])
provide_training = ValidateAttr(field="provide_training", type=[float, int])
social_security = ValidateAttr(field="social_security", type=[float, int])
provident_fund = ValidateAttr(field="provident_fund", type=[float, int])
physical_examination = ValidateAttr(field="physical_examination", type=[float, int])
paid_leave = ValidateAttr(field="paid_leave", type=[float, int])
supplier = ValidateAttr(field="supplier", type=[float, int])
customer_sales = ValidateAttr(field="customer_sales", type=[float, int])
repair_ratio = ValidateAttr(field="repair_ratio", type=[float, int])
poverty_alleviation = ValidateAttr(field="poverty_alleviation", type=[float, int])
judicial_risk = ValidateAttr(field="judicial_risk", type=[float, int, str])
total = ValidateAttr(field="total", type=[float, int])
fields_map = {
"resign": "离职人数占比",
"salary_increase": "人均薪酬涨幅",
"work_length": "劳动合同中的工作时长(周)",
"labor_disputes": "劳动纠纷",
"security_incident": "安全事故",
"provide_training": "提供培训",
"social_security": "社保缴纳是否符合当地标准",
"provident_fund": "公积金缴纳是否符合当地标准",
"physical_examination": "是否提供员工体检",
"paid_leave": "是否提供带薪假期",
"supplier": "公司从前三大供货商拿货占比",
"customer_sales": "公司前3大客户销量占比",
"repair_ratio": "公司返修、退回、投诉产品比例(%",
"poverty_alleviation": "扶贫+捐赠规模(万元)",
"judicial_risk": "司法风险",
"total": "合计"
}
class GovernanceScore(SpecObject):
"""治理得分"""
enterprise_nature = ValidateAttr(field="enterprise_nature", type=[float, int])
directors_board = ValidateAttr(field="directors_board", type=[float, int])
supervisory_board = ValidateAttr(field="supervisory_board", type=[float, int])
experience_year = ValidateAttr(field="experience_year", type=[float, int])
turnover_rate = ValidateAttr(field="turnover_rate", type=[float, int])
information_disclosure = ValidateAttr(field="information_disclosure", type=[float, int])
meetings_number = ValidateAttr(field="meetings_number", type=[float, int])
roe = ValidateAttr(field="roe", type=[float, int])
audit_report = ValidateAttr(field="audit_report", type=[float, int])
total = ValidateAttr(field="total", type=[float, int])
fields_map = {
"enterprise_nature": "企业性质",
"directors_board": "公司是否设有董事会",
"supervisory_board": "公司是否设有监事会",
"experience_year": "董监高平均拥有的行业经验年数",
"turnover_rate": "董监高近三年离职率",
"information_disclosure": "公司近三年信息披露及时、可靠、完备、审计质量",
"meetings_number": "公司董事会近三年年均开会次数",
"roe": "净资产收益率",
"audit_report": "公司是否有审计报告",
"total": "合计"
}
class EsgRatingResult(SpecObject):
"""esg评价结果"""
cid = ValidateAttr(field='cid', type=str, length=8, default=None)
rid = ValidateAttr(field="rid", type=str, length=8, default=None)
name = ValidateAttr(field='name', type=str, default=None)
year = ValidateAttr(field='year', type=str, default=None)
esg_score = ValidateAttr(field='esg_score', type=[float, int], default=None)
environmental_score = ValidateAttr(field='environmental_score', type=EnvironmentalScore)
social_score = ValidateAttr(field='social_score', type=SocialScore)
governance_score = ValidateAttr(field='governance_score', type=GovernanceScore)
level = ValidateAttr(field='level', type=str, in_list=RATING_RESULT)
rating_date = ValidateAttr(field='rating_date', func=Validate.date_format)
fields_map = {
"cid": "企业ID",
"rid": "评价ID",
"name": "企业名称",
"year": "评价年度",
"esg_score": "ESG得分",
"environmental_score": "环境得分",
"social_score": "社会得分",
"governance_score": "公司治理得分",
"level": "评价等级",
"rating_date": "评价时间"
}