Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
520cb3bb
authored
2022-10-17 16:20:01 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
82552671
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
src/apps/doc/views.py
src/prese/compare.py
src/prese/consts.py
src/apps/doc/views.py
View file @
520cb3b
...
...
@@ -62,8 +62,16 @@ class CustomDate(fields.Date):
class
CustomDecimal
(
fields
.
Decimal
):
def
__init__
(
self
,
places_2
=
False
,
*
args
,
**
kwargs
):
self
.
places_2
=
places_2
super
()
.
__init__
(
*
args
,
**
kwargs
)
def
_deserialize
(
self
,
value
,
attr
,
data
,
**
kwargs
):
return
self
.
_to_string
(
self
.
_validated
(
value
))
if
self
.
places_2
:
return
format
(
self
.
_validated
(
value
),
".2f"
)
else
:
return
format
(
self
.
_validated
(
value
),
"f"
)
# return self._to_string(self._validated(value))
# restframework将request.body封装至request.data, webargs从request.data中获取参数
...
...
@@ -109,7 +117,7 @@ se_associated_args = {
se_payment_args
=
{
'term'
:
fields
.
Int
(
required
=
True
),
'amount'
:
CustomDecimal
(
required
=
True
)
'amount'
:
CustomDecimal
(
required
=
True
,
places_2
=
True
)
}
se_bank_args
=
{
...
...
src/prese/compare.py
View file @
520cb3b
...
...
@@ -254,7 +254,7 @@ def pre_compare_license_id(license_en, id_res_list, field_list, applicant_type):
# 身份证、居住证 过期期限特殊处理
expiry_dates
=
set
()
key
=
compare_logic
.
get
(
'idExpiryDate'
)[
0
]
key
=
compare_logic
.
get
(
consts
.
ID_FIELDS
[
2
]
)[
0
]
for
ocr_res
in
ocr_res_list
:
if
key
in
ocr_res
:
expiry_dates
.
add
(
ocr_res
[
key
])
...
...
@@ -280,7 +280,7 @@ def pre_compare_license_id(license_en, id_res_list, field_list, applicant_type):
# 过期期限特殊处理
# N, N1, N2, Y
if
name
==
'idExpiryDate'
and
result
==
consts
.
RESULT_N
:
# 遍历所有背面过期时间
if
name
==
consts
.
ID_FIELDS
[
2
]
and
result
==
consts
.
RESULT_N
:
# 遍历所有背面过期时间
if
len
(
expiry_dates
)
==
0
:
result
=
consts
.
RESULT_N1
ocr_str
=
empty_str
...
...
@@ -302,7 +302,7 @@ def pre_compare_license_id(license_en, id_res_list, field_list, applicant_type):
result
=
consts
.
RESULT_Y
if
ca_or_se_idx
==
0
:
if
name
==
'idExpiryDate'
:
if
name
==
consts
.
ID_FIELDS
[
2
]
:
if
result
==
consts
.
RESULT_N
or
result
==
consts
.
RESULT_N1
:
break
elif
result
==
consts
.
RESULT_N
:
...
...
@@ -316,7 +316,7 @@ def pre_compare_license_id(license_en, id_res_list, field_list, applicant_type):
if
isinstance
(
value
,
list
):
value
=
json
.
dumps
(
value
,
ensure_ascii
=
False
)
comments
=
consts
.
ID_DATE_MAP
[
result
]
if
name
==
'idExpiryDate'
else
compare_logic
[
name
][
3
]
comments
=
consts
.
ID_DATE_MAP
[
result
]
if
name
==
consts
.
ID_FIELDS
[
2
]
else
compare_logic
[
name
][
3
]
result_field_list
.
append
((
value
,
ocr_str
,
result
,
'{0}{1}'
.
format
(
applicant_type
,
comments
)))
if
not
is_find
:
...
...
src/prese/consts.py
View file @
520cb3b
...
...
@@ -111,10 +111,10 @@ HT_COMPARE_LOGIC = {
AFC_CON_FIELDS
[
8
]:
(
'ASP项目详情-重要条款'
,
'se_asp_compare'
,
{},
'合同(重要条款)ASP名称或者金额与系统不一致'
),
AFC_CON_FIELDS
[
9
]:
(
'ASP项目详情'
,
'se_asp_compare'
,
{},
'合同ASP名称或者金额与系统不一致'
),
'主借人日期'
:
(
'主借人日期'
,
'se_have_compare'
,
{},
'合同主借款人签字日期无'
),
'共借人日期'
:
(
'共借人日期'
,
'se_have_compare'
,
{},
'合同共借人签字日期无'
),
'保证人日期1'
:
(
'保证人日期1'
,
'se_have_compare'
,
{},
'合同担保人1签字日期无'
),
'保证人日期2'
:
(
'保证人日期2'
,
'se_have_compare'
,
{},
'合同担保人2签字日期无'
),
AFC_HT_DATE_FIELDS
[
0
]
:
(
'主借人日期'
,
'se_have_compare'
,
{},
'合同主借款人签字日期无'
),
AFC_HT_DATE_FIELDS
[
1
]
:
(
'共借人日期'
,
'se_have_compare'
,
{},
'合同共借人签字日期无'
),
AFC_HT_DATE_FIELDS
[
2
]
:
(
'保证人日期1'
,
'se_have_compare'
,
{},
'合同担保人1签字日期无'
),
AFC_HT_DATE_FIELDS
[
3
]
:
(
'保证人日期2'
,
'se_have_compare'
,
{},
'合同担保人2签字日期无'
),
}
ID_COMPARE_LOGIC
=
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment