Commit 1d3887b3 authored by 竹天卫's avatar 竹天卫

移动端消息列表

parent cbe6cb6f
package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.service.ISysUserMessageService;
import cn.wise.sc.cement.business.wrapper.WrapMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -13,9 +22,31 @@ import org.springframework.web.bind.annotation.RestController;
* @author ztw
* @since 2020-10-13
*/
@Api(tags = "企业微信移动端-消息管理")
@RestController
@RequestMapping("/business/sys-user-message")
public class SysUserMessageController {
private static final Logger log = LoggerFactory.getLogger("TeamGroupController");
@Autowired
private ISysUserMessageService userMessageService;
@ApiOperation(value = "消息通知列表")
@GetMapping("/getMessages")
public BaseResponse getMessages() {
try {
return userMessageService.getMessages();
} catch (Exception e) {
log.debug("消息通知列表{}",e);
}
return BaseResponse.errorMsg("失败!");
}
}
......@@ -6,6 +6,8 @@ import cn.wise.sc.cement.business.util.WebSocketServer;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* <p>
* 服务类
......@@ -22,6 +24,8 @@ public interface ISysUserMessageService extends IService<SysUserMessage> {
BaseResponse<String> dealMessage(Integer userId, Integer appId, Integer messageType);
BaseResponse<List<SysUserMessage>> getMessages();
......
......@@ -4,6 +4,7 @@ import cn.wise.sc.cement.business.entity.SysUser;
import cn.wise.sc.cement.business.entity.SysUserMessage;
import cn.wise.sc.cement.business.mapper.SysUserMessageMapper;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.Message;
import cn.wise.sc.cement.business.service.ISysUserMessageService;
import cn.wise.sc.cement.business.service.ISysUserService;
......@@ -41,6 +42,8 @@ public class SysUserMessageServiceImpl extends ServiceImpl<SysUserMessageMapper,
protected HttpServletRequest request;
@Autowired
WebSocketServer webSocketServer;
@Autowired
private ISysUserService userService;
/**
* 发送消息
......@@ -128,5 +131,21 @@ public class SysUserMessageServiceImpl extends ServiceImpl<SysUserMessageMapper,
return BaseResponse.okData("成功");
}
/**
* 消息列表
* @return
*/
@Override
public BaseResponse<List<SysUserMessage>> getMessages(){
LoginUser loginUser = userService.getLoginUser();
if(loginUser == null){
return BaseResponse.errorMsg("请登录账号");
}
List<SysUserMessage> list = this.userMessageMapper.getNoDeal(loginUser.getId(), null, null);
return BaseResponse.okData(list);
}
}
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