通过websocket给服务端发送订单催单提醒消息

controller层

java 复制代码
@GetMapping("/reminder/{id}")
    public Result Remainder(@PathVariable("id") Long id){
        orderService.remainder(id);
        return Result.success();
    }

实现类

java 复制代码
    @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));

    }
相关推荐
YuMiao1 天前
gstatic连接问题导致Google Gemini / Studio页面乱码或图标缺失问题
服务器·网络协议
Jony_4 天前
高可用移动网络连接
网络协议
chilix4 天前
Linux 跨网段路由转发配置
网络协议
DianSan_ERP6 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅6 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
gihigo19986 天前
基于TCP协议实现视频采集与通信
网络协议·tcp/ip·音视频
2501_946205526 天前
晶圆机器人双臂怎么选型?适配2-12寸晶圆的末端效应器有哪些?
服务器·网络·机器人
linux kernel6 天前
第七部分:高级IO
服务器·网络
数字护盾(和中)6 天前
BAS+ATT&CK:企业主动防御的黄金组合
服务器·网络·数据库
~远在太平洋~6 天前
Debian系统如何删除多余的kernel
linux·网络·debian