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
0e55233e
authored
2022-06-09 11:21:22 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix idcard daily
1 parent
dcc1396d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
src/apps/doc/management/commands/idcard_daily.py
src/apps/doc/management/commands/idcard_daily.py
View file @
0e55233
...
...
@@ -2,7 +2,7 @@ import re
import
os
import
ast
import
datetime
from
openpyxl
import
Workbook
from
openpyxl
import
Workbook
,
load_workbook
from
django.core.management
import
BaseCommand
from
settings
import
conf
from
common.mixins
import
LoggerMixin
...
...
@@ -48,15 +48,26 @@ class Command(BaseCommand, LoggerMixin):
print
(
'log_path not exists'
)
return
wb_afc
=
Workbook
()
ws_afc
=
wb_afc
.
create_sheet
(
self
.
sheet_name
)
ws_afc
.
append
(
self
.
header
)
wb_afc
.
remove
(
wb_afc
.
get_sheet_by_name
(
'Sheet'
))
afc_excel_path
=
os
.
path
.
join
(
afc_excel_dir
,
'idcard_{0}.xlsx'
.
format
(
date_str
))
hil_excel_path
=
os
.
path
.
join
(
hil_excel_dir
,
'idcard_{0}.xlsx'
.
format
(
date_str
))
wb_hil
=
Workbook
()
ws_hil
=
wb_hil
.
create_sheet
(
self
.
sheet_name
)
ws_hil
.
append
(
self
.
header
)
wb_hil
.
remove
(
wb_hil
.
get_sheet_by_name
(
'Sheet'
))
if
os
.
path
.
isfile
(
afc_excel_path
):
wb_afc
=
load_workbook
(
afc_excel_path
)
ws_afc
=
wb_afc
.
get_sheet_by_name
(
self
.
sheet_name
)
else
:
wb_afc
=
Workbook
()
ws_afc
=
wb_afc
.
create_sheet
(
self
.
sheet_name
)
ws_afc
.
append
(
self
.
header
)
wb_afc
.
remove
(
wb_afc
.
get_sheet_by_name
(
'Sheet'
))
if
os
.
path
.
isfile
(
hil_excel_path
):
wb_hil
=
load_workbook
(
hil_excel_path
)
ws_hil
=
wb_hil
.
get_sheet_by_name
(
self
.
sheet_name
)
else
:
wb_hil
=
Workbook
()
ws_hil
=
wb_hil
.
create_sheet
(
self
.
sheet_name
)
ws_hil
.
append
(
self
.
header
)
wb_hil
.
remove
(
wb_hil
.
get_sheet_by_name
(
'Sheet'
))
with
open
(
log_path
,
'r'
,
encoding
=
'utf-8'
)
as
fp
:
for
line
in
fp
:
...
...
@@ -87,7 +98,5 @@ class Command(BaseCommand, LoggerMixin):
for
id_num
,
nation
in
content_list
:
ws_afc
.
append
((
application_id
[
0
],
id_num
,
nation
,
time_str
))
afc_excel_path
=
os
.
path
.
join
(
afc_excel_dir
,
'idcard_{0}.xlsx'
.
format
(
date_str
))
hil_excel_path
=
os
.
path
.
join
(
hil_excel_dir
,
'idcard_{0}.xlsx'
.
format
(
date_str
))
wb_afc
.
save
(
afc_excel_path
)
wb_hil
.
save
(
hil_excel_path
)
...
...
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