bind_rpj bug
This commit is contained in:
parent
47dd1d51cb
commit
711368bd9b
|
@ -8,6 +8,7 @@ from datetime import timedelta
|
||||||
import random
|
import random
|
||||||
from apps.utils.queryset import get_parent_queryset
|
from apps.utils.queryset import get_parent_queryset
|
||||||
from apps.wf.tasks import run_task
|
from apps.wf.tasks import run_task
|
||||||
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
||||||
|
|
||||||
class WfService(object):
|
class WfService(object):
|
||||||
|
@ -161,45 +162,45 @@ class WfService(object):
|
||||||
in new_ticket_data else Ticket.ticket_data.get(destination_participant, 0)
|
in new_ticket_data else Ticket.ticket_data.get(destination_participant, 0)
|
||||||
|
|
||||||
elif destination_participant_type == State.PARTICIPANT_TYPE_FORMCODE: # 代码获取
|
elif destination_participant_type == State.PARTICIPANT_TYPE_FORMCODE: # 代码获取
|
||||||
# if '.' in destination_participant:
|
|
||||||
module, func = destination_participant.rsplit(".", 1)
|
module, func = destination_participant.rsplit(".", 1)
|
||||||
m = importlib.import_module(module)
|
m = importlib.import_module(module)
|
||||||
f = getattr(m, func)
|
f = getattr(m, func)
|
||||||
destination_participant = f(state=state, ticket=ticket, new_ticket_data=new_ticket_data, handler=handler)
|
destination_participant = f(state=state, ticket=ticket, new_ticket_data=new_ticket_data, handler=handler)
|
||||||
# else:
|
|
||||||
# destination_participant = getattr(GetParticipants, destination_participant)(
|
|
||||||
# state=state, ticket=ticket, new_ticket_data=new_ticket_data, hander=handler)
|
|
||||||
|
|
||||||
elif destination_participant_type == State.PARTICIPANT_TYPE_DEPT: # 部门
|
elif destination_participant_type == State.PARTICIPANT_TYPE_DEPT: # 部门
|
||||||
destination_participant = list(User.objects.filter(
|
destination_participant = list(User.objects.filter(
|
||||||
dept__in=destination_participant).values_list('id', flat=True))
|
depts__in=destination_participant).values_list('id', flat=True))
|
||||||
|
|
||||||
elif destination_participant_type == State.PARTICIPANT_TYPE_POST: # 岗位
|
elif destination_participant_type == State.PARTICIPANT_TYPE_POST: # 岗位
|
||||||
user_queryset = User.objects.filter(posts__in=destination_participant)
|
user_queryset = User.objects.filter(posts__in=destination_participant)
|
||||||
# 如果选择了岗位, 需要走过滤策略
|
# 如果选择了岗位, 需要走过滤策略
|
||||||
if state.filter_policy == 1:
|
if state.filter_policy == 1:
|
||||||
depts = get_parent_queryset(ticket.belong_dept)
|
depts = get_parent_queryset(ticket.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
elif state.filter_policy == 2:
|
elif state.filter_policy == 2:
|
||||||
depts = get_parent_queryset(ticket.create_by.belong_dept)
|
depts = get_parent_queryset(ticket.create_by.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
elif state.filter_policy == 3:
|
elif state.filter_policy == 3:
|
||||||
depts = get_parent_queryset(handler.belong_dept)
|
depts = get_parent_queryset(handler.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
destination_participant = list(user_queryset.values_list('id', flat=True))
|
destination_participant = list(user_queryset.values_list('id', flat=True))
|
||||||
elif destination_participant_type == State.PARTICIPANT_TYPE_ROLE: # 角色
|
elif destination_participant_type == State.PARTICIPANT_TYPE_ROLE: # 角色
|
||||||
user_queryset = User.objects.filter(roles__in=destination_participant)
|
user_queryset = User.objects.filter(roles__in=destination_participant)
|
||||||
# 如果选择了角色, 需要走过滤策略
|
# 如果选择了角色, 需要走过滤策略
|
||||||
if state.filter_policy == 1:
|
if state.filter_policy == 1:
|
||||||
depts = get_parent_queryset(ticket.belong_dept)
|
depts = get_parent_queryset(ticket.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
elif state.filter_policy == 2:
|
elif state.filter_policy == 2:
|
||||||
depts = get_parent_queryset(ticket.create_by.belong_dept)
|
depts = get_parent_queryset(ticket.create_by.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
elif state.filter_policy == 3:
|
elif state.filter_policy == 3:
|
||||||
depts = get_parent_queryset(handler.belong_dept)
|
depts = get_parent_queryset(handler.belong_dept)
|
||||||
user_queryset = user_queryset.filter(dept__in=depts)
|
user_queryset = user_queryset.filter(depts__in=depts)
|
||||||
destination_participant = list(user_queryset.values_list('id', flat=True))
|
destination_participant = list(user_queryset.values_list('id', flat=True))
|
||||||
|
if destination_participant:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise ParseError('未找到处理人,工单无法继续')
|
||||||
if type(destination_participant) == list:
|
if type(destination_participant) == list:
|
||||||
destination_participant_type = State.PARTICIPANT_TYPE_MULTI
|
destination_participant_type = State.PARTICIPANT_TYPE_MULTI
|
||||||
destination_participant = list(set(destination_participant))
|
destination_participant = list(set(destination_participant))
|
||||||
|
|
Loading…
Reference in New Issue