Search in sources :

Example 1 with TestMsgVo

use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method getById.

@Override
public TestMsgVo getById(Long id) {
    TestMsg po = (TestMsg) get(TestMsg.class, id);
    TestMsgVo vo = genVo(po);
    return vo;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo)

Example 2 with TestMsgVo

use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method list.

@Override
public List<TestMsgVo> list(Long userId, Boolean isRead) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestMsg.class);
    dc.add(Restrictions.eq("userId", userId));
    if (isRead != null) {
        dc.add(Restrictions.eq("isRead", isRead));
    }
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.addOrder(Order.desc("createTime"));
    List<TestMsg> pos = findAllByCriteria(dc);
    List<TestMsgVo> vos = genVos(pos);
    return vos;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) DetachedCriteria(org.hibernate.criterion.DetachedCriteria)

Example 3 with TestMsgVo

use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method genVos.

@Override
public List<TestMsgVo> genVos(List<TestMsg> pos) {
    List<TestMsgVo> vos = new LinkedList<>();
    for (TestMsg po : pos) {
        TestMsgVo vo = genVo(po);
        vos.add(vo);
    }
    return vos;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) LinkedList(java.util.LinkedList)

Example 4 with TestMsgVo

use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.

the class MsgAction method markRead.

@AuthPassport(validate = true)
@RequestMapping(value = "markRead", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> markRead(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long id = json.getLong("id");
    TestMsg msg = msgService.markReadPers(id, userVo.getId());
    TestMsgVo vo = msgService.genVo(msg);
    optFacade.opt(WsConstant.WS_TODO, userVo.getId().toString());
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) UserVo(com.ngtesting.platform.vo.UserVo) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with TestMsgVo

use of com.ngtesting.platform.vo.TestMsgVo in project ngtesting-platform by aaronchen2k.

the class MsgAction method get.

@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    Long msgId = json.getLong("id");
    TestMsgVo vo = msgService.getById(msgId);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

TestMsgVo (com.ngtesting.platform.vo.TestMsgVo)7 TestMsg (com.ngtesting.platform.entity.TestMsg)4 JSONObject (com.alibaba.fastjson.JSONObject)3 HashMap (java.util.HashMap)3 AuthPassport (com.ngtesting.platform.util.AuthPassport)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 TestUser (com.ngtesting.platform.entity.TestUser)1 TestAlertVo (com.ngtesting.platform.vo.TestAlertVo)1 UserVo (com.ngtesting.platform.vo.UserVo)1 LinkedList (java.util.LinkedList)1 TimeoutException (java.util.concurrent.TimeoutException)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 TextMessage (org.springframework.web.socket.TextMessage)1