Commit 7833928c authored by jiaorz's avatar jiaorz

添加积分消息队列接口

parent 0e007d09
...@@ -45,7 +45,10 @@ public class MsgBiz { ...@@ -45,7 +45,10 @@ public class MsgBiz {
public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type) throws Exception { public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type) throws Exception {
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null;
if(appUserDTO != null) {
userId = appUserDTO.getImUserid();
}
log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit, type); log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit, type);
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
...@@ -54,7 +57,7 @@ public class MsgBiz { ...@@ -54,7 +57,7 @@ public class MsgBiz {
List<Msg> msgList = null; List<Msg> msgList = null;
if (type != null) { if (type != null) {
query = new Query(Criteria.where("body.type").is(type)); query = new Query(Criteria.where("body.type").is(type));
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid()); msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
...@@ -62,7 +65,7 @@ public class MsgBiz { ...@@ -62,7 +65,7 @@ public class MsgBiz {
ids.add(2); ids.add(2);
ids.add(4); ids.add(4);
query = new Query(Criteria.where("body.type").in(ids)); query = new Query(Criteria.where("body.type").in(ids));
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid()); msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} }
...@@ -87,11 +90,15 @@ public class MsgBiz { ...@@ -87,11 +90,15 @@ public class MsgBiz {
public ObjectRestResponse get(String id){ public ObjectRestResponse get(String id){
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null;
if(appUserDTO != null) {
userId = appUserDTO.getImUserid();
}
if(id == null) { if(id == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
Query query = new Query(Criteria.where("id").is(new ObjectId(id))); Query query = new Query(Criteria.where("id").is(new ObjectId(id)));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid()); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
List<MsgVo> msgVoList = replaceMsgResult(msgList); List<MsgVo> msgVoList = replaceMsgResult(msgList);
if(msgVoList.size() > 0) { if(msgVoList.size() > 0) {
return ObjectRestResponse.succ(msgVoList.get(0)); return ObjectRestResponse.succ(msgVoList.get(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment