fix bug
Showing
1 changed file
with
12 additions
and
10 deletions
| ... | @@ -89,6 +89,16 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -89,6 +89,16 @@ class Command(BaseCommand, LoggerMixin): |
| 89 | img_name, _ = os.path.splitext(os.path.basename(img_path)) | 89 | img_name, _ = os.path.splitext(os.path.basename(img_path)) |
| 90 | for i, sheet in enumerate(sheets): | 90 | for i, sheet in enumerate(sheets): |
| 91 | sheet_name = '{0}_{1}'.format(img_name, i) | 91 | sheet_name = '{0}_{1}'.format(img_name, i) |
| 92 | ws = wb.create_sheet(sheet_name) | ||
| 93 | cells = sheet.get('cells') | ||
| 94 | if not cells: | ||
| 95 | continue | ||
| 96 | for cell in cells: | ||
| 97 | c1 = cell.get('start_column') | ||
| 98 | r1 = cell.get('start_row') | ||
| 99 | words = cell.get('words') | ||
| 100 | ws.cell(row=r1 + 1, column=c1 + 1, value=words) | ||
| 101 | |||
| 92 | # ['户名', '卡号', '页码', '回单验证码', '打印时间', '起始时间', '终止时间'] | 102 | # ['户名', '卡号', '页码', '回单验证码', '打印时间', '起始时间', '终止时间'] |
| 93 | summary = sheet.get('summary') | 103 | summary = sheet.get('summary') |
| 94 | card = summary[1] | 104 | card = summary[1] |
| ... | @@ -136,14 +146,6 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -136,14 +146,6 @@ class Command(BaseCommand, LoggerMixin): |
| 136 | if summary[6] is not None: | 146 | if summary[6] is not None: |
| 137 | ed_list.append(summary[6]) | 147 | ed_list.append(summary[6]) |
| 138 | 148 | ||
| 139 | ws = wb.create_sheet(sheet_name) | ||
| 140 | cells = sheet.get('cells') | ||
| 141 | for cell in cells: | ||
| 142 | c1 = cell.get('start_column') | ||
| 143 | r1 = cell.get('start_row') | ||
| 144 | words = cell.get('words') | ||
| 145 | ws.cell(row=r1+1, column=c1+1, value=words) | ||
| 146 | |||
| 147 | @staticmethod | 149 | @staticmethod |
| 148 | def license1_process(ocr_data, license_summary, classify): | 150 | def license1_process(ocr_data, license_summary, classify): |
| 149 | license_data = ocr_data.get('data', []) | 151 | license_data = ocr_data.get('data', []) |
| ... | @@ -422,12 +424,12 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -422,12 +424,12 @@ class Command(BaseCommand, LoggerMixin): |
| 422 | return merged_bs_summary | 424 | return merged_bs_summary |
| 423 | 425 | ||
| 424 | # TODO 细化文件状态,不同异常状态,归还队列,重试时采取不同的处理 | 426 | # TODO 细化文件状态,不同异常状态,归还队列,重试时采取不同的处理 |
| 425 | # TODO 协程异步发送OCR请求 | ||
| 426 | # TODO 调用接口重试 | ||
| 427 | # TODO 异常邮件通知 | 427 | # TODO 异常邮件通知 |
| 428 | # 识别失败:普通异常,如PDF异常、构建过程异常 | 428 | # 识别失败:普通异常,如PDF异常、构建过程异常 |
| 429 | # EDMS异常:下载异常-->回队列-->邮件;上传异常-->重新上传队列-->邮件 | 429 | # EDMS异常:下载异常-->回队列-->邮件;上传异常-->重新上传队列-->邮件 |
| 430 | # 算法异常:第一道异常-->识别失败-->邮件;第二道异常-->识别失败-->邮件 | 430 | # 算法异常:第一道异常-->识别失败-->邮件;第二道异常-->识别失败-->邮件 |
| 431 | # TODO 协程异步发送OCR请求 | ||
| 432 | # TODO 调用接口重试 | ||
| 431 | # TODO 数据库断联问题 | 433 | # TODO 数据库断联问题 |
| 432 | def handle(self, *args, **kwargs): | 434 | def handle(self, *args, **kwargs): |
| 433 | sleep_second = int(conf.SLEEP_SECOND) | 435 | sleep_second = int(conf.SLEEP_SECOND) | ... | ... |
-
Please register or sign in to post a comment