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
5e556253
authored
2024-03-11 10:41:42 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:数据库加字段
1 parent
30dab433
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/models.py
src/apps/doc/views.py
src/common/tools/mssql_script27.py
src/apps/doc/management/commands/ocr_process.py
View file @
5e55625
...
...
@@ -1493,7 +1493,7 @@ class Command(BaseCommand, LoggerMixin):
# AFC合同
if
classify_1_str
==
str
(
consts
.
CONTRACT_CLASSIFY
):
is_fsm
=
doc
.
data_source
==
consts
.
DATA_SOURCE_LIST
[
3
]
is_fsm
=
doc
.
is_ovp_fsm
==
1
ocr_result
=
afc_predict
(
pdf_handler
.
pdf_info
,
is_fsm
=
is_fsm
)
page_res
=
{}
for
page_num
,
page_info
in
ocr_result
.
get
(
'page_info'
,
{})
.
items
():
...
...
@@ -1517,7 +1517,7 @@ class Command(BaseCommand, LoggerMixin):
}
# HIL合同
elif
classify_1_str
in
consts
.
HIL_CONTRACT_TYPE_MAP
:
is_fsm
=
doc
.
data_source
==
consts
.
DATA_SOURCE_LIST
[
3
]
is_fsm
=
doc
.
is_ovp_fsm
==
1
file_type_1
=
consts
.
HIL_CONTRACT_TYPE_MAP
.
get
(
classify_1_str
)
ocr_result_1
=
hil_predict
(
pdf_handler
.
pdf_info
,
file_type_1
,
is_fsm
=
is_fsm
)
rebuild_res_1
=
{}
...
...
src/apps/doc/models.py
View file @
5e55625
...
...
@@ -66,6 +66,7 @@ class HILDoc(models.Model):
metadata
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"电子PDF专属,PDF信息"
)
password
=
models
.
CharField
(
null
=
True
,
max_length
=
64
,
verbose_name
=
"文件密码"
)
is_ovp_fsm
=
models
.
SmallIntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"是否ovp 且 fsm 1:是"
)
class
Meta
:
managed
=
False
db_table
=
'hil_doc'
...
...
@@ -109,6 +110,7 @@ class AFCDoc(models.Model):
metadata
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"电子PDF专属,PDF信息"
)
password
=
models
.
CharField
(
null
=
True
,
max_length
=
64
,
verbose_name
=
"文件密码"
)
is_ovp_fsm
=
models
.
SmallIntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"是否ovp 且 fsm 1:是"
)
class
Meta
:
managed
=
False
situ_db_label
=
'afc'
...
...
src/apps/doc/views.py
View file @
5e55625
...
...
@@ -641,6 +641,7 @@ class UploadDocView(GenericView, DocHandler):
document_name
=
document_name
,
document_scheme
=
document_scheme
,
data_source
=
data_source
,
is_ovp_fsm
=
1
if
fsm
else
0
upload_finish_time
=
document
.
get
(
'uploadFinishTime'
),
password
=
pwd
if
isinstance
(
pwd
,
str
)
and
len
(
pwd
)
>
0
else
None
,
)
...
...
@@ -652,10 +653,7 @@ class UploadDocView(GenericView, DocHandler):
classify_1
=
0
# 电子合同 Econtract or OVP(FSM)
if
data_source
==
consts
.
DATA_SOURCE_LIST
[
2
]
or
data_source
==
consts
.
DATA_SOURCE_LIST
[
3
]:
# 如果是OVP来源的非FSM classify_1还是等于0,走纸质模型
if
data_source
==
consts
.
DATA_SOURCE_LIST
[
3
]
and
not
fsm
:
classify_1
=
0
elif
document_scheme
==
consts
.
DOC_SCHEME_LIST
[
1
]:
if
document_scheme
==
consts
.
DOC_SCHEME_LIST
[
1
]:
for
keyword
,
classify_1_tmp
in
consts
.
ECONTRACT_KEYWORDS_MAP
.
get
(
prefix
):
if
keyword
in
document_name
:
classify_1
=
classify_1_tmp
...
...
src/common/tools/mssql_script27.py
0 → 100644
View file @
5e55625
import
pyodbc
hil_sql
=
"""
ALTER TABLE hil_doc ADD is_ovp_fsm tinyint not null default 0;
"""
afc_sql
=
"""
ALTER TABLE afc_doc ADD is_ovp_fsm tinyint not null default 0;
"""
hil_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
hil_cursor
=
hil_cnxn
.
cursor
()
hil_cursor
.
execute
(
hil_sql
)
hil_cursor
.
close
()
hil_cnxn
.
close
()
afc_cnxn
=
pyodbc
.
connect
(
'DRIVER={ODBC Driver 17 for SQL Server};'
,
autocommit
=
True
)
afc_cursor
=
afc_cnxn
.
cursor
()
afc_cursor
.
execute
(
afc_sql
)
afc_cursor
.
close
()
afc_cnxn
.
close
()
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