33c7ea9a by 周伟奇

fix dda report

1 parent 50b74a85
...@@ -755,7 +755,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -755,7 +755,7 @@ class Command(BaseCommand, LoggerMixin):
755 # 'idcard': True or False, 755 # 'idcard': True or False,
756 # 'bs': None or normal or mobile, 756 # 'bs': None or normal or mobile,
757 # } 757 # }
758 report_list = [None, False, None, False] 758 report_list = [None, False, None, None]
759 do_dda = is_hil and doc.document_scheme == consts.DOC_SCHEME_LIST[1] 759 do_dda = is_hil and doc.document_scheme == consts.DOC_SCHEME_LIST[1]
760 except Exception as e: 760 except Exception as e:
761 self.online_log.error('{0} [process error (db filter)] [task={1}] [error={2}]'.format( 761 self.online_log.error('{0} [process error (db filter)] [task={1}] [error={2}]'.format(
...@@ -1023,6 +1023,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1023,6 +1023,7 @@ class Command(BaseCommand, LoggerMixin):
1023 if dda_record is None: 1023 if dda_record is None:
1024 dda_record = DDARecords(application_id=doc.application_id) 1024 dda_record = DDARecords(application_id=doc.application_id)
1025 except Exception as e: 1025 except Exception as e:
1026 report_list[3] = False
1026 self.online_log.error('{0} [process error (dda db get)] [task={1}] ' 1027 self.online_log.error('{0} [process error (dda db get)] [task={1}] '
1027 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc())) 1028 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
1028 else: 1029 else:
...@@ -1102,6 +1103,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1102,6 +1103,7 @@ class Command(BaseCommand, LoggerMixin):
1102 move_img_path_dict.setdefault( 1103 move_img_path_dict.setdefault(
1103 consts.IC_FIELD, set()).add(id_record.file_path) 1104 consts.IC_FIELD, set()).add(id_record.file_path)
1104 except Exception as e: 1105 except Exception as e:
1106 report_list[3] = False
1105 self.online_log.error( 1107 self.online_log.error(
1106 '{0} [process error (dda id process)] [task={1}] ' 1108 '{0} [process error (dda id process)] [task={1}] '
1107 '[error={2}]'.format(self.log_base, task_str, 1109 '[error={2}]'.format(self.log_base, task_str,
...@@ -1130,6 +1132,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1130,6 +1132,7 @@ class Command(BaseCommand, LoggerMixin):
1130 move_img_path_dict.setdefault( 1132 move_img_path_dict.setdefault(
1131 consts.BC_FIELD, set()).add(bc_record.file_path) 1133 consts.BC_FIELD, set()).add(bc_record.file_path)
1132 except Exception as e: 1134 except Exception as e:
1135 report_list[3] = False
1133 self.online_log.error( 1136 self.online_log.error(
1134 '{0} [process error (dda bc process)] [task={1}] ' 1137 '{0} [process error (dda bc process)] [task={1}] '
1135 '[error={2}]'.format(self.log_base, task_str, 1138 '[error={2}]'.format(self.log_base, task_str,
...@@ -1171,6 +1174,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1171,6 +1174,7 @@ class Command(BaseCommand, LoggerMixin):
1171 '{0} [dda process] [img path empty] [task={1}] ' 1174 '{0} [dda process] [img path empty] [task={1}] '
1172 '[path={2}]'.format(self.log_base, task_str, path)) 1175 '[path={2}]'.format(self.log_base, task_str, path))
1173 except Exception as e: 1176 except Exception as e:
1177 report_list[3] = False
1174 self.online_log.error( 1178 self.online_log.error(
1175 '{0} [process error (dda img move)] [task={1}] ' 1179 '{0} [process error (dda img move)] [task={1}] '
1176 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc())) 1180 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
...@@ -1202,16 +1206,19 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1202,16 +1206,19 @@ class Command(BaseCommand, LoggerMixin):
1202 is_id=False, 1206 is_id=False,
1203 file_path=bc_img_path) 1207 file_path=bc_img_path)
1204 except Exception as e: 1208 except Exception as e:
1209 report_list[3] = False
1205 self.online_log.error( 1210 self.online_log.error(
1206 '{0} [process error (dda id&bc db save)] [task={1}] ' 1211 '{0} [process error (dda id&bc db save)] [task={1}] '
1207 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc())) 1212 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
1208 1213
1209 except Exception as e: 1214 except Exception as e:
1215 report_list[3] = False
1210 self.online_log.error( 1216 self.online_log.error(
1211 '{0} [process error (dda process)] [task={1}] ' 1217 '{0} [process error (dda process)] [task={1}] '
1212 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc())) 1218 '[error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
1213 else: 1219 else:
1214 report_list[3] = True 1220 if report_list[3] is None:
1221 report_list[3] = True
1215 1222
1216 finally: 1223 finally:
1217 # report_dict = { 1224 # report_dict = {
...@@ -1282,7 +1289,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1282,7 +1289,7 @@ class Command(BaseCommand, LoggerMixin):
1282 self.log_base, traceback.format_exc())) 1289 self.log_base, traceback.format_exc()))
1283 1290
1284 try: 1291 try:
1285 if report_list[3]: 1292 if report_list[3] is not None:
1286 report_table.objects.create( 1293 report_table.objects.create(
1287 case_number=doc.application_id, 1294 case_number=doc.application_id,
1288 request_team=RequestTeam.get_value(doc.document_scheme, 0), 1295 request_team=RequestTeam.get_value(doc.document_scheme, 0),
...@@ -1290,6 +1297,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -1290,6 +1297,7 @@ class Command(BaseCommand, LoggerMixin):
1290 input_file=doc.document_name, 1297 input_file=doc.document_name,
1291 transaction_start=doc.start_time, 1298 transaction_start=doc.start_time,
1292 transaction_end=end_time, 1299 transaction_end=end_time,
1300 successful_at_this_level=report_list[3],
1293 process_name=ProcessName.DDA.value, 1301 process_name=ProcessName.DDA.value,
1294 ) 1302 )
1295 except Exception as e: 1303 except Exception as e:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!