def name(self,data): info = {} if len(data)!=0: for i,single in enumerate(data): if "regNo" in single.keys(): code = single["regNo"] code = deal_html_code.remove_symbol(code) else: code = '' if "uniScid" in single.keys(): ccode = single["uniScid"] else: ccode = '' ccode = deal_html_code.remove_symbol(ccode) if "brName" in single.keys(): name = single["brName"] name = deal_html_code.remove_symbol(name) else: name = '' if "regOrganName" in single.keys(): gov_dept = single["regOrganName"] gov_dept = deal_html_code.remove_symbol(gov_dept) else: gov_dept = '' info[i] = [name, code, gov_dept,ccode] return info
def name(self, data): information = {} for i, singledata in enumerate(data): types = '黑名单' if "bulletinListed" in singledata.keys(): in_reason = singledata["bulletinListed"] in_reason = deal_html_code.remove_symbol(in_reason) else: in_reason = '' if "abnTime" in singledata.keys(): in_date = singledata["abnTime"] in_date = change_chinese_date(in_date) else: in_date = '0000-00-00' if "bulletinRemoved" in singledata.keys(): out_reason = singledata["bulletinRemoved"] out_reason = deal_html_code.remove_symbol(out_reason) else: out_reason = '' if "remTime" in singledata.keys(): out_date = singledata["remTime"] out_date = change_chinese_date(out_date) else: out_date = '0000-00-00' if "remOrganInterpreted" in singledata.keys(): gov_dept = singledata["remOrganInterpreted"] else: gov_dept = '' information[i] = [ types, in_reason, in_date, out_reason, out_date, gov_dept ] return information
def name(self,data): information = {} for i in xrange(len(data)): singledata = data[i] types = '经营异常' if "speCauseInterpreted" in singledata.keys(): in_reason = singledata["speCauseInterpreted"] else: in_reason = '' if 'abnTime' in singledata.keys(): in_date = singledata["abnTime"] in_date = deal_html_code.change_chinese_date(in_date) else: in_date = '0000-00-00' if "remExcpResInterpreted" in singledata.keys(): out_reason = singledata["remExcpResInterpreted"] out_reason = deal_html_code.remove_symbol(out_reason) else: out_reason = '' if 'remDate' in singledata.keys(): out_date = singledata["remDate"] out_date = deal_html_code.change_chinese_date(out_date) else: out_date = '0000-00-00' if "decOrgInterpreted" in singledata.keys(): gov_dept = singledata["decOrgInterpreted"] else: gov_dept = '' information[i] = [types, in_reason, in_date, out_reason, out_date, gov_dept] return information
def name(self,data): information = {} for i,singledata in enumerate(data): # nodeNum = singledata["nodeNum"] ia_zch = singledata["regNum"] if "intCls" in singledata.keys(): ia_flh = singledata["intCls"] else: ia_flh = '' if "regAnncIssue" in singledata.keys(): ia_zcgg = singledata["regAnncIssue"] else: ia_zcgg = '' if "goodsCnName" in singledata.keys(): ia_servicelist = deal_html_code.remove_symbol(singledata["goodsCnName"]) else: ia_servicelist = '' if "propertyBgnDate" in singledata.keys(): begin = singledata["propertyBgnDate"] begin = deal_html_code.change_chinese_date(begin) else: begin = '' if "propertyEndDate" in singledata.keys(): end = singledata["propertyEndDate"] end = deal_html_code.change_chinese_date(end) else: end = '' if "uniScid" in singledata.keys(): regNo = singledata["uniScid"] else: regNo = singledata["regNo"] province = judge_province(regNo) if begin== '' and end =='': ia_zyqqx = '' else: ia_zyqqx = begin + '至' + end if "regAnncDate" in singledata.keys(): ia_zcdate = singledata["regAnncDate"] ia_zcdate = deal_html_code.change_chinese_date(ia_zcdate) else: ia_zcdate = '' if "tmImage" in singledata.keys(): tmImage = singledata["tmImage"] else: tmImage = '' information[i] = [ia_zch, ia_flh, ia_zcgg, ia_servicelist, ia_zyqqx, ia_zcdate,province,tmImage] return information
def get_single_goods(self,data): information = {} if data != '': for i,singledata in enumerate(data): name = singledata["guaName"] if "own" in singledata.keys(): ownership = singledata["own"] else: ownership = '' situation = singledata["guaDesc"] situation = deal_html_code.remove_symbol(situation) if "remark" in singledata.keys(): remark = singledata["remark"] else: remark = '' information[i] = [name, ownership, situation, remark] return information
def deal_info(self, item): info = {} href = item.xpath("./@href")[0] url = url_first + href company = item.xpath('./h1[@class="f20"]')[0].xpath('string(.)') company = remove_symbol(company) status = item.xpath('./div[@class="wrap-corpStatus"]')[0].xpath( 'string(.)') status = remove_symbol(status) code = item.xpath('.//div[@class="div-map2"]')[0].xpath('string(.)') code = remove_symbol(code) # print code if len(code.split(':')) == 2: code = code.split(':')[1] else: code = code.split(':')[1] daibiao = item.find('.//div[@class="div-user2"]').xpath('string(.)') daibiao = remove_symbol(daibiao) dates = item.find('.//div[@class="div-info-circle2"]').xpath( 'string(.)') dates = remove_symbol(dates) dates = dates.split(':')[1] dates = change_chinese_date(dates) history_name = item.xpath('.//div[@class="div-info-circle3"]') if len(history_name) != 0: history = item.xpath( './/div[@class="div-info-circle3"]/span[@class="g3"]' )[0].xpath('string(.)') else: history = None history = remove_symbol(history) if history != None: list = re.split(';', str(history)) templist = [] for k, temp in enumerate(list): if temp != u'': templist.append(temp) history = ';'.join(templist) info[code] = [url, company, status, code, daibiao, dates, history] return info
def get_all_info(self, url): information = {} result = requests.get(url).content data = json.loads(result) if "regNo" in data.keys(): code = data["regNo"] else: code = '' if "uniScid" in data.keys(): ccode = data["uniScid"] else: ccode = '' uuid = data["annlId"] name = data["entName"] if len(data["entAnnlEtpsSet"]) != 0: entAnnlEtps = data["entAnnlEtpsSet"][0] if 'tel' in entAnnlEtps.keys(): tel = entAnnlEtps["tel"] else: tel = '' if 'email' in entAnnlEtps.keys(): email = entAnnlEtps["email"] else: email = '' if 'postalCode' in entAnnlEtps.keys(): postcode = entAnnlEtps["postalCode"] else: postcode = '' if 'ifInvest' in entAnnlEtps.keys(): if_invest = int(entAnnlEtps["ifInvest"]) else: if_invest = 0 if 'ifStocktrans' in entAnnlEtps.keys(): if_sharetrans = int(entAnnlEtps["ifStocktrans"]) else: if_sharetrans = 0 else: tel = '' email = '' postcode = '' if_invest = 0 if_sharetrans = 0 if "hasFwarnnt" in data.keys(): if_fwarnnt = data["hasFwarnnt"] else: if_fwarnnt = 0 if "addr" in data.keys(): address = data["addr"] else: address = '' status = data["opStateInterpreted"] if len(data["entAnnlEmployeeSet"]) != 0: employees = data["entAnnlEmployeeSet"][0] employee = employees["empNum"] if_empnum = int(employees["empNumSign"]) else: employee = '' if_empnum = 0 if "womEmpNum" in data.keys(): womennum = data["womEmpNum"] if_womennum = int(data["womEmpNumSign"]) else: womennum = '' if_womennum = 0 if "holdingsMsg" in data.keys(): holding = data["holdingsMsg"] holding = config.holding[holding] if_holding = int(data["holdingsMsgSign"]) else: holding = '' if_holding = 0 if "mainBusiact" in data.keys(): mainbus = data["mainBusiact"] mainbus = deal_html_code.remove_symbol(mainbus) else: mainbus = '' if "priPid" in data.keys(): pripid = data["priPid"] else: pripid = '' refuuid = data["refUuid"] if "hasWebsite" in data.keys(): if_website = int(data["hasWebsite"]) else: if_website = 0 if "ifNet" in data.keys(): if_net = int(data["ifNet"]) else: if_net = 0 if "reportMode" in data.keys(): report_mode = data["reportMode"] else: report_mode = '' if "reportType" in data.keys(): types = config.company_type[data["reportType"]] else: types = '' if len(data["entAnnlPeSet"]) != 0: entAnnlPeSet = data["entAnnlPeSet"][0] if "psnName" in entAnnlPeSet.keys(): runner = entAnnlPeSet["psnName"] else: runner = '' if "fundAm" in entAnnlPeSet.keys(): amount = entAnnlPeSet["fundAm"] if "tel" in entAnnlPeSet.keys(): tel = entAnnlPeSet["tel"] else: tel = '' else: runner = '' amount = '' fill_date = data["anCheDate"] fill_date = deal_html_code.change_chinese_date(fill_date) information[0] = [ name, uuid, tel, address, email, postcode, status, employee, if_empnum, womennum, if_womennum, holding, if_holding, mainbus, code, ccode, pripid, refuuid, if_invest, if_sharetrans, if_fwarnnt, if_website, if_net, report_mode, types, runner, amount, province, fill_date ] runinfo = data["entAnnlRunSet"] assureinfo = data["entAnnlFwarnntSet"] investinfo = data["entAnnlOutinvSet"] labinfo = data["entAnnlSocSet"] permitinfo = data["entAnnlPermitSet"] partyinfo = data["entAnnlPartySet"] schangeinfo = data["entAnnlStocktransSet"] shareinfo = data["entAnnlInvestorSet"] webinfo = data["entAnnlWebsiteSet"] return information, runinfo, assureinfo, investinfo, labinfo, permitinfo, partyinfo, schangeinfo, shareinfo, webinfo
def update_basic(information, connect, cursor, gs_basic_id): if '企业名称' in information.keys(): name = information[u"企业名称"] elif '名称' in information.keys(): name = information[u"名称"] if '统一社会信用代码' in information.keys(): code = information[u"统一社会信用代码"] ccode = information[u"统一社会信用代码"] ccode = str(ccode).replace('\t', '').replace('\n', '').replace(' ', '') elif '注册号' in information.keys(): code = information[u"注册号"] ccode = '' elif '统一社会信用代码/注册号' in information.keys(): code = information[u"统一社会信用代码/注册号"] pattern = re.compile('^91.*|92.*|93.*') ccode = re.findall(pattern, code) if len(ccode) == 0: ccode = '' elif len(ccode) == 1: ccode = ccode[0] if '登记状态' in information.keys(): status = information[u"登记状态"] if '类型' in information.keys(): types = information[u'类型'] if '组成形式' in information.keys(): jj_type = information[u'组成形式'] else: jj_type = None if '法定代表人' in information.keys(): legal_person = information[u"法定代表人"] responser = None investor = None runner = None elif '经营者' in information.keys(): runner = information[u"经营者"] legal_person = None responser = None investor = None elif '负责人' in information.keys(): responser = information[u'负责人'] runner = None legal_person = None investor = None elif '投资人' in information.keys(): investor = information[u"投资人"] responser = None runner = None legal_person = None elif '执行事务合伙人' in information.keys(): legal_person = information[u"执行事务合伙人"] investor = None runner = None responser = None if '成立日期' in information.keys(): sign_date = information[u"成立日期"] sign_date = change_chinese_date(sign_date) elif '注册日期' in information.keys(): sign_date = information[u"注册日期"] sign_date = change_chinese_date(sign_date) else: sign_date = None if '注册资本' in information.keys(): reg_amount = information[u"注册资本"] elif '成员出资额' in information.keys(): reg_amount = information[u"成员出资额"] else: reg_amount = None if '核准日期' in information.keys(): appr_date = information[u"核准日期"] appr_date = change_chinese_date(appr_date) else: appr_date = None if '营业期限自' in information.keys(): start_date = information[u"营业期限自"] start_date = change_chinese_date(start_date) elif '合伙期限自' in information.keys(): start_date = information[u"合伙期限至"] start_date = change_chinese_date(start_date) else: start_date = None if '营业期限至' in information.keys(): end_date = information[u"营业期限至"] end_date = change_chinese_date(end_date) elif '合伙期限至' in information.keys(): end_date = information[u"合伙期限至"] end_date = change_chinese_date(end_date) else: end_date = None if '登记机关' in information.keys(): reg_zone = information[u"登记机关"] if '住所' in information.keys(): reg_address = information[u"住所"] elif '经营场所' in information.keys(): reg_address = information[u"经营场所"] elif '主要经营场所' in information.keys(): reg_address = information[u"主要经营场所"] elif '营业场所' in information.keys(): reg_address = information[u"营业场所"] if '业务范围' in information.keys(): scope = information[u"业务范围"] elif '经营范围' in information.keys(): scope = information[u"经营范围"] # updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) row_count = 0 flag = 0 ccode = remove_symbol(ccode) try: row_count = cursor.execute( update_string, (gs_basic_id, name, ccode, status, types, jj_type, legal_person, responser, investor, runner, sign_date, appr_date, reg_amount, start_date, end_date, reg_zone, reg_address, scope, gs_basic_id)) logging.info('update basic :%s' % row_count) connect.commit() except Exception, e: flag = 100000004 logging.error("basic error:" % e)
def name(self,data): info = {} if len(data)!=0: for i,single in enumerate(data): if "invName" in single.keys(): name = single["invName"] else: name = '' if "invTypeInterpreted" in single.keys(): types = single["invTypeInterpreted"] else: types = '' if single["blicTypeInterpreted"]=='': license_code = '' license_type = '' elif single["cetfTypeInterpreted"] =='': license_type = '' license_code = '' elif single["blicTypeInterpreted"]!='': license_type = single["blicTypeInterpreted"] license_code = single["bLicNo"] license_code = deal_html_code.remove_symbol(license_code) elif single["cetfTypeInterpreted"]: license_type = single["cetfTypeInterpreted"] license_code = single["cetfId"] encrypted = single["encrypted"] if "cetfType" in single.keys(): cetfType = single["cetfType"] elif "bLicType" in single.keys(): cetfType = single["bLicType"] else: cetfType = '' if "subconAm" in single.keys(): reg_amount = single["subconAm"] else: reg_amount = '' if "acconAm" in single.keys(): true_amount = single["acconAm"] else: true_amount = '' if "conDate" in single.keys(): ta_date = single["conDate"] ta_date = deal_html_code.change_chinese_date(ta_date) else: ta_date = '0000-00-00' if "conForm" in single.keys(): ta_ways = single["conForm"] else: ta_ways = '' if ta_ways == '1': ta_ways = '货币' if "countryInterpreted" in single.keys(): country = single["countryInterpreted"] else: country = '' if "dom" in single.keys(): address = single["dom"] else: address = '' info[i] = [name,types,license_code,license_type,reg_amount,true_amount,ta_date,ta_ways,country,address,encrypted,cetfType] return info
def name(self,data): info = [] name = data["entName"] if "uniScid" in data.keys(): ccode = data["uniScid"] else: ccode = '' if "opStateInterpreted" in data.keys(): status = data["opStateInterpreted"] else: status = '' if "entTypeInterpreted" in data.keys(): types = data["entTypeInterpreted"] else: types = '' if "lerep" in data.keys(): legal_person = data["lerep"] else: legal_person = '' if "estDate" in data.keys(): reg_date = data["estDate"] reg_date = deal_html_code.change_chinese_date(reg_date) else: reg_date = None if "issBlicDate" in data.keys(): appr_date = data["issBlicDate"] appr_date = deal_html_code.change_chinese_date(appr_date) else: appr_date = None if "regCapInterpreted" in data.keys(): reg_amount = data["regCapInterpreted"] else: reg_amount = '' if "opFrom" in data.keys(): start_date = data["opFrom"] start_date = deal_html_code.change_chinese_date(start_date) else: start_date = None if "opTo" in data.keys(): end_date = data["opTo"] end_date = deal_html_code.change_chinese_date(end_date) else: end_date = None if "regOrganInterpreted" in data.keys(): reg_zone = data["regOrganInterpreted"] else: reg_zone = '' if "dom" in data.keys(): reg_address = data["dom"] else: reg_address = '' if "opScope" in data.keys(): scope = data["opScope"] scope = deal_html_code.remove_symbol(scope) else: scope = '' if "canDate" in data.keys(): del_date = data["canDate"] del_date = deal_html_code.change_chinese_date(del_date) else: del_date = None info = [name,ccode,status,types,legal_person,reg_date,appr_date,reg_amount,start_date,end_date,reg_zone,reg_address,scope,del_date] return info