controller层
@GetMapping("/reminder/{id}")
public Result Remainder(@PathVariable("id") Long id){
orderService.remainder(id);
return Result.success();
}
实现类
@Override
public void remainder(Long id) {
Orders ordersDB = orderMapper.getById(id);
// 校验订单是否存在,并且状态为4
if (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));
}