123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- # -*- coding: utf-8 -*-
- import requests
- import json
- import os
- from ini_op import Config;
- base_dir = os.path.dirname(os.path.abspath(__file__))
- import log
- import utils
- # import jzutil
- logger = log.logger
- config = Config(base_dir+"/config.ini");
- CREATE_API = config.get("baseconf","create_api")
- qk_url= config.get("baseconf", "qk_url");
- hsz_url= config.get("baseconf", "hsz_url");
- hc_url= config.get("baseconf", "hc_url");
- jz_url= config.get("baseconf", "jz_url");
- rd_url= config.get("baseconf", "rd_url");
- isAutoApprove = config.get("baseconf", "isAutoApprove");
- #小赢服务
- def call_credit(businessInfo):
- credit_xml = businessInfo["creditXml"]
- extendData = businessInfo["extend"]
- extendData = json.loads(extendData)
- # credit_xml = '<征信原始Json串>'
- rule_params = {"riskVar": {"xdStatus": 1, "isApp": 1, "pyEdu": 1},
- "version": "0.0.3",
- "product_name": "kd",
- "ruleSet": {"ruleZx113": {},
- "ruleZx120": {},
- "ruleZx121": {},
- "ruleZx101": {},
- "ruleZxNohigh": {},
- "ruleZx119": {},
- "ruleZx118": {},
- "ruleZx108": {},
- "ruleZx104": {"tdCardOpenMonth": "3"},
- "ruleZx110": {},
- "ruleZx116": {"tdLoanOver1p5M": "1500000"},
- "ruleZx115": {"tdDebitCardTotal1": "0", "tdDebitCardTotal2": "2",
- "tdSingleDebitCardMax": "2"}},
- "specialSet": {"ruleZx111": {"tdMaxOpenMonth": "6"}},
- "scoreSet": {"ruleZx129": {"tdCreditScore": "850"}},
- "method": "rule_kd_one"}
- model_params = {"version": "kyd_pboc_lr_v1"}
- params = {
- 'ruleParams' : rule_params,
- 'modelParams': model_params
- }
- request_data = {
- 'requestId': businessInfo["coopBusinessNum"],
- 'extendData': json.dumps(extendData["zxmb"]),
- 'zxData': credit_xml
- }
- request_data1 = {
- 'requestId': businessInfo["coopBusinessNum"],
- 'extendData': extendData,
- }
- # logger.info(request_data1)
- resp = requests.post(CREATE_API, data=json.dumps(request_data))
- return resp.text
- #调用洽客http
- def callQk(businessInfo):
- credit_xml = businessInfo["result"]
- request_data = {
- 'queryReq': credit_xml
- }
- # logger.info(json.dumps(request_data))
- headers = {"Content-Type":"application/json"}
- resp = requests.post(qk_url, data=json.dumps(request_data),headers=headers)
- return resp.text
- #恒昌
- def callHc(businessInfo):
- credit_json = businessInfo["result"]
- request_data = {
- 'queryReq': credit_json
- }
- # logger.info(json.dumps(request_data))
- headers = {"Content-Type":"application/json"}
- resp = requests.post(hc_url, data=json.dumps(request_data),headers=headers)
- return resp.text
- #调用慧算账
- def callHsz(businessInfo):
- creditJson = businessInfo["result"]
- extend = businessInfo["extend"]
- request_data = {
- 'queryReq': creditJson,
- 'extend':extend
- }
- # logger.info(json.dumps(request_data))
- headers = {"Content-Type":"application/json"}
- resp = requests.post(hsz_url, data=json.dumps(request_data),headers=headers)
- return resp.text
- #新版桔子
- def callJz(businessInfo):
- creditJson = businessInfo["result"]
- extend = businessInfo["extend"]
- request_data = {
- 'queryReq': creditJson,
- 'extend':extend
- }
- # logger.info(json.dumps(request_data))
- headers = {"Content-Type":"application/json"}
- resp = requests.post(jz_url, data=json.dumps(request_data),headers=headers)
- result = resp.text
- dataResult = json.loads(result)
- dataResult["data"]["orderNo"]=businessInfo["coopBusinessNum"]
- # 桔子新版加密合并data字段
- # newResult = jzutil.encode(businessInfo)
- # dataResult["data"] = dataResult["data"].update(newResult)
- return json.dumps(dataResult)
- #仁东
- def callRd(businessInfo):
- credit_json = businessInfo["result"]
- request_data = {
- 'queryReq': credit_json
- }
- # logger.info(json.dumps(request_data))
- headers = {"Content-Type":"application/json"}
- resp = requests.post(rd_url, data=json.dumps(request_data),headers=headers)
- return resp.text
- def convert(N,key):
- N = null2Zero(N)
- result = ""
- if N == 0:
- result = "sun"
- elif N>=1 and N<3 and (key=="A2" or key=="A3" or key=="A8" or key=="A9" or key=="A10"):
- result = "aries"
- elif N>=3 and (key=="A2"):
- result = "taurus"
- elif N>=3 and N<6 and (key=="A3" or key=="A8" or key=="A9" or key=="A10"):
- result = "gemini"
- elif N>=6 and (key=="A3" or key=="A8" or key=="A9" or key=="A10"):
- result = "cancer"
- elif N>0 and N<=5000 and (key=="A4"):
- result = "leo"
- elif N > 5000 and N <= 10000 and (key == "A4"):
- result = "virgo"
- elif N > 0 and N <= 10000 and (key == "A1" or key == "A7"):
- result = "libra"
- elif N > 10000 and N <= 30000 and (key == "A1" or key == "A7"):
- result = "scorpio"
- elif N >30000 and (key == "A1" or key == "A7"):
- result = "sagittarius"
- elif N > 0 and N <= 50000 and (key == "A5" or key == "A6"):
- result = "capricorn"
- elif N > 50000 and N <= 100000 and (key == "A5" or key == "A6"):
- result = "aquarius"
- elif N > 100000 and N <= 500000 and (key == "A5" or key == "A6"):
- result = "pisces"
- elif N >500000 and (key == "A5" or key == "A6"):
- result = "moon"
- return result;
- def buildJyData(businessInfo,jsonPath):
- try:
- data = {}
- jsonData = json.loads(businessInfo["result"]);
- #强制执行信息-涉及金额
- publicInfoBrief = jsonData["公共信息概要"];
- data["A1"] = convert(publicInfoBrief["强制执行信息-涉及金额"],"A1")
- queryRecordSum = jsonData["查询记录汇总"];
- data["A2"] = convert(queryRecordSum["近1月内的查询次数-贷款审批"],"A2")
- loanInfo = jsonData["贷款信息"];
- data["A3"] = convert(loanInfo["当前贷款最大逾期期数"],"A3")
- data["A4"] = convert(loanInfo["当前贷款最大逾期金额"],"A4")
- data["A5"] = convert(loanInfo["当前未结清贷款余额总和"],"A5")
- data["A6"] = convert(loanInfo["当前正常贷款账户余额"],"A6")
- creditInfo = jsonData["贷记卡账户"];
- data["A7"] = convert(creditInfo["当前贷记卡最大逾期金额"],"A7")
- data["A8"] = convert(creditInfo["近12月贷记卡最大逾期期数"],"A8")
- queryRecordDetailDf = jsonData["信贷审批查询记录明细"]
- data["A9"] = convert(publicInfoBrief["强制执行信息-记录数"], "A9")
- data["A10"] = convert(queryRecordDetailDf["近3月查询次数"],"A10")
- except:
- pass
- with open(jsonPath, 'w', encoding='utf-8') as fp:
- fp.write(json.dumps(data))
- def null2Zero(value):
- if value==None:
- return 0
- else:
- return utils.toInt(value);
- #本地jar
- def callLocal(businessInfo):
- # 测试修改 这个地方改为读文件
- # with open('D:/jin_rong/test_data/朱传光_371425199305027971_256979050910728199.txt','r',encoding='utf8') as fp:
- # jsonData=json.load(fp);
- test_str=businessInfo["result"];
- jsonData = json.loads(test_str);
- approveResult = "1";
- #默认为通过,如果不满足条件为3
- loanInfo = jsonData["贷款信息"];
- badDebtsInfo = jsonData["呆账信息汇总"];
- parsePayRcdStatus = jsonData["24期还款状态"];
- creditInfo = jsonData["贷记卡账户"];
- creditInfoZ = jsonData["准贷记卡账户"];
- loanTradeInfoDf = jsonData["信贷交易信息提示"]
- # useRate = jsonData["使用率"]
- # queryRecordDetailDf = jsonData["信贷审批查询记录明细"]
- recoveryInfoSum = jsonData["信贷交易违约信息概要"]
- allAccountNum = null2Zero(loanTradeInfoDf["个人住房贷款账户数"])+null2Zero(loanTradeInfoDf["个人商用房贷款(包括商住两用)账户数"])\
- +null2Zero(loanTradeInfoDf["其他类贷款账户数"])+null2Zero(loanTradeInfoDf["贷记卡账户数"])\
- +null2Zero(loanTradeInfoDf["准贷记卡账户数"])
- #公积金
- housingFundRcd = jsonData["住房公积金参缴记录"]
- rule = ""
- if null2Zero(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"])>=1 or null2Zero(parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"])>=6:
- approveResult = "0"
- rule="#1"
- rule += "#全账户近24月逾期期数大于或等于“3”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"])
- rule += "#全账户近24月逾期期数大于或等于“1”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"])
- elif (utils.toInt(null2Zero(badDebtsInfo["账户数"]))>0) or null2Zero(badDebtsInfo["余额"])>0:
- approveResult = "0"
- rule="#2"
- rule += "#呆账账户数=" + str(badDebtsInfo["账户数"])
- elif parsePayRcdStatus["贷款账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""]=="1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""]=="1":
- approveResult = "0"
- rule="#3"
- rule += "#明细出现\"G\或者还款记录出现以资抵债\"Z\"=" + str(parsePayRcdStatus["贷款账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""]=="1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""]=="1")
- elif loanInfo.__contains__("当前贷款最大逾期期数") and null2Zero(loanInfo["当前贷款最大逾期期数"])>0:
- approveResult = "0"
- rule="#4"
- rule += "#当前贷款最大逾期期数=" + str(loanInfo["当前贷款最大逾期期数"])
- elif creditInfo.__contains__("当前贷记卡最大逾期期数") and null2Zero(creditInfo["当前贷记卡最大逾期期数"]) > 0:
- approveResult = "0"
- rule = "#4"
- rule += "#当前贷记卡最大逾期期数=" + str(creditInfo["当前贷记卡最大逾期期数"])
- elif null2Zero(creditInfo["名下贷记卡数量-状态异常"])>0:
- approveResult = "0"
- rule="#5"
- rule += "#名下贷记卡数量-状态异常=" + str(creditInfo["名下贷记卡数量-状态异常"])
- elif creditInfoZ.__contains__("名下准贷记卡数量-状态异常") and null2Zero(creditInfoZ["名下准贷记卡数量-状态异常"])>0:
- approveResult = "0"
- rule="#6"
- rule += "#名下准贷记卡数量-状态异常=" + str(creditInfoZ["名下准贷记卡数量-状态异常"])
- elif null2Zero(recoveryInfoSum["垫款业务账户数"])>=3:#原来为>0
- approveResult = "0"
- rule="#16"
- rule += "#垫款业务账户数=" + str(recoveryInfoSum["垫款业务账户数"])
- elif null2Zero(recoveryInfoSum["垫款业务余额"]) > 0:
- approveResult = "0"
- rule="#17"
- rule += "#垫款业务余额=" + str(recoveryInfoSum["垫款业务余额"])
- #白户
- elif allAccountNum==0 and housingFundRcd["参缴日期"]==None:
- approveResult = "0"
- rule = "#18"
- rule += "#白户#无信贷交易明细"
- if isAutoApprove =="1":
- approveResult = "1"
- data = {"approveResult":approveResult,"rule":rule}
- return data;
- #新版本地模型
- def callNewModel(businessInfo):
- jsonData = json.loads(businessInfo["result"]);
- approveResult = "1";
- # 默认为通过,如果不满足条件为3
- loanInfo = jsonData["贷款信息"];
- badDebtsInfo = jsonData["呆账信息汇总"];
- parsePayRcdStatus = jsonData["24期还款状态"];
- creditInfo = jsonData["贷记卡账户"];
- creditInfoZ = jsonData["准贷记卡账户"];
- loanTradeInfoDf = jsonData["信贷交易信息提示"]
- # useRate = jsonData["使用率"]
- # queryRecordDetailDf = jsonData["信贷审批查询记录明细"]
- recoveryInfoSum = jsonData["信贷交易违约信息概要"]
- allAccountNum = null2Zero(loanTradeInfoDf["个人住房贷款账户数"]) + null2Zero(loanTradeInfoDf["个人商用房贷款(包括商住两用)账户数"]) \
- + null2Zero(loanTradeInfoDf["其他类贷款账户数"]) + null2Zero(loanTradeInfoDf["贷记卡账户数"]) \
- + null2Zero(loanTradeInfoDf["准贷记卡账户数"])
- # 公积金
- housingFundRcd = jsonData["住房公积金参缴记录"]
- rule = ""
- if null2Zero(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"]) >= 1 or null2Zero(
- parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"]) >= 6:
- approveResult = "0"
- rule = "#1"
- rule += "#全账户近24月逾期期数大于或等于“3”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"])
- rule += "#全账户近24月逾期期数大于或等于“1”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"])
- elif (utils.toInt(null2Zero(badDebtsInfo["账户数"])) > 0) or null2Zero(badDebtsInfo["余额"]) > 0:
- approveResult = "0"
- rule = "#2"
- rule += "#呆账账户数=" + str(badDebtsInfo["账户数"])
- elif parsePayRcdStatus["贷款账户近24个月是否出现\"G\""] == "1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""] == "1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""] == "1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""] == "1":
- approveResult = "0"
- rule = "#3"
- rule += "#明细出现\"G\或者还款记录出现以资抵债\"Z\"=" + str(
- parsePayRcdStatus["贷款账户近24个月是否出现\"G\""] == "1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""] == "1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""] == "1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""] == "1")
- elif loanInfo.__contains__("当前贷款最大逾期期数") and null2Zero(loanInfo["当前贷款最大逾期期数"]) > 0:
- approveResult = "0"
- rule = "#4"
- rule += "#当前贷款最大逾期期数=" + str(loanInfo["当前贷款最大逾期期数"])
- elif creditInfo.__contains__("当前贷记卡最大逾期期数") and null2Zero(creditInfo["当前贷记卡最大逾期期数"]) > 0:
- approveResult = "0"
- rule = "#4"
- rule += "#当前贷记卡最大逾期期数=" + str(creditInfo["当前贷记卡最大逾期期数"])
- elif null2Zero(creditInfo["名下贷记卡数量-状态异常"]) > 0:
- approveResult = "0"
- rule = "#5"
- rule += "#名下贷记卡数量-状态异常=" + str(creditInfo["名下贷记卡数量-状态异常"])
- elif creditInfoZ.__contains__("名下准贷记卡数量-状态异常") and null2Zero(creditInfoZ["名下准贷记卡数量-状态异常"]) > 0:
- approveResult = "0"
- rule = "#6"
- rule += "#名下准贷记卡数量-状态异常=" + str(creditInfoZ["名下准贷记卡数量-状态异常"])
- elif null2Zero(recoveryInfoSum["垫款业务账户数"]) >= 3: # 原来为>0
- approveResult = "0"
- rule = "#16"
- rule += "#垫款业务账户数=" + str(recoveryInfoSum["垫款业务账户数"])
- elif null2Zero(recoveryInfoSum["垫款业务余额"]) > 0:
- approveResult = "0"
- rule = "#17"
- rule += "#垫款业务余额=" + str(recoveryInfoSum["垫款业务余额"])
- # 白户
- elif allAccountNum == 0 and housingFundRcd["参缴日期"] == None:
- approveResult = "1"
- rule = "#18"
- rule += "#白户#无信贷交易明细"
- if isAutoApprove == "1":
- approveResult = "1"
- data = {"approveResult": approveResult, "rule": rule}
- return data;
- #未上线
- def callNewModelX(businessInfo):
- jsonData = json.loads(businessInfo["result"]);
- approveResult = "1";
- #默认为通过,如果不满足条件为3
- loanInfo = jsonData["贷款信息"];
- badDebtsInfo = jsonData["呆账信息汇总"];
- parsePayRcdStatus = jsonData["24期还款状态"];
- creditInfo = jsonData["贷记卡账户"];
- creditInfoZ = jsonData["准贷记卡账户"];
- loanTradeInfoDf = jsonData["信贷交易信息提示"]
- useRate = jsonData["使用率"]
- queryRecordDetailDf = jsonData["信贷审批查询记录明细"]
- recoveryInfoSum = jsonData["信贷交易违约信息概要"]
- allAccountNum = null2Zero(loanTradeInfoDf["个人住房贷款账户数"])+null2Zero(loanTradeInfoDf["个人商用房贷款(包括商住两用)账户数"])\
- +null2Zero(loanTradeInfoDf["其他类贷款账户数"])+null2Zero(loanTradeInfoDf["贷记卡账户数"])\
- +null2Zero(loanTradeInfoDf["准贷记卡账户数"])
- loanAccountNum = null2Zero(loanTradeInfoDf["个人住房贷款账户数"]) + null2Zero(
- loanTradeInfoDf["个人商用房贷款(包括商住两用)账户数"]) + null2Zero(loanTradeInfoDf["其他类贷款账户数"])
- #公积金
- housingFundRcd = jsonData["住房公积金参缴记录"]
- rule = ""
- if null2Zero(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"])>=1 or null2Zero(parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"])>=6:
- approveResult = "0"
- rule="#1"
- rule += "#全账户近24月逾期期数大于或等于“3”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“3”的次数"])
- rule += "#全账户近24月逾期期数大于或等于“1”的次数=" + str(parsePayRcdStatus["全账户近24月逾期期数大于或等于“1”的次数"])
- elif (utils.toInt(null2Zero(badDebtsInfo["账户数"]))>0) or null2Zero(badDebtsInfo["余额"])>0:
- approveResult = "0"
- rule="#2"
- rule += "#呆账账户数=" + str(badDebtsInfo["账户数"])
- elif parsePayRcdStatus["贷款账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""]=="1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""]=="1":
- approveResult = "0"
- rule="#3"
- rule += "#明细出现\"G\或者还款记录出现以资抵债\"Z\"=" + str(parsePayRcdStatus["贷款账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷记卡账户近24个月是否出现\"G\""]=="1" \
- or parsePayRcdStatus["准贷记卡账户近24个月是否出现\"G\""]=="1" or parsePayRcdStatus["贷款账户近24个月是否出现\"Z\""]=="1")
- elif loanInfo.__contains__("当前贷款最大逾期期数") and null2Zero(loanInfo["当前贷款最大逾期期数"])>0:
- approveResult = "0"
- rule="#4"
- rule += "#当前贷款最大逾期期数=" + str(loanInfo["当前贷款最大逾期期数"])
- elif creditInfo.__contains__("当前贷记卡最大逾期期数") and null2Zero(creditInfo["当前贷记卡最大逾期期数"]) > 0:
- approveResult = "0"
- rule = "#4"
- rule += "#当前贷记卡最大逾期期数=" + str(creditInfo["当前贷记卡最大逾期期数"])
- elif null2Zero(creditInfo["名下贷记卡数量-状态异常"])>0:
- approveResult = "0"
- rule="#5"
- rule += "#名下贷记卡数量-状态异常=" + str(creditInfo["名下贷记卡数量-状态异常"])
- elif creditInfoZ.__contains__("名下准贷记卡数量-状态异常") and null2Zero(creditInfoZ["名下准贷记卡数量-状态异常"])>0:
- approveResult = "0"
- rule="#6"
- rule += "#名下准贷记卡数量-状态异常=" + str(creditInfoZ["名下准贷记卡数量-状态异常"])
- elif null2Zero(loanTradeInfoDf["贷记卡账户数"]) > 6 and null2Zero(useRate["贷记卡账户使用率(已用额度/授信总额)"]) > 0.9:
- approveResult = "3" # 当前信用卡超过6笔且信用卡透支严重(余额/授信>90%)
- rule = "#6"
- elif (null2Zero(loanTradeInfoDf["个人住房贷款账户数"]) + null2Zero(loanTradeInfoDf["个人商用房贷款(包括商住两用)账户数"]) + null2Zero(
- loanTradeInfoDf["其他类贷款账户数"])
- + null2Zero(loanTradeInfoDf["贷记卡账户数"]) + null2Zero(loanTradeInfoDf["准贷记卡账户数"])) > 8 and \
- null2Zero(useRate["全账户使用率(已用额度/授信总额)"]) > 0.9:
- approveResult = "3" # 全账户现在贷账户超过8且余额占比超90%
- rule = "#7"
- elif (loanAccountNum) > 6 and null2Zero(useRate["非循环贷账户使用率(已用额度/授信总额)"]) > 0.9:
- approveResult = "3" # 当前贷款超过6笔且余额较多(余额/授信>90%)
- rule = "#8"
- elif null2Zero(queryRecordDetailDf["近1月查询次数"]) > 3:
- rule = "#9" # 近1月总查询次数超过3次
- rule += "#近1月查询次数=" + str(null2Zero(queryRecordDetailDf["近1月查询次数"]))
- elif null2Zero(queryRecordDetailDf["最近1个月查询机构数"]) > 2:
- approveResult = "3" # 近1月查询机构数超过2个
- rule = "#18"
- rule += "#最近1个月查询机构数=" + str(queryRecordDetailDf["最近1个月查询机构数"])
- elif null2Zero(queryRecordDetailDf["近3月查询次数"]) > 6:
- approveResult = "3" # 近3月总查询超过6次
- rule = "#19"
- rule += "#近3月查询次数=" + str(queryRecordDetailDf["近3月查询次数"])
- elif null2Zero(queryRecordDetailDf["近6月查询次数贷款审批"]) > 6:
- approveResult = "3" # 近半年“贷款审批”、“信用卡审批”和“担保资格审查”超过6次
- rule = "#20"
- rule += "#近6月查询次数贷款审批=" + str(queryRecordDetailDf["近6月查询次数贷款审批"])
- elif null2Zero(queryRecordDetailDf["近6月查询次数信用卡审批"]) > 6:
- approveResult = "3" # 近半年“贷款审批”、“信用卡审批”和“担保资格审查”超过6次
- rule = "#21"
- rule += "#近6月查询次数信用卡审批=" + str(queryRecordDetailDf["近6月查询次数信用卡审批"])
- elif null2Zero(queryRecordDetailDf["最近6个月担保资格审查查询次数"]) > 6:
- approveResult = "3"
- rule = "#22"
- rule += "#最近6个月担保资格审查查询次数=" + str(queryRecordDetailDf["最近6个月担保资格审查查询次数"])
- elif null2Zero(queryRecordDetailDf["近3月查询次数贷款审批"]) > 4:
- approveResult = "3" # 近3月“贷款审批”、“信用卡审批”和“担保资格审查”超过4次
- rule = "#10"
- rule += "#近3月查询次数贷款审批=" + str(queryRecordDetailDf["近3月查询次数贷款审批"])
- elif null2Zero(queryRecordDetailDf["近3月查询次数信用卡审批"]) > 4:
- approveResult = "3" # 近3月“贷款审批”、“信用卡审批”和“担保资格审查”超过4次
- rule = "#11"
- rule += "#近3月查询次数信用卡审批=" + str(queryRecordDetailDf["近3月查询次数信用卡审批"])
- elif queryRecordDetailDf.__contains__("最近3个月担保资格审查查询次数") and null2Zero(queryRecordDetailDf["最近3个月担保资格审查查询次数"]) > 4:
- approveResult = "3" # 近3月“贷款审批”、“信用卡审批”和“担保资格审查”超过4次
- rule = "#12"
- rule += "#最近3个月担保资格审查查询次数=" + str(queryRecordDetailDf["最近3个月担保资格审查查询次数"])
- elif null2Zero(queryRecordDetailDf["最近3个月查询机构数"]) > 3:
- approveResult = "3" # 近3月查询机构数超过3个
- rule = "#14"
- rule += "#最近3个月查询机构数=" + str(queryRecordDetailDf["最近3个月查询机构数"])
- elif null2Zero(queryRecordDetailDf["近6月查询次数"]) > 10:
- approveResult = "3" # 近半年总查询超过10次
- rule = "#15"
- rule += "#近6月查询次数=" + str(queryRecordDetailDf["近6月查询次数"])
- elif null2Zero(recoveryInfoSum["垫款业务账户数"])>=3:#原来为>0
- approveResult = "0"
- rule="#16"
- rule += "#垫款业务账户数=" + str(recoveryInfoSum["垫款业务账户数"])
- elif null2Zero(recoveryInfoSum["垫款业务余额"]) > 0:
- approveResult = "0"
- rule="#17"
- rule += "#垫款业务余额=" + str(recoveryInfoSum["垫款业务余额"])
- #白户
- elif allAccountNum==0 and housingFundRcd["参缴日期"]==None:
- approveResult = "1"
- rule = "#18"
- rule += "#白户#无信贷交易明细#审批通过"
- if isAutoApprove =="1":
- approveResult = "1"
- data = {"approveResult":approveResult,"rule":rule}
- return data;
- if __name__ == '__main__':
- print(call_credit())
|