Commit 15e99060 authored by 张鹏程's avatar 张鹏程

修改bug

1. 准贷记卡 , 正则获取账户状态
parent 9acec8d0
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
**/.ipynb_checkpoints **/.ipynb_checkpoints
.ipynb_checkpoints .ipynb_checkpoints
startup.py startup.py
/html/* /html
.python-version .python-version
*.pyc *.pyc
*.pyc.orig *.pyc.orig
......
...@@ -157,7 +157,7 @@ class TransactionDetails(Base): ...@@ -157,7 +157,7 @@ class TransactionDetails(Base):
_json = {} _json = {}
_json['序号'] =v[0] _json['序号'] =v[0]
_json['描述'] =v[0]+'.'+v[1] _json['描述'] =v[0]+'.'+v[1]
r = re.findall("(\d{4}年\d{1,2}月\d{1,2}日)(.*?)发放的(.*?),业务号(.*?),授信额度[折合人民币]{0,5}(.*?)元,共享授信额度[折合人民币]{0,5}(.*?)元,(.*?)[,|。]{1}截至(\d{4}年\d{1,2}月\d{1,2}日),(账户状态为“[\u4E00-\u9FA5]{1,2}”)*",v[1]) r = re.findall("(\d{4}年\d{1,2}月\d{1,2}日)(.*?)发放的(.*?),业务号(.*?),授信额度[折合人民币]{0,5}(.*?)元,共享授信额度[折合人民币]{0,5}(.*?)元,(.*?)[,|。]{1}截至(\d{4}年\d{1,2}月\d{1,2}日),(账户状态为“[\u4E00-\u9FA5]{1,}”)*",v[1])
if r : if r :
r = r[0] r = r[0]
_json['银行名称'] = r[1] _json['银行名称'] = r[1]
...@@ -167,7 +167,7 @@ class TransactionDetails(Base): ...@@ -167,7 +167,7 @@ class TransactionDetails(Base):
_json['截止时间'] = r[7] _json['截止时间'] = r[7]
if r[8]: if r[8]:
r_temp = re.findall('账户状态为“(.*?)”',r[8])[0] r_temp = re.findall('账户状态为“(.*?)”',r[8])[0]
_json['账户状态 '] = r_temp _json['账户状态'] = r_temp
if v[2] != None: if v[2] != None:
table_tag = self.get_table(v[2]) table_tag = self.get_table(v[2])
...@@ -200,6 +200,11 @@ class TransactionDetails(Base): ...@@ -200,6 +200,11 @@ class TransactionDetails(Base):
df['逾期金额'] = df['逾期金额'].apply(lambda x : float(x.replace(',',''))) df['逾期金额'] = df['逾期金额'].apply(lambda x : float(x.replace(',','')))
table_json['逾期记录'] = df.to_dict(orient='records') table_json['逾期记录'] = df.to_dict(orient='records')
table_json['近5年逾期记录'] = table_json.pop('逾期记录') table_json['近5年逾期记录'] = table_json.pop('逾期记录')
if '账户状态' in table_json.keys() and table_json['账户状态'] == '正常':
if '账户状态' in _json.keys():
del _json['账户状态']
_json.update(table_json) _json.update(table_json)
_result.append(_json) _result.append(_json)
result['贷记卡'] = _result result['贷记卡'] = _result
......
...@@ -882,6 +882,46 @@ ...@@ -882,6 +882,46 @@
"result['result'][1]\n" "result['result'][1]\n"
] ]
}, },
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import re"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[('2016年08月01日',\n",
" '商业银行“LS”',\n",
" '贷记卡(美元账户)',\n",
" 'X',\n",
" '11,446',\n",
" '0',\n",
" '信用/免担保',\n",
" '2017年01月17日',\n",
" '账户状态为“销户”',\n",
" '销户')]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v1 = '2016年08月01日商业银行“LS”发放的贷记卡(美元账户),业务号X,授信额度折合人民币11,446元,共享授信额度折合人民币0元,信用/免担保,截至2017年01月17日,账户状态为“销户”。'\n",
"v2 = '2017年07月26日商业银行“ZU”发放的贷记卡(人民币账户),业务号X,授信额度0元,共享授信额度0元,信用/免担保,截至2019年04月24日,账户状态为“未激活”。'\n",
"re.findall(\"(\\d{4}年\\d{1,2}月\\d{1,2}日)(.*?)发放的(.*?),业务号(.*?),授信额度[折合人民币]{0,5}(.*?)元,共享授信额度[折合人民币]{0,5}(.*?)元,(.*?)[,|。]{1}截至(\\d{4}年\\d{1,2}月\\d{1,2}日),(账户状态为“[\\u4E00-\\u9FA5]{1,}”)*\",v1)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment