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
30dda232
authored
2025-04-01 17:41:37 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:add try catch
1 parent
c8eea704
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
src/apps/doc/ocr/ecm.py
src/apps/doc/views.py
src/apps/doc/ocr/ecm.py
View file @
30dda23
...
...
@@ -179,5 +179,5 @@ class ECM(GenericView):
response
=
requests
.
post
(
self
.
search_url
,
headers
=
header_info
,
json
=
args
,
verify
=
False
)
if
response
.
status_code
!=
200
:
raise
ECMException
(
'ECM search failed with code: {0}'
.
format
(
response
.
status_code
))
self
.
running_log
.
info
(
"{0} search response.json():{1}"
.
format
(
self
.
log_base
,
response
.
json
()))
#
self.running_log.info("{0} search response.json():{1}".format(self.log_base, response.json()))
return
response
.
json
()
\ No newline at end of file
...
...
src/apps/doc/views.py
View file @
30dda23
...
...
@@ -1906,6 +1906,7 @@ class SearchGBHistoryFileView(GenericView):
ecm
=
ECM
()
response_json
=
ecm
.
search_doc_info_list
(
file_path
,
business_type
)
data_objects
=
response_json
[
'Envelope'
][
'Body'
][
'executeResponse'
][
'return'
][
'dataPackage'
][
'DataObjects'
]
self
.
running_log
.
info
(
'[SearchGBHistoryFileView] [data_objects size={0}] '
.
format
(
len
(
data_objects
)))
for
data_object
in
data_objects
:
object_id
=
data_object
[
'Identity'
][
'ObjectId'
][
'@id'
]
properties_dict
=
{}
...
...
@@ -1915,11 +1916,13 @@ class SearchGBHistoryFileView(GenericView):
value
=
prop
.
get
(
'Value'
,
'null'
)
# 如果Value为空,则输出null
properties_dict
[
name
]
=
value
self
.
running_log
.
info
(
'[SearchGBHistoryFileView] [properties_dict={0}] '
.
format
(
properties_dict
))
try
:
gb_history_file_class
.
objects
.
create
(
object_id
=
object_id
,
object_name
=
properties_dict
.
get
(
'object_name'
,
''
),
application_no
=
properties_dict
.
get
(
'b_application_no'
,
''
),
object_type
=
properties_dict
.
get
(
'r_object_type'
,
''
)
,
object_type
=
'green_book'
,
customer_name
=
properties_dict
.
get
(
'b_customer_name'
,
''
),
content_size
=
properties_dict
.
get
(
'r_content_size'
,
''
),
owner_name
=
properties_dict
.
get
(
'owner_name'
,
''
),
...
...
@@ -1928,7 +1931,9 @@ class SearchGBHistoryFileView(GenericView):
location
=
properties_dict
.
get
(
'b_location'
,
''
),
download_finish
=
False
)
return
response
.
ok
(
data
=
False
)
except
Exception
as
e
:
self
.
exception_log
.
exception
(
'[SearchGBHistoryFileView] [db save failed] [error={0}]'
.
format
(
traceback
.
format_exc
()))
return
response
.
ok
(
data
=
True
)
class
DownloadGBHistoryFileView
(
GenericView
):
permission_classes
=
[
IsAuthenticated
]
...
...
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