예제 #1
0
    def update_to_db(self, gs_basic_id, information):
        insert_flag, update_flag = 0, 0
        flag = 0
        total = len(information)
        try:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(
                HOST, USER, PASSWD, DB, PORT)
            for key in information.keys():
                executor, stock_amount, court, notice_no = information[key][0], information[key][1], information[key][2], \
                                                           information[key][3]
                status, items, rule_no, enforce_no = information[key][4], information[key][5], information[key][6], \
                                                     information[key][7]
                cert_cate, cert_code, start_date, end_date = information[key][8], information[key][9], information[key][10], \
                                                             information[key][11]
                period, pub_date = information[key][12], information[key][13]

                count = cursor.execute(select_freeze, (gs_basic_id, rule_no))
                if count == 0:

                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                                 time.localtime(time.time()))
                    rows_count = cursor.execute(
                        freeze_string,
                        (gs_basic_id, executor, stock_amount, court, notice_no,
                         status, items, rule_no, enforce_no, cert_cate,
                         cert_code, start_date, end_date, period, pub_date,
                         updated_time))
                    insert_flag += rows_count
                    connect.commit()
        except Exception, e:
            cursor.close()
            connect.close()
            logging.error("freeze error: %s" % e)
            flag = 100000006
예제 #2
0
def get_info(code, ccode):
    pattern = re.compile(r'^9.*')
    result1 = re.findall(pattern, code)
    result2 = re.findall(pattern, ccode)
    if len(result1) == 0 and len(result2) == 0:
        string = code
    elif len(result1) == 1:
        string = code
    elif len(result2) == 1:
        string = ccode
    else:
        pass
    info, flag = get_list(string)
    if flag == 100000003:
        HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
        connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB,
                                                    PORT)
        select_string = select_name % gs_basic_id
        cursor.execute(select_string)
        name = cursor.fetchall()[0][0]
        name = deal_html_code.remove_symbol(name)
        cursor.close()
        connect.close()
        info, flag = get_list(name)
    return info, flag
예제 #3
0
    def update_to_db(self,gs_basic_id, information):
        insert_flag, update_flag = 0, 0
        remark = 0
        total = len(information)
        logging.info("person total:%s"%total)
        try:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
            string = update_string % gs_basic_id
            cursor.execute(string)
            connect.commit()
            cursor.close()
            connect.close()
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
            for key in information.keys():
                name = str(information[key][0])
                position = str(information[key][1])
                rows = cursor.execute(select_string, (name, position, gs_basic_id))
                # print name,position

                if int(rows) == 1:
                    gs_person_id = cursor.fetchall()[0][0]
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                    count = cursor.execute(update_quit, (updated_time, gs_basic_id, gs_person_id))
                    connect.commit()
                elif rows == 0:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                    count = cursor.execute(insert_string, (gs_basic_id, name,position, updated_time))
                    insert_flag += count
                    connect.commit()
        except Exception, e:
            remark = 100000006
            logging.error("person error: %s" % e)
예제 #4
0
 def update_to_db(self, info, gs_basic_id):
     insert_flag, update_flag = 0, 0
     remark = 0
     total = len(info)
     try:
         HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
         connect, cursor = Connect_to_DB().ConnectDB(
             HOST, USER, PASSWD, DB, PORT)
         for key, value in info.iteritems():
             person_name = value["person_name"]
             position = value["position"]
             rows = cursor.execute(select_string,
                                   (gs_basic_id, person_name, position))
             if int(rows) == 1:
                 gs_clear_id = cursor.fetchall()[0][0]
                 updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                              time.localtime(time.time()))
                 count = cursor.execute(
                     update_string,
                     (gs_clear_id, updated_time, gs_clear_id))
                 update_flag += count
                 connect.commit()
             elif rows == 0:
                 updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                              time.localtime(time.time()))
                 count = cursor.execute(
                     insert_string,
                     (gs_basic_id, person_name, position, updated_time))
                 insert_flag += count
                 connect.commit()
     except Exception, e:
         cursor.close()
         connect.close()
         remark = 100000006
         logging.error("clear error: %s" % e)
예제 #5
0
	def update_to_db(self, info, gs_basic_id):
		insert_flag, update_flag = 0, 0
		remark = 0
		total = len(info)
		source = 0
		try:
			HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
			connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
			for key, value in info.iteritems():
				name, code, filename, start_date = value["name"], value["code"], value["filename"], value["start_date"]
				end_date, content, gov_dept = value["end_date"], value["content"], value["gov_dept"]
				status = value["status"]
				count = cursor.execute(select_string, (gs_basic_id, filename, code, start_date, end_date))
				id = ''
				if count == 0:
					updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
					rows_count = cursor.execute(permit_string, (
						gs_basic_id, id, name, code, filename, start_date, end_date, content, gov_dept, status, source,
						updated_time))
					insert_flag += rows_count
					connect.commit()
		
		except Exception, e:
			cursor.close()
			connect.close()
			remark = 100000006
			logging.error("permit error: %s" % e)
예제 #6
0
def main():
   
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    flag,recordstotal,update_total,insert_total = update_branch3(cursor, connect, gs_basic_id, gs_py_id, select_except_py, update_except_py, Except, "except")
    cursor.close()
    connect.close()
예제 #7
0
def main():
    Log().found_log(gs_py_id, gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    Judge(gs_py_id, connect, cursor, gs_basic_id, url, pagenumber,
          perpage).update_branch(update_brand_py, Brand, "brand")
    cursor.close()
    connect.close()
예제 #8
0
def main():
    
    pages, perpages = 0, 0
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    Judge(gs_py_id,connect,cursor,gs_basic_id,url,pages,perpages).update_branch(update_mort_py,Mort,"mort")
    cursor.close()
    connect.close()
예제 #9
0
def main():
    Log().found_log(gs_py_id,gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    pages, perpages = 0, 0
    Judge(gs_py_id,connect,cursor,gs_basic_id,url,pages,perpages).update_branch(update_punish_py,Punish,"punish")
    cursor.close()
    connect.close()
예제 #10
0
def  main():
    Log().found_log(gs_py_id,gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    pages, perpages = 0,0
    urllist = url.split('qisuso')
    Judge(gs_py_id, connect, cursor, gs_basic_id, urllist,pages,perpages).update_branch(update_change_py, Change, "change")
    cursor.close()
    connect.close()
예제 #11
0
 def update_to_db(self, info, gs_basic_id):
     insert_flag, update_flag = 0, 0
     remark = 0
     cate = 0
     total = len(info)
     try:
         HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
         connect, cursor = Connect_to_DB().ConnectDB(
             HOST, USER, PASSWD, DB, PORT)
         string = update_share % gs_basic_id
         cursor.execute(string)
         connect.commit()
         cursor.close()
         connect.close()
         HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
         connect, cursor = Connect_to_DB().ConnectDB(
             HOST, USER, PASSWD, DB, PORT)
         for key in info.keys():
             name, types, license_type, license_code = info[key][0], info[
                 key][1], info[key][2], info[key][3]
             if name != '' or name != None:
                 pattern = re.compile('.*公司.*|.*中心.*|.*集团.*|.*企业.*')
                 result = re.findall(pattern, name)
                 if len(result) == 0:
                     iv_basic_id = 0
                 else:
                     select_unique = select_name % name
                     number = cursor.execute(select_unique)
                     if number == 0:
                         iv_basic_id = 0
                     elif int(number) == 1:
                         iv_basic_id = cursor.fechall[0][0]
             else:
                 iv_basic_id = 0
             count = cursor.execute(select_string,
                                    (gs_basic_id, name, types, cate))
             if count == 0:
                 updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                              time.localtime(time.time()))
                 rows_count = cursor.execute(
                     share_string,
                     (gs_basic_id, name, cate, types, license_type,
                      license_code, iv_basic_id, updated_time))
                 insert_flag += rows_count
                 connect.commit()
             elif int(count) == 1:
                 updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                              time.localtime(time.time()))
                 gs_shareholder_id = cursor.fetchall()[0][0]
                 cursor.execute(
                     update_quit,
                     (updated_time, gs_shareholder_id, gs_basic_id))
                 connect.commit()
     except Exception, e:
         remark = 100000006
         logging.info("shareholer error:%s" % e)
예제 #12
0
def main():

    pages, perpages = 0, 0
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    # urllist = url.split('qisuso')
    Judge(gs_py_id, connect, cursor, gs_basic_id, url, pages,
          perpages).update_branch(update_permit_py, Permit, "permit")
    cursor.close()
    connect.close()
예제 #13
0
def main(gs_basic_id,data):
    
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    object = Basic()
    info = object.name(data)
    remark = object.update_to_db(cursor,connect,gs_basic_id,info)
    print 'basic:%s' % str(remark)
    logging.info('basic:%s' % str(remark))
    cursor.close()
    connect.close()
예제 #14
0
def main(gs_py_id,gs_basic_id,data):
    Log().found_log(gs_py_id,gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    object = Basic()
    info = object.name(data)
    remark = object.update_to_db(cursor,connect,gs_basic_id,info)
    updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
    cursor.execute(update_py,(gs_py_id,remark,updated_time,gs_py_id))
    print 'basic:%s' % str(remark)
    cursor.close()
    connect.close()
예제 #15
0
	def update_to_db(self, info, gs_basic_id):
		insert_flag, update_flag = 0, 0
		total = len(info)
		remark = 0
		try:
			HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
			connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
			string = update_string % gs_basic_id
			cursor.execute(string)
			connect.commit()
			cursor.close()
			connect.close()
			HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
			connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
			for key in info.keys():
				name, position, sex = info[key][0], info[key][1], info[key][2]
				rows = cursor.execute(select_string, (gs_basic_id, name))
				if int(rows) >= 1:
					sign = 0
					for gs_person_id, pos in cursor.fetchall():
						if pos == position:
							sign = 1
							updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
							count = cursor.execute(update_quit, (updated_time, gs_basic_id, gs_person_id))
							connect.commit()
						# update_flag += count
						elif pos == None and position != None:
							updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
							count = cursor.execute(person_string,
												   (gs_person_id, position, sex, updated_time, gs_person_id))
							update_flag += count
							connect.commit()
							sign = 0
					if sign == 0:
						source = 0
						updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
						count = cursor.execute(insert_string, (gs_basic_id, name, position, sex, source, updated_time))
						insert_flag += count
						connect.commit()
					else:
						pass
				elif rows == 0:
					source = 0
					updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
					
					count = cursor.execute(insert_string, (gs_basic_id, name, position, sex, source, updated_time))
					insert_flag += count
					connect.commit()
		
		except Exception, e:
			print e
			remark = 100000006
			logging.error("person error: %s" % e)
예제 #16
0
def main():
    Log().found_log(gs_py_id, gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    flag, total, insert_total, update_total = update_report(
        url, cursor, connect, gs_basic_id, gs_py_id)
    cursor.close()
    connect.close()
    info = {"flag": 0, "total": 0, "insert": 0, "update": 0}
    info["flag"] = int(flag)
    info["total"] = int(total)
    info["insert"] = int(insert_total)
    info["update"] = int(update_total)
    print info
예제 #17
0
    def update_to_db(self, info, gs_basic_id):
        insert_flag, update_flag = 0, 0
        remark = 0
        total = len(info)
        try:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(
                HOST, USER, PASSWD, DB, PORT)
            for key, value in info.iteritems():
                equityNo, pledgor, pledBLicNo = value["equityNo"], value[
                    "pledgor"], value["pledBLicNo"]
                impAm, impOrg, impOrgBLicNo = value["impAm"], value[
                    "impOrg"], value["impOrgBLicNo"]
                equPleDate, publicDate, type = value["equPleDate"], value[
                    "publicDate"], value["type"]
                count = cursor.execute(select_stock, (gs_basic_id, equityNo))
                if count == 0:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                                 time.localtime(time.time()))
                    rows_count = cursor.execute(
                        stock_string,
                        (gs_basic_id, equityNo, pledgor, pledBLicNo, impAm,
                         impOrg, impOrgBLicNo, equPleDate, publicDate, type,
                         updated_time))
                    insert_flag += rows_count
                    connect.commit()
                elif int(count) == 1:
                    gs_stock_id = cursor.fetchall()[0][0]
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                                 time.localtime(time.time()))

                    rows_count = cursor.execute(
                        update_stock,
                        (gs_basic_id, pledgor, pledBLicNo, impAm, impOrg,
                         impOrgBLicNo, equPleDate, publicDate, type,
                         updated_time, gs_stock_id))

                    update_flag += rows_count
                    connect.commit()
        except Exception, e:
            cursor.close()
            connect.close()
            remark = 100000001

            logging.error("stock error: %s" % e)
예제 #18
0
	def update_to_db(self, information, gs_basic_id):
		insert_flag, update_flag = 0, 0
		flag = 0
		total = len(information)
		try:
			HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
			connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
			for key, value in information.iteritems():
				types, result = value["types"], value["result"]
				check_date, gov_dept = value["check_date"], value["gov_dept"]
				count = cursor.execute(select_check, (gs_basic_id, check_date, types))
				if count == 0:
					rows_count = cursor.execute(check_string, (gs_basic_id, types, result, check_date, gov_dept))
					insert_flag += rows_count
					connect.commit()
		except Exception, e:
			cursor.close()
			connect.close()
			flag = 100000006
			logging.error("check error: %s" % e)
예제 #19
0
def main():
    Log().found_log(gs_py_id,gs_basic_id)
    HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
    connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
    flag,recordstotal,update_total,insert_total = update_branch3(cursor, connect, gs_basic_id,gs_py_id, select_check_py, update_check_py, Check, "check")
    cursor.close()
    connect.close()
    info = {
        "flag": 0,
        "total": 0,
        "update": 0,
        "insert": 0,
        'totalpage': 0,
        'perpage': 0
    }
    info["flag"] = int(flag)
    info["total"] = int(recordstotal)
    info["update"] = int(update_total)
    info["insert"] = int(insert_total)
    print info
예제 #20
0
def last_request(challenge, validate, code, ccode, cookies):
    pattern = re.compile(r'^9.*')
    result1 = re.findall(pattern, code)
    result2 = re.findall(pattern, ccode)
    if len(result1) == 0 and len(result2) == 0:
        string = code
    elif len(result1) == 1:
        string = code
    elif len(result2) == 1:
        string = ccode
    else:
        pass
    url, company, history_name, flag = get_url_info(challenge, validate,
                                                    string, cookies)
    if flag == 100000003:
        challenge, validate, cookies = loop_break_password()
        if cookies == None:
            flag = 100000001
        elif challenge == None or validate == None:
            flag = 100000002
        else:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(
                HOST, USER, PASSWD, DB, PORT)
            select_string = select_name % gs_basic_id
            cursor.execute(select_string)
            name = cursor.fetchall()[0][0]
            name = remove_symbol(name)
            cursor.close()
            connect.close()
            url, company, history_name, flag = get_url_info(
                challenge, validate, str(name), cookies)
            if flag == 100000003:
                url, company, history_name = None, None, None
            else:
                if name != company:
                    url, company, history_name = None, None, None

    return url, company, history_name, flag
예제 #21
0
    def update_to_db(self,gs_basic_id,  information):
        cate = 0
        insert_flag,update_flag = 0,0
        remark = 0
        try:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
            string = update_share % gs_basic_id
            cursor.execute(string)
            connect.commit()
            cursor.close()
            connect.close()
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(HOST, USER, PASSWD, DB, PORT)
            for key in information.keys():
                name, license_code, license_type = information[key][0], information[key][1], information[key][2]
                types, ra_date, ra_ways, true_amount = information[key][3], information[key][4], information[key][5], \
                                                       information[key][6]
                reg_amount, ta_ways, ta_date = information[key][7], information[key][8], information[key][9]

                country,address = information[key][10],information[key][11]
                iv_basic_id = 0
                if name!= '' or name !='':
                    pattern = re.compile('.*公司.*|.*中心.*|.*集团.*|.*企业.*')
                    result = re.findall(pattern,name)
                    if len(result) ==0:
                        iv_basic_id = 0
                    else:
                        select_unique = select_name % name
                        number=cursor.execute(select_unique)
                        if number ==0:
                            iv_basic_id = 0
                        elif int(number)==1:
                            iv_basic_id = cursor.fechall[0][0]
                else:
                    iv_basic_id = 0
                ps_basic_id = 0
                if license_type == '中华人民共和国居民身份证':
                    if license_code == '' or license_code == '':
                        license_code = '非公示项'
                    elif len(license_code) == 15 or len(license_code) == 18:
                        ps_basic_id = self.judge_certcode(name, license_code, cursor, connect, gs_basic_id)
                elif license_code == '' or license_code == '' and license_type!='':
                    license_code = '非公示项'
                else:
                    ps_basic_id = 0
                count = cursor.execute(select_string, (gs_basic_id, name, types, cate))

                if count == 0:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                    rows_count = cursor.execute(share_string, (
                            gs_basic_id, name, cate, types, license_type, license_code, ra_date, ra_ways, true_amount,
                            reg_amount, ta_ways, ta_date, country,address,iv_basic_id,ps_basic_id,updated_time))
                    insert_flag += rows_count
                    connect.commit()
                elif int(count) == 1:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
                    gs_shareholder_id = cursor.fetchall()[0][0]
                    cursor.execute(update_quit, (updated_time, gs_shareholder_id, gs_basic_id))
                    connect.commit()
        except Exception, e:
            remark = 100000006
            logging.error("shareholder error:%s" % e)
예제 #22
0
    def update_to_db(self, info, gs_basic_id):

        cate = 0
        insert_flag, update_flag = 0, 0
        remark = 0
        total = len(info)
        try:
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(
                HOST, USER, PASSWD, DB, PORT)
            string = update_share % gs_basic_id
            cursor.execute(string)
            connect.commit()
            cursor.close()
            connect.close()
            HOST, USER, PASSWD, DB, PORT = config.HOST, config.USER, config.PASSWD, config.DB, config.PORT
            connect, cursor = Connect_to_DB().ConnectDB(
                HOST, USER, PASSWD, DB, PORT)
            for key, value in info.items():
                name, license_code, license_type = value["name"], value[
                    "license_code"], value["license_type"]
                types, ra_date, ra_ways, true_amount = value["types"], value[
                    "ra_date"], value["ra_ways"], value["true_amount"]
                reg_amount, ta_ways, ta_date = value["reg_amount"], value[
                    "ta_ways"], value["ta_date"]

                iv_basic_id = 0
                if name != '' and name != None:
                    pattern = re.compile('.*公司.*|.*中心.*|.*集团.*|.*企业.*')
                    result = re.findall(pattern, name)
                    if len(result) == 0:
                        iv_basic_id = 0
                    else:
                        select_unique = select_name % name
                        number = cursor.execute(select_unique)
                        if number == 0:
                            iv_basic_id = 0
                        elif int(number) == 1:
                            iv_basic_id = cursor.fechall[0][0]
                else:
                    iv_basic_id = 0

                count = cursor.execute(select_string,
                                       (gs_basic_id, name, types, cate))

                if count == 0:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                                 time.localtime(time.time()))
                    rows_count = cursor.execute(
                        share_string,
                        (gs_basic_id, name, cate, types, license_type,
                         license_code, ra_date, ra_ways, true_amount,
                         reg_amount, ta_ways, ta_date, iv_basic_id,
                         updated_time))
                    insert_flag += rows_count
                    connect.commit()
                elif int(count) == 1:
                    updated_time = time.strftime("%Y-%m-%d %H:%M:%S",
                                                 time.localtime(time.time()))
                    gs_shareholder_id = cursor.fetchall()[0][0]
                    cursor.execute(
                        update_quit,
                        (updated_time, gs_shareholder_id, gs_basic_id))
                    connect.commit()
        except Exception, e:
            traceback.format_exc()
            remark = 100000006
            logging.error("shareholder error:%s" % e)