26691edc by 周伟奇

fix bug

1 parent 71131e04
......@@ -89,6 +89,16 @@ class Command(BaseCommand, LoggerMixin):
img_name, _ = os.path.splitext(os.path.basename(img_path))
for i, sheet in enumerate(sheets):
sheet_name = '{0}_{1}'.format(img_name, i)
ws = wb.create_sheet(sheet_name)
cells = sheet.get('cells')
if not cells:
continue
for cell in cells:
c1 = cell.get('start_column')
r1 = cell.get('start_row')
words = cell.get('words')
ws.cell(row=r1 + 1, column=c1 + 1, value=words)
# ['户名', '卡号', '页码', '回单验证码', '打印时间', '起始时间', '终止时间']
summary = sheet.get('summary')
card = summary[1]
......@@ -136,14 +146,6 @@ class Command(BaseCommand, LoggerMixin):
if summary[6] is not None:
ed_list.append(summary[6])
ws = wb.create_sheet(sheet_name)
cells = sheet.get('cells')
for cell in cells:
c1 = cell.get('start_column')
r1 = cell.get('start_row')
words = cell.get('words')
ws.cell(row=r1+1, column=c1+1, value=words)
@staticmethod
def license1_process(ocr_data, license_summary, classify):
license_data = ocr_data.get('data', [])
......@@ -422,12 +424,12 @@ class Command(BaseCommand, LoggerMixin):
return merged_bs_summary
# TODO 细化文件状态,不同异常状态,归还队列,重试时采取不同的处理
# TODO 协程异步发送OCR请求
# TODO 调用接口重试
# TODO 异常邮件通知
# 识别失败:普通异常,如PDF异常、构建过程异常
# EDMS异常:下载异常-->回队列-->邮件;上传异常-->重新上传队列-->邮件
# 算法异常:第一道异常-->识别失败-->邮件;第二道异常-->识别失败-->邮件
# TODO 协程异步发送OCR请求
# TODO 调用接口重试
# TODO 数据库断联问题
def handle(self, *args, **kwargs):
sleep_second = int(conf.SLEEP_SECOND)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!