def __copy_props__(src: dict, target: Company): target.id = src.get('id', '-') target.name = src.get('name', '-').replace('<em>', '').replace('</em>', '') target.representative = src.get('legalPersonName', '-') target.address = src.get('regLocation', '-') target.region = src.get('base', '-') target.city = src.get('city', '-') target.district = src.get('district', '-') target.biz_status = src.get('regStatus', '-') target.credit_code = src.get('creditCode', '-') target.email = src.get('emails', ['-']).split(';')[0].replace('\t', '') target.phone = src.get('phoneNum', '-') target.biz_scope = src.get('businessScope', '-') target.company_type = src.get('companyOrgType', '-').replace('\t', '') target.taxpayer_code = src.get('creditCode', '-') target.registered_capital = src.get('regCapital', '-') target.lat_long = str({ 'lat': src.get('latitude', '-'), 'long': src.get('longitude', '-') }) target.setup_time = src.get('estiblishTime', '-')[0:10]
def assembly(cls, company: Company, raw_company: dict): company.name = raw_company.get('Name', '-') company.representative = raw_company.get('OperName', '-') company.address = raw_company.get('Address', '-') company.region = raw_company.get('AreaCode', '-') # todo company.city = raw_company.get('AreaCode', '-') # todo company.district = raw_company.get('AreaCode', '-') # todo company.biz_status = raw_company.get('Status', '-') company.credit_code = raw_company.get('CreditCode', '-') company.email = raw_company.get('Email', '-') company.phone = raw_company.get('ContactNumber', '-') company.biz_scope = raw_company.get('Scope', '-') company.company_type = raw_company.get('EconKind', '-') company.taxpayer_code = raw_company.get('CreditCode', '-') company.registered_capital = raw_company.get('RegistCapi', '-') company.lat_long = str({ 'lat': raw_company.get('X', '-'), 'long': raw_company.get('Y', '-') }) company.setup_time = raw_company.get('StartDate', '-')