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
17d3a43b
authored
2024-05-20 16:18:25 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:下载发票excel接口
1 parent
3a4fd0b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
src/apps/doc/internal_urls.py
src/apps/doc/views.py
src/apps/doc/internal_urls.py
View file @
17d3a43
...
...
@@ -4,5 +4,6 @@ from . import views
urlpatterns
=
[
path
(
r''
,
views
.
DocView
.
as_view
()),
path
(
r'invoice/downloadExcel'
,
views
.
InvoiceExcelView
.
as_view
()),
path
(
r'contract/v1'
,
views
.
SEContractView
.
as_view
()),
]
...
...
src/apps/doc/views.py
View file @
17d3a43
...
...
@@ -1845,3 +1845,29 @@ class GoView(GenericView):
return
response
.
ok
(
data
=
result
)
else
:
return
response
.
error_msg
(
msg
=
'识别错误'
)
class
InvoiceExcelView
(
GenericView
):
permission_classes
=
[
IsAuthenticated
]
authentication_classes
=
[
OAuth2AuthenticationWithUser
]
# 下载发票excel
@use_args
(
doc_list_args
,
location
=
'data'
)
def
get
(
self
,
request
,
args
):
application_ids
=
args
.
get
(
'application_ids'
)
application_entity
=
args
.
get
(
'application_entity'
)
url
=
'http://127.0.0.1:8088/napi/invoice/downloadExcel'
body
=
{
'applicationIds'
:
application_ids
,
'applicationEntity'
:
application_entity
}
try
:
self
.
running_log
.
info
(
"request java invoice excel api, url:{0}, body:{1}"
.
format
(
url
,
json
.
dumps
(
body
)))
headers
=
{
'Content-Type'
:
'application/json'
}
requests
.
post
(
url
,
headers
=
headers
,
json
=
body
)
self
.
running_log
.
info
(
"java invoice excel api finish, void"
)
except
Exception
as
e
:
self
.
running_log
.
error
(
"invoice excel request to java error, url:{0}, param:{1}, errorMsg:{2}"
.
format
(
url
,
json
.
dumps
(
body
),
traceback
.
format_exc
()))
...
...
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