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
40ea31e8
authored
2022-01-10 11:15:38 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
a7a8687b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
6 deletions
src/apps/account/views.py
src/apps/doc/consts.py
src/apps/doc/models.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/account/views.py
View file @
40ea31e
...
...
@@ -24,7 +24,7 @@ class LoginView(ObtainJSONWebToken, GenericView):
# rh.set_login_times(user_name, LOGIN_TIMES_LIMIT_EXPIRES)
raise
self
.
invalid_params
(
msg
=
"用户名或密码错误"
)
serializer
=
self
.
get_serializer
(
data
=
request
.
data
)
#
serializer.is_valid()
serializer
.
is_valid
()
user
=
serializer
.
object
.
get
(
'user'
)
data
=
{
'user_id'
:
user
.
id
,
...
...
src/apps/doc/consts.py
View file @
40ea31e
...
...
@@ -1694,7 +1694,7 @@ MVI_COMPARE_LOGIC = {
'vinNo'
:
(
'车辆识别代码'
,
'se_common_compare'
,
{},
'发票车架号与系统不一致'
),
'dealer'
:
(
'销方名称'
,
'se_contain_compare_2'
,
{},
'发票销货单位名称与系统不一致'
),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{},
'发票车辆价格与系统不一致'
),
'customerName'
:
(
'购方名称'
,
'se_
common_compare'
,
{
},
'发票购买方姓名与系统不一致'
),
'customerName'
:
(
'购方名称'
,
'se_
name_compare'
,
{
'is_passport'
:
True
,
'replace_kuohao'
:
True
},
'发票购买方姓名与系统不一致'
),
'idNum'
:
(
'购买方身份证号或组织机构代码'
,
'se_common_compare'
,
{},
'发票购买方证件号码与系统不一致'
),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
},
'发票开票日期早于首次提交申请日期'
),
'stamp'
:
(
'销售单位章'
,
'se_common_compare'
,
{},
'发票无章'
),
...
...
@@ -1711,7 +1711,7 @@ ZZSSE_FIELD = '增值税税额'
UCI_COMPARE_LOGIC
=
{
'vinNo'
:
(
'车架号'
,
'se_common_compare'
,
{},
'二手车发票车架号与系统不一致'
),
'vehicleTransactionAmount'
:
(
'价税合计小写'
,
'se_amount_compare'
,
{},
'二手车发票车价合计与系统车辆价格不一致'
),
'customerName'
:
(
'购方名称'
,
'se_name_compare'
,
{
'is_passport'
:
True
},
'二手车发票买方姓名与系统不一致'
),
'customerName'
:
(
'购方名称'
,
'se_name_compare'
,
{
'is_passport'
:
True
,
'replace_kuohao'
:
True
},
'二手车发票买方姓名与系统不一致'
),
'idNum'
:
(
'购方纳税人识别号'
,
'se_contain_compare_2'
,
{},
'二手车发票买方证件号码与系统不一致'
),
'dateOfInvoice'
:
(
'开票日期'
,
'se_date_compare_2'
,
{
'three_month'
:
True
},
'二手车发票开票日期早于首次提交申请日期'
),
'stamp'
:
(
'发票章'
,
'se_common_compare'
,
{},
'二手车发票章需人工核查'
),
...
...
src/apps/doc/models.py
View file @
40ea31e
...
...
@@ -833,7 +833,7 @@ class HILAutoSettlement(models.Model):
ocr_auto_result_pass
=
models
.
BooleanField
(
null
=
True
,
verbose_name
=
"auto结果"
)
ocr_whole_result_pass
=
models
.
BooleanField
(
null
=
True
,
verbose_name
=
"整体结果"
)
ocr_auto_result
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"auto比对结果"
)
ocr_latest_comparison_time
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
verbose_name
=
'最新比对时间'
)
# 索引
ocr_latest_comparison_time
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
'最新比对时间'
)
# 索引
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -863,7 +863,7 @@ class AFCAutoSettlement(models.Model):
ocr_auto_result_pass
=
models
.
BooleanField
(
null
=
True
,
verbose_name
=
"auto结果"
)
ocr_whole_result_pass
=
models
.
BooleanField
(
null
=
True
,
verbose_name
=
"整体结果"
)
ocr_auto_result
=
models
.
TextField
(
verbose_name
=
"auto比对结果"
)
ocr_latest_comparison_time
=
models
.
DateTimeField
(
auto_now
=
True
,
null
=
True
,
verbose_name
=
'最新比对时间'
)
ocr_latest_comparison_time
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
'最新比对时间'
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
src/celery_compare/tasks.py
View file @
40ea31e
...
...
@@ -2423,11 +2423,12 @@ def se_contract_compare(license_en, ocr_res_dict, strip_list, is_gsyh):
update_args
[
k
]
=
v
else
:
update_args
=
compare_logic
[
name
][
2
]
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str_or_list
,
**
update_args
)
if
isinstance
(
ocr_str_or_list
,
list
):
ocr_str
=
json
.
dumps
(
ocr_str_or_list
,
ensure_ascii
=
False
)
else
:
ocr_str_or_list
=
ocr_str_or_list
.
strip
()
ocr_str
=
ocr_str_or_list
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str_or_list
,
**
update_args
)
reason
=
compare_logic
[
name
][
3
]
else
:
result
=
consts
.
RESULT_N
...
...
src/common/tools/comparison.py
View file @
40ea31e
...
...
@@ -35,7 +35,14 @@ class Comparison:
' '
:
''
,
'·'
:
''
,
}
self
.
KH_TRANS_MAP
=
{
'('
:
'1'
,
')'
:
'1'
,
'('
:
'1'
,
')'
:
'1'
,
}
self
.
TRANS
=
str
.
maketrans
(
self
.
TRANS_MAP
)
self
.
KH_TRANS
=
str
.
maketrans
(
self
.
KH_TRANS_MAP
)
self
.
re_obj
=
r'[(\(].*?[\))]'
def
build_res
(
self
,
result
):
...
...
@@ -225,6 +232,9 @@ class Comparison:
if
kwargs
.
get
(
'is_passport'
):
input_tmp
=
input_str
.
upper
()
.
replace
(
' '
,
''
)
ocr_tmp
=
ocr_str
.
upper
()
.
replace
(
' '
,
''
)
if
kwargs
.
get
(
'replace_kuohao'
):
input_tmp
=
input_tmp
.
translate
(
self
.
KH_TRANS
)
ocr_tmp
=
ocr_tmp
.
translate
(
self
.
KH_TRANS
)
if
input_tmp
.
find
(
ocr_tmp
)
==
-
1
:
return
self
.
RESULT_N
else
:
...
...
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