提交 f37462bc 编写于 作者: tangyaolong's avatar tangyaolong

修改内容

上级 a6d79f3c
...@@ -658,16 +658,11 @@ public class NotifyCoreService { ...@@ -658,16 +658,11 @@ public class NotifyCoreService {
* 获取某个用户全量存储催办消息 * 获取某个用户全量存储催办消息
* @return * @return
*/ */
public Page<MsgBody> getBacklogAllContent(String toUserId,int msgType) { public Page<MsgBody> getBacklogAllContent(MsgBodySearchContext context) {
if(StringUtils.isEmpty(toUserId)) if(ObjectUtils.isEmpty(context)){
throw new BadRequestAlertException("无效用户ID","NotifyCoreService","getBacklogAllContent"); throw new BadRequestAlertException("无效消息上下文","NotifyCoreService","getBacklogAllContent");
if(ObjectUtils.isEmpty(msgType)) }
throw new BadRequestAlertException("无效消息种类","NotifyCoreService","getBacklogAllContent");
MsgBodySearchContext context = new MsgBodySearchContext();
context.setSize(Integer.MAX_VALUE); context.setSize(Integer.MAX_VALUE);
context.setN_msgtype_eq(msgType);
context.setN_tousers_eq(toUserId);
Page<MsgBody> result = msgBodyService.searchDefault(context); Page<MsgBody> result = msgBodyService.searchDefault(context);
return result; return result;
} }
...@@ -688,9 +683,9 @@ public class NotifyCoreService { ...@@ -688,9 +683,9 @@ public class NotifyCoreService {
* @return * @return
*/ */
public Page<MsgBody> getBacklogByPage(MsgBodySearchContext context) { public Page<MsgBody> getBacklogByPage(MsgBodySearchContext context) {
if(ObjectUtils.isEmpty(context)) if(ObjectUtils.isEmpty(context)){
throw new BadRequestAlertException("无效消息上下文","NotifyCoreService","getBacklogAllContent"); throw new BadRequestAlertException("无效消息上下文","NotifyCoreService","getBacklogAllContent");
}
String toUserId = context.getN_tousers_eq(); String toUserId = context.getN_tousers_eq();
if(!msgMap.containsKey(toUserId) && !expireMap.containsKey(toUserId)){ if(!msgMap.containsKey(toUserId) && !expireMap.containsKey(toUserId)){
return getBacklogPageContent(context); return getBacklogPageContent(context);
......
...@@ -4,16 +4,12 @@ import cn.ibizlab.api.dto.MsgBodyDTO; ...@@ -4,16 +4,12 @@ import cn.ibizlab.api.dto.MsgBodyDTO;
import cn.ibizlab.api.mapping.MsgBodyMapping; import cn.ibizlab.api.mapping.MsgBodyMapping;
import cn.ibizlab.core.extensions.domain.Template; import cn.ibizlab.core.extensions.domain.Template;
import cn.ibizlab.core.extensions.service.NotifyCoreService; import cn.ibizlab.core.extensions.service.NotifyCoreService;
import cn.ibizlab.core.notify.domain.MsgBody;
import cn.ibizlab.core.notify.filter.MsgBodySearchContext; import cn.ibizlab.core.notify.filter.MsgBodySearchContext;
import cn.ibizlab.core.notify.filter.MsgOpenAccessSearchContext;
import cn.ibizlab.core.notify.filter.MsgUserAccountSearchContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
...@@ -80,10 +76,16 @@ public class NotifyCoreResource { ...@@ -80,10 +76,16 @@ public class NotifyCoreResource {
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST,value = "/notify/msgbody/getallbacklogall") @RequestMapping(method = RequestMethod.POST,value = "/notify/msgbody/getallbacklogall")
public ResponseEntity<Page> getAllBacklogAll(@RequestBody MsgBodyDTO dto){ public ResponseEntity<List<MsgBodyDTO>> getAllBacklogAll(@RequestBody MsgBodySearchContext context){
Page page = notifyCoreService.getBacklogAllContent(dto.getToUsers(),dto.getMsgType()); Page domains = notifyCoreService.getBacklogAllContent(context);
return ResponseEntity.status(HttpStatus.OK).body(new PageImpl(mapping.toDto(page.getContent()), page.getPageable(), page.getTotalElements())); List<MsgBodyDTO> list = mapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
} }
/** /**
* 分页获取催办消息 * 分页获取催办消息
* @param * @param
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册