no need to generate number for all contact
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
from mrz.generator.td1 import TD1CodeGenerator
|
||||
|
||||
first_name = "Zhen"
|
||||
last_name = "XU"
|
||||
document_number = "E10805074"
|
||||
birth_day = "990620"
|
||||
sex = "F"
|
||||
first_name = "Lei"
|
||||
last_name = "PAN"
|
||||
document_number = "HP3E1P59N"
|
||||
birth_day = "841215"
|
||||
# sex = "F"
|
||||
sex = "M"
|
||||
# optinal_data = "MFMLMANK<<<<A9" #14位
|
||||
nationality = "CHN"
|
||||
country_code = "HUN"
|
||||
country_code = "FRA"
|
||||
# optinal_data = "<E10805074" # 14位
|
||||
optinal_data = None
|
||||
optinal_data = "<5703070161" #总共11位,最前面那位为空,所以加<
|
||||
document_prefix = "IR"
|
||||
expire_date = "240801"
|
||||
expire_date = "270803"
|
||||
if optinal_data is not None:
|
||||
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
|
||||
last_name, first_name, optional_data1=optinal_data)
|
||||
|
||||
@@ -5,8 +5,10 @@ from pathlib import Path
|
||||
import xlsxwriter
|
||||
|
||||
from src.db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from src.person_name.extract_name_with_pinyinlist import filter_already_validated_contacts, read_pinyin_list_from_file
|
||||
from src.pojo.contact_pojo import ContactPojo
|
||||
from src.utils.contacts.generate_random_passport_id import generate_single_titre_sejour_number
|
||||
from src.utils.contacts.generate_random_passport_id import generate_single_titre_sejour_number, \
|
||||
get_random_passport_id_number
|
||||
from src.utils.excel_reader import read_contacts, fr_phone_number_prefix, get_random_fr_phone_numbers, ExcelHelper
|
||||
|
||||
# from src.person_name.cython_extract_methods import filter_already_validated_contacts, read_pinyin_list_from_file
|
||||
@@ -16,7 +18,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
|
||||
|
||||
|
||||
def upload_contacts_list():
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-01-24.xlsx")
|
||||
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_all.xlsx")
|
||||
return _contacts_to_book
|
||||
|
||||
|
||||
@@ -51,13 +53,14 @@ def generate_contact_from_mail_list(mail_list_file,
|
||||
print(pinyin_name_list[0])
|
||||
for mail in mail_list:
|
||||
phone_number = get_random_fr_phone_numbers()
|
||||
# passport_number = get_random_passport_id_number()
|
||||
passport_number = generate_single_titre_sejour_number()
|
||||
passport_number = get_random_passport_id_number()
|
||||
resident_card_number = generate_single_titre_sejour_number()
|
||||
name = random.choice(pinyin_name_list)
|
||||
last_name = name.split(" ")[0]
|
||||
first_name = name.split(" ")[1]
|
||||
contact = ContactPojo(mail=mail.mail, phone_number=phone_number, passport=passport_number,
|
||||
last_name=last_name, first_name=first_name, store="random")
|
||||
contact.resident_card_number = resident_card_number
|
||||
generate_contacts.append(contact)
|
||||
write_new_contacts_to_excel(generate_contacts)
|
||||
|
||||
@@ -91,24 +94,25 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
|
||||
|
||||
|
||||
def generate_valid_contact_list_for_day(segment_number=1):
|
||||
_collection_name = "2025-01-24"
|
||||
_collection_name = "2025-03-08"
|
||||
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name)
|
||||
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
|
||||
_contact_to_save = []
|
||||
for _contact in _valid_contact_list:
|
||||
# _contact.store = "faubourg"
|
||||
_contact.store = "random"
|
||||
if _contact.last_name is None or len(_contact.last_name) == 0:
|
||||
# if _contact.last_name is None or len(_contact.last_name) == 0:
|
||||
for _true_contact in _all_contacts:
|
||||
if _true_contact.mail == _contact.mail:
|
||||
_contact.last_name = _true_contact.last_name
|
||||
_contact.phone = _true_contact.phone
|
||||
_contact.passport = _true_contact.passport
|
||||
_contact.first_name = _true_contact.first_name
|
||||
if _contact.resident_card_number is None or len(_contact.resident_card_number) == 0:
|
||||
for _true_contact in _all_contacts:
|
||||
if _true_contact.mail == _contact.mail:
|
||||
_contact.resident_card_number = _true_contact.resident_card_number
|
||||
# if _contact.resident_card_number is None or len(_contact.resident_card_number) == 0:
|
||||
# for _true_contact in _all_contacts:
|
||||
# if _true_contact.mail == _contact.mail:
|
||||
# _contact.resident_card_number = _true_contact.resident_card_number
|
||||
|
||||
# if len(_contact.serial) == 0:
|
||||
# _contact.serial = DEFAULT_SERIAL
|
||||
@@ -170,7 +174,6 @@ def generate_all_contact_list():
|
||||
random.shuffle(_all_contacts)
|
||||
for _contact in _all_contacts:
|
||||
_contact.store = "random"
|
||||
_contact.resident_card_number = generate_single_titre_sejour_number()
|
||||
write_new_contacts_to_excel(_all_contacts, file_name="all")
|
||||
write_list_with_segment_number("all", _all_contacts, 1)
|
||||
|
||||
@@ -230,16 +233,16 @@ def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str=
|
||||
|
||||
# 把新的联系人存到网上
|
||||
if __name__ == '__main__':
|
||||
contacts_to_book = upload_contacts_list()
|
||||
MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
# contacts_to_book = upload_contacts_list()
|
||||
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
|
||||
# print("start at {}".format(datetime.datetime.now()))
|
||||
# generate_valid_contact_list_for_day(segment_number=2)
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_yahoo_100_16_01_2025.xlsx")
|
||||
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_aol_400_08_03_2025.xlsx")
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# update_contact_list_not_received_mail()
|
||||
# get_old_validated_contact_list()
|
||||
# print("end at {}".format(datetime.datetime.now()))
|
||||
# generate_all_contact_list()
|
||||
generate_all_contact_list()
|
||||
# merge_contact_list_files(
|
||||
# ["/Users/lpan/Desktop/contact_list_2024-11-04.xlsx",
|
||||
# "/Users/lpan/Desktop/contact_list_2024-11-07.xlsx",
|
||||
|
||||
@@ -27,7 +27,7 @@ def get_random_passport_id_number() -> str:
|
||||
return id_number
|
||||
|
||||
|
||||
def get_random_number(size=6) -> str:
|
||||
def get_random_number(size=7) -> str:
|
||||
ran = ''.join(random.choices(string.digits, k=size))
|
||||
return ran
|
||||
|
||||
|
||||
Reference in New Issue
Block a user