add auto result to CMS
Showing
1 changed file
with
43 additions
and
27 deletions
... | @@ -2764,7 +2764,7 @@ def se_result_detect(ocr_res_dict): | ... | @@ -2764,7 +2764,7 @@ def se_result_detect(ocr_res_dict): |
2764 | return detect_list | 2764 | return detect_list |
2765 | 2765 | ||
2766 | 2766 | ||
2767 | def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj, full_result): | 2767 | def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj): |
2768 | try: | 2768 | try: |
2769 | # 比对逻辑 | 2769 | # 比对逻辑 |
2770 | # detect_list = se_result_detect(ocr_res_dict) | 2770 | # detect_list = se_result_detect(ocr_res_dict) |
... | @@ -2779,32 +2779,36 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc | ... | @@ -2779,32 +2779,36 @@ def se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, oc |
2779 | traceback.format_exc())) | 2779 | traceback.format_exc())) |
2780 | else: | 2780 | else: |
2781 | # 将比对结果写入数据库 auto settlement | 2781 | # 将比对结果写入数据库 auto settlement |
2782 | try: | 2782 | # try: |
2783 | auto_obj.aa_type = aa_type | 2783 | |
2784 | auto_obj.ocr_auto_result_pass = successful_at_this_level | 2784 | auto_obj.aa_type = aa_type |
2785 | auto_obj.ocr_whole_result_pass = full_result | 2785 | auto_obj.ocr_auto_result_pass = successful_at_this_level |
2786 | auto_obj.ocr_auto_result = json.dumps(compare_result) | 2786 | # auto_obj.ocr_whole_result_pass = full_result |
2787 | auto_obj.ocr_latest_comparison_time = datetime.now() | 2787 | auto_obj.ocr_auto_result = json.dumps(compare_result) |
2788 | auto_obj.rpa_result = None | 2788 | auto_obj.ocr_latest_comparison_time = datetime.now() |
2789 | auto_obj.rpa_1st_eye_tat = None | 2789 | auto_obj.rpa_result = None |
2790 | auto_obj.rpa_2nd_eye_tat = None | 2790 | auto_obj.rpa_1st_eye_tat = None |
2791 | auto_obj.rpa_3rd_eye_tat = None | 2791 | auto_obj.rpa_2nd_eye_tat = None |
2792 | auto_obj.rpa_total_tat = None | 2792 | auto_obj.rpa_3rd_eye_tat = None |
2793 | auto_obj.rpa_activated_time = None | 2793 | auto_obj.rpa_total_tat = None |
2794 | auto_obj.rpa_get_case_from_ocr_time = None | 2794 | auto_obj.rpa_activated_time = None |
2795 | auto_obj.rpa_get_case_from_oc_time = None | 2795 | auto_obj.rpa_get_case_from_ocr_time = None |
2796 | auto_obj.rpa_payment_authorize_time = None | 2796 | auto_obj.rpa_get_case_from_oc_time = None |
2797 | auto_obj.rpa_second_eye_time = None | 2797 | auto_obj.rpa_payment_authorize_time = None |
2798 | auto_obj.save() | 2798 | auto_obj.rpa_second_eye_time = None |
2799 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | 2799 | # auto_obj.save() |
2800 | log_base, application_entity, application_id, ocr_res_id)) | 2800 | # compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( |
2801 | except Exception as e: | 2801 | # log_base, application_entity, application_id, ocr_res_id)) |
2802 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | 2802 | |
2803 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | 2803 | # except Exception as e: |
2804 | traceback.format_exc())) | 2804 | # compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' |
2805 | # '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
2806 | # traceback.format_exc())) | ||
2807 | |||
2808 | return successful_at_this_level | ||
2805 | 2809 | ||
2806 | 2810 | ||
2807 | def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms): | 2811 | def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms, auto_result): |
2808 | try: | 2812 | try: |
2809 | # 比对逻辑 | 2813 | # 比对逻辑 |
2810 | start_time = datetime.now() | 2814 | start_time = datetime.now() |
... | @@ -2882,6 +2886,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res | ... | @@ -2882,6 +2886,7 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res |
2882 | "SubtenantId": consts.TENANT_MAP[application_entity], | 2886 | "SubtenantId": consts.TENANT_MAP[application_entity], |
2883 | "Data": { | 2887 | "Data": { |
2884 | "Result_Message": "Pass" if successful_at_this_level else "Fail", | 2888 | "Result_Message": "Pass" if successful_at_this_level else "Fail", |
2889 | "AutoCheckResult": "Pass" if auto_result else "Fail", | ||
2885 | "Failure_Reason": cn_failure_reason_str, | 2890 | "Failure_Reason": cn_failure_reason_str, |
2886 | "Application_Number": application_id, | 2891 | "Application_Number": application_id, |
2887 | "Bank_Statement": bs_failure_reason_str, | 2892 | "Bank_Statement": bs_failure_reason_str, |
... | @@ -2960,10 +2965,21 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -2960,10 +2965,21 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
2960 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) | 2965 | tmp_se_result = json.loads(ocr_res_dict.get(field_name)) |
2961 | tmp_ca_result.extend(tmp_se_result) | 2966 | tmp_ca_result.extend(tmp_se_result) |
2962 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) | 2967 | ocr_res_dict[field_name] = json.dumps(tmp_ca_result) |
2963 | full_result = se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms) | ||
2964 | # auto settlement | 2968 | # auto settlement |
2965 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement | 2969 | auto_class = HILAutoSettlement if application_entity == consts.HIL_PREFIX else AFCAutoSettlement |
2966 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() | 2970 | auto_obj = auto_class.objects.filter(application_id=application_id, on_off=True).first() |
2967 | if auto_obj is not None: | 2971 | if auto_obj is not None: |
2968 | se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj, full_result) | 2972 | auto_result = se_compare_auto(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, auto_obj) |
2973 | |||
2974 | full_result = se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res_dict, is_cms, auto_result) | ||
2969 | 2975 | ||
2976 | if auto_obj is not None: | ||
2977 | try: | ||
2978 | auto_obj.ocr_whole_result_pass = full_result | ||
2979 | auto_obj.save() | ||
2980 | compare_log.info('{0} [Auto SE] [result save success] [entity={1}] [id={2}] [ocr_res_id={3}]'.format( | ||
2981 | log_base, application_entity, application_id, ocr_res_id)) | ||
2982 | except Exception as e: | ||
2983 | compare_log.error('{0} [Auto SE] [result save error] [entity={1}] [id={2}] [ocr_res_id={3}] ' | ||
2984 | '[error={4}]'.format(log_base, application_entity, application_id, ocr_res_id, | ||
2985 | traceback.format_exc())) | ... | ... |
-
Please register or sign in to post a comment