Merge branch 'hotfix/2025-02' into feature/uat-tmp
Showing
1 changed file
with
137 additions
and
131 deletions
| ... | @@ -3776,6 +3776,7 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3776,6 +3776,7 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3776 | compare_log.info('[fsm thread]') | 3776 | compare_log.info('[fsm thread]') |
| 3777 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_") | 3777 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_") |
| 3778 | try: | 3778 | try: |
| 3779 | # 这个try不生效 | ||
| 3779 | pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | 3780 | pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) |
| 3780 | except Exception as e: | 3781 | except Exception as e: |
| 3781 | compare_log.info('[fsm thread fail] [error={0}]'.format(traceback.format_exc())) | 3782 | compare_log.info('[fsm thread fail] [error={0}]'.format(traceback.format_exc())) |
| ... | @@ -3783,37 +3784,40 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3783,37 +3784,40 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3783 | 3784 | ||
| 3784 | 3785 | ||
| 3785 | def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3786 | def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3786 | compare_log.info('{0} [receive fsm task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | 3787 | try: |
| 3788 | compare_log.info('{0} [receive fsm task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | ||
| 3787 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, | 3789 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 3788 | is_ca, is_cms)) | 3790 | is_ca, is_cms)) |
| 3789 | 3791 | ||
| 3790 | # 查看此订单号下是否有未完成的文件,如果有,等1分钟 | 3792 | # 查看此订单号下是否有未完成的文件,如果有,等1分钟 |
| 3791 | try: | ||
| 3792 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
| 3793 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3794 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3795 | 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)) | ||
| 3796 | except Exception as e: | ||
| 3797 | doc_wait_file_result = None | ||
| 3798 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3799 | if doc_wait_file_result is not None: | ||
| 3800 | # 实时查询延迟时间 | ||
| 3801 | try: | ||
| 3802 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3803 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3804 | delay_time = delay_time_config.value | ||
| 3805 | else: | ||
| 3806 | delay_time = 0 | ||
| 3807 | except Exception as e: | ||
| 3808 | delay_time = 0 | ||
| 3809 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3810 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3811 | 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)) | ||
| 3812 | try: | 3793 | try: |
| 3813 | time.sleep(int(delay_time)) | 3794 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc |
| 3795 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3796 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3797 | 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)) | ||
| 3814 | except Exception as e: | 3798 | except Exception as e: |
| 3815 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | 3799 | doc_wait_file_result = None |
| 3816 | 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)) | 3800 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) |
| 3801 | if doc_wait_file_result is not None: | ||
| 3802 | # 实时查询延迟时间 | ||
| 3803 | try: | ||
| 3804 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3805 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3806 | delay_time = delay_time_config.value | ||
| 3807 | else: | ||
| 3808 | delay_time = 0 | ||
| 3809 | except Exception as e: | ||
| 3810 | delay_time = 0 | ||
| 3811 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3812 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3813 | 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)) | ||
| 3814 | try: | ||
| 3815 | time.sleep(int(delay_time)) | ||
| 3816 | except Exception as e: | ||
| 3817 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | ||
| 3818 | 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)) | ||
| 3819 | except Exception as e: | ||
| 3820 | compare_log.info('[fsm_compare_thread error] [error={0}]'.format(traceback.format_exc())) | ||
| 3817 | 3821 | ||
| 3818 | 3822 | ||
| 3819 | # 调用java fsm 比对流程接口(http) | 3823 | # 调用java fsm 比对流程接口(http) |
| ... | @@ -3861,6 +3865,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3861,6 +3865,7 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3861 | compare_log.info('[non fsm thread]') | 3865 | compare_log.info('[non fsm thread]') |
| 3862 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_") | 3866 | #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_") |
| 3863 | try: | 3867 | try: |
| 3868 | # 这个try不生效 | ||
| 3864 | pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | 3869 | pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) |
| 3865 | except Exception as e: | 3870 | except Exception as e: |
| 3866 | compare_log.info('[non fsm thread fail] [error={0}]'.format(traceback.format_exc())) | 3871 | compare_log.info('[non fsm thread fail] [error={0}]'.format(traceback.format_exc())) |
| ... | @@ -3869,120 +3874,121 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3869,120 +3874,121 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3869 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3874 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3870 | # POS: application_id, application_entity, uniq_seq, None | 3875 | # POS: application_id, application_entity, uniq_seq, None |
| 3871 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 3876 | # OCR: application_id, business_type(application_entity), None, ocr_res_id |
| 3872 | 3877 | try: | |
| 3873 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' | 3878 | compare_log.info('{0} [receive task] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] [is_ca={5}] ' |
| 3874 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, | 3879 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 3875 | is_ca, is_cms)) | 3880 | is_ca, is_cms)) |
| 3876 | 3881 | ||
| 3877 | # 根据application_id查找最新的比对信息,如果没有,结束 | 3882 | # 根据application_id查找最新的比对信息,如果没有,结束 |
| 3878 | if is_ca: | 3883 | if is_ca: |
| 3879 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | 3884 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo |
| 3880 | else: | ||
| 3881 | if application_entity == consts.HIL_PREFIX: | ||
| 3882 | comparison_class = HILSECMSInfo if is_cms else HILSEComparisonInfo | ||
| 3883 | else: | 3885 | else: |
| 3884 | comparison_class = AFCSECMSInfo if is_cms else AFCSEComparisonInfo | 3886 | if application_entity == consts.HIL_PREFIX: |
| 3885 | last_obj = comparison_class.objects.filter(application_id=application_id).last() | 3887 | comparison_class = HILSECMSInfo if is_cms else HILSEComparisonInfo |
| 3886 | if last_obj is None: | ||
| 3887 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3888 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, | ||
| 3889 | ocr_res_id, is_ca, is_cms)) | ||
| 3890 | return | ||
| 3891 | |||
| 3892 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | ||
| 3893 | if is_ca: | ||
| 3894 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3895 | ca_ocr_res_dict = dict() | ||
| 3896 | else: | ||
| 3897 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult | ||
| 3898 | ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3899 | # if ocr_res_id is None: | ||
| 3900 | ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values( | ||
| 3901 | *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3902 | # else: | ||
| 3903 | # ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values( | ||
| 3904 | # *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3905 | if ocr_res_id is None: | ||
| 3906 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3907 | else: | ||
| 3908 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3909 | if ocr_res_dict is None: | ||
| 3910 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3911 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, | ||
| 3912 | uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3913 | return | ||
| 3914 | |||
| 3915 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 | ||
| 3916 | try: | ||
| 3917 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
| 3918 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3919 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3920 | 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)) | ||
| 3921 | except Exception as e: | ||
| 3922 | doc_wait_file_result = None | ||
| 3923 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3924 | if doc_wait_file_result is not None: | ||
| 3925 | # 实时查询延迟时间 | ||
| 3926 | try: | ||
| 3927 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3928 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3929 | delay_time = delay_time_config.value | ||
| 3930 | else: | 3888 | else: |
| 3931 | delay_time = 0 | 3889 | comparison_class = AFCSECMSInfo if is_cms else AFCSEComparisonInfo |
| 3932 | except Exception as e: | 3890 | last_obj = comparison_class.objects.filter(application_id=application_id).last() |
| 3933 | delay_time = 0 | 3891 | if last_obj is None: |
| 3934 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | 3892 | compare_log.info('{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' |
| 3935 | compare_log.info('delay_time:{0}'.format(delay_time)) | 3893 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, |
| 3936 | 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)) | 3894 | ocr_res_id, is_ca, is_cms)) |
| 3895 | return | ||
| 3896 | |||
| 3897 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | ||
| 3898 | if is_ca: | ||
| 3899 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3900 | ca_ocr_res_dict = dict() | ||
| 3901 | else: | ||
| 3902 | result_class = HILSEOCRResult if application_entity == consts.HIL_PREFIX else AFCSEOCRResult | ||
| 3903 | ca_result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ||
| 3904 | # if ocr_res_id is None: | ||
| 3905 | ca_ocr_res_dict = ca_result_class.objects.filter(application_id=application_id).values( | ||
| 3906 | *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3907 | # else: | ||
| 3908 | # ca_ocr_res_dict = ca_result_class.objects.filter(id=ocr_res_id).values( | ||
| 3909 | # *consts.CA_ADD_COMPARE_FIELDS).first() | ||
| 3910 | if ocr_res_id is None: | ||
| 3911 | ocr_res_dict = result_class.objects.filter(application_id=application_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3912 | else: | ||
| 3913 | ocr_res_dict = result_class.objects.filter(id=ocr_res_id).values(*consts.COMPARE_FIELDS).first() | ||
| 3914 | if ocr_res_dict is None: | ||
| 3915 | compare_log.info('{0} [ocr info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] ' | ||
| 3916 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, | ||
| 3917 | uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3918 | return | ||
| 3919 | |||
| 3920 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 | ||
| 3937 | try: | 3921 | try: |
| 3938 | time.sleep(int(delay_time)) | 3922 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc |
| 3923 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3924 | compare_log.info('doc_wait_file_result:{0}'.format(doc_wait_file_result)) | ||
| 3925 | 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)) | ||
| 3939 | except Exception as e: | 3926 | except Exception as e: |
| 3940 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | 3927 | doc_wait_file_result = None |
| 3941 | 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 | compare_log.info('[get doc_wait_file_result fail] [error={0}]'.format(traceback.format_exc())) |
| 3929 | if doc_wait_file_result is not None: | ||
| 3930 | # 实时查询延迟时间 | ||
| 3931 | try: | ||
| 3932 | delay_time_config = Configs.objects.filter(id=4).first() | ||
| 3933 | if delay_time_config is not None and delay_time_config.value is not None and delay_time_config.value.isdigit(): | ||
| 3934 | delay_time = delay_time_config.value | ||
| 3935 | else: | ||
| 3936 | delay_time = 0 | ||
| 3937 | except Exception as e: | ||
| 3938 | delay_time = 0 | ||
| 3939 | compare_log.info('[get delay_time_config fail] [error={0}]'.format(traceback.format_exc())) | ||
| 3940 | compare_log.info('delay_time:{0}'.format(delay_time)) | ||
| 3941 | 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)) | ||
| 3942 | try: | ||
| 3943 | time.sleep(int(delay_time)) | ||
| 3944 | except Exception as e: | ||
| 3945 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | ||
| 3946 | 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)) | ||
| 3942 | 3947 | ||
| 3943 | 3948 | ||
| 3944 | if is_ca: | 3949 | if is_ca: |
| 3945 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) | 3950 | ca_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict) |
| 3946 | else: | ||
| 3947 | id_res_list = [] | ||
| 3948 | for field_name in consts.CA_ADD_COMPARE_FIELDS: | ||
| 3949 | if field_name == consts.IC_OCR_FIELD: | ||
| 3950 | id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None) | ||
| 3951 | id_res_list.append(ocr_res_dict.get(field_name)) | ||
| 3952 | |||
| 3953 | if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str): | ||
| 3954 | tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name)) | ||
| 3955 | if isinstance(ocr_res_dict.get(field_name), str): | ||
| 3956 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) | ||
| 3957 | tmp_ca_result.extend(tmp_se_result) | ||
| 3958 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) | ||
| 3959 | # auto settlement | ||
| 3960 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement | ||
| 3961 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() | ||
| 3962 | bank_class = HILbankVerification if application_entity == consts.HIL_PREFIX else AFCbankVerification | ||
| 3963 | ignore_bank = bank_class.objects.filter(application_id=application_id, on_off=True).exists() | ||
| 3964 | data_source = '' | ||
| 3965 | if application_entity == consts.AFC_PREFIX: | ||
| 3966 | doc_obj = AFCDoc.objects.filter(application_id=application_id, document_name__icontains='电子签署-车辆抵押贷款合同').last() | ||
| 3967 | if doc_obj is not None: | ||
| 3968 | data_source = doc_obj.data_source | ||
| 3969 | compare_log.info('{0} [get data_source] [id={1}] [data_source={2}]]'.format( | ||
| 3970 | log_base, application_id, data_source)) | ||
| 3971 | if auto_obj is not None: | ||
| 3972 | 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) | ||
| 3973 | else: | 3951 | else: |
| 3974 | auto_result = None | 3952 | id_res_list = [] |
| 3953 | for field_name in consts.CA_ADD_COMPARE_FIELDS: | ||
| 3954 | if field_name == consts.IC_OCR_FIELD: | ||
| 3955 | id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None) | ||
| 3956 | id_res_list.append(ocr_res_dict.get(field_name)) | ||
| 3957 | |||
| 3958 | if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str): | ||
| 3959 | tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name)) | ||
| 3960 | if isinstance(ocr_res_dict.get(field_name), str): | ||
| 3961 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) | ||
| 3962 | tmp_ca_result.extend(tmp_se_result) | ||
| 3963 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) | ||
| 3964 | # auto settlement | ||
| 3965 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement | ||
| 3966 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() | ||
| 3967 | bank_class = HILbankVerification if application_entity == consts.HIL_PREFIX else AFCbankVerification | ||
| 3968 | ignore_bank = bank_class.objects.filter(application_id=application_id, on_off=True).exists() | ||
| 3969 | data_source = '' | ||
| 3970 | if application_entity == consts.AFC_PREFIX: | ||
| 3971 | doc_obj = AFCDoc.objects.filter(application_id=application_id, document_name__icontains='电子签署-车辆抵押贷款合同').last() | ||
| 3972 | if doc_obj is not None: | ||
| 3973 | data_source = doc_obj.data_source | ||
| 3974 | compare_log.info('{0} [get data_source] [id={1}] [data_source={2}]]'.format( | ||
| 3975 | log_base, application_id, data_source)) | ||
| 3976 | if auto_obj is not None: | ||
| 3977 | 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) | ||
| 3978 | else: | ||
| 3979 | auto_result = None | ||
| 3975 | 3980 | ||
| 3976 | 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) | 3981 | 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) |
| 3977 | |||
| 3978 | if auto_obj is not None: | ||
| 3979 | try: | ||
| 3980 | auto_obj.ocr_whole_result_pass = full_result | ||
| 3981 | auto_obj.save() | ||
| 3982 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
| 3983 | log_base, application_entity, application_id, ocr_res_id)) | ||
| 3984 | except Exception as e: | ||
| 3985 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 3986 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 3987 | traceback.format_exc())) | ||
| 3988 | 3982 | ||
| 3983 | if auto_obj is not None: | ||
| 3984 | try: | ||
| 3985 | auto_obj.ocr_whole_result_pass = full_result | ||
| 3986 | auto_obj.save() | ||
| 3987 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
| 3988 | log_base, application_entity, application_id, ocr_res_id)) | ||
| 3989 | except Exception as e: | ||
| 3990 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
| 3991 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
| 3992 | traceback.format_exc())) | ||
| 3993 | except Exception as e: | ||
| 3994 | compare_log.info('[compare_thread error] [error={0}]'.format(traceback.format_exc())) | ... | ... |
-
Please register or sign in to post a comment