【message】系统消息接口调试

pull/3/head
liuhanqing 2021-01-08 19:37:43 +08:00
parent 57df605600
commit 17fedc40f3
7 changed files with 50 additions and 11 deletions

View File

@ -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;
}
}

View File

@ -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;
/**

View File

@ -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();

View File

@ -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);

View File

@ -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;
/**

View File

@ -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>
<!--消息默认记录到库中-->

View File

@ -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);