123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- # -*- coding: utf-8 -*-
- # @Time : 2022/11/29 15:50
- # @Author : XuJiakai
- # @File : dim_name_mapping
- # @Software: PyCharm
- _map_class = {
- "基本信息": ['股东信息', '主要成员', '对外投资', '总公司', '分支机构', '历史变更', '企业年报', ],
- "法律风险": ['司法案件', '失信信息', '被执行人', '限制消费', '终本案件', '送达公告', '裁判文书', '开庭公告', '立案信息', '法院公告', '股权冻结', '破产重整', '司法拍卖',
- '询价评估', '限制出境', '诉前调解', '破产债权', ],
- "经营风险": ['行政处罚', '经营异常', '股权出质', '减资记录', '土地转让-出让人', '土地抵押-抵押人', '动产抵押', '环保处罚', '税收违法', '欠税公告', '公示催告', '严重违法',
- '简易注销', '解散清算', '股权质押', '股权质押-质押人', '知识产权出质', '注销备案'],
- "经营信息": ['招投标', '招聘信息', '特殊资质', '进出口信用', '行政许可', '土地公示', '购地信息', '土地转让-受让人', '土地抵押-抵押权人', '信用评级', '税务信用', '融资信息',
- '债券信息', '股权出质-质权人', '产品信息', '主要客户', '供应商', '抽查检查', '产权交易', '双随机抽查'],
- "知识产权": ['商标', '专利', '软件著作权', '作品著作权', '网站域名', ],
- "建筑信息": ['建筑资质', '建筑人员', '建筑项目', ],
- "融资信息": ['应收账款融资', 'DCM注册额度', '债券融资', '境外债券融资', '银行借款', '授信额度', '租赁融资', '信托融资', '其他融资', ],
- }
- _history_item_key = ['经营异常', '严重违法', '被执行人', '失信信息', '终本案件', '限制高消费', '法院公告', '行政处罚', '动产抵押', '土地抵押', '开庭公告',
- '股权出质-质权人', '股权出质', '股权冻结', ]
- _winhc_dim_map = {
- "股东信息": {
- "dim_name": "company_holder",
- "summary_key": "",
- "history_summary_key": "",
- "history": True,
- "sort_field": None
- },
- "主要成员": {
- "dim_name": "company_staff",
- "history": True,
- "sort_field": None
- },
- "对外投资": {
- "dim_name": "",
- "summary_key": "company_holder_del_0_invest",
- "history_summary_key": "company_holder_del_1_invest",
- "sort_field": ""
- },
- # "总公司": {
- # "dim_name": "",
- # "sort_field": None
- # },
- "分支机构": {
- "dim_name": "",
- "summary_key": "company_branch_del_0",
- "history_summary_key": "company_branch_del_1",
- "sort_field": ""
- },
- "历史变更": {
- "dim_name": "company_change",
- "summary_key": "",
- "sort_field": "change_time"
- },
- "企业年报": {
- "dim_name": "company_annual_report",
- "summary_key": "", "sort_field": ""
- },
- "司法案件": { # todo
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "失信信息": {
- "dim_name": "company_dishonest_info",
- "summary_key": "", "sort_field": "keyno:pub_date"
- },
- "被执行人": {
- "dim_name": "company_zxr",
- "summary_key": "", "sort_field": "keyno:case_create_time"
- },
- "限制消费": {
- "dim_name": "company_zxr_restrict",
- "summary_key": "", "sort_field": "publish_date"
- },
- "终本案件": {
- "dim_name": "company_zxr_final_case",
- "summary_key": "", "sort_field": "keyno:case_create_time"
- },
- "送达公告": { # todo
- "dim_name": "company_send_announcement",
- "summary_key": "", "sort_field": "plaintiff_info.litigant_id:start_date,defendant_info.litigant_id:start_date"
- },
- "裁判文书": { # fixme 需要跨集群查询
- "dim_name": "wenshu_detail_v2",
- "summary_key": "wenshu_detail_v2_del_0_defendant,wenshu_detail_v2_del_0_plaintiff", "sort_field": "wenshu_detail2:litigant_info.litigant_id:judge_date"
- },
- "开庭公告": {
- "dim_name": "company_court_open_announcement",
- "summary_key": "company_court_open_announcement_del_0_plaintiff,company_court_open_announcement_del_0_defendant", "sort_field": "defendant_info.litigant_id:start_date,plaintiff_info.litigant_id:start_date"
- },
- "立案信息": {
- "dim_name": "company_court_register",
- "summary_key": "company_court_register_del_0_defendant,company_court_register_del_0_plaintiff", "sort_field": "defendant_info.litigant_id:filing_date,plaintiff_info.litigant_id:filing_date"
- },
- "法院公告": {
- "dim_name": "company_court_announcement",
- "summary_key": "company_court_announcement_del_0_plaintiff,company_court_announcement_del_0_litigant",
- "sort_field": "defendant_info.litigant_id:publish_date,plaintiff_info.litigant_id:publish_date"
- },
- "股权冻结": { # todo 没有时间
- "dim_name": "company_judicial_assistance",
- "summary_key": "", "sort_field": ""
- },
- "破产重整": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "司法拍卖": {
- "dim_name": "auction_tracking",
- "summary_key": "", "sort_field": "company_info.company_id:start_time"
- },
- "询价评估": {
- "dim_name": "zxr_evaluate,zxr_evaluate_results",
- "summary_key": "", "sort_field": "winhc_index_rt_zxr_evaluate_results:keyno:publish_time"
- },
- "限制出境": {
- "dim_name": "restrictions_on_exit",
- "summary_key": "", "sort_field": ""
- },
- "诉前调解": {
- "dim_name": "litigation_mediation",
- "summary_key": "litigation_mediation_del_0_plaintiff,litigation_mediation_del_0_defendant", "sort_field": "defendant_info.litigant_id:filing_date,plaintiff_info.litigant_id:filing_date"
- },
- "破产债权": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "行政处罚": {
- "dim_name": "company_punishment_info,company_punishment_info_creditchina",
- "summary_key": "",
- "sort_field": "winhc_index_rt_company_punishment_info:company_id:decision_date,winhc_index_rt_company_punishment_info_creditchina:company_id:decision_date"
- },
- "经营异常": {
- "dim_name": "company_abnormal_info",
- "summary_key": "", "sort_field": "put_date"
- },
- "股权出质": { # todo
- "dim_name": "company_equity_info",
- "summary_key": "", "sort_field": ""
- },
- "减资记录": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "土地转让-出让人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "土地抵押-抵押人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "动产抵押": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "环保处罚": {
- "dim_name": "company_env_punishment",
- "summary_key": "", "sort_field": "publish_time"
- },
- "税收违法": {
- "dim_name": "company_tax_contravention",
- "summary_key": "", "sort_field": "publish_time"
- },
- "欠税公告": {
- "dim_name": "company_own_tax",
- "summary_key": "", "sort_field": "publish_date"
- },
- "公示催告": {
- "dim_name": "company_public_announcement",
- "summary_key": "", "sort_field": "publish_date"
- },
- "严重违法": {
- "dim_name": "company_illegal_info",
- "summary_key": "", "sort_field": "put_date"
- },
- "简易注销": {
- "dim_name": "company_brief_cancel_announcement",
- "summary_key": "", "sort_field": ""
- },
- "解散清算": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "股权质押": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "股权质押-质押人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "知识产权出质": { # todo 没有发现索引 404
- "dim_name": "company_ipr_pledge",
- "summary_key": "", "sort_field": ""
- },
- "注销备案": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "招投标": { # todo v9没有该维度
- "dim_name": "company_bid_new",
- "summary_key": "company_bid_new_del_0_supplier,company_bid_new_del_0_purchaser",
- "sort_field": "winhc_index_rt_company_bid_new:proxy.keyno:publish_time,winhc_index_rt_company_bid_new:purchaser_info.keyno:publish_time,winhc_index_rt_company_bid_new:supplier_info.keyno:publish_time"
- },
- "招聘信息": {
- "dim_name": "company_employment",
- "summary_key": "", "sort_field": ""
- },
- "特殊资质": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "进出口信用": { # todo 404
- "dim_name": "company_customs_credit",
- "summary_key": "", "sort_field": ""
- },
- "行政许可": {
- "dim_name": "company_license,company_license_entpub,company_license_creditchina",
- "summary_key": "",
- "sort_field": "winhc_index_rt_company_license:company_id:start_date,winhc_index_rt_company_license_entpub:company_id:start_date,winhc_index_rt_company_license_creditchina:company_id:decision_date"
- },
- "土地公示": {
- "dim_name": "company_land_publicity",
- "summary_key": "", "sort_field": "publication_date"
- },
- "购地信息": {
- "dim_name": "company_land_announcement",
- "summary_key": "", "sort_field": "contract_date"
- },
- "土地转让-受让人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "土地抵押-抵押权人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "信用评级": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "税务信用": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "融资信息": {
- "dim_name": "company_finance",
- "summary_key": "", "sort_field": ""
- },
- "债券信息": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "股权出质-质权人": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "产品信息": {
- "dim_name": "company_app_info",
- "summary_key": "", "sort_field": ""
- },
- "主要客户": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "供应商": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "抽查检查": {
- "dim_name": "company_check_info",
- "summary_key": "", "sort_field": "check_date"
- },
- "产权交易": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "双随机抽查": {
- "dim_name": "company_double_random_check_info",
- "summary_key": "", "sort_field": "check_date"
- },
- "商标": { # todo
- "dim_name": "company_tm",
- "summary_key": "", "sort_field": ""
- },
- "专利": {
- "dim_name": "company_patent",
- "summary_key": "", "sort_field": ""
- },
- "软件著作权": {
- "dim_name": "company_copyright_reg",
- "summary_key": "", "sort_field": ""
- },
- "作品著作权": {
- "dim_name": "company_copyright_works",
- "summary_key": "", "sort_field": ""
- },
- "网站域名": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "建筑资质": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "建筑人员": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "建筑项目": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "应收账款融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "DCM注册额度": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "债券融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "境外债券融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "银行借款": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "授信额度": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "租赁融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "信托融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- "其他融资": {
- "dim_name": "",
- "summary_key": "", "sort_field": ""
- },
- }
- _summary_dim_2_name = {}
- list = ['行政处罚', '企业年报', '历史变更', '主要成员', '股东信息']
- _item_2_class = {}
- for i in _map_class:
- for j in _map_class[i]:
- _item_2_class[j] = i
- pass
- for i in _winhc_dim_map:
- # if i not in list:
- # continue
- if 'summary_key' in _winhc_dim_map[i] and _winhc_dim_map[i]['summary_key'] != '':
- summary_key = _winhc_dim_map[i]['summary_key']
- for j in summary_key.split(','):
- _summary_dim_2_name[j] = _winhc_dim_map[i].copy()
- _summary_dim_2_name[j]['item_name'] = i
- _summary_dim_2_name[j]['class'] = _item_2_class[i]
- pass
- else:
- dim_name = _winhc_dim_map[i]['dim_name']
- if dim_name is None or dim_name == '':
- continue
- for j in dim_name.split(','):
- _summary_dim_2_name[j + "_del_0"] = _winhc_dim_map[i].copy()
- _summary_dim_2_name[j + "_del_0"]['item_name'] = i
- _summary_dim_2_name[j + "_del_0"]['class'] = _item_2_class[i]
- pass
- if 'history_summary_key' in _winhc_dim_map[i] and _winhc_dim_map[i]['history_summary_key'] != '':
- history_summary_key = _winhc_dim_map[i]['history_summary_key']
- for j in history_summary_key.split(','):
- _summary_dim_2_name[j] = _winhc_dim_map[i].copy()
- _summary_dim_2_name[j]['item_name'] = '历史' + i
- _summary_dim_2_name[j]['class'] = '历史信息'
- pass
- elif 'history' in _winhc_dim_map[i] and _winhc_dim_map[i]['history']:
- dim_name = _winhc_dim_map[i]['dim_name']
- if dim_name is None or dim_name == '':
- continue
- for j in dim_name.split(','):
- _summary_dim_2_name[j + "_del_1"] = _winhc_dim_map[i].copy()
- _summary_dim_2_name[j + "_del_1"]['item_name'] = '历史' + i
- _summary_dim_2_name[j + "_del_1"]['class'] = '历史信息'
- pass
- pass
- _latest_date_map = {
- }
- for i in _winhc_dim_map:
- if _winhc_dim_map[i]['sort_field'] is None or _winhc_dim_map[i]['sort_field'] == '':
- continue
- sort_field = _winhc_dim_map[i]['sort_field']
- dim_name = _winhc_dim_map[i]['dim_name']
- # index:company_id_f:sort_f
- li = []
- for j in sort_field.split(','):
- format_str = j
- num = j.count(':')
- if num == 0:
- if dim_name is None or dim_name == '':
- raise ValueError("dim_name is null !")
- format_str = 'winhc_index_rt_{}:company_id:'.format(dim_name) + j
- pass
- elif num == 1:
- if dim_name is None or dim_name == '':
- raise ValueError("dim_name is null !")
- format_str = 'winhc_index_rt_{}:'.format(dim_name) + j
- pass
- elif num == 2:
- tmp_str = j.split(":")
- if tmp_str[1] == '':
- tmp_str[1] = 'company_id'
- format_str = ':'.join(tmp_str)
- pass
- else:
- raise ValueError('sort_field: ' + j + ' error, format is index:company_id_f:sort_f')
- pass
- li.append(format_str)
- pass
- _latest_date_map[i] = ','.join(li)
- pass
- def get_summary_map():
- return _summary_dim_2_name
- def get_latest_date_map():
- return _latest_date_map
- def key_2_name(key: str):
- end_index = len(key)
- while True:
- if key in _summary_dim_2_name:
- return key, _summary_dim_2_name[key], end_index
- end_index = key.rfind('_')
- key = key[:end_index]
- pass
- if __name__ == '__main__':
- from utils import map_2_json_str
- print(map_2_json_str(_latest_date_map))
- pass
|