use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.
the class OptFacade method opt.
public void opt(JSONObject json, String userId) {
Map<String, Object> ret = new HashMap<>();
String type = json.getString("type");
try {
if (WsConstant.WS_OPEN.equals(type) || WsConstant.WS_TODO.equals(type)) {
List<TestMsgVo> msgs = msgService.list(Long.valueOf(userId), false);
List<TestAlertVo> alerts = alertService.list(Long.valueOf(userId), false);
ret.put("msgs", msgs);
ret.put("alerts", alerts);
ret.put("type", WsConstant.WS_MSG_AND_ALERT_LASTEST);
} else if (WsConstant.WS_OPT_ENTER_CHAT_ROOM.equals(type)) {
ret = optChat.enter(json);
} else if (WsConstant.WS_OPT_CHAT.equals(type)) {
ret = optChat.chat(json);
}
} catch (Exception e) {
logger.error(ExceptionUtil.GetExceptionInfo(e));
if (e.getCause() instanceof TimeoutException) {
ret.put("code", RespCode.BIZ_FAIL.getCode());
ret.put("msg", "操作超时!");
} else {
ret.put("msg", "操作出错,请稍后重试");
}
}
ret.put("code", 1);
if (ret.get("type") != null) {
scopeBean.sendMessageToClient(userId, new TextMessage(JSON.toJSONString(ret)));
}
}
use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.
the class MsgServiceImpl method genVo.
@Override
public TestMsgVo genVo(TestMsg po) {
TestMsgVo vo = new TestMsgVo();
BeanUtilEx.copyProperties(vo, po);
TestUser user = (TestUser) get(TestUser.class, po.getUserId());
vo.setAvatar(user.getAvatar());
return vo;
}
Aggregations