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
6c0c7f14
Commit
6c0c7f14
authored
Aug 28, 2019
by
张鹏程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
1. 贷记卡部分未解析出来 2. 贷记卡列表缺少最后一条数据
parent
15e99060
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
21 deletions
+41
-21
TransactionDetails_Service.py
service/TransactionDetails_Service.py
+41
-21
征信报告.ipynb
testfile/征信报告.ipynb
+0
-0
No files found.
service/TransactionDetails_Service.py
View file @
6c0c7f14
...
...
@@ -27,30 +27,47 @@ class TransactionDetails(Base):
if
'贷款'
in
tag
.
keys
():
result
.
update
(
self
.
get_Loan_Details
(
tag
[
'贷款'
]))
if
'贷记卡'
in
tag
.
keys
():
result
.
update
(
self
.
get_DebitCard_Details
(
tag
[
'贷记卡'
]))
result
.
update
(
self
.
get_DebitCard_Details
(
tag
[
'贷记卡'
]
,
'贷记卡'
))
if
'准贷记卡'
in
tag
.
keys
():
result
.
update
(
self
.
get_DebitCard_Details
(
tag
[
'准贷记卡'
]))
result
.
update
(
self
.
get_DebitCard_Details
(
tag
[
'准贷记卡'
]
,
'准贷记卡'
))
return
result
def
get_menuDetailsList
(
self
,
tag
):
# def get_menuDetailsList(self,tag):
# """交易信息明细小标题拆分"""
# _result = []
# _temp = []
# for i in tag:
# if i.td.attrs:
# try :
# if i.div['align'] == 'left':
# # print(list( re.findall('([0-9]\d{0,2})[\.]{1}(\S+)',i.div.get_text())[0]))
# _temp.extend(list( re.findall('([0-9]\d{0,2})[\.]{1}(\S+)',i.div.get_text())[0]))
# elif i.div['align'] == 'center':
# _temp.append(i)
# except:
# _temp.append(None)
# else:
# if i.table:
# _temp.append(i) #
# if _temp:
# _result.append(_temp)
# _temp = []
# return _result
def
get_menuDetailsList
(
self
,
tag
):
# 交易信息明细拆分
"""交易信息明细小标题拆分"""
_result
=
[]
_temp
=
[]
for
i
in
tag
:
if
i
.
td
.
attrs
:
try
:
if
i
.
div
[
'align'
]
==
'left'
:
# print(list( re.findall('([0-9]\d{0,2})[\.]{1}(\S+)',i.div.get_text())[0]))
_temp
.
extend
(
list
(
re
.
findall
(
'([0-9]
\
d{0,2})[
\
.]{1}(
\
S+)'
,
i
.
div
.
get_text
())[
0
]))
elif
i
.
div
[
'align'
]
==
'center'
:
_temp
.
append
(
i
)
except
:
for
i
,
v
in
enumerate
(
tag
):
if
v
.
td
.
get
(
'align'
):
# print(i,v)
table
=
v
.
next_sibling
.
next_sibling
_temp
.
extend
(
list
(
re
.
findall
(
'([0-9]
\
d{0,2})[
\
.]{1}(
\
S+)'
,
v
.
div
.
get_text
())[
0
]))
if
table
.
div
:
_temp
.
append
(
table
)
else
:
_temp
.
append
(
None
)
else
:
if
i
.
table
:
_temp
.
append
(
i
)
#
if
_temp
:
_result
.
append
(
_temp
)
_result
.
append
(
_temp
)
_temp
=
[]
return
_result
...
...
@@ -144,14 +161,17 @@ class TransactionDetails(Base):
table_json
[
'近5年逾期记录'
]
=
table_json
.
pop
(
'逾期记录'
)
if
'账户状态'
in
table_json
.
keys
()
and
table_json
[
'账户状态'
]
!=
''
and
table_json
[
'账户状态'
]
!=
None
:
if
'账户状态'
in
_json
.
keys
():
del
_json
[
'账户状态'
]
_json
.
update
(
table_json
)
_result
.
append
(
_json
)
result
[
'贷款'
]
=
_result
return
result
def
get_DebitCard_Details
(
self
,
tag
):
def
get_DebitCard_Details
(
self
,
tag
,
key
):
"""贷记卡明细拆分"""
result
=
{
'贷记卡'
:{}}
result
=
{
key
:{}}
_result
=
[]
for
v
in
tag
:
_json
=
{}
...
...
@@ -201,13 +221,13 @@ class TransactionDetails(Base):
table_json
[
'逾期记录'
]
=
df
.
to_dict
(
orient
=
'records'
)
table_json
[
'近5年逾期记录'
]
=
table_json
.
pop
(
'逾期记录'
)
if
'账户状态'
in
table_json
.
keys
()
and
table_json
[
'账户状态'
]
==
'正常'
:
if
'账户状态'
in
table_json
.
keys
()
and
table_json
[
'账户状态'
]
!=
''
and
table_json
[
'账户状态'
]
!=
None
:
if
'账户状态'
in
_json
.
keys
():
del
_json
[
'账户状态'
]
_json
.
update
(
table_json
)
_result
.
append
(
_json
)
result
[
'贷记卡'
]
=
_result
result
[
key
]
=
_result
return
result
def
get_json_DebitCard
(
self
,
tag
):
...
...
testfile/征信报告.ipynb
View file @
6c0c7f14
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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