controller層
@GetMapping("/reminder/{id}")public Result Remainder(@PathVariable("id") Long id){orderService.remainder(id);return Result.success();}
實現類
@Overridepublic void remainder(Long id) {Orders ordersDB = orderMapper.getById(id);// 校驗訂單是否存在,并且狀態為4if (ordersDB == null) {throw new OrderBusinessException(MessageConstant.ORDER_STATUS_ERROR);}HashMap map = new HashMap();map.put("type",2);map.put("orderId",id);map.put("content","訂單號" + ordersDB.getNumber());webSocketServer.sendToAllClient(JSON.toJSONString(map));}