通过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));

    }
相关推荐
树℡独6 小时前
ns-3仿真之应用层(五)
服务器·网络·tcp/ip·ns3
zhang133830890757 小时前
CG-09H 超声波风速风向传感器 加热型 ABS材质 重量轻 没有机械部件
大数据·运维·网络·人工智能·自动化
津津有味道8 小时前
易语言TCP服务端接收刷卡数据并向客户端读卡器发送指令
服务器·网络协议·tcp·易语言
酣大智9 小时前
接口模式参数
运维·网络·网络协议·tcp/ip
Genie cloud9 小时前
1Panel SSL证书申请完整教程
服务器·网络协议·云计算·ssl
24zhgjx-lxq10 小时前
华为ensp:MSTP
网络·安全·华为·hcip·ensp
ling___xi10 小时前
《计算机网络》计网3小时期末速成课各版本教程都可用谢稀仁湖科大版都可用_哔哩哔哩_bilibili(笔记)
网络·笔记·计算机网络
REDcker10 小时前
Linux 文件描述符与 Socket 选项操作详解
linux·运维·网络
Up九五小庞10 小时前
用arpspoof实现100%批量切断192.168.110.10 - 192.168.110.100 断网(双向欺骗)--九五小庞
网络·开源
躺柒10 小时前
读数字时代的网络风险管理:策略、计划与执行04风险指引体系
大数据·网络·信息安全·数字化·网络管理·网络风险管理