package com.example.xiaoshiweixinback.controller; import com.example.xiaoshiweixinback.business.common.Constants; import com.example.xiaoshiweixinback.business.common.Response; import com.example.xiaoshiweixinback.business.common.base.Records; import com.example.xiaoshiweixinback.checkLogin.checkLogin; import com.example.xiaoshiweixinback.entity.dto.ticket.AcceptTicketDTO; import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO; import com.example.xiaoshiweixinback.entity.dto.ticket.TicketQueryDTO; import com.example.xiaoshiweixinback.entity.product.ProductDTO; import com.example.xiaoshiweixinback.entity.dto.ticket.TicketDTO; import com.example.xiaoshiweixinback.service.TicketService; import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Slf4j @RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/ticket") @RestController @RequiredArgsConstructor public class TicketController { private final TicketService ticketService; @checkLogin @Operation(summary = "添加工单") @PostMapping("/addTicket") public Response addTicket(@RequestBody TicketDTO ticketDTO) { Integer id = ticketService.addorUpdateTicket(ticketDTO); if (!id.equals(-1)) { Records records = new Records(); records.setData(id); return Response.success(records); } else { return Response.error("发生错误"); } } public Response queryHotProduct(@RequestBody ProductDTO productDTO) { // Records records =productService.queryHotProduct(productDTO); return Response.success("records"); } @Operation(summary = "更新工单进度") @PostMapping("/updateTicketProcess") public Response updateTicketProcess(@RequestBody TicketProcessUpDTO ticketProcessUpDTO) { Integer id = ticketService.updateProcess(ticketProcessUpDTO); if (id.equals(0)) { return Response.error("更新工单进度失败,没有权限"); } return Response.success(id); } @Operation(summary = "查询工单") @PostMapping("/queryTicket") @checkLogin public Response queryTicket(@RequestBody TicketQueryDTO ticketQueryDTO) { Records records = ticketService.queryTickets(ticketQueryDTO); return Response.success(records); } @Operation(summary = "受理工单") @PostMapping("/acceptTicket") @checkLogin public Response acceptTicket(@RequestBody AcceptTicketDTO acceptTicketDTO) { Integer id = ticketService.acceptTicket(acceptTicketDTO); Records records = new Records(); records.setData(id); return Response.success(records); } }