from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr, Validate class BasicBusinessInfo(SpecObject): cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) enterprise_abbreviation = ValidateAttr(field="enterprise_abbreviation", type=str) type_of_enterprise = ValidateAttr(field="type_of_enterprise", type=str) warranty_type = ValidateAttr(field="warranty_type", type=str) unified_social_credit_code = ValidateAttr(field="unified_social_credit_code", type=str) organization_code = ValidateAttr(field="organization_code", type=str) date_of_establishment = ValidateAttr(field="date_of_establishment", type=str) registered_capital = ValidateAttr(field="registered_capital", type=str) paid_in_capital = ValidateAttr(field="paid_in_capital", type=str) business_scope = ValidateAttr(field="business_scope", type=str) province = ValidateAttr(field="province", type=str) city = ValidateAttr(field="city", type=str) registered_address = ValidateAttr(field="registered_address", type=str) contact_address = ValidateAttr(field="contact_address", type=str) e_mail = ValidateAttr(field="e_mail", type=str) contact_number = ValidateAttr(field="contact_number", type=str) number_of_participants = ValidateAttr(field="number_of_participants", type=str) company_positioning = ValidateAttr(field="company_positioning", type=str) legal_representative = ValidateAttr(field="legal_representative", type=str) the_actual_controller = ValidateAttr(field="the_actual_controller", type=str) shareholder_information = ValidateAttr(field="shareholder_information", type=str) executive_information = ValidateAttr(field="executive_information", type=str) fields_map = { "cid": "企业ID", "company_name": "企业名称", "enterprise_abbreviation": "企业简称", "type_of_enterprise": "企业类型", "warranty_type": "担保类型", "unified_social_credit_code": "统一社会信用代码", "organization_code": "组织代码", "date_of_establishment": "成立日期", "registered_capital": "注册资本(万元)", "paid_in_capital": "实缴资本(万元)", "business_scope": "经营范围", "province": "所在省份", "city": "所在城市", "registered_address": "注册地址", "contact_address": "通信地址", "e_mail": "电子邮箱", "contact_number": "联系电话", "number_of_participants": "参保人数", "company_positioning": "公司定位", "legal_representative": "法定代表人", "the_actual_controller": "实际控制人", "shareholder_information": "股东信息", "executive_information": "高管信息" } class CompanyOverviewInfo(SpecObject): """公司概览信息""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) credit_rating = ValidateAttr(field="credit_rating", type=str) rating_date = ValidateAttr(field="rating_date", func=Validate.date_format) province_city = ValidateAttr(field="province_city", type=str) label = ValidateAttr(field="label", type=str) update_time = ValidateAttr(field="update_time", func=Validate.date_format) fields_map = { "cid": "企业ID", "company_name": "企业名称", "credit_rating": "信用评级", "rating_date": "评级日期", "province_city": "所属省市", "label": "公司标签", "update_time": "更新时间" } class FinancialData(SpecObject): class BalanceSheet(SpecObject): """资产负债表""" money_funds = ValidateAttr(field="", type=[str, float, int]) entrusted_loans = ValidateAttr(field="", type=[str, float, int]) other_receivables = ValidateAttr(field="", type=[str, float, int]) reimbursement_receivable = ValidateAttr(field="", type=[str, float, int]) total_current_assets = ValidateAttr(field="", type=[str, float, int]) available_sale_financial_assets = ValidateAttr(field="", type=[str, float, int]) long_term_equity_investment = ValidateAttr(field="", type=[str, float, int]) fixed_assets = ValidateAttr(field="", type=[str, float, int]) foreclosed_assets = ValidateAttr(field="", type=[str, float, int]) other_non_current_assets = ValidateAttr(field="", type=[str, float, int]) total_non_current_assets = ValidateAttr(field="", type=[str, float, int]) total_assets = ValidateAttr(field="", type=[str, float, int]) short_term_borrowing = ValidateAttr(field="", type=[str, float, int]) other_payables = ValidateAttr(field="", type=[str, float, int]) total_current_liabilities = ValidateAttr(field="", type=[str, float, int]) long_term_borrowing = ValidateAttr(field="", type=[str, float, int]) interest_bearing_liabilities = ValidateAttr(field="", type=[str, float, int]) total_non_current_liabilities = ValidateAttr(field="", type=[str, float, int]) total_liabilities = ValidateAttr(field="", type=[str, float, int]) paid_capital = ValidateAttr(field="", type=[str, float, int]) capital_reserve = ValidateAttr(field="", type=[str, float, int]) undistributed_profit = ValidateAttr(field="", type=[str, float, int]) total_Owner_equity = ValidateAttr(field="", type=[str, float, int]) net_worth = ValidateAttr(field="", type=[str, float, int]) fields_map = { money_funds: "货币资金", entrusted_loans: "委托贷款", other_receivables: "其他应收款", reimbursement_receivable: "应收代偿款", total_current_assets: "流动资产合计", available_sale_financial_assets: "可供出售金融资产", long_term_equity_investment: "长期股权投资", fixed_assets: "固定资产", foreclosed_assets: "抵债资产", other_non_current_assets: "其他非流动资产", total_non_current_assets: "非流动资产合计", total_assets: "资产总额", short_term_borrowing: "短期借款", other_payables: "其他应付款", total_current_liabilities: "流动负债合计", long_term_borrowing: "长期借款", interest_bearing_liabilities: "有息负债", total_non_current_liabilities: "非流动负债合计", total_liabilities: "负债合计", paid_capital: "实收资本", capital_reserve: "资本公积", undistributed_profit: "未分配利润", total_Owner_equity: "所有者权益合计", net_worth: "净资产" } class IncomeSheet(SpecObject): """利润表""" operating_income = ValidateAttr(field="operating_income", type=[str, float, int]) guarantee_fee_income = ValidateAttr(field="guarantee_fee_income", type=[str, float, int]) loan_interest_income = ValidateAttr(field="loan_interest_income", type=[str, float, int]) investment_business_income = ValidateAttr(field="investment_business_income", type=[str, float, int]) other_business_income = ValidateAttr(field="other_business_income", type=[str, float, int]) main_business_cost = ValidateAttr(field="main_business_cost", type=[str, float, int]) taxes_surcharges = ValidateAttr(field="taxes_surcharges", type=[str, float, int]) operating_administrative_expenses = ValidateAttr(field="operating_administrative_expenses", type=[str, float, int]) interest_income = ValidateAttr(field="interest_income", type=[str, float, int]) interest_expense = ValidateAttr(field="interest_expense", type=[str, float, int]) asset_impairment_loss = ValidateAttr(field="asset_impairment_loss", type=[str, float, int]) investment_income = ValidateAttr(field="investment_income", type=[str, float, int]) operating_profit = ValidateAttr(field="operating_profit", type=[str, float, int]) other_income = ValidateAttr(field="other_income", type=[str, float, int]) net_profit = ValidateAttr(field="net_profit", type=[str, float, int]) fields_map = { "operating_income": "营业收入", "guarantee_fee_income": "担保费收入", "loan_interest_income": "委贷利息收入", "investment_business_income": "投资业务收入", "other_business_income": "其他业务收入", "main_business_cost": "主营业务成本", "taxes_surcharges": "税金及附加", "operating_administrative_expenses": "业务及管理费用", "interest_income": "利息收入", "interest_expense": "利息支出", "asset_impairment_loss": "资产减值损失", "investment_income": "投资收益", "operating_profit": "营业利润", "other_income": "其他收益", "net_profit": "净利润" } class AppendixSheet(SpecObject): """补充数据表""" current_compensation_amount = ValidateAttr(field="current_compensation_amount", type=[str, float, int]) current_compensation_recycle_amount = ValidateAttr(field="current_compensation_recycle_amount", type=[str, float, int]) guarantee_liability = ValidateAttr(field="guarantee_liability", type=[str, float, int]) accumulated_compensation_amount = ValidateAttr(field="accumulated_compensation_amount", type=[str, float, int]) cumulative_compensation_recovery_amount = ValidateAttr(field="cumulative_compensation_recovery_amount", type=[str, float, int]) cumulative_amount = ValidateAttr(field="cumulative_amount", type=[str, float, int]) largest_financing = ValidateAttr(field="largest_financing", type=[str, float, int]) financing_guarantee_liabilities = ValidateAttr(field="financing_guarantee_liabilities", type=[str, float, int]) financial_guarantee_responsibility_balance = ValidateAttr(field="financial_guarantee_responsibility_balance", type=[str, float, int]) risk_weighted_assets = ValidateAttr(field="risk_weighted_assets", type=[str, float, int]) guaranteed_risk_reserve_balance = ValidateAttr(field="guaranteed_risk_reserve_balance", type=[str, float, int]) top_five_financing_guarantee_liabilities = ValidateAttr(field="top_five_financing_guarantee_liabilities", type=[str, float, int]) maximum_enterprise_financing_guarantee = ValidateAttr(field="maximum_enterprise_financing_guarantee", type=[str, float, int]) guarantee_compensation_reserve = ValidateAttr(field="guarantee_compensation_reserve", type=[str, float, int]) unexpired_liability_reserve = ValidateAttr(field="unexpired_liability_reserve", type=[str, float, int]) counter_guarantee_amount = ValidateAttr(field="counter_guarantee_amount", type=[str, float, int]) bank_credit_limit = ValidateAttr(field="bank_credit_limit", type=[str, float, int]) unused_credit_limit = ValidateAttr(field="unused_credit_limit", type=[str, float, int]) number_cooperative_banks = ValidateAttr(field="number_cooperative_banks", type=[str, float, int]) deposit_margin = ValidateAttr(field="deposit_margin", type=[str, float, int]) save_margin = ValidateAttr(field="save_margin", type=[str, float, int]) guaranteed_balance = ValidateAttr(field="guaranteed_balance", type=[str, float, int]) current_guarantee_business_income = ValidateAttr(field="current_guarantee_business_income", type=[str, float, int]) last_period_guarantee_business_income = ValidateAttr(field="last_period_guarantee_business_income", type=[str, float, int]) one_assets = ValidateAttr(field="one_assets", type=[str, float, int]) two_assets = ValidateAttr(field="two_assets", type=[str, float, int]) three_assets = ValidateAttr(field="three_assets", type=[str, float, int]) fields_map = { "current_compensation_amount": "当期代偿金额", "current_compensation_recycle_amount": "当期代偿回收金额", "guarantee_liability": "当期解除担保责任余额", "accumulated_compensation_amount": "近三年累计代偿金额", "cumulative_compensation_recovery_amount": "近三年累计代偿回收金额", "cumulative_amount": "近三年累计解除担保责任金额", "largest_financing": "最大单一行业融资担保责任余额", "financing_guarantee_liabilities": "当期新增融资担保责任余额", "financial_guarantee_responsibility_balance": "融资担保责任余额", "risk_weighted_assets": "风险加权资产", "guaranteed_risk_reserve_balance": "担保风险准备金余额", "top_five_financing_guarantee_liabilities": "前五大被担保企业融资担保责任余额", "maximum_enterprise_financing_guarantee": "最大被担保企业融资担保责任余额", "guarantee_compensation_reserve": "担保赔偿准备金", "unexpired_liability_reserve": "未到期责任准备金", "counter_guarantee_amount": "反担保金额", "bank_credit_limit": "银行授信额度", "unused_credit_limit": "授信未使用额度", "number_cooperative_banks": "合作银行数量", "deposit_margin": "存入保证金", "save_margin": "存出保证金", "guaranteed_balance": "担保在保余额", "current_guarantee_business_income": "当期担保业务收入", "last_period_guarantee_business_income": "上期担保业务收入", "one_assets": "I类资产", "two_assets": "II类资产", "three_assets": "III类资产" } class FinancialIndicator(SpecObject): """财务指标""" guaranteed_insured_balance_growth_rate = ValidateAttr(field="guaranteed_insured_balance_growth_rate", type=[str, float, int]) guaranteed_revenue_growth_rate = ValidateAttr(field="guaranteed_revenue_growth_rate", type=[str, float, int]) growth_rate_of_total_assets = ValidateAttr(field="growth_rate_of_total_assets", type=[str, float, int]) cash_assets_ratio = ValidateAttr(field="cash_assets_ratio", type=[str, float, int]) current_ratio = ValidateAttr(field="current_ratio", type=[str, float, int]) compensation_reserve_ratio = ValidateAttr(field="compensation_reserve_ratio", type=[str, float, int]) compensation_rate = ValidateAttr(field="compensation_rate", type=[str, float, int]) risk_reserve_adequacy_ratio = ValidateAttr(field="risk_reserve_adequacy_ratio", type=[str, float, int]) single_customer_concentration = ValidateAttr(field="single_customer_concentration", type=[str, float, int]) current_guarantee_compensation_rate = ValidateAttr(field="current_guarantee_compensation_rate", type=[str, float, int]) current_compensation_recovery_rate = ValidateAttr(field="current_compensation_recovery_rate", type=[str, float, int]) financing_guarantee_magnification = ValidateAttr(field="financing_guarantee_magnification", type=[str, float, int]) industry_concentration = ValidateAttr(field="industry_concentration", type=[str, float, int]) return_total_assets = ValidateAttr(field="return_total_assets", type=[str, float, int]) operating_margin = ValidateAttr(field="operating_margin", type=[str, float, int]) roe = ValidateAttr(field="roe", type=[str, float, int]) actual_asset_liability_ratio = ValidateAttr(field="actual_asset_liability_ratio", type=[str, float, int]) capital_adequacy_ratio = ValidateAttr(field="capital_adequacy_ratio", type=[str, float, int]) paid_capital = ValidateAttr(field="paid_capital", type=[str, float, int]) guarantee_business_income = ValidateAttr(field="guarantee_business_income", type=[str, float, int]) cumulative_guarantee_compensation_rate = ValidateAttr(field="cumulative_guarantee_compensation_rate", type=[str, float, int]) cumulative_compensation_recovery_rate = ValidateAttr(field="cumulative_compensation_recovery_rate", type=[str, float, int]) risk_coverage_ratio = ValidateAttr(field="risk_coverage_ratio", type=[str, float, int]) cash_asset_compensation_rate = ValidateAttr(field="cash_asset_compensation_rate", type=[str, float, int]) margin_ratio = ValidateAttr(field="margin_ratio", type=[str, float, int]) proportion_investment_business_income = ValidateAttr(field="proportion_investment_business_income", type=[str, float, int]) investment_income_growth_rate = ValidateAttr(field="investment_income_growth_rate", type=[str, float, int]) one_proportion_class_assets = ValidateAttr(field="one_proportion_class_assets", type=[str, float, int]) customer_concentration = ValidateAttr(field="customer_concentration", type=[str, float, int]) proportion_income_guarantee_business = ValidateAttr(field="proportion_income_guarantee_business", type=[str, float, int]) two_proportion_class_assets = ValidateAttr(field="two_proportion_class_assets", type=[str, float, int]) three_proportion_class_assets = ValidateAttr(field="three_proportion_class_assets", type=[str, float, int]) fields_map = { guaranteed_insured_balance_growth_rate: "担保在保余额增长率(%)", guaranteed_revenue_growth_rate: "担保收入增长率(%)", growth_rate_of_total_assets: "资产总额增长率(%)", cash_assets_ratio: "现金类资产比率(%)", current_ratio: "流动比率(%)", compensation_reserve_ratio: "代偿准备金比率(%)", compensation_rate: "代偿保障率(%)", risk_reserve_adequacy_ratio: "风险准备金充足率(%)", single_customer_concentration: "单一客户集中度(%)", current_guarantee_compensation_rate: "当期担保代偿率(%)", current_compensation_recovery_rate: "当期代偿回收率(%)", financing_guarantee_magnification: "融资担保放大倍数(倍)", industry_concentration: "行业集中度(%)", return_total_assets: "总资产收益率(%)", operating_margin: "营业利润率(%)", roe: "净资产收益率(%)", actual_asset_liability_ratio: "实际资产负债率(%)", capital_adequacy_ratio: "资本充足率(%)", paid_capital: "实收资本(亿元)", guarantee_business_income: "担保业务收入(万元)", cumulative_guarantee_compensation_rate: "近三年累计担保代偿率(%)", cumulative_compensation_recovery_rate: "近三年累计代偿回收率(%)", risk_coverage_ratio: "风险覆盖率(%)", cash_asset_compensation_rate: "现金类资产代偿保障率(%)", margin_ratio: "保证金比率(%)", proportion_investment_business_income: "投资业务收入占比(%)", investment_income_growth_rate: "投资收益增长率(%)", one_proportion_class_assets: "I类资产占比(%)", customer_concentration: "客户集中度(%)", proportion_income_guarantee_business: "担保业务收入占比(%)", two_proportion_class_assets: "II类资产占比(%)", three_proportion_class_assets: "III类资产占比(%)" } """财务数据""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) balance_sheet = ValidateAttr(field="balance_sheet", type=BalanceSheet) income_sheet = ValidateAttr(field="income_sheet", type=IncomeSheet) appendix_sheet = ValidateAttr(field="appendix_sheet", type=AppendixSheet) financial_indicator = ValidateAttr(field="financial_indicator", type=FinancialIndicator) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "balance_sheet": "资产负债表", "income_sheet": "利润表", "appendix_sheet": "补充数据表", "financial_indicator": "财务指标" } class CustomerInfo(SpecObject): """客户信息""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) client_name = ValidateAttr(field="client_name", type=str) guarantee_type = ValidateAttr(field="guarantee_type", type=str) balance_under_insurance = ValidateAttr(field="balance_under_insurance", type=[str, float, int]) financing_guarantee_balance = ValidateAttr(field="financing_guarantee_balance", type=[str, float, int]) guarantee_start_date = ValidateAttr(field="guarantee_start_date", type=[str, float, int]) guarantee_end_date = ValidateAttr(field="guarantee_end_date", type=[str, float, int]) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "client_name": "客户名称", "guarantee_type": "担保类型", "balance_under_insurance": "在保余额", "financing_guarantee_balance": "融资担保责任余额", "guarantee_start_date": "担保起始日", "guarantee_end_date": "担保截止日" } class RegionalDistribution(SpecObject): """区域分布""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) region = ValidateAttr(field="region", type=str) year_end_insured_balance = ValidateAttr(field="year_end_insured_balance", type=[str, float, int]) year_end_insured_liability_balance = ValidateAttr(field="year_end_insured_balance", type=[str, float, int]) insured_balance_newly_added = ValidateAttr(field="insured_balance_newly_added", type=[str, float, int]) insured_liability_newly_added = ValidateAttr(field="insured_liability_newly_added", type=[str, float, int]) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "region": "地区", "year_end_insured_balance": "年末在保余额", "year_end_insured_liability_balance": "年末在保责任余额", "insured_balance_newly_added": "当年新增在保余额", "insured_liability_newly_added": "当年新增在保责任余额" } class IndustryDistribution(SpecObject): """行业分布""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) industry = ValidateAttr(field="industry", type=str) year_end_insured_balance = ValidateAttr(field="year_end_insured_balance", type=[str, float, int]) year_end_insured_liability_balance = ValidateAttr(field="year_end_insured_balance", type=[str, float, int]) insured_balance_newly_added = ValidateAttr(field="insured_balance_newly_added", type=[str, float, int]) insured_liability_newly_added = ValidateAttr(field="insured_liability_newly_added", type=[str, float, int]) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "industry": "所属行业", "year_end_insured_balance": "年末在保余额", "year_end_insured_liability_balance": "年末在保责任余额", "insured_balance_newly_added": "当年新增在保余额", "insured_liability_newly_added": "当年新增在保责任余额" } class GuaranteedBalanceDistribution(SpecObject): """担保余额分布""" class GuaranteeBalance(SpecObject): """担保金额相关""" one_million = ValidateAttr(field="one_million", type=[str, float, int]) five_million = ValidateAttr(field="five_million", type=[str, float, int]) ten_million = ValidateAttr(field="ten_million", type=[str, float, int]) thirty_million = ValidateAttr(field="thirty_million", type=[str, float, int]) fifty_million = ValidateAttr(field="fifty_million", type=[str, float, int]) eighty_million = ValidateAttr(field="eighty_million", type=[str, float, int]) one_hundred_million = ValidateAttr(field="one_hundred_million", type=[str, float, int]) more_than_one_hundred_million = ValidateAttr(field="more_than_one_hundred_million", type=[str, float, int]) total = ValidateAttr(field="total", type=[str, float, int]) fields_map = { "one_million": "金额<=100w", "five_million": "100w<金额<=500w", "ten_million": "500w<金额<=1000w", "thirty_million": "1000w<金额<=3000w", "fifty_million": "3000w<金额<=5000w", "eighty_million": "5000w<金额<=8000w", "one_hundred_million": "8000w<金额<=10000w", "more_than_one_hundred_million": "金额>10000w", "total": "合计" } cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) guarantee_account = ValidateAttr(field="guaranteed_account", type=GuaranteeBalance) guarantee_number = ValidateAttr(field="guaranteed_number", type=GuaranteeBalance) guarantee_liability_balance = ValidateAttr(field="guarantee_liability_balance", type=GuaranteeBalance) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "guaranteed_account": "担保户数", "guaranteed_number": "担保笔数", "guarantee_liability_balance": "担保责任余额" } class RatingRecord(SpecObject): """评级记录""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) rid = ValidateAttr(field="rid", type=str) level = ValidateAttr(field="level", type=str) rating_date = ValidateAttr(field="rating_date", func=Validate.date_format) rating_report = ValidateAttr(field="rating_report", type=str) fields_map = { "cid": "企业ID", "company_name": "企业名称", "rid": "评级ID", "level": "信用等级", "rating_date": "评级日期", "rating_report": "评级报告" }