use of com.ngtesting.platform.vo.TestAlertVo 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.TestAlertVo in project ngtesting-platform by aaronchen2k.
the class AlertServiceImpl method genVos.
@Override
public List<TestAlertVo> genVos(List<TestAlert> pos) {
List<TestAlertVo> vos = new LinkedList<>();
for (TestAlert run : pos) {
TestAlertVo vo = genVo(run);
vos.add(vo);
}
return vos;
}
use of com.ngtesting.platform.vo.TestAlertVo in project ngtesting-platform by aaronchen2k.
the class AlertServiceImpl method genVo.
@Override
public TestAlertVo genVo(TestAlert po) {
TestAlertVo vo = new TestAlertVo();
BeanUtilEx.copyProperties(vo, po);
vo.setName(po.getEntityName());
TestUser user = (TestUser) get(TestUser.class, po.getUserId());
TestUser assignee = (TestUser) get(TestUser.class, po.getAssigneeId());
vo.setUserName(user.getName());
vo.setUserAvatar(user.getAvatar());
vo.setAssigneeName(assignee.getName());
vo.setAssigneeAvatar(assignee.getAvatar());
Date now = new Date();
Long startTimeOfToday = DateUtils.GetStartTimeOfDay(now).getTime();
Long endTimeOfToday = DateUtils.GetEndTimeOfDay(now).getTime();
Date startTime = po.getStartTime();
Date endTime = po.getEndTime();
if (endTime != null && endTime.getTime() >= startTimeOfToday && endTime.getTime() <= endTimeOfToday) {
vo.setTitle("测试集" + StringUtil.highlightDict(vo.getName()) + "完成");
} else {
vo.setTitle("测试集" + StringUtil.highlightDict(vo.getName()) + "开始");
}
return vo;
}
Aggregations