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

修改内容

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