tfse-app-api-v0.2/Rating/Credit/CreditObj.py

142 lines
6.1 KiB
Python
Raw Normal View History

2022-04-13 17:06:01 +08:00
from Utils.ObjUtil import SpecObject
from Utils.ValidateUtil import ValidateAttr
class RatingRecord(SpecObject):
"""评价记录 """
rid = ValidateAttr(field='rid', type=str, length=8)
cid = ValidateAttr(field='cid', type=str, length=8)
company = ValidateAttr(field='company', type=str)
project = ValidateAttr(field='project', type=str, in_list=["综合信用评价", "ESG评价"])
methods = ValidateAttr(field='methods', type=str, in_list=["企业申报"])
status = ValidateAttr(field='status', type=str, in_list=["进行", "完成"])
result = ValidateAttr(field='result', type=str,
in_list=["AAA", "AA+", "AA", "AA-", "A+", "A", "A-", "BBB+", "BBB", "BBB-", "BB+", "BB",
2022-04-14 17:02:47 +08:00
"BB-", "B+", "B", "B-", "CCC", "CC"], default=None)
report_fid = ValidateAttr(field='report_fid', type=str, default=None)
certificate_fid = ValidateAttr(field='certificate_fid', type=str, default=None)
2022-04-13 17:06:01 +08:00
begin_time = ValidateAttr(field='begin_time', type=str)
2022-04-14 17:02:47 +08:00
submit_time = ValidateAttr(field='submit_time', type=str, default=None)
finish_time = ValidateAttr(field='finish_time', type=str, default=None)
finish_date = ValidateAttr(field='finish_date', type=str, default=None)
2022-04-13 17:06:01 +08:00
fields_map = {
"rid": "评价ID",
"cid": "企业ID",
"company": "企业名称",
"project": "评价项目",
"methods": "评价方式",
"status": "进行状态",
"result": "评价结果",
"report_fid": "报告fid",
"certificate_fid": "证书fid",
"begin_time": "开始填报时间",
"submit_time": "提交填报时间",
"finish_time": "评价完成时间",
"finish_date": "评价完成日期"
}
class BalanceSheet(SpecObject):
"""资产负债表"""
report_date = ValidateAttr(field='report_date', default=None, length=10, type=str)
accounts_receivable = ValidateAttr(field='accounts_receivable', default=None, type=float)
stock = ValidateAttr(field='stock', type=float, default=None)
total_current_assets = ValidateAttr(field='total_current_assets', default=None, type=float)
total_assets = ValidateAttr(field='total_assets', default=None, type=float)
short_loan = ValidateAttr(field='short_loan', default=None, type=float)
one_year_liabilities = ValidateAttr(field='one_year_liabilities', default=None, type=float)
total_current_liabilities = ValidateAttr(field='total_current_liabilities', default=None, type=float)
long_term_loan = ValidateAttr(field='long_term_loan', default=None, type=float)
total_liabilities = ValidateAttr(field='total_liabilities', default=None, type=float)
total_owners_equity = ValidateAttr(field='total_owners_equity', default=None, type=float)
fields_map = {
"report_date": "报告期",
"accounts_receivable": "应收账款",
"stock": "存货",
"total_current_assets": "流动资产合计",
"total_assets": "资产总计",
"short_loan": "短期借款",
"one_year_liabilities": "一年内到期非流动负债",
"total_current_liabilities": "流动负债合计",
"long_term_loan": "长期借款",
"total_liabilities": "负债合计",
"total_owners_equity": "所有者权益合计"
}
class IncomeSheet(SpecObject):
"""利润表"""
report_date = ValidateAttr(field='report_date', default=None, length=10, type=str)
operating_income = ValidateAttr(field='operating_income', default=None, type=float)
operating_cost = ValidateAttr(field='operating_cost', default=None, type=float)
total_profit = ValidateAttr(field='total_profit', default=None, type=float)
net_profit = ValidateAttr(field='net_profit', default=None, type=float)
fields_map = {
"report_date": "报告期",
"operating_income": "营业收入",
"operating_cost": "营业成本",
"total_profit": "利润总额",
"net_profit": "净利润"
}
2022-04-25 15:40:24 +08:00
2022-04-13 17:06:01 +08:00
class AppendixDataSheet(SpecObject):
"""补充数据表"""
report_date = ValidateAttr(field='report_date', default=None, length=10, type=str)
rd_expenses = ValidateAttr(field='rd_expenses', default=None, type=float)
interest_disbursement = ValidateAttr(field='interest_disbursement', default=None, type=float)
interest_expense = ValidateAttr(field='interest_expense', default=None, type=float)
fields_map = {
"report_date": "报告期",
"rd_expenses": "研发费用",
"interest_disbursement": "计入财务费的利息支出",
"interest_expense": "资本化利息支出"
}
class FinancialReport(SpecObject):
"""财务填报"""
balance_sheet_list = ValidateAttr(field='balance_sheet_list', instance_list=BalanceSheet)
income_sheet_list = ValidateAttr(field='income_sheet_list', instance_list=IncomeSheet)
appendix_data_sheet_list = ValidateAttr(field='appendix_data_sheet_list', instance_list=AppendixDataSheet)
fields_map = {
"balance_sheet_list": "资产负债表",
"income_sheet_list": "利润表",
"appendix_data_sheet_list": '补充数据表'
}
2022-04-18 16:52:54 +08:00
class BusinessQuestionnaire(object):
2022-04-13 17:06:01 +08:00
"""经营问卷"""
2022-04-18 16:52:54 +08:00
questionnaire = ValidateAttr(field='questionnaire', type=list)
2022-04-13 17:06:01 +08:00
2022-04-18 16:52:54 +08:00
def list_to_save(self):
"""列表保存"""
return self.questionnaire
2022-04-13 17:06:01 +08:00
2022-04-25 15:40:24 +08:00
2022-04-13 17:06:01 +08:00
class CreditInputData(SpecObject):
"""填报数据"""
rid = ValidateAttr(field='rid', type=str, length=8)
cid = ValidateAttr(field='cid', type=str, length=8)
company = ValidateAttr(field='company', type=str)
year = ValidateAttr(field='year', type=str, length=5)
2022-04-14 17:02:47 +08:00
industry = ValidateAttr(field='industry', default=None, type=list)
business_questionnaire = ValidateAttr(field='business_questionnaire', type=list)
financial_report = ValidateAttr(field='financial_report', type=FinancialReport)
2022-04-13 17:06:01 +08:00
fields_map = {
"rid": "评价ID",
"cid": "企业ID",
"company": "企业名称",
"year": "评价年度",
"industry": "行业选择",
"business_questionnaire": "经营问卷",
"financial_report": "财务填报"
}