fix(ticket): remove batch assign and restructure detail dialog
This commit is contained in:
@@ -183,21 +183,6 @@ func (c *TicketController) PostAssign() *web.JsonResult {
|
||||
return web.JsonSuccess()
|
||||
}
|
||||
|
||||
func (c *TicketController) PostBatch_assign() *web.JsonResult {
|
||||
operator, err := services.AuthService.RequirePermission(c.Ctx, constants.PermissionTicketAssign)
|
||||
if err != nil {
|
||||
return web.JsonError(err)
|
||||
}
|
||||
req := request.BatchAssignTicketRequest{}
|
||||
if err := params.ReadJSON(c.Ctx, &req); err != nil {
|
||||
return web.JsonError(err)
|
||||
}
|
||||
if err := services.TicketService.BatchAssignTickets(req, operator); err != nil {
|
||||
return web.JsonError(err)
|
||||
}
|
||||
return web.JsonSuccess()
|
||||
}
|
||||
|
||||
func (c *TicketController) PostChange_status() *web.JsonResult {
|
||||
operator, err := services.AuthService.RequirePermission(c.Ctx, constants.PermissionTicketChangeStatus)
|
||||
if err != nil {
|
||||
|
||||
@@ -43,12 +43,6 @@ type CreateTicketProgressRequest struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type BatchAssignTicketRequest struct {
|
||||
TicketIDs []int64 `json:"ticketIds"`
|
||||
ToUserID int64 `json:"toUserId"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
type SaveTicketViewRequest struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
||||
@@ -330,39 +330,6 @@ func (s *ticketService) AssignTicket(req request.AssignTicketRequest, operator *
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ticketService) BatchAssignTickets(req request.BatchAssignTicketRequest, operator *dto.AuthPrincipal) error {
|
||||
if operator == nil {
|
||||
return errorsx.Unauthorized("未登录或登录已过期")
|
||||
}
|
||||
ticketIDs := normalizeInt64IDs(req.TicketIDs)
|
||||
if len(ticketIDs) == 0 {
|
||||
return errorsx.InvalidParam("请选择工单")
|
||||
}
|
||||
assignedEvents := make([]events.TicketAssignedEvent, 0, len(ticketIDs))
|
||||
if err := sqls.WithTransaction(func(ctx *sqls.TxContext) error {
|
||||
for _, ticketID := range ticketIDs {
|
||||
event, err := s.assignTicketTx(ctx.Tx, request.AssignTicketRequest{
|
||||
TicketID: ticketID,
|
||||
ToUserID: req.ToUserID,
|
||||
Reason: req.Reason,
|
||||
}, operator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if event != nil {
|
||||
assignedEvents = append(assignedEvents, *event)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := range assignedEvents {
|
||||
eventbus.PublishAsync(context.Background(), assignedEvents[i])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ticketService) ChangeStatus(req request.ChangeTicketStatusRequest, operator *dto.AuthPrincipal) error {
|
||||
if operator == nil {
|
||||
return errorsx.Unauthorized("未登录或登录已过期")
|
||||
|
||||
Reference in New Issue
Block a user