init 5155 cms wait
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 |
| ... | @@ -49,6 +50,8 @@ from apps.doc.named_enum import RequestTeam, RequestTrigger, ProcessName, ErrorT | ... | @@ -49,6 +50,8 @@ from apps.doc.named_enum import RequestTeam, RequestTrigger, ProcessName, ErrorT |
| 49 | from common.tools.comparison import cp | 50 | from common.tools.comparison import cp |
| 50 | from common.tools.des import decode_des | 51 | from common.tools.des import decode_des |
| 51 | 52 | ||
| 53 | import threading | ||
| 54 | |||
| 52 | compare_log = logging.getLogger('compare') | 55 | compare_log = logging.getLogger('compare') |
| 53 | log_base = '[Compare]' | 56 | log_base = '[Compare]' |
| 54 | # e_log_base = '[e-contract]' | 57 | # e_log_base = '[e-contract]' |
| ... | @@ -3729,6 +3732,10 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3729,6 +3732,10 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3729 | 3732 | ||
| 3730 | @app.task | 3733 | @app.task |
| 3731 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3734 | def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3735 | producer_thread = threading.Thread(target=compare_thread, args=(application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3736 | producer_thread.start() | ||
| 3737 | |||
| 3738 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | ||
| 3732 | # POS: application_id, application_entity, uniq_seq, None | 3739 | # POS: application_id, application_entity, uniq_seq, None |
| 3733 | # OCR: application_id, business_type(application_entity), None, ocr_res_id | 3740 | # OCR: application_id, business_type(application_entity), None, ocr_res_id |
| 3734 | 3741 | ||
| ... | @@ -3736,6 +3743,15 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3736,6 +3743,15 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3736 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, | 3743 | '[is_cms={6}]'.format(log_base, application_entity, application_id, uniq_seq, ocr_res_id, |
| 3737 | is_ca, is_cms)) | 3744 | is_ca, is_cms)) |
| 3738 | 3745 | ||
| 3746 | # 查看此订单号下是否有未完成的文件,如果有,等3分钟 | ||
| 3747 | doc_wait_file_class = HILDoc if application_entity == consts.HIL_PREFIX else AFCDoc | ||
| 3748 | doc_wait_file_result = doc_wait_file_class.objects.filter(application_id=application_id, status=1).first() | ||
| 3749 | if doc_wait_file_result is not None: | ||
| 3750 | 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'))) | ||
| 3751 | time.sleep(60) | ||
| 3752 | 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'))) | ||
| 3753 | |||
| 3754 | |||
| 3739 | # 根据application_id查找最新的比对信息,如果没有,结束 | 3755 | # 根据application_id查找最新的比对信息,如果没有,结束 |
| 3740 | if is_ca: | 3756 | if is_ca: |
| 3741 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | 3757 | comparison_class = HILComparisonInfo if application_entity == consts.HIL_PREFIX else AFCComparisonInfo | ... | ... |
-
Please register or sign in to post a comment