ADD:try catch
Showing
1 changed file
with
137 additions
and
131 deletions
| ... | @@ -3732,6 +3732,7 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3732,6 +3732,7 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3732 | compare_log.info('[fsm thread]') | 3732 | compare_log.info('[fsm thread]') |
| 3733 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_") | 3733 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_") |
| 3734 | try: | 3734 | try: |
| 3735 | # 这个try不生效 | ||
| 3735 | pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | 3736 | pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) |
| 3736 | except Exception as e: | 3737 | except Exception as e: |
| 3737 | compare_log.info('[fsm thread fail] [error={0}]'.format(traceback.format_exc())) | 3738 | compare_log.info('[fsm thread fail] [error={0}]'.format(traceback.format_exc())) |
| ... | @@ -3739,37 +3740,40 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3739,37 +3740,40 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3739 | 3740 | ||
| 3740 | 3741 | ||
| 3741 | def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3742 | def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3742 | compare_log.info('{0} [receive fsm task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | 3743 | try: |
| 3744 | compare_log.info('{0} [receive fsm task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | ||
| 3743 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, | 3745 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 3744 | is_ca, is_cms)) | 3746 | is_ca, is_cms)) |
| 3745 | 3747 | ||
| 3746 | # 查看此订单号下是否有未完成的文件,如果有,等1分钟 | 3748 | # 查看此订单号下是否有未完成的文件,如果有,等1分钟 |
| 3747 | try: | ||
| 3748 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
| 3749 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3750 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3751 | 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)) | ||
| 3752 | except Exception as e: | ||
| 3753 | doc_wait_file_result = None | ||
| 3754 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3755 | if doc_wait_file_result is not None: | ||
| 3756 | # 实时查询延迟时间 | ||
| 3757 | try: | ||
| 3758 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3759 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3760 | delay_time = delay_time_config.value | ||
| 3761 | else: | ||
| 3762 | delay_time = 0 | ||
| 3763 | except Exception as e: | ||
| 3764 | delay_time = 0 | ||
| 3765 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3766 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3767 | 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)) | ||
| 3768 | try: | 3749 | try: |
| 3769 | time.sleep(int(delay_time)) | 3750 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc |
| 3751 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3752 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3753 | 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)) | ||
| 3770 | except Exception as e: | 3754 | except Exception as e: |
| 3771 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | 3755 | doc_wait_file_result = None |
| 3772 | 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)) | 3756 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) |
| 3757 | if doc_wait_file_result is not None: | ||
| 3758 | # 实时查询延迟时间 | ||
| 3759 | try: | ||
| 3760 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3761 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3762 | delay_time = delay_time_config.value | ||
| 3763 | else: | ||
| 3764 | delay_time = 0 | ||
| 3765 | except Exception as e: | ||
| 3766 | delay_time = 0 | ||
| 3767 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3768 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3769 | 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)) | ||
| 3770 | try: | ||
| 3771 | time.sleep(int(delay_time)) | ||
| 3772 | except Exception as e: | ||
| 3773 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | ||
| 3774 | 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)) | ||
| 3775 | except Exception as e: | ||
| 3776 | compare_log.info('[fsm_compare_thread error] [error={0}]'.format(traceback.format_exc())) | ||
| 3773 | 3777 | ||
| 3774 | 3778 | ||
| 3775 | # 调用java fsm 比对流程接口(http) | 3779 | # 调用java fsm 比对流程接口(http) |
| ... | @@ -3817,6 +3821,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3817,6 +3821,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3817 | compare_log.info('[non fsm thread]') | 3821 | compare_log.info('[non fsm thread]') |
| 3818 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_") | 3822 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_") |
| 3819 | try: | 3823 | try: |
| 3824 | # 这个try不生效 | ||
| 3820 | pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | 3825 | pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) |
| 3821 | except Exception as e: | 3826 | except Exception as e: |
| 3822 | compare_log.info('[non fsm thread fail] [error={0}]'.format(traceback.format_exc())) | 3827 | compare_log.info('[non fsm thread fail] [error={0}]'.format(traceback.format_exc())) |
| ... | @@ -3825,120 +3830,121 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3825,120 +3830,121 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3825 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3830 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3826 | # POS: application_id, application_entity, uniq_seq, None | 3831 | # POS: application_id, application_entity, uniq_seq, None |
| 3827 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 3832 | # OCR: application_id, business_type(application_entity), None, ocr_res_id |
| 3828 | 3833 | try: | |
| 3829 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | 3834 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' |
| 3830 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, | 3835 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 3831 | is_ca, is_cms)) | 3836 | is_ca, is_cms)) |
| 3832 | 3837 | ||
| 3833 | # 根据application_id查找最新的比对信息,如果没有,结束 | 3838 | # 根据application_id查找最新的比对信息,如果没有,结束 |
| 3834 | if is_ca: | 3839 | if is_ca: |
| 3835 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | 3840 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo |
| 3836 | else: | ||
| 3837 | if application_entity == consts.HIL_PREFIX: | ||
| 3838 | comparison_class = HILSECMSInfo if is_cms else HILSEComparisonInfo | ||
| 3839 | else: | 3841 | else: |
| 3840 | comparison_class = AFCSECMSInfo if is_cms else AFCSEComparisonInfo | 3842 | if application_entity == consts.HIL_PREFIX: |
| 3841 | last_obj = comparison_class.objects.filter(application_id=application_id).last() | 3843 | comparison_class = HILSECMSInfo if is_cms else HILSEComparisonInfo |
| 3842 | if last_obj is None: | ||
| 3843 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3844 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, | ||
| 3845 | ocr_res_id, is_ca, is_cms)) | ||
| 3846 | return | ||
| 3847 | |||
| 3848 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | ||
| 3849 | if is_ca: | ||
| 3850 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3851 | ca_ocr_res_dict = dict() | ||
| 3852 | else: | ||
| 3853 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult | ||
| 3854 | ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3855 | # if ocr_res_id is None: | ||
| 3856 | ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values( | ||
| 3857 | *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3858 | # else: | ||
| 3859 | # ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values( | ||
| 3860 | # *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3861 | if ocr_res_id is None: | ||
| 3862 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3863 | else: | ||
| 3864 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3865 | if ocr_res_dict is None: | ||
| 3866 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3867 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, | ||
| 3868 | uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3869 | return | ||
| 3870 | |||
| 3871 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 | ||
| 3872 | try: | ||
| 3873 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
| 3874 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3875 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3876 | 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)) | ||
| 3877 | except Exception as e: | ||
| 3878 | doc_wait_file_result = None | ||
| 3879 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3880 | if doc_wait_file_result is not None: | ||
| 3881 | # 实时查询延迟时间 | ||
| 3882 | try: | ||
| 3883 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3884 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3885 | delay_time = delay_time_config.value | ||
| 3886 | else: | 3844 | else: |
| 3887 | delay_time = 0 | 3845 | comparison_class = AFCSECMSInfo if is_cms else AFCSEComparisonInfo |
| 3888 | except Exception as e: | 3846 | last_obj = comparison_class.objects.filter(application_id=application_id).last() |
| 3889 | delay_time = 0 | 3847 | if last_obj is None: |
| 3890 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | 3848 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' |
| 3891 | compare_log.info('delay_time:{0}'.format(delay_time)) | 3849 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, |
| 3892 | 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)) | 3850 | ocr_res_id, is_ca, is_cms)) |
| 3851 | return | ||
| 3852 | |||
| 3853 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | ||
| 3854 | if is_ca: | ||
| 3855 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3856 | ca_ocr_res_dict = dict() | ||
| 3857 | else: | ||
| 3858 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult | ||
| 3859 | ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3860 | # if ocr_res_id is None: | ||
| 3861 | ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values( | ||
| 3862 | *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3863 | # else: | ||
| 3864 | # ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values( | ||
| 3865 | # *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3866 | if ocr_res_id is None: | ||
| 3867 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3868 | else: | ||
| 3869 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3870 | if ocr_res_dict is None: | ||
| 3871 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3872 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, | ||
| 3873 | uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3874 | return | ||
| 3875 | |||
| 3876 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 | ||
| 3893 | try: | 3877 | try: |
| 3894 | time.sleep(int(delay_time)) | 3878 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc |
| 3879 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3880 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3881 | 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)) | ||
| 3895 | except Exception as e: | 3882 | except Exception as e: |
| 3896 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | 3883 | doc_wait_file_result = None |
| 3897 | 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)) | 3884 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) |
| 3885 | if doc_wait_file_result is not None: | ||
| 3886 | # 实时查询延迟时间 | ||
| 3887 | try: | ||
| 3888 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3889 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3890 | delay_time = delay_time_config.value | ||
| 3891 | else: | ||
| 3892 | delay_time = 0 | ||
| 3893 | except Exception as e: | ||
| 3894 | delay_time = 0 | ||
| 3895 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3896 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3897 | 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)) | ||
| 3898 | try: | ||
| 3899 | time.sleep(int(delay_time)) | ||
| 3900 | except Exception as e: | ||
| 3901 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | ||
| 3902 | 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)) | ||
| 3898 | 3903 | ||
| 3899 | 3904 | ||
| 3900 | if is_ca: | 3905 | if is_ca: |
| 3901 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) | 3906 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) |
| 3902 | else: | ||
| 3903 | id_res_list = [] | ||
| 3904 | for field_name in consts.CA_ADD_COMPARE_FIELDS: | ||
| 3905 | if field_name == consts.IC_OCR_FIELD: | ||
| 3906 | id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None) | ||
| 3907 | id_res_list.append(ocr_res_dict.get(field_name)) | ||
| 3908 | |||
| 3909 | if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str): | ||
| 3910 | tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name)) | ||
| 3911 | if isinstance(ocr_res_dict.get(field_name), str): | ||
| 3912 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) | ||
| 3913 | tmp_ca_result.extend(tmp_se_result) | ||
| 3914 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) | ||
| 3915 | # auto settlement | ||
| 3916 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement | ||
| 3917 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() | ||
| 3918 | bank_class = HILbankVerification if application_entity == consts.HIL_PREFIX else AFCbankVerification | ||
| 3919 | ignore_bank = bank_class.objects.filter(application_id=application_id, on_off=True).exists() | ||
| 3920 | data_source = '' | ||
| 3921 | if application_entity == consts.AFC_PREFIX: | ||
| 3922 | doc_obj = AFCDoc.objects.filter(application_id=application_id, document_name__icontains='电子签署-车辆抵押贷款合同').last() | ||
| 3923 | if doc_obj is not None: | ||
| 3924 | data_source = doc_obj.data_source | ||
| 3925 | compare_log.info('{0} [get data_source] [id={1}] [data_source={2}]]'.format( | ||
| 3926 | log_base, application_id, data_source)) | ||
| 3927 | if auto_obj is not None: | ||
| 3928 | auto_result = se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj, ignore_bank, id_res_list, data_source) | ||
| 3929 | else: | 3907 | else: |
| 3930 | auto_result = None | 3908 | id_res_list = [] |
| 3909 | for field_name in consts.CA_ADD_COMPARE_FIELDS: | ||
| 3910 | if field_name == consts.IC_OCR_FIELD: | ||
| 3911 | id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None) | ||
| 3912 | id_res_list.append(ocr_res_dict.get(field_name)) | ||
| 3913 | |||
| 3914 | if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str): | ||
| 3915 | tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name)) | ||
| 3916 | if isinstance(ocr_res_dict.get(field_name), str): | ||
| 3917 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) | ||
| 3918 | tmp_ca_result.extend(tmp_se_result) | ||
| 3919 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) | ||
| 3920 | # auto settlement | ||
| 3921 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement | ||
| 3922 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() | ||
| 3923 | bank_class = HILbankVerification if application_entity == consts.HIL_PREFIX else AFCbankVerification | ||
| 3924 | ignore_bank = bank_class.objects.filter(application_id=application_id, on_off=True).exists() | ||
| 3925 | data_source = '' | ||
| 3926 | if application_entity == consts.AFC_PREFIX: | ||
| 3927 | doc_obj = AFCDoc.objects.filter(application_id=application_id, document_name__icontains='电子签署-车辆抵押贷款合同').last() | ||
| 3928 | if doc_obj is not None: | ||
| 3929 | data_source = doc_obj.data_source | ||
| 3930 | compare_log.info('{0} [get data_source] [id={1}] [data_source={2}]]'.format( | ||
| 3931 | log_base, application_id, data_source)) | ||
| 3932 | if auto_obj is not None: | ||
| 3933 | auto_result = se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj, ignore_bank, id_res_list, data_source) | ||
| 3934 | else: | ||
| 3935 | auto_result = None | ||
| 3931 | 3936 | ||
| 3932 | full_result = se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms, auto_result, ignore_bank, id_res_list, data_source) | 3937 | full_result = se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms, auto_result, ignore_bank, id_res_list, data_source) |
| 3933 | |||
| 3934 | if auto_obj is not None: | ||
| 3935 | try: | ||
| 3936 | auto_obj.ocr_whole_result_pass = full_result | ||
| 3937 | auto_obj.save() | ||
| 3938 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
| 3939 | log_base, application_entity, application_id, ocr_res_id)) | ||
| 3940 | except Exception as e: | ||
| 3941 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 3942 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 3943 | traceback.format_exc())) | ||
| 3944 | 3938 | ||
| 3939 | if auto_obj is not None: | ||
| 3940 | try: | ||
| 3941 | auto_obj.ocr_whole_result_pass = full_result | ||
| 3942 | auto_obj.save() | ||
| 3943 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
| 3944 | log_base, application_entity, application_id, ocr_res_id)) | ||
| 3945 | except Exception as e: | ||
| 3946 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 3947 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 3948 | traceback.format_exc())) | ||
| 3949 | except Exception as e: | ||
| 3950 | compare_log.info('[compare_thread error] [error={0}]'.format(traceback.format_exc())) | ... | ... |
-
Please register or sign in to post a comment