fix: ticket_handle_permission_check 重新梳理
This commit is contained in:
parent
d44f9751bb
commit
b2cfdf9995
|
@ -241,32 +241,21 @@ class WfService(object):
|
|||
|
||||
@classmethod
|
||||
def ticket_handle_permission_check(cls, ticket: Ticket, user: User) -> dict:
|
||||
if ticket.in_add_node:
|
||||
return dict(permission=False, msg="工单当前处于加签中,请加签完成后操作", need_accept=False)
|
||||
transitions = cls.get_state_transitions(ticket.state)
|
||||
if not transitions:
|
||||
return dict(permission=True, msg="工单当前状态无需操作")
|
||||
current_participant_count = 0
|
||||
participant_type = ticket.participant_type
|
||||
participant = ticket.participant
|
||||
state = ticket.state
|
||||
if participant_type == State.PARTICIPANT_TYPE_PERSONAL:
|
||||
if type(participant) == list:
|
||||
if user.id not in participant:
|
||||
return dict(permission=False, msg="非当前处理人", need_accept=False)
|
||||
if len(participant) > 1 and state.distribute_type == State.STATE_DISTRIBUTE_TYPE_ACTIVE:
|
||||
return dict(permission=False, msg="需要先接单再处理", need_accept=True)
|
||||
else:
|
||||
if user.id != participant:
|
||||
return dict(permission=False, msg="非当前处理人", need_accept=False)
|
||||
elif participant_type in [State.PARTICIPANT_TYPE_MULTI,
|
||||
State.PARTICIPANT_TYPE_DEPT, State.PARTICIPANT_TYPE_ROLE]:
|
||||
if user.id not in participant:
|
||||
return dict(permission=False, msg="非当前处理人", need_accept=False)
|
||||
current_participant_count = len(participant)
|
||||
if current_participant_count == 1:
|
||||
if [user.id] == participant or user.id == participant:
|
||||
pass
|
||||
else:
|
||||
return dict(permission=False, msg="非当前处理人", need_accept=False)
|
||||
elif current_participant_count > 1 and state.distribute_type == State.STATE_DISTRIBUTE_TYPE_ACTIVE:
|
||||
if user.id not in participant:
|
||||
return dict(permission=False, msg="非当前处理人", need_accept=False)
|
||||
return dict(permission=False, msg="需要先接单再处理", need_accept=True)
|
||||
if ticket.in_add_node:
|
||||
return dict(permission=False, msg="工单当前处于加签中,请加签完成后操作", need_accept=False)
|
||||
return dict(permission=True, msg="", need_accept=False)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue