【7.0.4】【notice】整理消息和通知

pull/22/head
fengshuonan 2021-06-14 22:45:22 +08:00
parent 1a8affbb9e
commit 038be58952
3 changed files with 80 additions and 2 deletions

View File

@ -20,7 +20,22 @@
<!--消息api模块-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>message-api</artifactId>
<artifactId>message-sdk-db</artifactId>
<version>${roses.version}</version>
</dependency>
<!--包装器模块-->
<!--包装结果-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>wrapper-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--系统管理api模块-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>system-api</artifactId>
<version>${roses.version}</version>
</dependency>

View File

@ -22,7 +22,7 @@
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.message.modular;
package cn.stylefeng.roses.kernel.message.modular.controller;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.message.api.MessageApi;
@ -30,11 +30,13 @@ import cn.stylefeng.roses.kernel.message.api.enums.MessageReadFlagEnum;
import cn.stylefeng.roses.kernel.message.api.pojo.request.MessageRequest;
import cn.stylefeng.roses.kernel.message.api.pojo.request.MessageSendRequest;
import cn.stylefeng.roses.kernel.message.api.pojo.response.MessageResponse;
import cn.stylefeng.roses.kernel.message.modular.wrapper.MessageWrapper;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.wrapper.api.annotation.Wrapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -127,6 +129,7 @@ public class SysMessageController {
* @date 2021/1/8 13:50
*/
@GetResource(name = "分页查询系统消息列表", path = "/sysMessage/page")
@Wrapper(MessageWrapper.class)
public ResponseData page(MessageRequest messageRequest) {
return new SuccessResponseData(messageApi.queryPageCurrentUser(messageRequest));
}

View File

@ -0,0 +1,60 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.message.modular.wrapper;
import cn.hutool.extra.spring.SpringUtil;
import cn.stylefeng.roses.kernel.message.api.pojo.response.MessageResponse;
import cn.stylefeng.roses.kernel.system.api.UserServiceApi;
import cn.stylefeng.roses.kernel.system.api.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.wrapper.api.BaseWrapper;
import java.util.HashMap;
import java.util.Map;
/**
*
*
* @author fengshuonan
* @date 2021/6/14 17:28
*/
public class MessageWrapper implements BaseWrapper<MessageResponse> {
@Override
public Map<String, Object> doWrap(MessageResponse beWrappedModel) {
HashMap<String, Object> resultMap = new HashMap<>();
UserServiceApi userServiceApi = SpringUtil.getBean(UserServiceApi.class);
if (beWrappedModel.getSendUserId() != null) {
SysUserDTO sysUserDTO = userServiceApi.getUserInfoByUserId(beWrappedModel.getSendUserId());
if (sysUserDTO != null) {
resultMap.put("sendUserName", sysUserDTO.getRealName());
}
}
return resultMap;
}
}