TicketController.java 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.example.xiaoshiweixinback.controller;
  2. import com.example.xiaoshiweixinback.business.common.Constants;
  3. import com.example.xiaoshiweixinback.business.common.Response;
  4. import com.example.xiaoshiweixinback.business.common.base.Records;
  5. import com.example.xiaoshiweixinback.checkLogin.checkLogin;
  6. import com.example.xiaoshiweixinback.entity.dto.ticket.AcceptTicketDTO;
  7. import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO;
  8. import com.example.xiaoshiweixinback.entity.dto.ticket.TicketQueryDTO;
  9. import com.example.xiaoshiweixinback.entity.product.ProductDTO;
  10. import com.example.xiaoshiweixinback.entity.dto.ticket.TicketDTO;
  11. import com.example.xiaoshiweixinback.service.TicketService;
  12. import io.swagger.v3.oas.annotations.Operation;
  13. import lombok.RequiredArgsConstructor;
  14. import lombok.extern.slf4j.Slf4j;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. @Slf4j
  20. @RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/ticket")
  21. @RestController
  22. @RequiredArgsConstructor
  23. public class TicketController {
  24. private final TicketService ticketService;
  25. @checkLogin
  26. @Operation(summary = "添加工单")
  27. @PostMapping("/addTicket")
  28. public Response addTicket(@RequestBody TicketDTO ticketDTO) {
  29. Integer id = ticketService.addorUpdateTicket(ticketDTO);
  30. if (!id.equals(-1)) {
  31. Records records = new Records();
  32. records.setData(id);
  33. return Response.success(records);
  34. } else {
  35. return Response.error("发生错误");
  36. }
  37. }
  38. public Response queryHotProduct(@RequestBody ProductDTO productDTO) {
  39. // Records records =productService.queryHotProduct(productDTO);
  40. return Response.success("records");
  41. }
  42. @Operation(summary = "更新工单进度")
  43. @PostMapping("/updateTicketProcess")
  44. public Response updateTicketProcess(@RequestBody TicketProcessUpDTO ticketProcessUpDTO) {
  45. Integer id = ticketService.updateProcess(ticketProcessUpDTO);
  46. if (id.equals(0)) {
  47. return Response.error("更新工单进度失败,没有权限");
  48. }
  49. return Response.success(id);
  50. }
  51. @Operation(summary = "查询工单")
  52. @PostMapping("/queryTicket")
  53. @checkLogin
  54. public Response queryTicket(@RequestBody TicketQueryDTO ticketQueryDTO) {
  55. Records records = ticketService.queryTickets(ticketQueryDTO);
  56. return Response.success(records);
  57. }
  58. @Operation(summary = "受理工单")
  59. @PostMapping("/acceptTicket")
  60. @checkLogin
  61. public Response acceptTicket(@RequestBody AcceptTicketDTO acceptTicketDTO) {
  62. Integer id = ticketService.acceptTicket(acceptTicketDTO);
  63. Records records = new Records();
  64. records.setData(id);
  65. return Response.success(records);
  66. }
  67. }