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
72c57e42
authored
2022-06-13 20:53:19 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add rpa field
1 parent
8b24dc41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
src/apps/doc/models.py
src/celery_compare/tasks.py
src/common/tools/mssql_script17.py
src/apps/doc/models.py
View file @
72c57e4
...
...
@@ -625,6 +625,7 @@ class AFCSECompareResult(models.Model):
reason9_count
=
models
.
SmallIntegerField
(
default
=
0
,
verbose_name
=
"原因9数目"
)
reason10_count
=
models
.
SmallIntegerField
(
default
=
0
,
verbose_name
=
"原因10数目"
)
result
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"比对结果"
)
failure_reason
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"failure reason for RPA"
)
comments
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"备注"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
False
,
verbose_name
=
'修改时间'
)
# 索引
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -681,6 +682,7 @@ class HILSECompareResult(models.Model):
reason9_count
=
models
.
SmallIntegerField
(
default
=
0
,
verbose_name
=
"原因9数目"
)
reason10_count
=
models
.
SmallIntegerField
(
default
=
0
,
verbose_name
=
"原因10数目"
)
result
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"比对结果"
)
failure_reason
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"failure reason for RPA"
)
comments
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"备注"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
False
,
verbose_name
=
'修改时间'
)
# 索引
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
src/celery_compare/tasks.py
View file @
72c57e4
...
...
@@ -2517,6 +2517,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto):
successful_at_this_level
=
True
failure_reason
=
{}
cn_reason_list
=
[]
rpa_failure_reason
=
{}
for
info_key
,
info_value
in
compare_info
.
items
():
if
info_key
in
[
'individualCusInfo'
,
'applicantInformation'
]:
...
...
@@ -2547,6 +2548,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto):
successful_at_this_level
=
False
failure_field
.
append
(
name
)
cn_reason_list
.
append
(
cn_reason
)
rpa_failure_reason
.
setdefault
(
cn_reason
,
[])
.
append
(
value
)
compare_result
.
append
(
{
consts
.
HEAD_LIST
[
0
]:
info_key
,
...
...
@@ -2598,8 +2600,10 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto):
failure_field
.
append
(
name
)
if
isinstance
(
cn_reason
,
str
):
cn_reason_list
.
append
(
cn_reason
)
rpa_failure_reason
.
setdefault
(
cn_reason
,
[])
.
append
(
value
)
elif
isinstance
(
cn_reason
,
list
):
cn_reason_list
.
extend
(
cn_reason
)
rpa_failure_reason
.
setdefault
(
'、'
.
join
(
cn_reason
),
[])
.
append
(
value
)
compare_result
.
append
(
{
consts
.
HEAD_LIST
[
0
]:
info_key
,
...
...
@@ -2642,7 +2646,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto):
last_cn_reason_list
.
append
(
i
)
cn_failure_reason_str
=
'
\n
'
.
join
(
last_cn_reason_list
)
bs_failure_reason_str
=
'
\n
'
.
join
(
bs_cn_reason_list
)
return
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
,
bs_failure_reason_str
return
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
,
bs_failure_reason_str
,
rpa_failure_reason
def
se_result_detect
(
ocr_res_dict
):
...
...
@@ -2705,7 +2709,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
detect_list
=
se_result_detect
(
ocr_res_dict
)
compare_info
,
application_version
,
is_gsyh
=
get_se_cms_compare_info
(
last_obj
,
application_entity
,
detect_list
)
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
,
bs_failure_reason_str
=
se_compare_process
(
compare_info
,
ocr_res_dict
,
is_gsyh
,
False
)
compare_result
,
total_fields
,
failed_count
,
successful_at_this_level
,
failure_reason_str
,
cn_failure_reason_str
,
bs_failure_reason_str
,
rpa_failure_reason
=
se_compare_process
(
compare_info
,
ocr_res_dict
,
is_gsyh
,
False
)
compare_log
.
info
(
'{0} [SE] [compare success] [entity={1}] [id={2}] [ocr_res_id={3}] [result={4}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
,
compare_result
))
except
Exception
as
e
:
...
...
@@ -2729,6 +2733,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
# res_obj.reason1_count = reason1_count
res_obj
.
result
=
json
.
dumps
(
compare_result
)
res_obj
.
update_time
=
datetime
.
now
()
res_obj
.
failure_reason
=
json
.
dumps
(
rpa_failure_reason
,
ensure_ascii
=
True
)
res_obj
.
save
()
compare_log
.
info
(
'{0} [SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'
.
format
(
log_base
,
application_entity
,
application_id
,
ocr_res_id
))
...
...
src/common/tools/mssql_script17.py
0 → 100644
View file @
72c57e4
import
pyodbc
hil_sql
=
"""
ALTER TABLE hil_se_compare_result ADD failure_reason nvarchar(max);
"""
afc_sql
=
"""
ALTER TABLE afc_se_compare_result ADD failure_reason nvarchar(max);
"""
hil_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
hil_cursor
=
hil_cnxn
.
cursor
()
hil_cursor
.
execute
(
hil_sql
)
hil_cursor
.
close
()
hil_cnxn
.
close
()
afc_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
afc_cursor
=
afc_cnxn
.
cursor
()
afc_cursor
.
execute
(
afc_sql
)
afc_cursor
.
close
()
afc_cnxn
.
close
()
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