完成客户催单功能

This commit is contained in:
subaixi 2024-10-06 22:25:32 +08:00
parent 682786dd27
commit 1116905790
3 changed files with 37 additions and 0 deletions

View File

@ -118,4 +118,16 @@ public class OrderController {
orderService.repetition(id); orderService.repetition(id);
return Result.success(); return Result.success();
} }
/**
* 用户催单
* @param id
* @return
*/
@GetMapping("/reminder/{id}")
@ApiOperation("用户催单")
public Result reminder(@PathVariable Long id) {
orderService.reminder(id);
return Result.success();
}
} }

View File

@ -99,4 +99,10 @@ public interface OrderService {
* @param id * @param id
*/ */
void complete(Long id); void complete(Long id);
/**
* 订单催单
* @param id
*/
void reminder(Long id);
} }

View File

@ -478,6 +478,25 @@ public class OrderServiceImpl implements OrderService {
orderMapper.update(orders); orderMapper.update(orders);
} }
/**
* 订单催单
* @param id
*/
public void reminder(Long id) {
// 查询订单是否存在
Orders orders = orderMapper.getById(id);
if (orders == null) {
throw new OrderBusinessException(MessageConstant.ORDER_NOT_FOUND);
}
//基于WebSocket实现催单
Map map = new HashMap();
map.put("type", 2);//2代表用户催单
map.put("orderId", id);
map.put("content", "订单号:" + orders.getNumber());
webSocketServer.sendToAllClient(JSON.toJSONString(map));
}
private List<OrderVO> getOrderVOList(Page<Orders> page) { private List<OrderVO> getOrderVOList(Page<Orders> page) {
//需要返回订单菜品信息自定义OrderVO响应结果 //需要返回订单菜品信息自定义OrderVO响应结果
List<OrderVO> orderVOList = new ArrayList<>(); List<OrderVO> orderVOList = new ArrayList<>();