From 0d1fe0bc7f4fca9d2631c76f41b72aea04ea058e Mon Sep 17 00:00:00 2001 From: blackholll Date: Mon, 20 May 2019 22:53:44 +0800 Subject: [PATCH] bugfix: timer_transition --- service/ticket/ticket_base_service.py | 2 +- tasks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service/ticket/ticket_base_service.py b/service/ticket/ticket_base_service.py index e7f5411a..0e3761d7 100644 --- a/service/ticket/ticket_base_service.py +++ b/service/ticket/ticket_base_service.py @@ -1492,7 +1492,7 @@ def handle_timer_transition(cls, ticket_id, destination_state_id): for destination_transition in destination_transition_queryset: if destination_transition.transition_type_id == CONSTANT_SERVICE.TRANSITION_TYPE_TIMER: from tasks import timer_transition - timer_transition.apply_async(args=[ticket_id.id, destination_state_id, datetime.datetime.now(), destination_transition.id], countdown=destination_transition.timer, queue='loonflow') + timer_transition.apply_async(args=[ticket_id, destination_state_id, datetime.datetime.now(), destination_transition.id], countdown=destination_transition.timer, queue='loonflow') return True, '' @classmethod diff --git a/tasks.py b/tasks.py index a48cca5f..62abcb6b 100644 --- a/tasks.py +++ b/tasks.py @@ -139,9 +139,9 @@ def timer_transition(ticket_id, state_id, date_time, transition_id): """ # 需要满足工单此状态后续无其他操作才自动流转 # 查询该工单此状态所有操作 - flow_log_set, msg = TicketBaseService().get_ticket_flow_log(ticket_id, per_page=1000) + flow_log_set, msg = TicketBaseService().get_ticket_flow_log(ticket_id, 'loonrobot', per_page=1000) for flow_log in flow_log_set: - if flow_log.state_id == state_id and flow_log.gmt_created > date_time: + if flow_log.get('state').get('state_id') == state_id and flow_log.get('gmt_created') > date_time: return True, '后续有操作,定时器失效' # 执行流转 handle_ticket_data = dict(transition_id=transition_id, username='loonrobot', suggestion='定时器流转')