fix(系统管理-消息中心): 接收管理第三方平台渠道在未配置成功状态也能展示
This commit is contained in:
parent
633f04e604
commit
98b3bb213b
@ -3,6 +3,7 @@ package io.dataease.controller.sys;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgChannel;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgSetting;
|
||||
import io.dataease.plugins.common.base.domain.SysMsgType;
|
||||
@ -19,9 +20,11 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
@ -34,17 +37,20 @@ public class MsgController {
|
||||
@Resource
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@Resource
|
||||
private AuthUserService authUserService;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(paramType="path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType="path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "msgRequest", value = "查询条件", required = true)
|
||||
@ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "msgRequest", value = "查询条件", required = true)
|
||||
})
|
||||
public Pager<List<MsgGridDto>> messages(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody MsgRequest msgRequest) {
|
||||
Long userId = AuthUtils.getUser().getUserId();
|
||||
List<Long> typeIds = null;
|
||||
if (ObjectUtils.isNotEmpty(msgRequest.getType())){
|
||||
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
|
||||
List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes();
|
||||
typeIds = sysMsgTypes.stream().filter(sysMsgType -> msgRequest.getType() == sysMsgType.getPid()).map(SysMsgType::getMsgTypeId).collect(Collectors.toList());
|
||||
}
|
||||
@ -56,9 +62,10 @@ public class MsgController {
|
||||
|
||||
@ApiOperation("查询未读数量")
|
||||
@PostMapping("/unReadCount")
|
||||
public Long unReadCount() {;
|
||||
public Long unReadCount() {
|
||||
;
|
||||
Long userId = null;
|
||||
if(null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
|
||||
if (null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
|
||||
throw new RuntimeException("缺少用户ID");
|
||||
}
|
||||
return sysMsgService.queryCount(userId);
|
||||
@ -66,7 +73,7 @@ public class MsgController {
|
||||
|
||||
@ApiOperation("设置已读")
|
||||
@PostMapping("/setReaded/{msgId}")
|
||||
@ApiImplicitParam(paramType="path", name = "msgId", value = "消息ID", required = true, dataType = "Long")
|
||||
@ApiImplicitParam(paramType = "path", name = "msgId", value = "消息ID", required = true, dataType = "Long")
|
||||
public void setReaded(@PathVariable Long msgId) {
|
||||
sysMsgService.setReaded(msgId);
|
||||
}
|
||||
@ -109,7 +116,21 @@ public class MsgController {
|
||||
@ApiOperation("查询渠道")
|
||||
@PostMapping("/channelList")
|
||||
public List<SysMsgChannel> channelList() {
|
||||
return sysMsgService.channelList();
|
||||
List<SysMsgChannel> sysMsgChannels = sysMsgService.channelList();
|
||||
if (ObjectUtils.isEmpty(sysMsgChannels)) return sysMsgChannels;
|
||||
return sysMsgChannels.stream().filter(channel -> {
|
||||
Long msgChannelId = channel.getMsgChannelId();
|
||||
if (msgChannelId == 3L) {
|
||||
return authUserService.supportWecom();
|
||||
}
|
||||
if (msgChannelId == 4L) {
|
||||
return authUserService.supportDingtalk();
|
||||
}
|
||||
if (msgChannelId == 5L) {
|
||||
return authUserService.supportLark();
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@ApiOperation("查询订阅")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user