MOD:比对前fsm判断
Showing
2 changed files
with
16 additions
and
6 deletions
... | @@ -42,6 +42,8 @@ from apps.doc.models import ( | ... | @@ -42,6 +42,8 @@ from apps.doc.models import ( |
42 | DDARecords, | 42 | DDARecords, |
43 | IDBCRecords, | 43 | IDBCRecords, |
44 | Configs, | 44 | Configs, |
45 | AFCCmsStatusInfo, | ||
46 | HILCmsStatusInfo, | ||
45 | ) | 47 | ) |
46 | from celery_compare.tasks import compare, fsm_compare | 48 | from celery_compare.tasks import compare, fsm_compare |
47 | 49 | ||
... | @@ -2056,8 +2058,13 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -2056,8 +2058,13 @@ class Command(BaseCommand, LoggerMixin): |
2056 | self.log_base, task_str, res_obj.id)) | 2058 | self.log_base, task_str, res_obj.id)) |
2057 | # 触发比对 | 2059 | # 触发比对 |
2058 | try: | 2060 | try: |
2059 | fsm_activited = getattr(res_obj, 'fsm_activited') | 2061 | # 是否fsm |
2060 | if fsm_activited: | 2062 | cms_status_class = HILCmsStatusInfo if business_type in consts.HIL_SET else AFCCmsStatusInfo |
2063 | cms_status_info = cms_status_class.objects.filter(application_id=doc.application_id).first() | ||
2064 | is_fsm = cms_status_info and cms_status_info.is_fsm == 1 | ||
2065 | self.online_log.info('{0} [isfsm] [task={1}] [true or false={2}]'.format( | ||
2066 | self.log_base, task_str, is_fsm)) | ||
2067 | if is_fsm: | ||
2061 | fsm_compare.apply_async((doc.application_id, business_type, None, res_obj.id, is_ca, True), | 2068 | fsm_compare.apply_async((doc.application_id, business_type, None, res_obj.id, is_ca, True), |
2062 | queue='queue_compare') | 2069 | queue='queue_compare') |
2063 | else: | 2070 | else: | ... | ... |
... | @@ -580,9 +580,12 @@ class UploadDocView(GenericView, DocHandler): | ... | @@ -580,9 +580,12 @@ class UploadDocView(GenericView, DocHandler): |
580 | document_scheme = self.fix_scheme(document_scheme) | 580 | document_scheme = self.fix_scheme(document_scheme) |
581 | 581 | ||
582 | # fsm激活状态, 更新ocr_result 表fsm状态 | 582 | # fsm激活状态, 更新ocr_result 表fsm状态 |
583 | is_fsm = consts.FSM_ACTIVITED_STATUS.get(application_status) or consts.FSM_BEFORE_ACTIVITED_STATUS.get(application_status) | ||
583 | self.running_log.info('[doc upload applicationId-{0}] [applicationStatus-{1}, activated-{2}]' | 584 | self.running_log.info('[doc upload applicationId-{0}] [applicationStatus-{1}, activated-{2}]' |
584 | .format(application_id, application_status, True if consts.FSM_ACTIVITED_STATUS.get(application_status) else False)) | 585 | .format(application_id, application_status, is_fsm)) |
585 | if consts.FSM_ACTIVITED_STATUS.get(application_status): | 586 | if is_fsm: |
587 | # fsm激活状态 0(默认):非sfm;1:激活前;2:激活后 | ||
588 | fsm_activited = 2 if consts.FSM_ACTIVITED_STATUS.get(application_status) else 1 | ||
586 | result_class = None | 589 | result_class = None |
587 | if business_type == consts.HIL_PREFIX: | 590 | if business_type == consts.HIL_PREFIX: |
588 | if document_scheme == RequestTeam.ACCEPTANCE.name: | 591 | if document_scheme == RequestTeam.ACCEPTANCE.name: |
... | @@ -597,12 +600,12 @@ class UploadDocView(GenericView, DocHandler): | ... | @@ -597,12 +600,12 @@ class UploadDocView(GenericView, DocHandler): |
597 | 600 | ||
598 | ocr_result_obj = result_class.objects.filter(application_id=application_id).first() | 601 | ocr_result_obj = result_class.objects.filter(application_id=application_id).first() |
599 | if ocr_result_obj: | 602 | if ocr_result_obj: |
600 | ocr_result_obj.fsm_activited = 1 | 603 | ocr_result_obj.fsm_activited = fsm_activited |
601 | ocr_result_obj.save() | 604 | ocr_result_obj.save() |
602 | else: | 605 | else: |
603 | ocr_result_obj = result_class() | 606 | ocr_result_obj = result_class() |
604 | ocr_result_obj.application_id = application_id | 607 | ocr_result_obj.application_id = application_id |
605 | ocr_result_obj.fsm_activited = 1 | 608 | ocr_result_obj.fsm_activited = fsm_activited |
606 | ocr_result_obj.save() | 609 | ocr_result_obj.save() |
607 | 610 | ||
608 | if data_source == consts.DATA_SOURCE_LIST[1]: | 611 | if data_source == consts.DATA_SOURCE_LIST[1]: | ... | ... |
-
Please register or sign in to post a comment