17d3a43b by 冯轩

MOD:下载发票excel接口

1 parent 3a4fd0b0
......@@ -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()),
]
......
......@@ -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()))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!