5e463cbd by 周伟奇

fix bs and license script

1 parent 7fc3f80e
...@@ -40,7 +40,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -40,7 +40,8 @@ class Command(BaseCommand, LoggerMixin):
40 print('excel dir not exists') 40 print('excel dir not exists')
41 return 41 return
42 excel_path = os.path.join(excel_dir, 'bs_{0}.xlsx'.format(date_str)) 42 excel_path = os.path.join(excel_dir, 'bs_{0}.xlsx'.format(date_str))
43 log_path = os.path.join(conf.LOG_DIR, 'bs.log.{0}'.format(date_str)) 43 # log_path = os.path.join(conf.LOG_DIR, 'bs.log.{0}'.format(date_str))
44 log_path = os.path.join(conf.LOG_DIR, 'bs_statistics.log.{0}'.format(date_str))
44 if not os.path.exists(log_path): 45 if not os.path.exists(log_path):
45 print('log_path not exists') 46 print('log_path not exists')
46 return 47 return
...@@ -48,7 +49,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -48,7 +49,8 @@ class Command(BaseCommand, LoggerMixin):
48 summary_dict = {} 49 summary_dict = {}
49 with open(log_path, 'r', encoding='utf-8') as fp: 50 with open(log_path, 'r', encoding='utf-8') as fp:
50 for line in fp: 51 for line in fp:
51 search_obj = re.search(r'task=(.*) merged_bs_summary=(.*)', line) 52 # search_obj = re.search(r'task=(.*) merged_bs_summary=(.*)', line)
53 search_obj = re.search(r'\[task=(.*)] \[bs_summary=(.*)]', line)
52 task_str = search_obj.group(1) 54 task_str = search_obj.group(1)
53 business_type, doc_id_str = task_str.split(consts.SPLIT_STR) 55 business_type, doc_id_str = task_str.split(consts.SPLIT_STR)
54 doc_id = int(doc_id_str) 56 doc_id = int(doc_id_str)
......
...@@ -14,7 +14,6 @@ class Command(BaseCommand, LoggerMixin): ...@@ -14,7 +14,6 @@ class Command(BaseCommand, LoggerMixin):
14 14
15 def __init__(self): 15 def __init__(self):
16 super().__init__() 16 super().__init__()
17 self.log_base = '[license statistics]'
18 self.header_map = { 17 self.header_map = {
19 consts.MVI_CLASSIFY: [('申请ID', '发票代码', '发票号码', '开票日期', '不含税价', '发票联', '购买方名称', 18 consts.MVI_CLASSIFY: [('申请ID', '发票代码', '发票号码', '开票日期', '不含税价', '发票联', '购买方名称',
20 '购买方证件号码', '纳税人识别号', '车架号', '价税合计小写', '销货单位名称', '增值税税额', 19 '购买方证件号码', '纳税人识别号', '车架号', '价税合计小写', '销货单位名称', '增值税税额',
...@@ -75,7 +74,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -75,7 +74,8 @@ class Command(BaseCommand, LoggerMixin):
75 print('excel dir not exists') 74 print('excel dir not exists')
76 return 75 return
77 excel_path = os.path.join(excel_dir, 'license_{0}.xlsx'.format(date_str)) 76 excel_path = os.path.join(excel_dir, 'license_{0}.xlsx'.format(date_str))
78 log_path = os.path.join(conf.LOG_DIR, 'license.log.{0}'.format(date_str)) 77 # log_path = os.path.join(conf.LOG_DIR, 'license.log.{0}'.format(date_str))
78 log_path = os.path.join(conf.LOG_DIR, 'license_statistics.log.{0}'.format(date_str))
79 if not os.path.exists(log_path): 79 if not os.path.exists(log_path):
80 print('log_path not exists') 80 print('log_path not exists')
81 return 81 return
...@@ -92,7 +92,8 @@ class Command(BaseCommand, LoggerMixin): ...@@ -92,7 +92,8 @@ class Command(BaseCommand, LoggerMixin):
92 92
93 with open(log_path, 'r', encoding='utf-8') as fp: 93 with open(log_path, 'r', encoding='utf-8') as fp:
94 for line in fp: 94 for line in fp:
95 search_obj = re.search(r'task=(.*) license_summary=(.*)', line) 95 # search_obj = re.search(r'task=(.*) license_summary=(.*)', line)
96 search_obj = re.search(r'\[task=(.*)] \[license_summary=(.*)]', line)
96 task_str = search_obj.group(1) 97 task_str = search_obj.group(1)
97 license_summary = ast.literal_eval(search_obj.group(2)) 98 license_summary = ast.literal_eval(search_obj.group(2))
98 business_type, doc_id_str = task_str.split(consts.SPLIT_STR) 99 business_type, doc_id_str = task_str.split(consts.SPLIT_STR)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!