Merge branch 'feature/CHINARPA-5155' into feature/uat-tmp
Showing
1 changed file
with
16 additions
and
0 deletions
... | @@ -39,6 +39,7 @@ from apps.doc.models import ( | ... | @@ -39,6 +39,7 @@ from apps.doc.models import ( |
39 | HILCompareReportNew, | 39 | HILCompareReportNew, |
40 | AFCCompareReportNew, | 40 | AFCCompareReportNew, |
41 | AFCDoc, | 41 | AFCDoc, |
42 | HILDoc, | ||
42 | DealerMapping, | 43 | DealerMapping, |
43 | ) | 44 | ) |
44 | from apps.doc import consts | 45 | from apps.doc import consts |
... | @@ -50,6 +51,8 @@ from common.tools.comparison import cp | ... | @@ -50,6 +51,8 @@ from common.tools.comparison import cp |
50 | # from common.tools.des import decode_des | 51 | # from common.tools.des import decode_des |
51 | from common.tools.aes_util import aes_decrypt_cbc | 52 | from common.tools.aes_util import aes_decrypt_cbc |
52 | 53 | ||
54 | import threading | ||
55 | |||
53 | compare_log = logging.getLogger('compare') | 56 | compare_log = logging.getLogger('compare') |
54 | log_base = '[Compare]' | 57 | log_base = '[Compare]' |
55 | # e_log_base = '[e-contract]' | 58 | # e_log_base = '[e-contract]' |
... | @@ -3731,6 +3734,10 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3731,6 +3734,10 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
3731 | 3734 | ||
3732 | @app.task | 3735 | @app.task |
3733 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3736 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
3737 | producer_thread = threading.Thread(target=compare_thread, args=(application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
3738 | producer_thread.start() | ||
3739 | |||
3740 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | ||
3734 | # POS: application_id, application_entity, uniq_seq, None | 3741 | # POS: application_id, application_entity, uniq_seq, None |
3735 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 3742 | # OCR: application_id, business_type(application_entity), None, ocr_res_id |
3736 | 3743 | ||
... | @@ -3738,6 +3745,15 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3738,6 +3745,15 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
3738 | '[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, |
3739 | is_ca, is_cms)) | 3746 | is_ca, is_cms)) |
3740 | 3747 | ||
3748 | # 查看此订单号下是否有未完成的文件,如果有,等3分钟 | ||
3749 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
3750 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
3751 | if doc_wait_file_result is not None: | ||
3752 | compare_log.info('{0} [comparison unfinished file wait 180s start] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.get('id'))) | ||
3753 | time.sleep(60) | ||
3754 | compare_log.info('{0} [comparison unfinished file wait 180s end] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.get('id'))) | ||
3755 | |||
3756 | |||
3741 | # 根据application_id查找最新的比对信息,如果没有,结束 | 3757 | # 根据application_id查找最新的比对信息,如果没有,结束 |
3742 | if is_ca: | 3758 | if is_ca: |
3743 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | 3759 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | ... | ... |
-
Please register or sign in to post a comment