Beispiel #1
0
 def __basic_info__(src: dict, target: Company):
     # 公司外部系统ID
     target.id = src.get('id', '-')
     # 公司名称
     target.name = src.get('name',
                           '-').replace('<em>',
                                        '').replace('</em>', '')
     # 公司简称
     target.short_name = src.get('alias', '-')
     # 公司法人
     target.representative = src.get('legalPersonName', '-')
     # 公司成立时间
     target.found_time = src.get('estiblishTime', '-')[0:10]
     # 公司地址
     target.company_address = src.get('regLocation', '-')
     # 公司注册地址
     target.register_address = src.get('regLocation', '-')
     # 公司所在省份,例:浙江,北京,广东
     target.province = src.get('base', '-')
     # 公司所在市
     target.city = src.get('city', '-')
     # 公司所在区
     target.district = src.get('district', '-')
     # 公司经营状态
     target.biz_status = src.get('regStatus', '-')
     # 公司地址经纬度坐标
     target.geoloc = str({
         'latitude': src.get('latitude', '-'),
         'longitude': src.get('longitude', '-')
     })
     # 公司邮箱列表
     target.emails = src.get('emails',
                             ['-']).split(';')[0].replace('\t', '')
     # 公司联系方式列表
     target.phones = src.get('phoneList', [])
     # 公司联系方式
     target.contact = src.get('phoneNum', '-')
     # 公司经营范围
     target.biz_scope = src.get('businessScope', '-')
     # 公司类型
     target.company_type = src.get('companyOrgType',
                                   '-').replace('\t', '')
     # 公司质量分数
     target.score = src.get('orginalScore', 0)
     # 公司注册资本
     target.register_capital = src.get('regCapital', '-')
     # 公司统一社会信用代码
     target.credit_code = src.get('creditCode', '-')
     # 公司纳税号
     target.taxpayer_code = src.get('taxCode')
     if not target.taxpayer_code:
         target.taxpayer_code = target.credit_code
     # 公司注册号
     target.register_code = src.get('regNumber', '-')
     # 公司组织机构代码
     target.organization_code = src.get('orgNumber', '-')
     # 公司标签列表
     target.tags = src.get('labelListV2', [])
     # 公司行业分类
     target.industry = src.get('categoryStr', '-')
Beispiel #2
0
 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', '-')
Beispiel #4
0
 async def post(self):
     """
     注册weid,其中kyc认证部分暂时忽略,后续可自行调整
     :return:
     """
     r_dict = {'respBody': '', 'errorCode': 200, 'errorMessage': 'success'}
     category = int(self.get_i_argument('category'))
     if category == 0:
         stuId = self.get_i_argument('stuId')
         name = self.get_i_argument('name')
         school = self.get_i_argument('school')
         id_card = self.get_i_argument('id_card')
         try:
             res = requests.post(host, json=Args.register_weid).json()
             print(res)
             _, tx_hash = fisco_client.fisco_add_data(
                 'insertStudent',
                 [res['respBody'], stuId, id_card, name, school])
             student = Student()
             student.weid = res['respBody']
             student.school = school
             student.name = name
             student.stuId = stuId
             student.idCard = id_card
             student.tx_hash = tx_hash
             await student.save()
             r_dict['respBody'] = res['respBody']
         except Exception:
             logger.error(traceback.format_exc())
         return r_dict
     elif category == 1:
         name = self.get_i_argument('name')
         location = self.get_i_argument('location')
         business = self.get_i_argument('business')
         try:
             res = requests.post(host, json=Args.register_weid).json()
             print(res)
             _, tx_hash = fisco_client.fisco_add_data(
                 'insertCompany',
                 [res['respBody'], name, location, business])
             company = Company()
             company.name = name
             company.location = location
             company.business = business
             company.weid = res['respBody']
             company.tx_hash = tx_hash
             await company.save()
             r_dict['respBody'] = res['respBody']
         except Exception:
             logger.error(traceback.format_exc())
         return r_dict
     else:
         name = self.get_i_argument('name')
         school = self.get_i_argument('school')
         teacher_id = self.get_i_argument('teacher_id')
         try:
             res = requests.post(host, json=Args.register_weid).json()
             # fisco_client.fisco_add_data('insetCompany', [name, location, business, res['respBody']])
             teacher = Teacher()
             teacher.weid = res['respBody']
             teacher.school = school
             teacher.name = name
             teacher.teacher_id = teacher_id
             await teacher.save()
             res['user_cid'] = teacher.cid
             res['category'] = 2
             r_dict['respBody'] = res['respBody']
         except Exception:
             pass
         return r_dict