f9d91879 by 冯轩

merge

2 parents 06c3f071 d5e82125
...@@ -2158,10 +2158,20 @@ class Command(BaseCommand, LoggerMixin): ...@@ -2158,10 +2158,20 @@ class Command(BaseCommand, LoggerMixin):
2158 # 更新OCR累计识别结果表 2158 # 更新OCR累计识别结果表
2159 if business_type == consts.HIL_PREFIX: 2159 if business_type == consts.HIL_PREFIX:
2160 result_class = HILOCRResult if is_ca else HILSEOCRResult 2160 result_class = HILOCRResult if is_ca else HILSEOCRResult
2161 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict, down_payment_dict) 2161 try:
2162 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2163 except Exception as e:
2164 # 遇到报错重试一次,希望解决两个文件首次入库都插入的问题
2165 self.online_log.error('{0} [process error (ocr result save) retry] [task={1}] [error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
2166 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2162 else: 2167 else:
2163 result_class = AFCOCRResult if is_ca else AFCSEOCRResult 2168 result_class = AFCOCRResult if is_ca else AFCSEOCRResult
2164 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict, down_payment_dict) 2169 try:
2170 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2171 except Exception as e:
2172 # 遇到报错重试一次,希望解决两个文件首次入库都插入的问题
2173 self.online_log.error('{0} [process error (ocr result save) retry] [task={1}] [error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
2174 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2165 2175
2166 except Exception as e: 2176 except Exception as e:
2167 self.online_log.error( 2177 self.online_log.error(
...@@ -2200,10 +2210,20 @@ class Command(BaseCommand, LoggerMixin): ...@@ -2200,10 +2210,20 @@ class Command(BaseCommand, LoggerMixin):
2200 # 更新OCR累计识别结果表 2210 # 更新OCR累计识别结果表
2201 if business_type == consts.HIL_PREFIX: 2211 if business_type == consts.HIL_PREFIX:
2202 result_class = HILOCRResult if is_ca else HILSEOCRResult 2212 result_class = HILOCRResult if is_ca else HILSEOCRResult
2203 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict, down_payment_dict) 2213 try:
2214 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2215 except Exception as e:
2216 # 遇到报错重试一次,希望解决两个文件首次入库都插入的问题
2217 self.online_log.error('{0} [process error (ocr result save) retry] [task={1}] [error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
2218 res_obj = atomicSaveDBHIL(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2204 else: 2219 else:
2205 result_class = AFCOCRResult if is_ca else AFCSEOCRResult 2220 result_class = AFCOCRResult if is_ca else AFCSEOCRResult
2206 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict, down_payment_dict) 2221 try:
2222 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2223 except Exception as e:
2224 # 遇到报错重试一次,希望解决两个文件首次入库都插入的问题
2225 self.online_log.error('{0} [process error (ocr result save) retry] [task={1}] [error={2}]'.format(self.log_base, task_str, traceback.format_exc()))
2226 res_obj = atomicSaveDBAFC(self,result_class,doc,license_summary,ic_merge,rp_merge, task_str, financial_statement_dict, financial_explanation_dict)
2207 except Exception as e: 2227 except Exception as e:
2208 self.online_log.error( 2228 self.online_log.error(
2209 '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format( 2229 '{0} [process error (ocr result save)] [task={1}] [error={2}]'.format(
......
...@@ -3864,31 +3864,6 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ ...@@ -3864,31 +3864,6 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_
3864 '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, 3864 '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id,
3865 is_ca, is_cms)) 3865 is_ca, is_cms))
3866 3866
3867 # 查看此订单号下是否有未完成的文件,如果有,等?分钟
3868 doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc
3869 doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first()
3870 compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result))
3871 compare_log.info('{0} [comparison unfinished file check] [entity={1}] [id={2}] [doc_wait_file_result={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result))
3872 if doc_wait_file_result is not None:
3873 # 实时查询延迟时间
3874 try:
3875 delay_time_config = Configs.objects.filter(id=4).first()
3876 if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit():
3877 delay_time = delay_time_config.value
3878 else:
3879 delay_time = 0
3880 except Exception as e:
3881 delay_time = 0
3882 compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc()))
3883 compare_log.info('delay_time:{0}'.format(delay_time))
3884 compare_log.info('{0} [comparison unfinished file wait delay_time start] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id))
3885 try:
3886 time.sleep(int(delay_time))
3887 except Exception as e:
3888 compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc()))
3889 compare_log.info('{0} [comparison unfinished file wait delay_time end] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id))
3890
3891
3892 # 根据application_id查找最新的比对信息,如果没有,结束 3867 # 根据application_id查找最新的比对信息,如果没有,结束
3893 if is_ca: 3868 if is_ca:
3894 comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo 3869 comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo
...@@ -3927,6 +3902,31 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ ...@@ -3927,6 +3902,31 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_
3927 uniq_seq, ocr_res_id, is_ca, is_cms)) 3902 uniq_seq, ocr_res_id, is_ca, is_cms))
3928 return 3903 return
3929 3904
3905 # 查看此订单号下是否有未完成的文件,如果有,等?分钟
3906 doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc
3907 doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first()
3908 compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result))
3909 compare_log.info('{0} [comparison unfinished file check] [entity={1}] [id={2}] [doc_wait_file_result={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result))
3910 if doc_wait_file_result is not None:
3911 # 实时查询延迟时间
3912 try:
3913 delay_time_config = Configs.objects.filter(id=4).first()
3914 if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit():
3915 delay_time = delay_time_config.value
3916 else:
3917 delay_time = 0
3918 except Exception as e:
3919 delay_time = 0
3920 compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc()))
3921 compare_log.info('delay_time:{0}'.format(delay_time))
3922 compare_log.info('{0} [comparison unfinished file wait delay_time start] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id))
3923 try:
3924 time.sleep(int(delay_time))
3925 except Exception as e:
3926 compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc()))
3927 compare_log.info('{0} [comparison unfinished file wait delay_time end] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id))
3928
3929
3930 if is_ca: 3930 if is_ca:
3931 ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) 3931 ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict)
3932 else: 3932 else:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!