Search in sources :

Example 41 with TestUser

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);
    }
}
Also used : TestPlan(com.ngtesting.platform.entity.TestPlan) TestAlert(com.ngtesting.platform.entity.TestAlert) TestUser(com.ngtesting.platform.entity.TestUser)

Example 42 with TestUser

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;
}
Also used : TestAlertVo(com.ngtesting.platform.vo.TestAlertVo) TestUser(com.ngtesting.platform.entity.TestUser) Date(java.util.Date)

Example 43 with TestUser

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;
}
Also used : TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) TestUser(com.ngtesting.platform.entity.TestUser)

Aggregations

TestUser (com.ngtesting.platform.entity.TestUser)43 HashMap (java.util.HashMap)13 JSONObject (com.alibaba.fastjson.JSONObject)12 AuthPassport (com.ngtesting.platform.util.AuthPassport)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 UserVo (com.ngtesting.platform.vo.UserVo)9 List (java.util.List)9 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)9 TestOrg (com.ngtesting.platform.entity.TestOrg)5 TestVerifyCode (com.ngtesting.platform.entity.TestVerifyCode)5 Date (java.util.Date)5 RelationOrgGroupUserVo (com.ngtesting.platform.vo.RelationOrgGroupUserVo)3 LinkedList (java.util.LinkedList)3 OrgVo (com.ngtesting.platform.vo.OrgVo)2 TestAlert (com.ngtesting.platform.entity.TestAlert)1 TestOrgGroup (com.ngtesting.platform.entity.TestOrgGroup)1 TestOrgRole (com.ngtesting.platform.entity.TestOrgRole)1 TestPlan (com.ngtesting.platform.entity.TestPlan)1 TestProject (com.ngtesting.platform.entity.TestProject)1