mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
添加测试接口
This commit is contained in:
parent
61e15be833
commit
231ece98e5
@ -17,6 +17,8 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.websocket.dto.WebSocketMessageDto;
|
||||||
|
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.dromara.web.domain.bo.*;
|
import org.dromara.web.domain.bo.*;
|
||||||
@ -31,6 +33,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -412,8 +416,24 @@ public class EqHomeController extends BaseController {
|
|||||||
return R.ok(BCrypt.checkpw(bo.getPassword(), sysUserVo.getPassword()));
|
return R.ok(BCrypt.checkpw(bo.getPassword(), sysUserVo.getPassword()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送websocket消息
|
||||||
|
* @param msg
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/sendWebSocketMsg")
|
||||||
|
public R<Void> sendWebSocketMsg(String msg){
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
scheduledExecutorService.schedule(() -> {
|
||||||
|
WebSocketMessageDto dto = new WebSocketMessageDto();
|
||||||
|
dto.setMessage(msg);
|
||||||
|
dto.setSessionKeys(List.of(userId));
|
||||||
|
WebSocketUtils.publishMessage(dto);
|
||||||
|
}, 3, TimeUnit.SECONDS);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user