def get_info(self, data): tr_list = data.xpath(".//tr") info = {} for i, singledata in enumerate(tr_list): temp = {} td_list = singledata.xpath("./td") # 针对表头和为信息的情况进行特殊对待 if len(td_list) == 0 or len(td_list) == 1: continue temp["name"] = deal_html_code.remove_symbol( td_list[1].xpath("string(.)")) reg_amount = deal_html_code.remove_symbol( td_list[2].xpath("string(.)")) temp["reg_amount"] = deal_html_code.match_float(reg_amount) reg_date = deal_html_code.remove_symbol( td_list[3].xpath("string(.)")) temp["reg_date"] = deal_html_code.change_chinese_date(reg_date) temp["reg_way"] = deal_html_code.remove_symbol( td_list[4].xpath("string(.)")) ac_amount = deal_html_code.remove_symbol( td_list[5].xpath("string(.)")) temp["ac_amount"] = deal_html_code.match_float(ac_amount) ac_date = deal_html_code.remove_symbol( td_list[6].xpath("string(.)")) temp["ac_date"] = deal_html_code.change_chinese_date(ac_date) temp["ac_way"] = deal_html_code.remove_symbol( td_list[7].xpath("string(.)")) info[i] = temp return info
def get_info(self, data): info = {} for key, value in dict.iteritems(): info[value] = deal_html_code.get_match_info(key, data) # 调用juege_if_public判断是否公示,判断是否公示是根据所取到的该部分信息中是否含有元 # 进行判断的,可能总结不够全面,以后见到不含元的再更改函数 info["if_asset"] = self.judge_if_public(info["asset"]) # 判断完是否公示后调用match_float取里面的数字 info["asset"] = deal_html_code.match_float(info["asset"]) info["if_benifit"] = self.judge_if_public(info["benifit"]) info["benifit"] = deal_html_code.match_float(info["benifit"]) info["if_main"] = self.judge_if_public(info["main_income"]) info["main_income"] = deal_html_code.match_float(info["main_income"]) info["if_net"] = self.judge_if_public(info["net_income"]) info["net_income"] = deal_html_code.match_float(info["net_income"]) info["if_tax"] = self.judge_if_public(info["tax"]) info["tax"] = deal_html_code.match_float(info["tax"]) info["if_loan"] = self.judge_if_public(info["loan"]) info["loan"] = deal_html_code.match_float(info["loan"]) info["if_subsidy"] = self.judge_if_public(info["subsidy"]) info["subsidy"] = deal_html_code.match_float(info["subsidy"]) info["if_income"] = deal_html_code.match_float(info["income"]) info["income"] = self.judge_if_public(info["income"]) info["if_profit"] = deal_html_code.match_float(info["profit"]) info["profit"] = self.judge_if_public(info["profit"]) info["if_debt"] = deal_html_code.match_float(info["debt"]) info["debt"] = self.judge_if_public(info["debt"]) return info
def deal_single_info(self, data, info): for i, singledata in enumerate(data): org = singledata["ORG"] id = singledata["ID"] seqid = singledata["SEQ_ID"] code = singledata["GUARANTY_REG_NO"] dates = singledata["START_DATE"] dates = deal_html_code.change_chinese_date(dates) dept = singledata["CREATE_ORG"] amount = singledata["ASSURE_CAPI"] amount = deal_html_code.match_float(amount) status = singledata["STATUS"] cates = singledata["ASSURE_KIND"] start_date = singledata["ASSURE_START_DATE"] start_date = deal_html_code.change_date_style(start_date) end_date = singledata["ASSURE_END_DATE"] end_date = deal_html_code.change_date_style(end_date) period = "自" + start_date + "至" + end_date ranges = singledata["ASSURE_SCOPE"] remark = singledata["REMARK"] cancel_cause = singledata["WRITEOFF_REASON"] RN = singledata["RN"] types = 'mort_person' person_href = person_url + params.format(org, id, seqid) person_info = self.get_detail_info(person_href, types) types = 'mort_goods' goods_href = goods_url + params.format(org, id, seqid) # print goods_href goods_info = self.get_detail_info(goods_href, types) info[RN] = [ code, dates, dept, amount, status, cates, period, ranges, remark, cancel_cause, person_info, goods_info ]
def get_info(self, data): info = {} for key, value in config.report_lab_dict.iteritems(): info[value] = deal_html_code.get_match_info(key, data) # 这两种情况的采集没有太大意义就不再入库 if info["birth_num"] == '' or info["birth_num"] == '人': info = {} else: # 判定欠费金额,实际缴费金额,缴费基数 是否公示 # 判定标准选取生育的各个对应信息进行标准, # 即认为如果生育、医疗、养老、失业中有一个欠费,实缴,基数是不公示的 # 则其他的也是不公示的 if info["birth_owe"] > 0: if_owe = 0 else: if_owe = 1 info["if_owe"] = if_owe if info["birth_base"] == 0: if_basenum = 0 else: if_basenum = 1 info["if_basenum"] = if_basenum if info["birth"] == 0: if_periodamount = 0 else: if_periodamount = 1 info["if_periodamount"] = if_periodamount for key, value in info.iteritems(): print key, value if "if" in key: continue info[key] = deal_html_code.match_float(value) return info
def deal_single_info(self, data, info): for i, singledata in enumerate(data): name = singledata["STOCK_NAME"] reg_amount = singledata["SHOULD_CAPI"] reg_amount = deal_html_code.match_float(reg_amount) reg_date = singledata["SHOULD_CAPI_DATE"] reg_date = deal_html_code.change_chinese_date(reg_date) reg_way = singledata["SHOULD_CAPI_TYPE"] ac_amount = singledata["REAL_CAPI"] ac_amount = deal_html_code.match_float(ac_amount) ac_date = singledata["REAL_CAPI_DATE"] ac_date = deal_html_code.change_chinese_date(ac_date) ac_way = singledata["REAL_CAPI_TYPE"] uuid = singledata["ID"] RN = singledata["RN"] info[RN] = [name, uuid,reg_amount, reg_date, reg_way, ac_amount, ac_date, ac_way]
def get_info(self): result, status_code = Send_Request(self.url, self.headers).send_request() info = {} runinfo = {} if status_code == 200: flag = 1 data = json.loads(result.content) code = data["REG_NO"] if code.startswith("9"): ccode = code else: ccode = '' name = data["CORP_NAME"] tel = data["TEL"] address = data["ADDR"] email = data["E_MAIL"] postcode = data["ZIP"] status = data["PRODUCE_STATUS"] employee = data["PRAC_PERSON_NUM"] if employee == None: if_empnum = 0 elif u"不公示" in employee: if_empnum = 0 else: if_empnum = 1 womennum = data["WOM_EMP_NUM"] if womennum == None: if_womennum = 0 elif u"不公示" in womennum: if_womennum = 0 else: if_womennum = 1 holding = data["HOLDINGS_MSG"] if holding == None: if_holding = 0 elif u"不公示" in holding: if_holding = 0 else: if_holding = 1 mainbus = data["MAIN_BUSIACT"] runner = data["OPER_MAN_NAME"] amount = data["REG_CAPI"] fill_date = data["REPORT_DATE"] info[0] = [ name, tel, address, email, postcode, status, employee, if_empnum, womennum, if_womennum, holding, if_holding, mainbus, code, ccode, runner, amount, fill_date ] asset = data["NET_AMOUNT"] if_asset = self.judge_if_public(asset) asset = deal_html_code.match_float(asset) benifit = data["TOTAL_EQUITY"] if_benifit = self.judge_if_public(benifit) benifit = deal_html_code.match_float(benifit) income = data["SERV_FARE_INCOME"] if_income = self.judge_if_public(income) income = deal_html_code.match_float(income) profit = data["PROFIT_TOTAL"] if_profit = self.judge_if_public(profit) profit = deal_html_code.match_float(profit) main_income = data["SALE_INCOME"] if_main = self.judge_if_public(main_income) main_income = deal_html_code.match_float(main_income) net_income = data["PROFIT_RETA"] if_net = self.judge_if_public(net_income) net_income = deal_html_code.match_float(net_income) tax = data["TAX_TOTAL"] if_tax = self.judge_if_public(tax) tax = deal_html_code.match_float(tax) debt = data["DEBT_AMOUNT"] if_debt = self.judge_if_public(debt) debt = deal_html_code.match_float(debt) loan = data["LOAN"] if_loan = self.judge_if_public(loan) loan = deal_html_code.match_float(loan) subsidy = data["SUBSIDY"] if_subsidy = self.judge_if_public(subsidy) subsidy = deal_html_code.match_float(subsidy) runinfo[0] = [ asset, if_asset, benifit, if_benifit, income, if_income, profit, if_profit, main_income, if_main, net_income, if_net, tax, if_tax, debt, if_debt, loan, if_loan, subsidy, if_subsidy ] else: flag = 100000004 return info, runinfo, flag
def get_info(self): result, status_code = Send_Request(self.url,self.headers).send_request() info = {} if status_code == 200: flag = 1 data = json.loads(result.content) if len(data) >0: uuid = data["ID"] birth_owe = data["PAYMENT_SY"] birth_num = data["MATERNITY_NUM"] birth = data["SOCIALINS_SY"] birth_base = data["WAGES_SY"] if u"不公示" in birth_owe: if_owe = 0 else: if_owe = 1 if u"不公示" in birth_base: if_basenum = 0 else: if_basenum = 0 if u"不公示" in birth: if_periodamount = 0 else: if_periodamount = 1 birth_owe = deal_html_code.match_float(birth_owe) birth_num = deal_html_code.match_float(birth_num) birth = deal_html_code.match_float(birth) birth_base = deal_html_code.match_float(birth_base) old_num = deal_html_code.match_float(data["ENDOWMENT_NUM"]) old_owe = deal_html_code.match_float(data["PAYMENT_JBYL"]) old = deal_html_code.match_float(data["SOCIALINS_JBYL"]) old_base = deal_html_code.match_float(data["WAGES_JBYL"]) unemploy = deal_html_code.match_float(data["SOCIALINS_SYBX"]) unemploy_base = deal_html_code.match_float(data["WAGES_SYBX"]) unemploy_owe = deal_html_code.match_float(data["PAYMENT_SYBX"]) unemploy_num = deal_html_code.match_float(data["UNEMPLOYED_NUM"]) medical = deal_html_code.match_float(data["SOCIALINS_YLBX"]) medical_base = deal_html_code.match_float(data["WAGES_YLBX"]) medical_owe = deal_html_code.match_float(data["PAYMENT_YLBX"]) medical_num = deal_html_code.match_float(data["MEDICARE_NUM"]) injury = deal_html_code.match_float(data["SOCIALINS_GSBX"]) injury_owe = deal_html_code.match_float(data["PAYMENT_GSBX"]) injury_num = deal_html_code.match_float(data["EMPLOYMENT_INJURY_NUM"]) info[0] = [uuid, if_owe, if_basenum, if_periodamount, birth_owe, birth_num, birth, birth_base, old_num, old_owe, old, old_base, \ unemploy, unemploy_base, unemploy_owe, unemploy_num, medical, medical_base, medical_owe, medical_num, injury, injury_owe, injury_num] else: logging.info("无社保信息") else: flag = 100000004 logging.info("打开社保链接失败!") return info,flag