use of com.ngtesting.platform.entity.TestUser in project ngtesting-platform by aaronchen2k.
the class AlertServiceImpl method saveAlert.
@Override
public void saveAlert(TestRun run) {
for (TestUser user : run.getAssignees()) {
TestAlert po = getByRun(run.getId());
;
if (po == null) {
po = new TestAlert();
}
po.setType("run");
po.setDescr(run.getDescr());
po.setEntityId(run.getId());
po.setEntityName(run.getName());
po.setStatus(run.getStatus().toString());
po.setRead(false);
po.setUserId(run.getUserId());
po.setAssigneeId(user.getId());
TestPlan plan = run.getPlan();
if (plan == null || plan.getId() == null) {
plan = (TestPlan) get(TestPlan.class, run.getPlanId());
}
po.setStartTime(plan.getStartTime());
po.setEndTime(plan.getEndTime());
saveOrUpdate(po);
}
}
use of com.ngtesting.platform.entity.TestUser 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;
}
use of com.ngtesting.platform.entity.TestUser 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