コード例 #1
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     date = dt.datetime.now().date()
     for data_jsons in data:
         if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
            '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
             continue
         res = decrypts(data_jsons)
         res_json = str(res).replace(
             "'", "").split('success')[0] + 'success":true}' + "]"
         data_json = json.loads(res_json)
         if data_json[0]['data']['total'] == 0:
             continue
         now = int(time.time())
         comp_json = data_json[0]['data']['list'][0]
         comp_id = comp_json['QY_ID'] + '_' + str(now)
         company_name = comp_json['QY_NAME']
         enterprise_code = comp_json['QY_ORG_CODE']
         country = comp_json['QY_REGION_NAME']
         legal = comp_json['QY_FR_NAME']
         corp_code = comp_json['OLD_CODE']
         # 把公司信息存入数据库
         item = dict(
             insert_time=date,  # 获取时间
             company_ID=comp_id,  # '建设部企业ID'
             company_name=company_name,  # '企业名称'
             enterprise_code=enterprise_code,  # '统一社会信用代码'
             corp_code=corp_code,  # 组织机构代码
             legal=legal,  # '法人代表'
             country=country,  # '企业注册属地'
         )
         # 把公司url 标示存入 redis
         if self.__saveOneData__(table_name='BuildCompanyInfo', data=item):
             self.__saveOneID__(idx=comp_id, rediskey='CompInfoID')
             self.__saveOneID__(idx=company_name, rediskey='CompName')
コード例 #2
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         for data_jsons in data:
             if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                 continue
             res = decrypts(data_jsons)
             res_json = str(res).replace(
                 "'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             aa = data_json[0]['data']['list']
             print(aa)
             if len(aa) > 0 and aa != '':
                 _list = data_json[0]['data']['list']
                 for project in _list:
                     _id = project["ID"]
                     if str(comp_id).split("_",
                                           1)[0] == 'BuildLicenceListID':
                         _id = project["BUILDERLICENCENUM"]
                     key_del = 'Temp' + str(comp_id).split("_", 1)[0]
                     del_id = str(comp_id).split("_", 1)[1]
                     comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                     self.__saveOneID__(idx=str(_id) + "_" + comp,
                                        rediskey=str(comp_id).split("_",
                                                                    1)[0])
                     self.__deleteID__(idx=del_id, rediskey=key_del)
             else:
                 project_id = str(comp_id).split("_", 1)[1]
                 key_null = str(comp_id).split("_", 1)[0] + 'isNULL'
                 key_del = 'Temp' + str(comp_id).split("_", 1)[0]
                 self.__saveOneID__(idx=project_id, rediskey=key_null)
                 self.__deleteID__(idx=project_id, rediskey=key_del)
     except Exception as e:
         print(e)
コード例 #3
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             res = decrypts(data_jsons)
             res_json = str(res).replace("'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             aa = data_json[0]['data']['list']
             if len(aa) > 0 and aa != '':
                 comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                 for dataJson in aa:
                     bafinishID = dataJson['ID']
                     project_ID = dataJson['PRJNUM']
                     completed_code = dataJson['PRJFINISHNUM']
                     province_completed_code = dataJson['PROVINCEPRJFINISHNUM']
                     build_licence_code = dataJson['BUILDERLICENCENUM']
                     money = dataJson['FACTCOST']
                     begin_date = dataJson['BDATE']
                     end_date = dataJson['EDATE']
                     area = dataJson['FACTAREA']
                     build_scale = dataJson['FACTSIZE']
                     building_system = dataJson['PRJSTRUCTURETYPE']
                     recod_time = dataJson['CREATEDATE']
                     if begin_date is not None and int(begin_date) < 0:
                         begin_date = None
                     if end_date is not None and int(end_date) < 0:
                         end_date = None
                     if recod_time is not None and int(recod_time) < 0:
                         recod_time = None
                     if begin_date is not None:
                         time_begin = time.localtime(int(begin_date) / 1000)
                         begin_date = time.strftime("%Y-%m-%d", time_begin)
                     if end_date is not None:
                         time_end = time.localtime(int(end_date) / 1000)
                         end_date = time.strftime("%Y-%m-%d", time_end)
                     if recod_time is not None:
                         time_recod = time.localtime(int(recod_time) / 1000)
                         recod_time = time.strftime("%Y-%m-%d", time_recod)
                     if bafinishID is None:
                         bafinishID = ''
                     item = dict(
                         company_ID=comp,  # '建设部企业ID'
                         insert_time=date,  # 获取时间
                         completed_verification_ID=bafinishID,  # 竣工验收备案信息ID
                         project_ID=project_ID,  # 项目编号
                         completed_code=completed_code,  # 竣工备案编号
                         province_completed_code=province_completed_code,  # 省级竣工备案编号
                         money=money,  # 实际造价
                         area=area,  # 面积
                         build_scale=build_scale,  # 建设规模
                         building_system=building_system,  # 结构体系
                         begin_date=begin_date,  # 实际开工日期
                         end_date=end_date,  # 实际竣工日期
                         recod_time=recod_time,  # 记录登记时间
                         build_licence_code=build_licence_code,
                     )
                     if self.__saveOneData__(table_name='CompletionVerification', data=item):
                         self.__saveOneID__(idx=bafinishID, rediskey='ProjectFinishInfoID')
     except Exception as e:
         print(e)
コード例 #4
0
ファイル: ProjectInfoSpider.py プロジェクト: yuanpneg/jzsc
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue

                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                data = data_json[0]['data']
                if data is not None:
                    pro_id = data['ID']
                    project_name = data['PRJNAME']
                    project_ID = data['PRJNUM']
                    project_code = data['PROVINCEPRJNUM']
                    project_region = ""
                    if data['COUNTY'] is None and data['CITY'] is not None:
                        project_region = data['PROVINCE'] + '-' + data['CITY']
                    elif data['CITY'] is None:
                        project_region = data['PROVINCE']
                    else:
                        project_region = data['PROVINCE'] + '-' + data[
                            'CITY'] + '-' + data['COUNTY']
                    build_company = data['BUILDCORPNAME']
                    build_company_code = data['BUILDCORPCODE']
                    project_type = data['PRJTYPENUM']
                    construction_nature = data['PRJPROPERTYNUM']
                    engineering_purpose = data['PRJFUNCTIONNUM']
                    total_money = data['ALLINVEST']
                    total_area = data['ALLAREA']
                    approval_level = data['PRJAPPROVALLEVELNUM']
                    approval_num = data['PRJAPPROVALNUM']
                    item = dict(
                        company_ID=comp_id,  # '建设部企业ID'
                        insert_time=date,  # 获取时间
                        project_name=project_name,  # 项目名称
                        project_ID=project_ID,  # 项目编号
                        project_code=project_code,  # 省级项目编号
                        project_region=project_region,  # 所在区划
                        build_company=build_company,  # 建设单位
                        build_company_code=
                        build_company_code,  # 建设单位组织机构代码(统一社会信用代码)
                        project_type=project_type,  # 项目分类
                        construction_nature=construction_nature,  # 建设性质
                        engineering_purpose=engineering_purpose,  # 工程用途
                        total_money=total_money,  # 总投资
                        total_area=total_area,  # 总面积
                        approval_level=approval_level,  # 立项级别
                        approval_num=approval_num,  # 立项文号
                    )
                    if self.__saveOneData__(table_name='ProjectInfo',
                                            data=item):
                        self.__saveOneID__(idx=pro_id, rediskey='ProjectID')
        except Exception as e:
            print(e)
コード例 #5
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                 continue
             res = decrypts(data_jsons)
             res_json = str(res).replace(
                 "'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             if data_json[0]['data'] is not None:
                 qualification_list = data_json[0]['data']['pageList'][
                     'list']
                 for qualification in qualification_list:
                     name = qualification['APT_NAME']
                     qualification_type = qualification['APT_TYPE_NAME']
                     certification_code = qualification['APT_CERTNO']
                     certification_date = qualification['APT_GET_DATE']
                     validity_term = qualification['APT_EDATE']
                     certification_authority = qualification[
                         'APT_GRANT_UNIT']
                     if certification_date is not None and int(
                             certification_date) < 0:
                         certification_date = None
                     if validity_term is not None and int(
                             validity_term) < 0:
                         validity_term = None
                     if certification_date is not None:
                         time_get = time.localtime(
                             int(certification_date) / 1000)
                         certification_date = time.strftime(
                             "%Y-%m-%d", time_get)
                     if validity_term is not None:
                         time_end = time.localtime(
                             int(validity_term) / 1000)
                         validity_term = time.strftime("%Y-%m-%d", time_end)
                     item = dict(
                         insert_time=date,  # 获取时间
                         company_ID=comp_id,  # 建设部企业ID
                         type=qualification_type,  # '资质类别'
                         certification_code=certification_code,  # '资质证书号'
                         name=name,  # '资质名称'
                         certification_date=certification_date,  # '发证日期'
                         validity_term=validity_term,  # '证书有效期'
                         certification_authority=
                         certification_authority,  # '发证机关'
                     )
                     if self.__saveOneData__(
                             table_name='EnterpriseQualification',
                             data=item):
                         self.__saveOneID__(idx=comp_id,
                                            rediskey='QualificationInfoID')
     except Exception as e:
         print(e)
コード例 #6
0
ファイル: CompanyInfoSpider.py プロジェクト: yuanpneg/jzsc
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         if len(data) > 0:
             date = dt.datetime.now().date()
             for data_jsons in data:
                 if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                    '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                     continue
                 res = decrypts(data_jsons)
                 res_json = str(res).replace(
                     "'", "").split('success')[0] + 'success":true}' + "]"
                 data_json = json.loads(res_json)
                 if data_json[0]['data'] is not None:
                     # company_id = data_json[0]['data']['compMap']['QY_ID']+'_'+str(now)
                     enterprise_code = data_json[0]['data']['compMap'][
                         'QY_ORG_CODE']
                     company_name = data_json[0]['data']['compMap'][
                         'QY_NAME']
                     country = data_json[0]['data']['compMap'][
                         'QY_REGION_NAME']
                     address = data_json[0]['data']['compMap']['QY_ADDR']
                     company_type = data_json[0]['data']['compMap'][
                         'QY_JJXZ']
                     legal = data_json[0]['data']['compMap']['QY_FR_NAME']
                     corp_code = data_json[0]['data']['compMap']['OLD_CODE']
                     telephone = data_json[0]['data']['compMap'][
                         'QY_OFFICE_TEL']
                     license_code = data_json[0]['data']['compMap'][
                         'QY_YYZZH']
                     # 把公司信息存入数据库
                     item = dict(
                         insert_time=date,  # 获取时间
                         company_ID=comp_id,  # '建设部企业ID'
                         company_name=company_name,  # '企业名称'
                         enterprise_code=enterprise_code,  # '统一社会信用代码'
                         corp_code=corp_code,  # 组织机构代码
                         license_code=license_code,  # 营业执照号
                         legal=legal,  # '法人代表'
                         company_type=company_type,  # '企业类型'
                         country=country,  # '企业注册属地'
                         address=address,  # '企业经营地址'
                         telephone=telephone,
                     )
                     if self.__saveOneData__(table_name='BuildCompanyInfo',
                                             data=item):
                         self.__saveOneID__(idx=comp_id,
                                            rediskey='CompInfoID')
                 else:
                     self.__saveOneID__(
                         idx=company_name,
                         rediskey="ComInfoIDisNull")  # 把无详情的公司存入redis中
     except Exception as e:
         print(e)
コード例 #7
0
ファイル: BuilderLicenceSpider.py プロジェクト: yuanpneg/jzsc
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue

                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                data = data_json[0]['data']
                if data is not None:
                    buildliseID = data['BUILDERLICENCENUM']
                    project_ID = data['PRJNUM']
                    province_permit_code = data['PROVINCEPRJNUM']
                    permit_code = data['BUILDERLICENCENUM']
                    check_plans_code = data['CENSORNUM']
                    contract_money = data['CONTRACTMONEY']
                    area = data['AREA']
                    release_time = data['RELEASEDATE']  # '发证日期'
                    recod_time = data['CREATEDATE']
                    if release_time is not None and int(release_time) < 0:
                        release_time = None
                    if recod_time is not None and int(recod_time) < 0:
                        recod_time = None
                    if release_time is not None:
                        time_get = time.localtime(int(release_time) / 1000)
                        release_time = time.strftime("%Y-%m-%d", time_get)
                    if recod_time is not None:
                        time_end = time.localtime(int(recod_time) / 1000)
                        recod_time = time.strftime("%Y-%m-%d", time_end)
                    item = dict(
                        company_ID=comp_id,  # '建设部企业ID'
                        insert_time=date,  # 获取时间
                        construction_permit_ID=buildliseID,  # 施工许可信息ID
                        project_ID=project_ID,  # 项目编号
                        permit_code=permit_code,  # 施工许可证编号
                        province_permit_code=province_permit_code,  # 省级施工许可证编号
                        check_plans_code=check_plans_code,  # 施工图审查合格证书编号
                        contract_money=contract_money,  # 合同金额
                        area=area,  # 面积
                        recod_time=recod_time,  # 记录登记时间
                        release_time=release_time,
                    )
                    value = str(buildliseID) + '_' + comp_id
                    if self.__saveOneData__(table_name='ConstructionPermit',
                                            data=item):
                        self.__saveOneID__(idx=value,
                                           rediskey='BuildLicenceInfoID')
        except Exception as e:
            print(e)
コード例 #8
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             res = decrypts(data_jsons)
             res_json = str(res).replace("'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             aa = data_json[0]['data']['list']
             if len(aa) > 0 and aa != '':
                 comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                 for dataJson in aa:
                     contractID = dataJson['CONTRACTORCORPID']
                     project_ID = dataJson['PRJNUM']
                     contract_filing_code = dataJson['RECORDNUM']
                     province_contract_filing_code = dataJson['PROVINCERECORDNUM']
                     contract_code = dataJson['CONTRACTNUM']
                     contract_type = dataJson['CONTRACTTYPENUM']
                     contract_money = dataJson['CONTRACTMONEY']
                     contractor_out_name = dataJson['PROPIETORCORPNAME']
                     contractor_name = dataJson['CONTRACTORCORPNAME']
                     contract_signing_date = dataJson['CONTRACTDATE']
                     recod_time = dataJson['CREATEDATE']
                     if recod_time is not None and int(recod_time) < 0:
                         recod_time = None
                     if contract_signing_date is not None and int(contract_signing_date) < 0:
                         contract_signing_date = None
                     if recod_time is not None:
                         time_end = time.localtime(int(recod_time) / 1000)
                         recod_time = time.strftime("%Y-%m-%d", time_end)
                     if contract_signing_date is not None:
                         time_get = time.localtime(int(contract_signing_date) / 1000)
                         contract_signing_date = time.strftime("%Y-%m-%d", time_get)
                     item = dict(
                         company_ID=comp,  # '建设部企业ID'
                         insert_time=date,  # 获取时间
                         contract_filing_ID=contractID,  # 合同备案信息ID
                         project_ID=project_ID,  # 项目编号
                         contract_filing_code=contract_filing_code,  # '合同备案编号'
                         province_contract_filing_code=province_contract_filing_code,  # 省级合同备案编号
                         contract_code=contract_code,  # 合同编号
                         contract_type=contract_type,  # 合同类别
                         contract_money=contract_money,  # 合同金额
                         contract_signing_date=contract_signing_date,  # 合同签订日期
                         contractor_out_name=contractor_out_name,  # 发包单位名称
                         contractor_name=contractor_name,  # 承包单位名称
                         recod_time=recod_time,  # 记录登记时间
                     )
                     if self.__saveOneData__(table_name='ContractFiling', data=item):
                         self.__saveOneID__(idx=contractID, rediskey='ContractInfoID')
     except Exception as e:
         print(e)
コード例 #9
0
ファイル: TenderListSpider.py プロジェクト: yuanpneg/jzsc
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             res = decrypts(data_jsons)
             res_json = str(res).replace(
                 "'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             aa = data_json[0]['data']['list']
             if len(aa) > 0 and aa != '':
                 comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                 for dataJson in aa:
                     terderID = dataJson['ID']
                     bidder_name = dataJson['TENDERCORPNAME']
                     winningbid_ID = dataJson['TENDERNUM']
                     project_ID = dataJson['PRJNUM']
                     province_winningbid_ID = dataJson['PROVINCETENDERNUM']
                     tender_type = dataJson['TENDERCLASSNUM']
                     tender_method = dataJson['TENDERTYPENUM']
                     winningbid_date = dataJson[
                         'TENDERRESULTDATE']  # '中标日期'
                     winningbid_money = dataJson['TENDERMONEY']
                     if winningbid_date is not None and int(
                             winningbid_date) < 0:
                         winningbid_date = None
                     if winningbid_date is not None:
                         time_get = time.localtime(
                             int(winningbid_date) / 1000)
                         winningbid_date = time.strftime(
                             "%Y-%m-%d", time_get)
                     item = dict(
                         company_ID=comp,  # '建设部企业ID'
                         insert_time=date,  # 获取时间
                         tender_ID=terderID,  # 招投标信息ID
                         project_ID=project_ID,  # '项目编号'
                         winningbid_ID=winningbid_ID,  # '中标通知书编号'
                         province_winningbid_ID=
                         province_winningbid_ID,  # '省级中标通知书编号'
                         tender_type=tender_type,  # '招标类型'
                         tender_method=tender_method,  # '招标方式'
                         winningbid_date=winningbid_date,  # '中标日期'
                         winningbid_money=winningbid_money,  # '中标金额'
                         bidder_name=bidder_name,  # '中标单位名称'
                     )
                     if self.__saveOneData__(table_name='BiddingInfo',
                                             data=item):
                         self.__saveOneID__(idx=terderID,
                                            rediskey='TenderInfoID')
     except Exception as e:
         print(e)
コード例 #10
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                 continue
             res = decrypts(data_jsons)
             res_json = str(res).replace(
                 "'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             if data_json[0]['data'] is not None:
                 datas = data_json[0]['data']['list']
                 comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                 for data in datas:
                     if len(data) > 0:
                         user_name = data['PERSONNAME']
                         project_id = str(data['PRJNUM'])
                         cid = data['PERSONIDCARD']
                         company_name = data['CORPNAME']
                         company_type = data['CORPROLENUM']
                         user_id = data['PERSONID']
                         corpcode = data['CORPCODE']
                         per_type = data['IDCARDTYPENUM']
                         company_id = comp
                         buildliseID = data['CORPID']
                         if buildliseID is None:
                             buildliseID = ''
                         item = dict(
                             insert_time=date,  # 插入时间
                             construction_permit_ID=buildliseID,  # 施工许可信息ID
                             user_id=user_id,  # 人员id
                             cid=cid,  # 身份证
                             user_name=user_name,  # 人员姓名
                             company_name=company_name,  # 公司名称
                             company_type=company_type,  # 公司类型
                             per_type=per_type,  # 人员类型
                             company_id=company_id,  # 公司id
                             corpcode=corpcode,
                             project_id=project_id,
                         )
                         if self.__saveOneData__(
                                 table_name='ConstructionPermitPerson',
                                 data=item):
                             self.__saveOneID__(
                                 idx=buildliseID,
                                 rediskey='ProjectCorpInfoID')
     except Exception as e:
         print(e)
コード例 #11
0
 def __getMaxPage__(self, url):
     try:
         if self.ip is None:
             ip, port = self.__getProxy__()
             self.ip = ip
             self.port = port
         proxyMeta = "http://%(host)s:%(port)s" % {
             "host": self.ip,
             "port": self.port,
         }
         proxies = {
             "http": proxyMeta,
         }
         response = requests.get(url,
                                 proxies=proxies,
                                 headers=self._HEADERS,
                                 verify=False,
                                 timeout=10)
         if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
            '4f4019b64d9a050272bd5914634d030aab69' in response.text:
             access_token = getToken()
             while access_token is None:
                 access_token = getToken()
             self._HEADERS = {
                 'Accept':
                 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
                 'accessToken': access_token
             }
             return self.__getMaxPage__(url)
         res = decrypts(response.text)
         res = str(res).replace(
             "'", "").split('success')[0] + 'success":true}' + "]"
         data_json = json.loads(res)
         if data_json[0]['code'] == 401:
             time.sleep(60)
             return self.__getMaxPage__(url)
         elif data_json[0]['code'] == 200:
             return data_json
         else:
             return self.__getMaxPage__(url)
     except Exception as e:
         print(e)
         ip, port = self.__getProxy__()
         self.ip = ip
         self.port = port
         return self.__getMaxPage__(url)
コード例 #12
0
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue
                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                if data_json[0]['data'] is not None and len(data_json) > 0:
                    person_list = data_json[0]['data']['list']
                    for person in person_list:
                        name = person['RY_NAME']
                        company_name = person['REG_QYMC']
                        cid = person['RY_CARDNO']
                        compile_data = person['profs']
                        regist_type = person['REG_TYPE_NAME']
                        regist_code = person['REG_SEAL_CODE']
                        person_ID = person["RY_ID"]
                        item = dict(companyName=company_name)
                        item_persion = dict(
                            insert_time=date,  # 获取时间
                            person_ID=person_ID,  # 人员ID
                            name=name,  # 姓名
                            cid=cid,  # 身份证号
                            company_name=company_name,  # 公司名称
                            regist_type=regist_type,  # 注册类别
                            regist_code=regist_code,  # 注册号(执业印章号)
                            registered_major=compile_data,  # 注册专业
                        )
                        self.__saveOneData__(table_name="personInfo",
                                             data=item_persion)
                        if self.__findOneID__(idx=company_name,
                                              rediskey='companyName'):
                            pass
                        else:
                            self.__saveOneID__(idx=company_name,
                                               rediskey='companyName')
                            self.__saveOneData__(table_name='companyName',
                                                 data=item)

        except Exception as e:
            print(e)
コード例 #13
0
 async def __saveJsonData__(self, data=None, comp_id=None):
     try:
         date = dt.datetime.now().date()
         for data_jsons in data:
             if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                 continue
             res = decrypts(data_jsons)
             res_json = str(res).replace(
                 "'", "").split('success')[0] + 'success":true}' + "]"
             data_json = json.loads(res_json)
             datas = data_json[0]['data']['list']
             if len(datas) > 0:
                 for data in datas:
                     if len(data) > 0:
                         buildliseID = data['BUILDERLICENCENUM']
                         user_id = data['USERID']
                         cid = data['IDCARD']
                         user_name = data['USERNAME']
                         company_name = data['CORPNAME']
                         company_type = data['CORPROLE']
                         per_type = data['PERTYPE']
                         company_id = comp_id
                         item = dict(
                             insert_time=date,  # 插入时间
                             construction_permit_ID=buildliseID,  # 施工许可信息ID
                             user_id=user_id,  # 人员id
                             cid=cid,  # 身份证
                             user_name=user_name,  # 人员姓名
                             company_name=company_name,  # 公司名称
                             company_type=company_type,  # 公司类型
                             per_type=per_type,  # 人员类型
                             company_id=company_id,  # 公司id
                         )
                         if self.__saveOneData__(
                                 table_name='ConstructionPermitPerson',
                                 data=item):
                             self.__saveOneID__(
                                 idx=buildliseID,
                                 rediskey='BuildLicencePersonID')
     except Exception as e:
         print(e)
コード例 #14
0
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                res = decrypts(data_jsons)
                res_json = str(res).replace("'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                if data_json[0]['data'] is not None:
                    projcet_list = data_json[0]['data']['list']
                    for project in projcet_list:
                        project_num = str(project['PRJNUM']) + "_" + comp_id
                        project_ID = project["PRJNUM"]
                        project_name = project["PRJNAME"]
                        if project['COUNTY'] is None and project['CITY'] is not None:
                            project_region = project['PROVINCE'] + '-' + project['CITY']
                        elif project['CITY'] is None:
                            project_region = project['PROVINCE']
                        else:
                            project_region = project['PROVINCE'] + '-' + project['CITY'] + '-' + project['COUNTY']
                        build_company = project['BUILDCORPNAME']
                        project_type = project['PRJTYPENUM']
                        item = dict(
                            company_ID=comp_id,  # '建设部企业ID'
                            insert_time=date,  # 获取时间
                            project_name=project_name,  # 项目名称
                            project_ID=project_ID,  # 项目编号
                            project_region=project_region,  # 所在区划
                            build_company=build_company,  # 建设单位
                            project_type=project_type,  # 项目分类
                        )
                        if self.__saveOneData__(table_name='ProjectInfo', data=item):
                            self.__saveOneID__(idx=project_ID, rediskey='ProjectID')
                            self.__saveOneID__(idx=project_num, rediskey='TempTenderListID')
                            self.__saveOneID__(idx=project_num, rediskey='TempContractListID')
                            self.__saveOneID__(idx=project_num, rediskey='TempProFinishListID')
                            self.__saveOneID__(idx=project_num, rediskey='TempProCensorListID')
                            self.__saveOneID__(idx=project_num, rediskey='TempProjectCorpInfoID')
                            self.__saveOneID__(idx=project_num, rediskey='TempBuildLicenceListID')

        except Exception as e:
            print(e)
コード例 #15
0
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                res = decrypts(data_jsons)
                res_json = str(res).replace("'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                aa = data_json[0]['data']['list']
                if len(aa) > 0 and aa != '':
                    comp = str(comp_id).split("_", 1)[1].split("_", 1)[1]
                    for dataJson in aa:
                        buildliseID = dataJson['ID']
                        project_ID = dataJson['PRJNUM']
                        province_permit_code = dataJson['PROVINCEBUILDERLICENCENUM']
                        permit_code = dataJson['BUILDERLICENCENUM']
                        contract_money = dataJson['CONTRACTMONEY']
                        area = dataJson['AREA']
                        release_time = dataJson['RELEASEDATE']  # '发证日期'
                        if release_time is not None and int(release_time) < 0:
                            release_time = None
                        if release_time is not None:
                            time_get = time.localtime(int(release_time) / 1000)
                            release_time = time.strftime("%Y-%m-%d", time_get)
                        item = dict(
                            company_ID=comp,  # '建设部企业ID'
                            insert_time=date,  # 获取时间
                            construction_permit_ID=buildliseID,  # 施工许可信息ID
                            project_ID=project_ID,  # 项目编号
                            permit_code=permit_code,  # 施工许可证编号
                            province_permit_code=province_permit_code,  # 省级施工许可证编号
                            contract_money=contract_money,  # 合同金额
                            area=area,  # 面积
                            release_time=release_time,  # 发证日期

                        )
                        value = str(buildliseID) + '_' + comp
                        if self.__saveOneData__(table_name='ConstructionPermit', data=item):
                            self.__saveOneID__(idx=value, rediskey='BuildLicenceInfoID')
        except Exception as e:
            print(e)
コード例 #16
0
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue

                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                data = data_json[0]['data']
                if data is not None:
                    bafinishID = data['ID']
                    project_ID = data['PRJNUM']
                    completed_code = data['PRJFINISHNUM']
                    province_completed_code = data['PROVINCEPRJFINISHNUM']
                    money = data['FACTCOST']
                    build_scale = data['FACTSIZE']
                    building_system = data['PRJSTRUCTURETYPE']
                    area = data['FACTAREA']
                    build_licence_code = data['BUILDERLICENCENUM']
                    begin_date = data['BDATE']
                    end_date = data['EDATE']
                    recod_time = data['CREATEDATE']
                    if begin_date is not None and int(begin_date) < 0:
                        begin_date = None
                    if end_date is not None and int(end_date) < 0:
                        end_date = None
                    if recod_time is not None and int(recod_time) < 0:
                        recod_time = None
                    if begin_date is not None:
                        time_begin = time.localtime(int(begin_date) / 1000)
                        begin_date = time.strftime("%Y-%m-%d", time_begin)
                    if end_date is not None:
                        time_end = time.localtime(int(end_date) / 1000)
                        end_date = time.strftime("%Y-%m-%d", time_end)
                    if recod_time is not None:
                        time_recod = time.localtime(int(recod_time) / 1000)
                        recod_time = time.strftime("%Y-%m-%d", time_recod)
                    item = dict(
                        company_ID=comp_id,  # '建设部企业ID'
                        insert_time=date,  # 获取时间
                        completed_verification_ID=bafinishID,  # 竣工验收备案信息ID
                        project_ID=project_ID,  # 项目编号
                        completed_code=completed_code,  # 竣工备案编号
                        province_completed_code=
                        province_completed_code,  # 省级竣工备案编号
                        money=money,  # 实际造价
                        area=area,  # 面积
                        build_scale=build_scale,  # 建设规模
                        building_system=building_system,  # 结构体系
                        begin_date=begin_date,  # 实际开工日期
                        end_date=end_date,  # 实际竣工日期
                        recod_time=recod_time,  # 记录登记时间
                        build_licence_code=build_licence_code,
                    )
                    if self.__saveOneData__(
                            table_name='CompletionVerification', data=item):
                        self.__saveOneID__(idx=comp_id,
                                           rediskey='ProjectFinishInfoID')
        except Exception as e:
            print(e)
コード例 #17
0
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue

                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                data = data_json[0]['data']
                if data is not None:
                    contractID = data['ID']
                    project_ID = data['PRJNUM']
                    contract_code = data['CONTRACTNUM']
                    contract_filing_code = data['RECORDNUM']
                    contract_type = data['CONTRACTTYPENUM']
                    contract_group = ''
                    contract_money = data['CONTRACTMONEY']
                    build_scale = data['PRJSIZE']
                    contractor_out_name = data['PROPIETORCORPNAME']
                    contractor_out_code = data['PROPIETORCORPCODE']
                    contractor_name = data['CONTRACTORCORPNAME']
                    contractor_code = data['CONTRACTORCORPCODE']
                    union_contractor_name = data['UNIONCORPNAME']
                    union_contractor_code = data['UNIONCORPCODE']
                    province_contract_filing_code = ''
                    recod_time = data['CREATEDATE']
                    contract_signing_date = data['CONTRACTDATE']
                    if recod_time is not None and int(recod_time) < 0:
                        recod_time = None
                    if contract_signing_date is not None and int(
                            contract_signing_date) < 0:
                        contract_signing_date = None
                    if recod_time is not None:
                        time_end = time.localtime(int(recod_time) / 1000)
                        recod_time = time.strftime("%Y-%m-%d", time_end)
                    if contract_signing_date is not None:
                        time_get = time.localtime(
                            int(contract_signing_date) / 1000)
                        contract_signing_date = time.strftime(
                            "%Y-%m-%d", time_get)
                    item = dict(
                        company_ID=comp_id,  # '建设部企业ID'
                        insert_time=date,  # 获取时间
                        contract_filing_ID=contractID,  # 合同备案信息ID
                        project_ID=project_ID,  # 项目编号
                        contract_filing_code=contract_filing_code,  # '合同备案编号'
                        province_contract_filing_code=
                        province_contract_filing_code,  # 省级合同备案编号
                        contract_code=contract_code,  # 合同编号
                        contract_group=contract_group,  # 合同分类
                        contract_type=contract_type,  # 合同类别
                        contract_money=contract_money,  # 合同金额
                        build_scale=build_scale,  # 建设规模
                        contract_signing_date=contract_signing_date,  # 合同签订日期
                        contractor_out_name=contractor_out_name,  # 发包单位名称
                        contractor_out_code=contractor_out_code,  # 发包单位组织机构代码
                        contractor_name=contractor_name,  # 承包单位名称
                        contractor_code=contractor_code,  # 承包单位组织机构代码
                        union_contractor_name=union_contractor_name,  # 联合体承包单位名称
                        union_contractor_code=
                        union_contractor_code,  # 联合体承包单位组织机构代码
                        recod_time=recod_time,  # 记录登记时间
                    )
                    if self.__saveOneData__(table_name='ContractFiling',
                                            data=item):
                        self.__saveOneID__(idx=contractID,
                                           rediskey='ContractInfoID')
        except Exception as e:
            print(e)
コード例 #18
0
ファイル: TenderSpider.py プロジェクト: yuanpneg/jzsc
    async def __saveJsonData__(self, data=None, comp_id=None):
        try:
            date = dt.datetime.now().date()
            for data_jsons in data:
                if '4bd02be856577e3e61e83b86f51afca55280b5ee9ca16beb9b2a65406045c9497c089d5e8ff97c63000f62b011a6' \
                   '4f4019b64d9a050272bd5914634d030aab69' in data_jsons:
                    continue

                res = decrypts(data_jsons)
                res_json = str(res).replace(
                    "'", "").split('success')[0] + 'success":true}' + "]"
                data_json = json.loads(res_json)
                data = data_json[0]['data']
                if data is not None:
                    # comp_id = data['TENDERCORPID']
                    terderID = data['ID']
                    project_ID = data['PRJNUM']
                    winningbid_ID = data['TENDERNUM']
                    province_winningbid_ID = data['PROVINCETENDERNUM']
                    tender_type = data['TENDERCLASSNUM']
                    tender_method = data['TENDERTYPENUM']
                    winningbid_date = data['TENDERRESULTDATE']  # '中标日期'
                    winningbid_money = data['TENDERMONEY']
                    build_scale = ''  # '建设规模'
                    area = data['AREA']
                    bidding_agent = data['AGENCYCORPNAME']
                    bidder_name = data['TENDERCORPNAME']
                    bidder_corp_code = data['TENDERCORPCODE']
                    manager_name = data['CONSTRUCTORNAME']
                    manager_cid = data['CONSTRUCTORIDCARD']
                    recod_time = data['CREATEDATE']
                    persion_ID = ''
                    bidding_agent_group = data['AGENCYCORPCODE']
                    if recod_time is not None and int(recod_time) < 0:
                        recod_time = None
                    if winningbid_date is not None and int(
                            winningbid_date) < 0:
                        winningbid_date = None
                    if winningbid_date is not None:
                        time_get = time.localtime(int(winningbid_date) / 1000)
                        winningbid_date = time.strftime("%Y-%m-%d", time_get)
                    if recod_time is not None:
                        time_end = time.localtime(int(recod_time) / 1000)
                        recod_time = time.strftime("%Y-%m-%d", time_end)
                    item = dict(
                        company_ID=comp_id,  # '建设部企业ID'
                        insert_time=date,  # 获取时间
                        tender_ID=terderID,  # 招投标信息ID
                        project_ID=project_ID,  # '项目编号'
                        winningbid_ID=winningbid_ID,  # '中标通知书编号'
                        province_winningbid_ID=
                        province_winningbid_ID,  # '省级中标通知书编号'
                        tender_type=tender_type,  # '招标类型'
                        tender_method=tender_method,  # '招标方式'
                        winningbid_date=winningbid_date,  # '中标日期'
                        winningbid_money=winningbid_money,  # '中标金额'
                        build_scale=build_scale,  # '建设规模'
                        area=area,  # '面积'
                        bidding_agent=bidding_agent,  # '招标代理单位'
                        bidding_agent_group=
                        bidding_agent_group,  # '招标代理单位组织机构代码'
                        bidder_name=bidder_name,  # '中标单位名称'
                        bidder_corp_code=bidder_corp_code,  # '中标单位组织机构代码'
                        manager_name=manager_name,  # '项目经理/总监理工程师姓名'
                        manager_cid=manager_cid,  # '项目经理/总监理工程师身份证号码'
                        recod_time=recod_time,  # '记录登记时间'
                        persion_ID=persion_ID,  # '人员id'
                    )
                    if self.__saveOneData__(table_name='BiddingInfo',
                                            data=item):
                        self.__saveOneID__(idx=terderID,
                                           rediskey='TenderInfoID')
        except Exception as e:
            print(e)