配置是否发送亚微消息

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

View File

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