Esempio n. 1
0
 def carClass(self):
     """carClass 返回申请人准驾车型"""
     result=self.mongo.query_by_user_id( db='galaxy',
                                         collection='py_record',
                                         find={'cardId':factor_encrypt_identity(self.info.cert_id),'phone':factor_encrypt_identity(self.info.phone),'realName':factor_encrypt_identity(self.info.user_name)})
     if not result:
         return self.SET_DEFAULT_VALUE_INT_9999999
     if not result[0].get('pyResponse') or not result[0].get('pyResponse').get('returnValue') \
         or not result[0].get('pyResponse').get('returnValue').get('cisReport'):
         return self.SET_DEFAULT_VALUE_INT_9999999
     carClass=result[0].get('pyResponse').get('returnValue').get('cisReport')[0].get('driverLicenseInfo').get('carClass',self.SET_DEFAULT_VALUE_INT_9999996)
     if carClass==self.SET_DEFAULT_VALUE_INT_9999996 or not carClass:
         return self.SET_DEFAULT_VALUE_INT_9999996
     if 'A1' in carClass:
         return 7
     if 'A2' in carClass:
         return 6
     if 'A3' in carClass:
         return 5
     if 'B1' in carClass:
         return 4
     if 'B2' in carClass:
         return 3
     if 'C1' in carClass:
         return 2
     if 'C2' in carClass:
         return 1
     return 0
Esempio n. 2
0
 def loanProductApplyStatus(self):
     """loanProductApplyStatus 我司申请消费贷款记录 Integer"""
     sql_xin="select * from s_user_product_audit where id_no='%s'"%self.info.cert_id
     result_xin=self.mysql.queryall_by_table_new_only(db='xinyongjin',sql=sql_xin)
     if result_xin:
         return 1
     if str(self.info.cert_id)[-1].lower()=='x' or str(self.info.cert_id)[-1].lower()=='X':
         i='x'
     else:
         i=int(str(self.info.cert_id)[-1])%10
     encrypt_cert_id=factor_encrypt_identity(self.info.cert_id)
     sql = "select customer_id from identiy_card_%s where identity_card='%s';" % (i, encrypt_cert_id)
     result = self.mysql.queryone_by_customer_id_sxj('customer_center', sql)
     if not result:
         return 0
     sql="select user_id from customer where id='%s' and delete_flag=0"%(result['customer_id'])
     result= self.mysql.queryone_by_customer_id_sxj('customer_center',sql)
     if not result:
         return 0
     sql="select id from customer where user_id='%s' and delete_flag=0"%result['user_id']
     result= self.mysql.queryall_by_table_new_only('customer_center',sql)
     customer_ids = list(set([str(data['id']) for data in result]))
     if not customer_ids:
         return 0
     customer_ids_string = ','.join(customer_ids)
     sql = "select * from a_customer_apply_{0} where customer_id in (%s) and delete_flag=0" %customer_ids_string
     result = self.mysql.queryall_by_table_new_only('apply_center', sql)
     if not result:
         return 0
     return 1
Esempio n. 3
0
 def idcardHitFrozenIdcard(self):
     """idcardHitFrozenIdcard 申请人身份证号命中冻结客户身份证号"""
     sql = "select * from rota_freeze where is_deleted=0 and cert_id='%s'" % factor_encrypt_identity(
         self.info.cert_id)
     rota_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
     if not rota_result:
         return self.SET_DEFAULT_VALUE_INT_0
     return self.SET_DEFAULT_VALUE_INT_1
Esempio n. 4
0
 def certIdHitOverdueCertId(self):
     """certIdHitOverdueCertId  申请人身份证号命中逾期客户身份证号  产品:全产品"""
     mysql = "select cert_id from rota_overdue where cert_id='{0}' and is_deleted=0".format(
         factor_encrypt_identity(self.info.cert_id))
     result = self.mysql.queryone_by_customer_id_sxj(db='skynet_rota', sql=mysql)
     if not result:
         return self.SET_DEFAULT_VALUE_INT_0
     return self.SET_DEFAULT_VALUE_INT_1
Esempio n. 5
0
 def idcardHitFraudIdcard(self):
     """idcardHitFraudIdcard 申请人身份证号命中欺诈客户身份证号"""
     sql = "select * from rota_fraud where cert_id='%s' and is_deleted=0" % factor_encrypt_identity(
         self.info.cert_id)
     rota_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
     if rota_result:
         return self.SET_DEFAULT_VALUE_INT_1
     return self.SET_DEFAULT_VALUE_INT_0
Esempio n. 6
0
 def __hitFreezeList(self, productId):
     mysql = "select * from rota_freeze where cert_id='{0}' and product_id={1} and freeze_expires>='{2}' and is_deleted=0".format(
         factor_encrypt_identity(int(self.info.cert_id)),
         productId, datetime.datetime.now())
     result = self.mysql.queryone_by_customer_id_sxj(db='skynet_rota', sql=mysql)
     if not result:
         return 0
     return 1
Esempio n. 7
0
    def drivingLicenceStatus(self):
        """drivingLicenceStatus 返回驾驶证状态"""
        result=self.mongo.query_by_user_id( db='galaxy',
                                            collection='py_record',
                                            find={'cardId':factor_encrypt_identity(self.info.cert_id),'phone':factor_encrypt_identity(self.info.phone),'realName':factor_encrypt_identity(self.info.user_name)})
        if not result:
            return self.SET_DEFAULT_VALUE_INT_9999999
        if not result[0].get('pyResponse') or not result[0].get('pyResponse').get('returnValue') \
            or not result[0].get('pyResponse').get('returnValue').get('cisReport'):
            return self.SET_DEFAULT_VALUE_INT_9999999
        status=result[0].get('pyResponse').get('returnValue').get('cisReport')[0].get('driverLicenseInfo').get('status',self.SET_DEFAULT_VALUE_INT_9999996)

        if status==self.SET_DEFAULT_VALUE_INT_9999996 or not status:
            return self.SET_DEFAULT_VALUE_INT_9999996
        statusList=[]
        if u'正常' in status:
            statusList.append('1')
        if u'超分' in status:
            statusList.append('2')
        if u'转出' in status:
            statusList.append('3')
        if u'暂扣' in status:
            statusList.append('4')
        if u'撤销' in status:
            statusList.append('5')
        if u'吊销' in status:
            statusList.append('6')
        if u'注销' in status:
            statusList.append('7')
        if u'违法未处理' in status:
            statusList.append('8')
        if u'停止使用' in status:
            statusList.append('9')
        if u'事故未处理' in status:
            statusList.append('10')
        if u'协查' in status:
            statusList.append('11')
        if u'锁定' in status:
            statusList.append('12')
        if u'逾期未换证' in status:
            statusList.append('13')
        if u'延期换证' in status:
            statusList.append('14')
        if u'延期体检' in status:
            statusList.append('15')
        if u'逾期未体检' in status:
            statusList.append('16')
        if u'逾期未审验' in status:
            statusList.append('17')
        if u'其他' in status:
            statusList.append('18')
        if u'扣留' in status:
            statusList.append('19')
        if not statusList:
            return self.SET_DEFAULT_VALUE_INT_0
        return ';'.join(statusList)
Esempio n. 8
0
 def __tdResult(self,item_id):
     results = self.mongo.queryall_by_userId(db='galaxy', collection="td_record",
                                         find={"realName": factor_encrypt_identity(self.info.user_name),"cardId":factor_encrypt_identity(self.info.cert_id),"phone":factor_encrypt_identity(self.info.phone)})
     if not results:
         return self.SET_DEFAULT_VALUE_INT_9999999
     if not results[0].get('tdReportResponse'):
         return self.SET_DEFAULT_VALUE_INT_9999996
     for row in results[0].get('tdReportResponse').get('risk_items'):
         if row.get('item_id')==str(item_id):
             return self.SET_DEFAULT_VALUE_INT_1
     return self.SET_DEFAULT_VALUE_INT_0
Esempio n. 9
0
 def drivingLicenceExpiryDate(self):
     """drivingLicenceExpiryDate 返回申请人驾驶证的有效期"""
     result=self.mongo.query_by_user_id( db='galaxy',
                                         collection='py_record',
                                         find={'cardId':factor_encrypt_identity(self.info.cert_id),'phone':factor_encrypt_identity(self.info.phone),'realName':factor_encrypt_identity(self.info.user_name)})
     if not result:
         return self.SET_DEFAULT_VALUE_INT_9999999
     if not result[0].get('pyResponse') or not result[0].get('pyResponse').get('returnValue') \
         or not result[0].get('pyResponse').get('returnValue').get('cisReport'):
         return self.SET_DEFAULT_VALUE_INT_9999999
     expiryDate=result[0].get('pyResponse').get('returnValue').get('cisReport')[0].get('driverLicenseInfo').get('expiryDate',self.SET_DEFAULT_VALUE_INT_9999996)
     if expiryDate==self.SET_DEFAULT_VALUE_INT_9999996:
         return self.SET_DEFAULT_VALUE_INT_9999996
     if expiryDate=='':
         return self.SET_DEFAULT_VALUE_INT_9999996
     return datetime.datetime.strptime(expiryDate, "%Y-%m-%d")
Esempio n. 10
0
 def phoneHitFrozenCertIdCnt(self):
     """phoneHitFrozenCertIdCnt 申请人手机号命中冻结客户手机号个数"""
     sql = "select * from rota_freeze where is_deleted=0 and encryption_phone='%s'" % factor_encrypt_identity(self.info.phone)
     rota_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
     if not rota_result:
         return self.SET_DEFAULT_VALUE_INT_0
     cardIds = []
     for card in rota_result:
         if card.get('cert_id'):
             cardIds.append(factor_decrypt_identity(card.get('cert_id')))
     return len(list(set(cardIds)))
Esempio n. 11
0
 def contactsPhoneHitFrozenPhoneCnt(self):
     """contactsPhoneHitFrozenPhoneCnt 申请人的联系人手机号命中冻结客户手机号个数  产品:全产品"""
     count = self.SET_DEFAULT_VALUE_INT_0
     if self.info.relativeContact:
         sql = "select * from rota_freeze where is_deleted=0 and encryption_phone='%s'" % factor_encrypt_identity(self.info.relativeContact)
         status_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
         if status_result:
             count += 1
     if self.info.colleagueContact:
         sql = "select * from rota_freeze where is_deleted=0 and encryption_phone='%s'" % factor_encrypt_identity(self.info.colleagueContact)
         status_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
         if status_result:
             count += 1
     if self.info.friendContact:
         sql = "select * from rota_freeze where is_deleted=0 and encryption_phone='%s'" % factor_encrypt_identity(self.info.friendContact)
         status_result = self.mysql.queryall_by_customer_id('skynet_rota', sql)
         if status_result:
             count += 1
     return count
Esempio n. 12
0
 def maxLateDays(self):
     """maxLateDays 最大逾期天数"""
     overdue_list=[]
     sql="select user_id from s_user_identity where identity_card= '%s';"%self.info.cert_id
     result = self.mysql.queryone_by_customer_id('xinyongjin', sql)
     if result and result.get('user_id'):
         old_list = self.__old_overdue_days(result.get('user_id'), -36)
         for old in old_list:
             overdue_list.append((return_strfYmd_date(old[2]) - return_strfYmd_date(old[1])).days)
     if str(self.info.cert_id)[-1].lower()=='x':
         i='x'
     else:
         i=int(str(self.info.cert_id)[-1])%10
     sql = "select customer_id from identiy_card_%s where identity_card='%s' and group_id =1;" % (i,factor_encrypt_identity(int(self.info.cert_id)))
     result = self.mysql.queryone_by_customer_id('customer_center', sql)
     if result and result.get('customer_id'):
         ljd_customer_id=result.get('customer_id')
         userId_sql="select * from customer where id ='%s'"%ljd_customer_id
         result = self.mysql.queryone_by_customer_id('customer_center', userId_sql)
         user_id=result.get('user_id')
         new_list = self.__hexin_bill(user_id, self.ljd_product_id, -36)+\
                     self.__hexin_bill(user_id, self.sxj_product_id, -36)+\
                     self.__hexin_bill(user_id, self.kdw_product_id, -36)
         for new in new_list:
             overdue_list.append((return_strfYmd_date(new[2]) - return_strfYmd_date(new[1])).days)
     if not overdue_list or max(overdue_list)<=0:
         return 0
     return max(overdue_list)
Esempio n. 13
0
 def lateCnt(self):
     """lateCnt 逾期次数"""
     count=0
     sql="select user_id from s_user_identity where identity_card= '%s';"%self.info.cert_id
     result = self.mysql.queryone_by_customer_id('xinyongjin', sql)
     if result and result.get('user_id'):
         old_days_list=self.__old_overdue_days(result.get('user_id'),-36)
         for days in old_days_list:
             if return_strfYmd_date(days[2])>return_strfYmd_date(days[1]):
                 count+=1
     if str(self.info.cert_id)[-1].lower()=='x':
         i='x'
     else:
         i=int(str(self.info.cert_id)[-1])%10
     sql = "select customer_id from identiy_card_%s where identity_card='%s' and group_id =1;" % (i,factor_encrypt_identity(int(self.info.cert_id)))
     result = self.mysql.queryone_by_customer_id('customer_center', sql)
     if result and result.get('customer_id'):
         ljd_customer_id=result.get('customer_id')
         userId_sql="select * from customer where id ='%s'"%ljd_customer_id
         result = self.mysql.queryone_by_customer_id('customer_center', userId_sql)
         user_id=result.get('user_id')
         all_list_days=self.__hexin_bill(user_id,self.ljd_product_id,-12)+self.__hexin_bill(user_id,self.sxj_product_id,-12)+self.__hexin_bill(user_id,self.kdw_product_id,-12)
         for days in all_list_days:
             if return_strfYmd_date(days[2])>return_strfYmd_date(days[1]):
                 count+=1
     return count
Esempio n. 14
0
 def finalScore(self):
     """finalScore 同盾分 Integer"""
     results = self.mongo.query_by_user_id(db='galaxy', collection="td_record",find={"realName": factor_encrypt_identity(self.info.user_name),"cardId":factor_encrypt_identity(self.info.cert_id),"phone":factor_encrypt_identity(self.info.phone)})
     if not results:
         return self.SET_DEFAULT_VALUE_INT_9999999
     if results[0].get('result')=='-1':
         return self.SET_DEFAULT_VALUE_INT_9999999
     if not results[0].get('tdReportResponse'):
         return self.SET_DEFAULT_VALUE_INT_9999996
     return results[0].get('tdReportResponse').get('final_score')
Esempio n. 15
0
 def spouseFinalScore(self):
     """spouseFinalScore 申请人配偶的同盾分"""
     spouseIdNumber = self.info.result.get('data').get('spouseIdNumber')
     spousePhone =self.info.result.get('data').get('spousePhone')
     spouseName  =self.info.result.get('data').get('spouseName')
     results = self.mongo.query_by_user_id(db='galaxy', collection="td_record",find={"realName": factor_encrypt_identity(spouseName),"cardId":factor_encrypt_identity(spouseIdNumber),"phone":factor_encrypt_identity(spousePhone)})
     if not results:
         return self.SET_DEFAULT_VALUE_INT_9999999
     if results[0].get('result')=='-1':
         return self.SET_DEFAULT_VALUE_INT_9999999
     if not results[0].get('tdReportResponse'):
         return self.SET_DEFAULT_VALUE_INT_9999996
     return results[0].get('tdReportResponse').get('final_score')
Esempio n. 16
0
 def idcardHitFrozenIdcardNew(self):
     """idcardHitFrozenIdcardNew 身份证号命中冻结名单  --产品:2345借款"""
     return self.__HitRotaFreeze(hitType='cert_id',hitData=factor_encrypt_identity(self.info.cert_id))
Esempio n. 17
0
 def phoneHitFrozenPhone(self):
     """phoneHitFrozenPhone 手机号命中冻结名单  --产品:2345借款"""
     return self.__HitRotaFreeze(hitType='encryption_phone',hitData=factor_encrypt_identity(self.info.phone))
Esempio n. 18
0
    def lastBorrowLateDays(self):
        """lastBorrowLateDays 最后一次借款逾期天数"""
        old_list=[]
        new_list=[]
        sql="select user_id from s_user_identity where identity_card= '%s';"%self.info.cert_id
        result = self.mysql.queryone_by_customer_id('xinyongjin', sql)

        if result and result.get('user_id'):
            old_list = self.__old_overdue_days(result.get('user_id'), -36)
        if str(self.info.cert_id)[-1].lower()=='x':
            i='x'
        else:
            i=int(str(self.info.cert_id)[-1])%10
        sql = "select customer_id from identiy_card_%s where identity_card='%s' and group_id =1;" % (i,factor_encrypt_identity(int(self.info.cert_id)))
        result = self.mysql.queryone_by_customer_id('customer_center', sql)
        if result and result.get('customer_id'):
            ljd_customer_id=result.get('customer_id')
            userId_sql="select * from customer where id ='%s'"%ljd_customer_id
            result = self.mysql.queryone_by_customer_id('customer_center', userId_sql)
            user_id=result.get('user_id')
            new_list = self.__hexin_bill(user_id, self.ljd_product_id, -36)+\
                        self.__hexin_bill(user_id, self.sxj_product_id, -36)+\
                        self.__hexin_bill(user_id, self.kdw_product_id, -36)
        all_list_days=old_list+new_list
        all_list_days.sort()
        if not all_list_days:
            return 0
        return (return_strfYmd_date(all_list_days[-1][2]) - return_strfYmd_date(all_list_days[-1][1])).days