fix(系统管理-消息中心): 接收管理第三方平台渠道在未配置成功状态也能展示

This commit is contained in:
fit2cloud-chenyw 2022-09-19 16:25:22 +08:00
parent 633f04e604
commit 98b3bb213b

View File

@ -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,6 +37,9 @@ public class MsgController {
@Resource
private SysMsgService sysMsgService;
@Resource
private AuthUserService authUserService;
@ApiOperation("分页查询")
@PostMapping("/list/{goPage}/{pageSize}")
@ApiImplicitParams({
@ -56,7 +62,8 @@ public class MsgController {
@ApiOperation("查询未读数量")
@PostMapping("/unReadCount")
public Long unReadCount() {;
public Long unReadCount() {
;
Long userId = null;
if (null == AuthUtils.getUser() || (userId = AuthUtils.getUser().getUserId()) == null) {
throw new RuntimeException("缺少用户ID");
@ -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("查询订阅")