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
5e463cbd
authored
2021-01-19 17:36:54 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bs and license script
1 parent
7fc3f80e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
src/apps/doc/management/commands/bs_statistics.py
src/apps/doc/management/commands/license_statistics.py
src/apps/doc/management/commands/bs_statistics.py
View file @
5e463cb
...
...
@@ -40,7 +40,8 @@ class Command(BaseCommand, LoggerMixin):
print
(
'excel dir not exists'
)
return
excel_path
=
os
.
path
.
join
(
excel_dir
,
'bs_{0}.xlsx'
.
format
(
date_str
))
log_path
=
os
.
path
.
join
(
conf
.
LOG_DIR
,
'bs.log.{0}'
.
format
(
date_str
))
# log_path = os.path.join(conf.LOG_DIR, 'bs.log.{0}'.format(date_str))
log_path
=
os
.
path
.
join
(
conf
.
LOG_DIR
,
'bs_statistics.log.{0}'
.
format
(
date_str
))
if
not
os
.
path
.
exists
(
log_path
):
print
(
'log_path not exists'
)
return
...
...
@@ -48,7 +49,8 @@ class Command(BaseCommand, LoggerMixin):
summary_dict
=
{}
with
open
(
log_path
,
'r'
,
encoding
=
'utf-8'
)
as
fp
:
for
line
in
fp
:
search_obj
=
re
.
search
(
r'task=(.*) merged_bs_summary=(.*)'
,
line
)
# search_obj = re.search(r'task=(.*) merged_bs_summary=(.*)', line)
search_obj
=
re
.
search
(
r'\[task=(.*)] \[bs_summary=(.*)]'
,
line
)
task_str
=
search_obj
.
group
(
1
)
business_type
,
doc_id_str
=
task_str
.
split
(
consts
.
SPLIT_STR
)
doc_id
=
int
(
doc_id_str
)
...
...
src/apps/doc/management/commands/license_statistics.py
View file @
5e463cb
...
...
@@ -14,7 +14,6 @@ class Command(BaseCommand, LoggerMixin):
def
__init__
(
self
):
super
()
.
__init__
()
self
.
log_base
=
'[license statistics]'
self
.
header_map
=
{
consts
.
MVI_CLASSIFY
:
[(
'申请ID'
,
'发票代码'
,
'发票号码'
,
'开票日期'
,
'不含税价'
,
'发票联'
,
'购买方名称'
,
'购买方证件号码'
,
'纳税人识别号'
,
'车架号'
,
'价税合计小写'
,
'销货单位名称'
,
'增值税税额'
,
...
...
@@ -75,7 +74,8 @@ class Command(BaseCommand, LoggerMixin):
print
(
'excel dir not exists'
)
return
excel_path
=
os
.
path
.
join
(
excel_dir
,
'license_{0}.xlsx'
.
format
(
date_str
))
log_path
=
os
.
path
.
join
(
conf
.
LOG_DIR
,
'license.log.{0}'
.
format
(
date_str
))
# log_path = os.path.join(conf.LOG_DIR, 'license.log.{0}'.format(date_str))
log_path
=
os
.
path
.
join
(
conf
.
LOG_DIR
,
'license_statistics.log.{0}'
.
format
(
date_str
))
if
not
os
.
path
.
exists
(
log_path
):
print
(
'log_path not exists'
)
return
...
...
@@ -92,7 +92,8 @@ class Command(BaseCommand, LoggerMixin):
with
open
(
log_path
,
'r'
,
encoding
=
'utf-8'
)
as
fp
:
for
line
in
fp
:
search_obj
=
re
.
search
(
r'task=(.*) license_summary=(.*)'
,
line
)
# search_obj = re.search(r'task=(.*) license_summary=(.*)', line)
search_obj
=
re
.
search
(
r'\[task=(.*)] \[license_summary=(.*)]'
,
line
)
task_str
=
search_obj
.
group
(
1
)
license_summary
=
ast
.
literal_eval
(
search_obj
.
group
(
2
))
business_type
,
doc_id_str
=
task_str
.
split
(
consts
.
SPLIT_STR
)
...
...
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