from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr, Validate class BalanceSheet(SpecObject): """资产负债表""" report_date = ValidateAttr(field='report_date', default=None, func=Validate.date_format, 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, func=Validate.date_format, 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": "净利润" } class AppendixDataSheet(SpecObject): """补充数据表""" report_date = ValidateAttr(field='report_date', default=None, func=Validate.date_format, 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": '补充数据表' } class BusinessQuestionnaire(object): """经营问卷""" questionnaire = ValidateAttr(field='questionnaire', type=list) def list_to_save(self): """列表保存""" return self.questionnaire 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) industry = ValidateAttr(field='industry', default=None, type=list) business_questionnaire = ValidateAttr(field='business_questionnaire', type=list) financial_report = ValidateAttr(field='financial_report', type=FinancialReport) fields_map = { "rid": "评价ID", "cid": "企业ID", "company": "企业名称", "year": "评价年度", "industry": "行业选择", "business_questionnaire": "经营问卷", "financial_report": "财务填报" }