from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr class BasicInfo(SpecObject): """基本工商信息""" status = ValidateAttr(field="status", type=str, default=None) legal_person = ValidateAttr(field="legal_person", type=str, default=None) company_type = ValidateAttr(field="company_type", type=str, default=None) taxpayer_id = ValidateAttr(field="taxpayer_id", type=str, default=None) business_scope = ValidateAttr(field="business_scope", type=str, default=None) registered_capital = ValidateAttr(field="registered_capital", type=str, default=None) paid_capital = ValidateAttr(field="paid_capital", type=str, default=None) registered_address = ValidateAttr(field="registered_address", type=str, default=None) registration_authority = ValidateAttr(field="registration_authority", type=str, default=None) industry = ValidateAttr(field="industry", type=str, default=None) staff_size = ValidateAttr(field="staff_size", type=str, default=None) people_insured_num = ValidateAttr(field="people_insured_num", type=int, default=None) micro_company = ValidateAttr(field="micro_company", type=str, default=None) fields_map = { "status": "企业状态", "legal_person": "法定代表人", "company_type": "企业类型", "taxpayer_id": "纳税人识别号", "business_scope": "经营范围", "registered_capital": "注册资本", "paid_capital": "实缴资本", "registered_address": "注册地址", "registration_authority": "登记机关", "industry": "行业", "staff_size": "人员规模", "people_insured_num": "参保人数", "micro_company": "小微企业" } class ShareHolder(SpecObject): """股东信息""" name = ValidateAttr(field='name', type=str) share_holder_type = ValidateAttr(field='share_holder_type', type=str, default=None) share_holding_ratio = ValidateAttr(field="share_holding_ratio", type=str, default=None) subscription_amount = ValidateAttr(field="subscription_amount", type=str, default=None) subscription_date = ValidateAttr(field="subscription_date", type=str, default=None) paid_amount = ValidateAttr(field="paid_amount", type=list, default=[]) payment_method = ValidateAttr(field="payment_method", type=list, default=[]) payment_time = ValidateAttr(field="payment_time", type=list, default=[]) fields_map = { "name": "股东", "share_holder_type": "股东类型", "share_holding_ratio": "持股比例", "subscription_amount": "认缴金额", "subscription_date": "认缴日期", "paid_amount": "实缴金额", "payment_method": "实缴方式", "payment_time": "实缴时间" } class MainMember(SpecObject): """主要成员""" name = ValidateAttr(field="name", type=str) job_title = ValidateAttr(field="job_title", type=list, default=None) fields_map = { "name": "姓名", "job_title": "职务" } class BalanceSheet(SpecObject): """资产负债表""" accounts_receivable = ValidateAttr(field='accounts_receivable', type=float) stock = ValidateAttr(field='stock', type=float) total_current_assets = ValidateAttr(field='total_current_assets', type=float) total_assets = ValidateAttr(field='total_assets', type=float) short_loan = ValidateAttr(field='short_loan', type=float) one_year_liabilities = ValidateAttr(field='one_year_liabilities', type=float) total_current_liabilities = ValidateAttr(field='total_current_liabilities', type=float) long_term_loan = ValidateAttr(field='long_term_loan', type=float) total_liabilities = ValidateAttr(field='total_liabilities', type=float) total_owners_equity = ValidateAttr(field='total_owners_equity', type=float) fields_map = { '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 ProfitSheet(SpecObject): """利润表""" operating_income = ValidateAttr(field='operating_income', type=float) operating_cost = ValidateAttr(field='operating_cost', type=float) total_profit = ValidateAttr(field='total_profit', type=float) net_profit = ValidateAttr(field='net_profit', type=float) fields_map = { 'operating_income': '营业收入', 'operating_cost': '营业成本', 'total_profit': '利润总额', 'net_profit': '净利润' } class AppendixDataSheet(SpecObject): """补充数据表""" rd_expenses = ValidateAttr(field='rd_expenses', type=float) interest_disbursement = ValidateAttr(field='interest_disbursement', type=float) interest_expense = ValidateAttr(field='interest_expense', type=float) fields_map = { 'rd_expenses': '研发费用异常', 'interest_disbursement': '计入财务费的利息支出异常', 'interest_expense': '资本化利息支出异常' } class FinancialIndex(SpecObject): """财务指标""" roe = ValidateAttr(field="roe", type=float) inventory_turnover = ValidateAttr(field="inventory_turnover", type=float) interest_multiple = ValidateAttr(field="interest_multiple", type=float) accounts_receivable_turnover = ValidateAttr(field="accounts_receivable_turnover", type=float) total_asset_turnover = ValidateAttr(field="total_asset_turnover", type=float) total_asset_growth_rate = ValidateAttr(field="total_asset_growth_rate", type=float) roa = ValidateAttr(field="roa", type=float) technology_investment_ratio = ValidateAttr(field="technology_investment_ratio", type=float) operating_growth_rate = ValidateAttr(field="operating_growth_rate", type=float) assets_and_liabilities = ValidateAttr(field="assets_and_liabilities", type=float) quick_ratio = ValidateAttr(field="quick_ratio", type=float) fields_map = { "roe": "净资产收益率", "inventory_turnover": "存货周转率", "interest_multiple": "已获利息倍数", "accounts_receivable_turnover": "应收账款周转率", "total_asset_turnover": "总资产周转率", "total_asset_growth_rate": "总资产增长率", "roa": "总资产报酬率", "technology_investment_ratio": "技术投入比率", "operating_growth_rate": "营业增长率", "assets_and_liabilities": "资产负债率", "quick_ratio": "速动比率" } class HeadInfo(SpecObject): """""" class LatestCCRating(SpecObject): """""" level = ValidateAttr(field='level', type=str, default='N/A') score = ValidateAttr(field='level', type=str, default='N/A') rating_time = ValidateAttr(field='level', type=str, default='N/A') fields_map = { "level": "信用等级", "score": "信用评分", "rating_time": "评价时间" } class LatestESGRating(SpecObject): """""" level = ValidateAttr(field='level', type=str, default='N/A') score = ValidateAttr(field='level', type=str, default='N/A') rating_time = ValidateAttr(field='level', type=str, default='N/A') fields_map = { "level": "ESG等级", "score": "ESG评分", "rating_time": "评价时间" } name = ValidateAttr(field='name', type=str) verify_status = ValidateAttr(field='verify_status', in_list=["已认证", "未认证"]) latest_cc_rating = ValidateAttr(field='latest_cc_rating', type=LatestCCRating) latest_esg_rating = ValidateAttr(field='latest_esg_rating', type=LatestESGRating) fields_map = { "name": "企业名称", "verify_status": "企业认证", "latest_cc_rating": "综合信用评价", "latest_esg_rating": "ESG评价" } class Company(object): """企业""" cid = ValidateAttr(field='cid', type=str, length=8) name = ValidateAttr(field='name', type=str) industry_l1 = ValidateAttr(field='industry_l1', type=str) industry_l2 = ValidateAttr(field='industry_l2', type=str) basic_info = ValidateAttr(field='basic_info', type=BasicInfo) share_holder = ValidateAttr(field='share_holders', instance_list=ShareHolder) main_members = ValidateAttr(field="main_members", instance_list=MainMember) balance_sheet = ValidateAttr(field='balance_sheet', type=BalanceSheet) profit_sheet = ValidateAttr(field='profit_sheet', type=ProfitSheet) # income_sheet = {} appendix_sheet = ValidateAttr(field='appendix_sheet', type=AppendixDataSheet) fin_index = ValidateAttr(field='fin_index', type=FinancialIndex) cc_rating_result = ValidateAttr(field='cc_rating_result', type=dict) esg_rating_result = ValidateAttr(field='esg_rating_result', type=dict) update_time = ValidateAttr(field='update_time', type=dict) fields_map = { "cid": "企业ID", "name": "企业名称", "industry_l1": "一级行业", "industry_l2": "二级行业", "basic_info": "工商信息", "share_holders": "股东信息", "main_members": "主要成员", "balance_sheet": "资产负债表", "profit_sheet": "利润表", "income_sheet": "现金流量表", "appendix_sheet": "财务补充数据", "fin_index": "财务指标", "cc_rating_result": "综信评价结果", "esg_rating_result": "ESG评价结果", "update_time": "更新时间" } def get_head_info(self): """头部信息""" def get_basic_info(self): """获取基本工商信息"""