Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
credit-report-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
credit-report-api
Commits
15e99060
Commit
15e99060
authored
Aug 27, 2019
by
张鹏程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
1. 准贷记卡 , 正则获取账户状态
parent
9acec8d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
.gitignore
.gitignore
+1
-1
TransactionDetails_Service.py
service/TransactionDetails_Service.py
+7
-2
征信报告.ipynb
testfile/征信报告.ipynb
+40
-0
No files found.
.gitignore
View file @
15e99060
...
@@ -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
...
...
service/TransactionDetails_Service.py
View file @
15e99060
...
@@ -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
...
...
testfile/征信报告.ipynb
View file @
15e99060
...
@@ -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,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment