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
17c207a9
authored
2021-05-17 23:44:38 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
merge fix
2 parents
d19ca8f1
c270100a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
6 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/models.py
src/apps/doc/ocr/wb.py
src/common/tools/mssql_script4.py
src/apps/doc/consts.py
View file @
17c207a
...
...
@@ -520,7 +520,7 @@ OTHER_TUPLE = (None, None, None, None, None, None, None, None, None, None, None,
# "35":"针式打印-部分格线-竖版-邮储银行",
# "36":"针式打印-部分格线-竖版-邮储银行-绿卡",
# "
38
":"普通打印-无格线-农业银行-整数-特殊",
# "
50
":"普通打印-无格线-农业银行-整数-特殊",
CLASSIFY_LIST
=
[
(
'其他'
,
OTHER_TUPLE
),
...
...
@@ -563,6 +563,18 @@ CLASSIFY_LIST = [
(
'针式打印-部分格线-竖版-邮储银行'
,
(
2
,
None
,
5
,
6
,
None
,
4
,
None
,
7
,
None
,
None
,
None
,
None
,
None
)),
(
'针式打印-部分格线-竖版-邮储银行-绿卡'
,
(
2
,
None
,
5
,
6
,
None
,
4
,
None
,
7
,
None
,
None
,
None
,
None
,
None
)),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'其他'
,
OTHER_TUPLE
),
(
'普通打印-无格线-农业银行-整数-特殊'
,
(
1
,
None
,
3
,
4
,
None
,
2
,
None
,
5
,
None
,
None
,
None
,
None
,
None
)),
]
...
...
@@ -608,6 +620,18 @@ CLASSIFY_HEADER_LIST = [
(
'序号'
,
'交易日期'
,
'交易渠道'
,
'摘要'
,
'交易金额'
,
'账户余额'
,
'对方账号/卡号/汇票号'
,
'原子账号'
,
'交易机构名称'
),
(
'序号'
,
'交易日期'
,
'交易渠道'
,
'摘要'
,
'交易金额'
,
'账户余额'
,
'对方账号/卡号/汇票号'
,
'原子账号'
,
'交易机构名称'
),
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
OTHER_TUPLE
,
(
'交易日期'
,
'摘要/附言'
,
'交易金额'
,
'账户余额'
,
'对方账号和户名'
),
]
...
...
@@ -812,7 +836,7 @@ MVI_FIELD_ORDER = (('发票代码', '发票代码'),
(
'主管税务机关及代码'
,
'主管税务机关及代码'
),
(
'吨位'
,
'吨位'
),
(
'限乘人数'
,
'限乘人数'
),)
IC_PID
=
VAT_PID
=
VATS_PID
=
MVC_PID
=
MVI_PID
=
None
IC_PID
=
VAT_PID
=
VATS_PID
=
MVC_PID
=
MVI_PID
=
RP_PID
=
None
# 营业执照
BL_CN_NAME
=
'营业执照'
...
...
@@ -916,6 +940,10 @@ BC_FIELD_ORDER = (('BankName', '发卡行名称'),
(
'CardType'
,
'银行卡类型'
),
(
'Name'
,
'持卡人姓名'
),)
# DDA
DDA_CN_NAME
=
'DDA'
DDA_CLASSIFY
=
38
SUCCESS_CODE_SET
=
{
'0'
,
0
}
FIELD_ORDER_MAP
=
{
...
...
@@ -941,7 +969,7 @@ MODEL_FIELD_VAT = 'vat_count'
LICENSE_ORDER
=
((
MVI_CLASSIFY
,
(
MVI_PID
,
MVI_CN_NAME
,
MVI_FIELD_ORDER
,
False
,
False
,
MODEL_FIELD_MVI
)),
(
IC_CLASSIFY
,
(
IC_PID
,
IC_CN_NAME
,
None
,
True
,
False
,
MODEL_FIELD_IC
)),
(
RP_CLASSIFY
,
(
None
,
RP_CN_NAME
,
None
,
True
,
False
,
MODEL_FIELD_RP
)),
(
RP_CLASSIFY
,
(
RP_PID
,
RP_CN_NAME
,
None
,
True
,
False
,
MODEL_FIELD_RP
)),
(
BC_CLASSIFY
,
(
BC_PID
,
BC_CN_NAME
,
BC_FIELD_ORDER
,
False
,
False
,
MODEL_FIELD_BC
)),
(
BL_CLASSIFY
,
(
BL_PID
,
BL_CN_NAME
,
BL_FIELD_ORDER
,
False
,
False
,
MODEL_FIELD_BL
)),
(
UCI_CLASSIFY
,
(
UCI_PID
,
UCI_CN_NAME
,
UCI_FIELD_ORDER
,
False
,
False
,
MODEL_FIELD_UCI
)),
...
...
@@ -960,12 +988,12 @@ FOLDER_LICENSE_ORDER = ((MVI_CLASSIFY, (MVI_PID, MVI_CN_NAME, MVI_FIELD_ORDER, F
LICENSE_CLASSIFY_MAPPING
=
dict
(
LICENSE_ORDER
)
OTHER_CLASSIFY_SET
=
{
OTHER_CLASSIFY
}
LICENSE_CLASSIFY_SET_1
=
{
IC_CLASSIFY
,
VAT_CLASSIFY
,
MVC_CLASSIFY
,
MVI_CLASSIFY
,
UCI_CLASSIFY
}
LICENSE_CLASSIFY_SET_1
=
{
IC_CLASSIFY
,
VAT_CLASSIFY
,
MVC_CLASSIFY
,
MVI_CLASSIFY
,
UCI_CLASSIFY
,
DDA_CLASSIFY
}
LICENSE_CLASSIFY_SET_2
=
{
BL_CLASSIFY
,
EEP_CLASSIFY
,
DL_CLASSIFY
,
PP_CLASSIFY
,
BC_CLASSIFY
}
NYYH_CLASSIFY
=
{
17
,
18
}
NYZS_CLASSIFY
=
18
SPECIAL_NYZS_CLASSIFY
=
38
SPECIAL_NYZS_CLASSIFY
=
50
MS_CLASSIFY
=
21
MS_ERROR_COL
=
(
5
,
6
)
WECHART_CLASSIFY
=
12
...
...
@@ -1168,5 +1196,25 @@ CO_ORDER = ('customerType', 'customerChineseName', 'legalRepName', 'idNum', 'bus
PREFIX_MVC
=
'GB'
PREFIX_DL
=
'DL'
# --------------- DDA 保存图片 --------------------
DDA_FIELD
=
'DDA'
IC_FIELD
=
'ID'
BC_FIELD
=
'BC'
IC_KEY_FIELD
=
(
'姓名'
,
'公民身份号码'
)
BC_KEY_FIELD
=
'CardNum'
DDA_IC_NAME
=
'customer_name'
DDA_IC_ID
=
'customer_id'
DDA_BC_NAME
=
'account_name'
DDA_BC_ID
=
'account_id'
DDA_IMG_PATH
=
'img_path'
DDA_PRO
=
'pro'
DDA_MAPPING
=
[
(
DDA_IC_NAME
,
IC_FIELD
),
(
DDA_IC_ID
,
IC_FIELD
),
(
DDA_BC_ID
,
BC_FIELD
),
]
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
17c207a
This diff is collapsed.
Click to expand it.
src/apps/doc/models.py
View file @
17c207a
...
...
@@ -387,3 +387,51 @@ class AFCCompareOfflineReport(models.Model):
situ_db_label
=
'afc'
# DDA ID & BC ----> HIL SE 专有
class
DDARecords
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
,
verbose_name
=
"id"
)
# 主键
application_id
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"申请id"
)
# 索引
is_dda_found
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"DDA是否找到"
)
is_id_found
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"身份证是否找到"
)
is_bc_found
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"银行卡是否找到"
)
all_found
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"是否全找到"
)
dda_path
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"DDA图片路径"
)
id_path
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"身份证图片路径"
)
bc_path
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"银行卡图片路径"
)
customer_name
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"DDA身份证姓名"
)
customer_id
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"DDA身份证号码"
)
account_id
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"DDA银行卡号"
)
dda_found_time
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
'DDA时间'
)
id_found_time
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
'身份证时间'
)
bc_found_time
=
models
.
DateTimeField
(
null
=
True
,
verbose_name
=
'银行卡时间'
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
# 索引
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
# 索引
class
Meta
:
managed
=
False
db_table
=
'dda_records'
class
IDBCRecords
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
,
verbose_name
=
"id"
)
# 主键
application_id
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"申请id"
)
# 索引
target_name
=
models
.
CharField
(
null
=
True
,
max_length
=
1024
,
verbose_name
=
"DDA身份证姓名"
)
# 与申请号联合索引
target_id
=
models
.
CharField
(
max_length
=
1024
,
verbose_name
=
"DDA身份证号码or银行卡号"
)
# 与申请号联合索引
is_id
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
"身份证or银行卡"
)
file_path
=
models
.
CharField
(
max_length
=
1024
,
verbose_name
=
"图片路径"
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
class
Meta
:
managed
=
False
db_table
=
'idbc_records'
...
...
src/apps/doc/ocr/wb.py
View file @
17c207a
...
...
@@ -708,7 +708,7 @@ class BSWorkbook(Workbook):
self
.
remove
(
self
.
get_sheet_by_name
(
'Sheet'
))
def
rebuild
(
self
,
bs_summary
,
license_summary
,
res_list
,
document_scheme
):
count_list
=
[(
consts
.
MODEL_FIELD_BS
,
len
(
self
.
sheetnames
)
-
1
)]
count_list
=
[(
consts
.
MODEL_FIELD_BS
,
len
(
bs_summary
)
)]
if
document_scheme
==
consts
.
DOC_SCHEME_LIST
[
1
]:
self
.
license_rebuild
(
license_summary
,
document_scheme
,
count_list
)
self
.
bs_rebuild
(
bs_summary
)
...
...
src/common/tools/mssql_script4.py
0 → 100644
View file @
17c207a
import
pyodbc
hil_sql
=
"""
create table dda_records
(
id bigint identity
primary key,
application_id nvarchar(64) not null,
is_dda_found bit default 0 not null,
is_id_found bit default 0 not null,
is_bc_found bit default 0 not null,
all_found bit default 0 not null,
dda_path nvarchar(1024),
id_path nvarchar(1024),
bc_path nvarchar(1024),
customer_name nvarchar(1024),
customer_id nvarchar(1024),
account_id nvarchar(1024),
dda_found_time datetime,
id_found_time datetime,
bc_found_time datetime,
update_time datetime not null,
create_time datetime not null,
);
create index dda_records_application_id_index
on dda_records (application_id);
create index dda_records_update_time_index
on dda_records (update_time);
create index dda_records_create_time_index
on dda_records (create_time);
create table idbc_records
(
id bigint identity
primary key,
application_id nvarchar(64) not null,
target_name nvarchar(1024),
target_id nvarchar(1024) not null,
is_id bit default 1 not null,
file_path nvarchar(1024) not null,
create_time datetime not null,
);
create index idbc_records_application_id_index
on idbc_records (application_id);
create index idbc_records_application_id_target_name_index
on idbc_records (application_id, target_name);
create index idbc_records_application_id_target_id_index
on idbc_records (application_id, target_id);
"""
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()
\ No newline at end of file
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