配置是否发送亚微消息

This commit is contained in:
wangliwen 2022-10-31 16:35:21 +08:00
parent ddd1c3196a
commit ca652464d9
2 changed files with 15 additions and 5 deletions

View File

@ -29,6 +29,7 @@ import org.apache.shiro.session.UnknownSessionException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -65,6 +66,9 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
@Autowired @Autowired
private NoticeUntil noticeUntil; private NoticeUntil noticeUntil;
@Value("#{new Boolean(${notice.yawei})")
private Boolean noticeYaWei; // 是否发送消息到亚微中心
@Override @Override
public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) { public QueryWrapper<SysNoticeEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<SysNoticeEntity> wrapper = new QueryWrapper<>(); QueryWrapper<SysNoticeEntity> wrapper = new QueryWrapper<>();
@ -212,11 +216,15 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
MessageData<String> message = new MessageData<String>().msg(notice.getTitle()); MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
webSocketServer.sendMessage(finalUserIdList, message); webSocketServer.sendMessage(finalUserIdList, message);
}, executor).thenRunAsync(() -> { }, executor).thenRunAsync(() -> {
if (noticeYaWei) {
try { try {
sendToYaweiUser(notice, finalUserIdList); sendToYaweiUser(notice, finalUserIdList);
} catch (Exception exception) { } catch (Exception exception) {
logger.error("", exception); logger.error("", exception);
} }
} else {
logger.info("无需发送到第三方 亚微消息");
}
}, executor); }, executor);
} }
} }

View File

@ -152,4 +152,6 @@ front:
# 基础设施,部门最大申请数量 # 基础设施,部门最大申请数量
infrastructure: infrastructure:
dept-can-apply-max: 10 dept-can-apply-max: 10
# 是否发亚微消息
notice:
yawei: true