Merge remote-tracking branch 'origin/group5-notice'

pull/3/head
fengshuonan 2021-01-13 11:01:54 +08:00
commit 5a5b588f8d
7 changed files with 101 additions and 2 deletions

View File

@ -121,4 +121,25 @@ public interface MessageApi {
*/ */
List<MessageResponse> queryListCurrentUser(MessageParam messageParam); List<MessageResponse> queryListCurrentUser(MessageParam messageParam);
/**
*
*
* @param messageParam
* @return
* @author liuhanqing
* @date 2021/1/11 21:21
*/
Integer queryCount(MessageParam messageParam);
/**
*
*
* @param messageParam
* @return
* @author liuhanqing
* @date 2021/1/11 21:21
*/
Integer queryCountCurrentUser(MessageParam messageParam);
} }

View File

@ -1,9 +1,13 @@
package cn.stylefeng.roses.kernel.message.api.pojo; package cn.stylefeng.roses.kernel.message.api.pojo;
import cn.stylefeng.roses.kernel.message.api.enums.MessageProrityLevelEnum;
import cn.stylefeng.roses.kernel.message.api.enums.MessageReadFlagEnum;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
/** /**
* *
@ -69,4 +73,29 @@ public class MessageResponse implements Serializable {
*/ */
private Integer readFlag; private Integer readFlag;
/**
*
*/
private String priorityLevelValue;
/**
* 0-1-
*/
private String readFlagValue;
public String getPriorityLevelValue(){
AtomicReference<String> value = new AtomicReference<>("");
Optional.ofNullable(this.priorityLevel).ifPresent(val ->{
value.set(MessageProrityLevelEnum.getName(this.priorityLevel));
});
return value.get();
}
public String getReadFlagValue(){
AtomicReference<String> value = new AtomicReference<>("");
Optional.ofNullable(this.readFlag).ifPresent(val ->{
value.set(MessageReadFlagEnum.getName(this.readFlag));
});
return value.get();
}
} }

View File

@ -15,7 +15,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
@ -117,4 +119,20 @@ public class SysMessageController {
return new SuccessResponseData(messageApi.queryListCurrentUser(messageParam)); return new SuccessResponseData(messageApi.queryListCurrentUser(messageParam));
} }
/**
*
*
* @author liuhanqing
* @date 2021/1/11 19:50
*/
@GetResource(name = "系统消息列表", path = "/sysMessage/unReadCount")
public ResponseData msgUnRead(MessageParam messageParam) {
messageParam.setReadFlag(MessageReadFlagEnum.UNREAD.getCode());
Integer messageCount = messageApi.queryCountCurrentUser(messageParam);
Map<String, Object> msgMap = new HashMap<>(1);
msgMap.put("msgUnReadCount", messageCount);
return new SuccessResponseData(messageApi.queryListCurrentUser(messageParam));
}
} }

View File

@ -194,4 +194,19 @@ public class MessageDbServiceImpl implements MessageApi {
messageParam.setReceiveUserId(loginUser.getUserId()); messageParam.setReceiveUserId(loginUser.getUserId());
return this.queryList(messageParam); return this.queryList(messageParam);
} }
@Override
public Integer queryCount(MessageParam messageParam) {
return sysMessageService.count(messageParam);
}
@Override
public Integer queryCountCurrentUser(MessageParam messageParam) {
if (ObjectUtil.isEmpty(messageParam)) {
messageParam = new MessageParam();
}
// 获取当前登录人
LoginUser loginUser = LoginContext.me().getLoginUser();
messageParam.setReceiveUserId(loginUser.getUserId());
return this.queryCount(messageParam);
}
} }

View File

@ -31,4 +31,13 @@ public interface SysMessageService extends IService<SysMessage> {
* @date 2021/1/8 15:21 * @date 2021/1/8 15:21
*/ */
List<SysMessage> list(MessageParam messageParam); List<SysMessage> list(MessageParam messageParam);
/**
*
*
* @param messageParam
* @author liuhanqing
* @date 2021/1/11 19:21
*/
Integer count(MessageParam messageParam);
} }

View File

@ -38,6 +38,12 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageParam); LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageParam);
return this.list(wrapper); return this.list(wrapper);
} }
@Override
public Integer count(MessageParam messageParam) {
LambdaQueryWrapper<SysMessage> wrapper = createWrapper(messageParam);
return this.count(wrapper);
}
/** /**
* wrapper * wrapper
* *

View File

@ -53,11 +53,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!--消息模块-->
<dependency> <dependency>
<groupId>cn.stylefeng.roses</groupId> <groupId>cn.stylefeng.roses</groupId>
<artifactId>message-api</artifactId> <artifactId>message-spring-boot-starter</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>