fix: 加签和加签完成接口需要校验
This commit is contained in:
parent
a757321f5c
commit
1c661631ea
|
@ -420,8 +420,10 @@ class TicketViewSet(CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, R
|
||||||
"""
|
"""
|
||||||
加签
|
加签
|
||||||
"""
|
"""
|
||||||
ticket = self.get_object()
|
|
||||||
data = request.data
|
data = request.data
|
||||||
|
sr = TicketAddNodeSerializer(data=data)
|
||||||
|
sr.is_valid(raise_exception=True)
|
||||||
|
ticket = self.get_object()
|
||||||
add_user = User.objects.get(pk=data['toadd_user'])
|
add_user = User.objects.get(pk=data['toadd_user'])
|
||||||
ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL
|
ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL
|
||||||
ticket.participant = add_user.id
|
ticket.participant = add_user.id
|
||||||
|
@ -443,6 +445,10 @@ class TicketViewSet(CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, R
|
||||||
加签完成
|
加签完成
|
||||||
"""
|
"""
|
||||||
ticket = self.get_object()
|
ticket = self.get_object()
|
||||||
|
if ticket.in_add_node is False:
|
||||||
|
raise ParseError('该工单不在加签状态中')
|
||||||
|
elif ticket.participant != request.user.id:
|
||||||
|
raise ParseError('非当前加签人')
|
||||||
ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL
|
ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL
|
||||||
ticket.in_add_node = False
|
ticket.in_add_node = False
|
||||||
ticket.participant = ticket.add_node_man.id
|
ticket.participant = ticket.add_node_man.id
|
||||||
|
|
Loading…
Reference in New Issue