mirror of https://gitee.com/stylefeng/roses
【message】系统消息接口调试
parent
57df605600
commit
17fedc40f3
|
@ -0,0 +1,40 @@
|
|||
package cn.stylefeng.roses.kernel.message.api.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 消息阅读状态
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/4 22:26
|
||||
*/
|
||||
@Getter
|
||||
public enum MessageBusinessTypeEnum {
|
||||
|
||||
/**
|
||||
* 已读
|
||||
*/
|
||||
SYS_NOTICE("sys_notice", "系统通知");
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
MessageBusinessTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (MessageBusinessTypeEnum flagEnum : MessageBusinessTypeEnum.values()) {
|
||||
if (flagEnum.getCode().equals(code)) {
|
||||
return flagEnum.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 发送系统消息的参数
|
||||
|
@ -46,7 +47,7 @@ public class MessageSendParam extends BaseRequest {
|
|||
/**
|
||||
* 业务id
|
||||
*/
|
||||
@NotBlank(message = "业务id不能为空", groups = {add.class, edit.class})
|
||||
@NotNull(message = "业务id不能为空", groups = {add.class, edit.class})
|
||||
private Long businessId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@ import cn.stylefeng.roses.kernel.message.api.pojo.MessageSendParam;
|
|||
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
|
||||
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
||||
import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -17,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 系统消息控制器
|
||||
|
@ -54,7 +52,7 @@ public class SysMessageController {
|
|||
* @date 2021/1/8 13:50
|
||||
*/
|
||||
@PostResource(name = "批量更新系统消息状态", path = "/sysMessage/batchUpdateReadFlag")
|
||||
public ResponseData sendMessage(@RequestBody @Validated(MessageParam.updateReadFlag.class) MessageParam messageParam) {
|
||||
public ResponseData batchUpdateReadFlag(@RequestBody @Validated(MessageParam.updateReadFlag.class) MessageParam messageParam) {
|
||||
List<Long> messageIdList = messageParam.getMessageIdList();
|
||||
messageApi.batchReadFlagByMessageIds(StrUtil.join(",", messageIdList), MessageReadFlagEnum.READ);
|
||||
return new SuccessResponseData();
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MessageDbServiceImpl implements MessageApi {
|
|||
userIds = Convert.toList(Long.class, userIdArr);
|
||||
}
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
throw new SystemModularException(MessageExceptionEnum.ERROR_RECEIVE_USER_IDS, receiveUserIds);
|
||||
throw new SystemModularException(MessageExceptionEnum.ERROR_RECEIVE_USER_IDS, "传入接收用户id字符串不合法:" + receiveUserIds);
|
||||
}
|
||||
|
||||
Set<Long> userIdSet = new HashSet<>(userIds);
|
||||
|
|
|
@ -27,13 +27,13 @@ public class SysMessage extends BaseEntity {
|
|||
/**
|
||||
* 接收用户id
|
||||
*/
|
||||
@TableId(value = "receive_user_id")
|
||||
@TableField(value = "receive_user_id")
|
||||
private Long receiveUserId;
|
||||
|
||||
/**
|
||||
* 发送用户id
|
||||
*/
|
||||
@TableId(value = "send_user_id")
|
||||
@TableField(value = "send_user_id")
|
||||
private Long sendUserId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
<dependencies>
|
||||
|
||||
<!--消息管理-->
|
||||
<!--<dependency>
|
||||
<dependency>
|
||||
<groupId>cn.stylefeng.roses</groupId>
|
||||
<artifactId>message-business-manage</artifactId>
|
||||
<artifactId>message-business</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>-->
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--消息默认记录到库中-->
|
||||
|
|
|
@ -469,7 +469,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
LambdaQueryWrapper<SysUser> wrapper = createWrapper(sysUserRequest);
|
||||
|
||||
// 排除超级管理员
|
||||
wrapper.ne(SysUser::getSuperAdminFlag, YesOrNotEnum.Y.getCode());
|
||||
// wrapper.ne(SysUser::getSuperAdminFlag, YesOrNotEnum.Y.getCode());
|
||||
|
||||
// 只查询id
|
||||
wrapper.select(SysUser::getUserId);
|
||||
|
|
Loading…
Reference in New Issue