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
eb21c5bc
authored
2020-07-22 18:12:50 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix application_id
1 parent
97994674
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
15 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/doc_process.py
src/apps/doc/views.py
src/apps/doc/consts.py
View file @
eb21c5b
PAGE_DEFAULT
=
1
PAGE_SIZE_DEFAULT
=
10
FIXED_APPLICATION_ID
=
'手工单
'
FIXED_APPLICATION_ID
_PREFIX
=
'CH-S
'
DOC_SCHEME_LIST
=
[
'ACCEPTANCE'
,
'SETTLEMENT'
,
'CONTRACT MANAGEMENT'
]
DATA_SOURCE_LIST
=
[
'POS'
,
'EAPP'
,
'ECONTRACT'
]
...
...
src/apps/doc/management/commands/doc_process.py
View file @
eb21c5b
...
...
@@ -79,8 +79,9 @@ class Command(BaseCommand, LoggerMixin):
return
None
,
None
,
None
# TODO EDMS下载pdf
doc_data_path
=
os
.
path
.
join
(
self
.
data_dir
,
business_type
,
str
(
doc
.
id
))
os
.
makedirs
(
doc_data_path
,
exist_ok
=
True
)
pdf_path
=
os
.
path
.
join
(
doc_data_path
,
'{0}.pdf'
.
format
(
doc
.
id
))
if
doc
.
application_id
!=
consts
.
FIXED_APPLICATION_ID
:
if
not
doc
.
application_id
.
startswith
(
consts
.
FIXED_APPLICATION_ID_PREFIX
)
:
self
.
edms
.
download
(
pdf_path
,
doc
.
metadata_version_id
)
excel_path
=
os
.
path
.
join
(
doc_data_path
,
'{0}.xls'
.
format
(
doc
.
id
))
...
...
src/apps/doc/views.py
View file @
eb21c5b
...
...
@@ -271,20 +271,20 @@ class DocView(GenericView, DocHandler):
@use_args
(
upload_pdf_args
,
location
=
'files'
)
def
post
(
self
,
request
,
args
):
# 1. 上传信息记录
const_str
=
consts
.
FIXED_APPLICATION_ID
metadata_version_id
=
str
(
int
(
time
.
time
()))
application_id
=
'{0}{1}'
.
format
(
consts
.
FIXED_APPLICATION_ID_PREFIX
,
metadata_version_id
)
upload_finish_time
=
timezone
.
now
()
document_scheme
=
random
.
choice
(
consts
.
DOC_SCHEME_LIST
)
data_source
=
random
.
choice
(
consts
.
DATA_SOURCE_LIST
)
business_type
=
random
.
choice
(
consts
.
BUSINESS_TYPE_LIST
)
record
=
UploadDocRecords
.
objects
.
create
(
metadata_version_id
=
metadata_version_id
,
application_id
=
const_str
,
main_applicant
=
const_str
,
co_applicant
=
const_str
,
guarantor_1
=
const_str
,
guarantor_2
=
const_str
,
document_name
=
const_str
,
application_id
=
application_id
,
main_applicant
=
''
,
co_applicant
=
''
,
guarantor_1
=
''
,
guarantor_2
=
''
,
document_name
=
application_id
,
document_scheme
=
document_scheme
,
business_type
=
business_type
,
data_source
=
data_source
,
...
...
@@ -296,12 +296,12 @@ class DocView(GenericView, DocHandler):
doc
=
doc_class
.
objects
.
create
(
record_id
=
record
.
id
,
metadata_version_id
=
metadata_version_id
,
application_id
=
const_str
,
main_applicant
=
const_str
,
co_applicant
=
const_str
,
guarantor_1
=
const_str
,
guarantor_2
=
const_str
,
document_name
=
const_str
,
application_id
=
application_id
,
main_applicant
=
''
,
co_applicant
=
''
,
guarantor_1
=
''
,
guarantor_2
=
''
,
document_name
=
application_id
,
document_scheme
=
document_scheme
,
data_source
=
data_source
,
upload_finish_time
=
upload_finish_time
,
...
...
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