MOD:下载发票excel接口
Showing
2 changed files
with
27 additions
and
0 deletions
... | @@ -4,5 +4,6 @@ from . import views | ... | @@ -4,5 +4,6 @@ from . import views |
4 | 4 | ||
5 | urlpatterns = [ | 5 | urlpatterns = [ |
6 | path(r'', views.DocView.as_view()), | 6 | path(r'', views.DocView.as_view()), |
7 | path(r'invoice/downloadExcel', views.InvoiceExcelView.as_view()), | ||
7 | path(r'contract/v1', views.SEContractView.as_view()), | 8 | path(r'contract/v1', views.SEContractView.as_view()), |
8 | ] | 9 | ] | ... | ... |
... | @@ -1845,3 +1845,29 @@ class GoView(GenericView): | ... | @@ -1845,3 +1845,29 @@ class GoView(GenericView): |
1845 | return response.ok(data=result) | 1845 | return response.ok(data=result) |
1846 | else: | 1846 | else: |
1847 | return response.error_msg(msg='识别错误') | 1847 | return response.error_msg(msg='识别错误') |
1848 | |||
1849 | class InvoiceExcelView(GenericView): | ||
1850 | permission_classes = [IsAuthenticated] | ||
1851 | authentication_classes = [OAuth2AuthenticationWithUser] | ||
1852 | |||
1853 | # 下载发票excel | ||
1854 | @use_args(doc_list_args, location='data') | ||
1855 | def get(self, request, args): | ||
1856 | application_ids = args.get('application_ids') | ||
1857 | application_entity = args.get('application_entity') | ||
1858 | |||
1859 | url = 'http://127.0.0.1:8088/napi/invoice/downloadExcel' | ||
1860 | body = { | ||
1861 | 'applicationIds': application_ids, | ||
1862 | 'applicationEntity': application_entity | ||
1863 | } | ||
1864 | try: | ||
1865 | self.running_log.info("request java invoice excel api, url:{0}, body:{1}".format(url, json.dumps(body))) | ||
1866 | headers = { | ||
1867 | 'Content-Type': 'application/json' | ||
1868 | } | ||
1869 | requests.post(url, headers=headers, json=body) | ||
1870 | self.running_log.info("java invoice excel api finish, void") | ||
1871 | except Exception as e: | ||
1872 | self.running_log.error("invoice excel request to java error, url:{0}, param:{1}, errorMsg:{2}".format( | ||
1873 | url, json.dumps(body), traceback.format_exc())) | ... | ... |
-
Please register or sign in to post a comment