def get_gu_dong_detail(self, inv_id):
     url = "http://www.gsxt.gov.cn/corp-query-entprise-info-shareholderDetail-%s.html" % urllib.quote(
         inv_id.encode('utf-8')).replace('%7C', '|')
     try:
         r = self.get_request(url)
         j = json.loads(r.text)
     except (requests.exceptions.ContentDecodingError, ValueError):
         return {u'认缴明细': [], u'实缴明细': []}
     rjmx = []
     sjmx = []
     if 'data' in j:
         sj_data = j['data'][0]
         rj_data = j['data'][1]
         for sj in sj_data:
             sje = sj['acConAm']
             sjczfs = sj['conForm_CN']
             sjczrq = TimeUtils.get_date(sj['conDate'])
             sjmx.append({
                 u'实缴出资方式': sjczfs,
                 u'实缴出资额(万元)': sje,
                 u'实缴出资日期': sjczrq
             })
         for rj in rj_data:
             rje = rj['subConAm']
             rjczfs = rj['conForm_CN']
             rjczrq = TimeUtils.get_date(rj['conDate'])
             rjmx.append({
                 u'认缴出资方式': rjczfs,
                 u'认缴出资额(万元)': rje,
                 u'认缴出资日期': rjczrq
             })
     return {u'认缴明细': rjmx, u'实缴明细': sjmx}
 def get_dong_chan_di_ya_detail(self, dy_id, output_data):
     # 抵押权人信息
     dyqrxx_url = 'http://www.gsxt.gov.cn/corp-query-entprise-info-mortregpersoninfo-%s.html' % dy_id
     dyqrxx_res = self.get_request(dyqrxx_url)
     dyqrxx_data = json.loads(dyqrxx_res.text)['data']
     dyqrxx_dict = {
         'bLicType_CN': 'dyqr_zzlx',  # 抵押权人证照类型
         'more': 'dyqr_mc',  # 抵押权人名称
         'bLicNo': 'dyqr_zzhm',  # 证照号码
         # '': '',  # 住所地
     }
     # 被担保主债权信息
     bdbzzqxx_url = 'http://www.gsxt.gov.cn/corp-query-entprise-info-mortCreditorRightInfo-%s.html' % dy_id
     bdbzzqxx_res = self.get_request(bdbzzqxx_url)
     bdbzzqxx_data = json.loads(bdbzzqxx_res.text)['data']
     bdbzzqxx_dict = {
         'priClaSecKind_CN': 'dbzq_zl',  # 种类
         'priClaSecAm': 'dbzq_sl',  # 数额
         'warCov': 'dbzq_fw',  # 担保的范围
         'remark': 'dbzq_bz',  # 备注
     }
     # 抵押物信息
     dywxx_url = 'http://www.gsxt.gov.cn/corp-query-entprise-info-mortGuaranteeInfo-%s.html' % dy_id
     dywxx_res = self.get_request(dywxx_url)
     dywxx_data = json.loads(dywxx_res.text)['data']
     dywxx_dict = {
         'guaDes': 'dyw_xq',  # 数量、质量、状况、所在地等情况
         'own': 'dyw_gs',  # 所有权或使用权归属
         'guaName': 'dyw_mc',  # 抵押物名称
     }
     for d in dyqrxx_data:
         for k in d:
             if k in dyqrxx_dict:
                 col = dyqrxx_dict[k]
                 val = d[k]
                 output_data[col] = val
     for d in bdbzzqxx_data:
         for k in d:
             if k in bdbzzqxx_dict:
                 col = bdbzzqxx_dict[k]
                 val = d[k]
                 # if col == 'pefPerForm' or col == 'pefPerTo' and val:
                 #     val = TimeUtils.get_date(val)
                 if col == 'priClaSecAm':
                     val = val + bdbzzqxx_data['regCapCur_CN']
                 output_data[col] = val
         output_data['dbzq_qx'] = TimeUtils.get_date(
             d['pefPerForm']) + u'至' + TimeUtils.get_date(d['pefPerTo'])
         # val = TimeUtils.get_date(val)
     for d in dywxx_data:
         for k in d:
             if k in dywxx_dict:
                 col = dywxx_dict[k]
                 val = d[k]
                 output_data[col] = val
Example #3
0
 def get_chou_cha_jian_cha(self):
     """
     获取抽查检查信息
     :return:
     """
     draw = 1
     chou_cha_jian_cha_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.chou_cha_jian_cha_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             chou_cha_jian_cha_data.append({})
             for k in item:
                 if k in TianJinConfig.chou_cha_jian_cha_dict:
                     col = TianJinConfig.chou_cha_jian_cha_dict[k]
                     val = item[k]
                     if type(val) == unicode:
                         if '<span' in val:
                             val = re.sub('<span[^<]*</span>', '', val)
                         if '<div' in val:
                             val = re.sub('<div[^<]*</div>', '', val)
                         val = re.sub(r'\s', '', val)
                     if col == 'check_type':
                         if str(val) == '1':
                             val = u'抽查'
                         elif str(val) == '2':
                             val = u'检查'
                     elif col == 'check_date' and val:
                         val = TimeUtils.get_date(val)
                     chou_cha_jian_cha_data[-1][col] = val
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             draw += 1
             # self.get_chou_cha_jian_cha(draw + 1, chou_cha_jian_cha_data)
         else:
             # print json.dumps(chou_cha_jian_cha_data, ensure_ascii=False)
             family = 'Spot_Check'
             table_id = '16'
             self.json_result[family] = []
             for i in range(len(chou_cha_jian_cha_data)):
                 row = chou_cha_jian_cha_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.cur_mc, table_id,
                                                    self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.cur_mc
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break
 def get_dong_chan_di_ya(self):
     draw = 1
     dong_chan_di_ya_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.dong_chan_di_ya_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             dong_chan_di_ya_data.append({})
             for k in item:
                 if k in ZongJuConfig.dong_chan_di_ya_dict:
                     col = ZongJuConfig.dong_chan_di_ya_dict[k]
                     val = item[k]
                     if type(val) == unicode:
                         if '<span' in val:
                             val = re.sub('<span[^<]*</span>', '', val)
                         if '<div' in val:
                             val = re.sub('<div[^<]*</div>', '', val)
                         val = re.sub(r'\s', '', val)
                     if col == 'chattelmortgage_status':
                         if str(val) == '1':
                             val = u'有效'
                         else:
                             val = u'无效'
                     elif col == 'chattelmortgage_guaranteedamount':
                         val = str(val) + re.sub(r'\s', '',
                                                 item['regCapCur_Cn'])
                     elif col == 'chattelmortgage_registrationdate' and val:
                         val = TimeUtils.get_date(val)
                     dong_chan_di_ya_data[-1][col] = val
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             draw += 1
             # self.get_gu_quan_chu_zhi(draw + 1, dong_chan_di_ya_data)
         else:
             # print json.dumps(dong_chan_di_ya_data, ensure_ascii=False)
             family = 'Chattel_Mortgage'
             table_id = '11'
             self.json_result[family] = []
             for i in range(len(dong_chan_di_ya_data)):
                 row = dong_chan_di_ya_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.input_company_name,
                                                    table_id, self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.input_company_name
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break
Example #5
0
 def get_jing_ying_yi_chang(self):
     """
     获取经营异常信息
     :return:
     """
     draw = 1
     jing_ying_yi_chang_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.jing_ying_yi_chang_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             jing_ying_yi_chang_data.append({})
             for k in item:
                 if k in TianJinConfig.jing_ying_yi_chang_dict:
                     col = TianJinConfig.jing_ying_yi_chang_dict[k]
                     val = item[k]
                     if type(val) == unicode:
                         if '<span' in val:
                             val = re.sub('<span[^<]*</span>', '', val)
                         if '<div' in val:
                             val = re.sub('<div[^<]*</div>', '', val)
                         val = re.sub(r'\s', '', val)
                     if col == 'abnormal_datesin' or col == 'abnormal_datesout' and val:
                         val = TimeUtils.get_date(val)
                     jing_ying_yi_chang_data[-1][col] = val
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             draw += 1
             # self.get_jing_ying_yi_chang(draw + 1, jing_ying_yi_chang_data)
         else:
             # print json.dumps(jing_ying_yi_chang_data, ensure_ascii=False)
             family = 'Business_Abnormal'
             table_id = '14'
             self.json_result[family] = []
             for i in range(len(jing_ying_yi_chang_data)):
                 row = jing_ying_yi_chang_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.cur_mc, table_id,
                                                    self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.cur_mc
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break
 def get_bian_geng(self):
     draw = 1
     bian_geng_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.bian_geng_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             bian_geng_data.append({})
             for k in item:
                 col = ZongJuConfig.bian_geng_dict[k]
                 val = item[k]
                 if type(val) == unicode:
                     if '<span' in val:
                         val = re.sub('<span[^<]*</span>', '', val)
                     if '<div' in val:
                         val = re.sub('<div[^<]*</div>', '', val)
                     val = re.sub(r'\s', '', val)
                 if col == 'changedannouncement_date' and val:
                     val = TimeUtils.get_date(val)
                 bian_geng_data[-1][col] = val
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             draw += 1
             # self.get_bian_geng(draw + 1, bian_geng_data)
         else:
             # print json.dumps(bian_geng_data, ensure_ascii=False)
             family = 'Changed_Announcement'
             table_id = '05'
             self.json_result[family] = []
             for i in range(len(bian_geng_data)):
                 row = bian_geng_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.input_company_name,
                                                    table_id, self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.input_company_name
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break
Example #7
0
 def get_xing_zheng_chu_fa(self):
     """
     获取行政处罚信息
     :return:
     """
     draw = 1
     xing_zheng_chu_fa_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.xing_zheng_chu_fa_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             if not item['illegActType'] and not item['penAuth_CN'] \
                     and not item['penContent'] and not item['penDecIssDate'] \
                     and not item['penDecNo']:
                 continue
             xing_zheng_chu_fa_data.append({})
             for k in item:
                 if k in TianJinConfig.xing_zheng_chu_fa_dict:
                     col = TianJinConfig.xing_zheng_chu_fa_dict[k]
                     val = item[k]
                     if type(val) == unicode:
                         if '<span' in val:
                             val = re.sub('<span[^<]*</span>', '', val)
                         if '<div' in val:
                             val = re.sub('<div[^<]*</div>', '', val)
                         val = re.sub(r'\s', '', val)
                     if col in ('penalty_decisiondate',
                                'penalty_announcedate') and val:
                         val = TimeUtils.get_date(val)
                     xing_zheng_chu_fa_data[-1][col] = val
             if item['vPunishmentDecision'] and item['vPunishmentDecision'][
                     'fileName'].endswith('.pdf'):
                 detail_url = 'http://tj.gsxt.gov.cn/doc/%s/casefiles/%s' % (
                     item['nodeNum'],
                     item['vPunishmentDecision']['fileName'])
                 xing_zheng_chu_fa_data[-1]['penalty_details'] = detail_url
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             # self.get_xing_zheng_chu_fa(draw + 1, xing_zheng_chu_fa_data)
             draw += 1
         else:
             # print json.dumps(xing_zheng_chu_fa_data, ensure_ascii=False)
             family = 'Administrative_Penalty'
             table_id = '13'
             self.json_result[family] = []
             for i in range(len(xing_zheng_chu_fa_data)):
                 row = xing_zheng_chu_fa_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.cur_mc, table_id,
                                                    self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.cur_mc
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break
Example #8
0
 def get_gu_quan_chu_zhi(self):
     """
     获取股权出质信息
     :return:
     """
     draw = 1
     gu_quan_chu_zhi_data = []
     while True:
         params = {
             'draw': draw,
             'length': 5,
             'start': 5 * (draw - 1),
         }
         r = self.post_request(self.gu_quan_chu_zhi_url, params=params)
         json_obj = json.loads(r.text)
         data = json_obj['data']
         for item in data:
             gu_quan_chu_zhi_data.append({})
             for k in item:
                 if k in TianJinConfig.gu_quan_chu_zhi_dict:
                     col = TianJinConfig.gu_quan_chu_zhi_dict[k]
                     val = item[k]
                     if type(val) == unicode:
                         if '<span' in val:
                             val = re.sub('<span[^<]*</span>', '', val)
                         if '<div' in val:
                             val = re.sub('<div[^<]*</div>', '', val)
                         val = re.sub(r'\s', '', val)
                     if col == 'equitypledge_status':
                         if str(val) == '1':
                             val = u'有效'
                         else:
                             val = u'无效'
                     elif col == 'equitypledge_amount' and val:
                         if item['pledAmUnit']:
                             val = str(val) + re.sub(
                                 r'\s', '', item['pledAmUnit'])
                         else:
                             val = str(val) + u'万元'
                     elif col == 'equitypledge_registrationdate' and val:
                         val = TimeUtils.get_date(val)
                     gu_quan_chu_zhi_data[-1][col] = val
         if int(json_obj['draw']) < int(json_obj['totalPage']):
             draw += 1
             # self.get_gu_quan_chu_zhi(draw + 1, gu_quan_chu_zhi_data)
         else:
             # print json.dumps(gu_quan_chu_zhi_data, ensure_ascii=False)
             family = 'Equity_Pledge'
             table_id = '12'
             self.json_result[family] = []
             for i in range(len(gu_quan_chu_zhi_data)):
                 row = gu_quan_chu_zhi_data[i]
                 self.json_result[family].append({})
                 self.json_result[family][-1][
                     'rowkey'] = '%s_%s_%s_%s%d' % (self.cur_mc, table_id,
                                                    self.reg_code,
                                                    self.today, i + 1)
                 self.json_result[family][-1][
                     family + ':registrationno'] = self.reg_code
                 self.json_result[family][-1][
                     family + ':enterprisename'] = self.cur_mc
                 for k in row:
                     col = family + ':' + k
                     val = row[k]
                     self.json_result[family][-1][col] = val
             break