案例描述

在平台上的消息服务类发送消息与通知

实现思路

  1. 确定平台现有的websocket是通的,8088端口是可用的,instant数据库是可以连上的

  2. 在写后台代码,调运相关方法进行推送

  3. 在平台功能写个测试按钮,调运接口进行测试

操作步骤

1. 确定平台现有的websocket是通的,8088端口是可用的,instant数据库是可以连上的

2. 在写后台代码,调运相关方法进行推送

@Controller
@RequestMapping(value = "/je/demo/test")
public class TestDemoController  extends AbstractPlatformController {
    @Autowired
    private UserMsgManaer userMsgManaer;
    @Autowired
    private DwrManager dwrManager;

    @RequestMapping(value = "/getMsg", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    @ResponseBody
    public void getMsg(){
        EndUser user = SecurityUserHolder.getCurrentUser();
        String userId= user.getUserId();
        String userName = user.getUsername();
        //通知内容
        String HYTZ_NR ="请尽快审批";
        String title = "测试消息发送";
        dwrManager.sendMsg(userId,title,HYTZ_NR);
        userMsgManaer.sendMsg(userName,userId,title,HYTZ_NR,"MSG","消息","",null);
    }
}

3. 在平台功能写个测试按钮,调运接口进行测试

- 页面消息提醒效果

- 通知消息提醒效果

最后编辑: 呼丽华  文档更新时间: 2024-03-05 11:49   作者:呼丽华