Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
c84faeb9
Commit
c84faeb9
authored
Feb 22, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新消息
parent
af125485
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
src/main/java/cn/meteor/beyondclouds/modules/message/entity/Message.java
+2
-2
src/main/java/cn/meteor/beyondclouds/modules/message/listener/MessageListener.java
+3
-3
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
+6
-6
No files found.
src/main/java/cn/meteor/beyondclouds/modules/message/entity/Message.java
View file @
c84faeb9
...
...
@@ -33,7 +33,7 @@ public class Message implements Serializable {
private
String
messageId
;
@ApiModelProperty
(
value
=
"消息发送者ID"
)
private
String
from
;
private
String
from
Id
;
@ApiModelProperty
(
value
=
"消息发送者昵称"
)
private
String
fromName
;
...
...
@@ -42,7 +42,7 @@ public class Message implements Serializable {
private
String
fromAvatar
;
@ApiModelProperty
(
value
=
"消息接收者ID"
)
private
String
to
;
private
String
to
Id
;
@ApiModelProperty
(
value
=
"消息类型"
)
private
Integer
msgType
;
...
...
src/main/java/cn/meteor/beyondclouds/modules/message/listener/MessageListener.java
View file @
c84faeb9
...
...
@@ -297,18 +297,18 @@ public class MessageListener implements DataItemChangeListener {
if
(
subject
.
isAuthenticated
())
{
String
from
=
(
String
)
subject
.
getId
();
User
user
=
userService
.
getById
(
from
);
message
.
setFrom
(
from
);
message
.
setFrom
Id
(
from
);
message
.
setFromName
(
user
.
getNickName
());
message
.
setFromAvatar
(
user
.
getUserAvatar
());
}
else
{
message
.
setFrom
(
SysConstants
.
SYS_ID
);
message
.
setFrom
Id
(
SysConstants
.
SYS_ID
);
message
.
setFromName
(
SysConstants
.
SYS_ID
);
message
.
setFromName
(
SysConstants
.
SYS_NAME
);
message
.
setFromAvatar
(
""
);
}
message
.
setMsgType
(
msgType
);
message
.
setMsgContent
(
msg
);
message
.
setTo
(
to
);
message
.
setTo
Id
(
to
);
messageService
.
save
(
message
);
Integer
totalCount
=
messageService
.
getTotalCount
(
to
);
...
...
src/main/java/cn/meteor/beyondclouds/modules/message/service/impl/MessageServiceImpl.java
View file @
c84faeb9
...
...
@@ -38,7 +38,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
@Override
public
void
readMessages
(
String
userId
)
{
UpdateWrapper
updateWrapper
=
new
UpdateWrapper
();
updateWrapper
.
eq
(
"to"
,
userId
);
updateWrapper
.
eq
(
"to
_id
"
,
userId
);
updateWrapper
.
set
(
"status"
,
MessageStatus
.
READ
.
getStatus
());
update
(
updateWrapper
);
}
...
...
@@ -48,7 +48,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
IPage
<
Message
>
page
=
new
Page
<>(
pageNumber
,
pageSize
);
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"to"
,
userId
);
messageQueryWrapper
.
eq
(
"to
_id
"
,
userId
);
messageQueryWrapper
.
orderByDesc
(
"create_time"
);
return
page
(
page
,
messageQueryWrapper
);
}
...
...
@@ -73,7 +73,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"message_id"
,
messageId
)
.
eq
(
"to"
,
userId
);
.
eq
(
"to
_id
"
,
userId
);
Message
message
=
getOne
(
messageQueryWrapper
);
//2. 若找不到该消息,抛出业务异常
...
...
@@ -89,7 +89,7 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
public
void
deleteAllMessage
(
String
userId
)
{
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"to"
,
userId
);
messageQueryWrapper
.
eq
(
"to
_id
"
,
userId
);
remove
(
messageQueryWrapper
);
}
...
...
@@ -97,14 +97,14 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
@Override
public
Integer
getTotalCount
(
String
to
)
{
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"to"
,
to
);
messageQueryWrapper
.
eq
(
"to
_id
"
,
to
);
return
count
(
messageQueryWrapper
);
}
@Override
public
Integer
getUnReadCount
(
String
to
)
{
QueryWrapper
<
Message
>
messageQueryWrapper
=
new
QueryWrapper
<>();
messageQueryWrapper
.
eq
(
"to"
,
to
);
messageQueryWrapper
.
eq
(
"to
_id
"
,
to
);
messageQueryWrapper
.
eq
(
"status"
,
0
);
return
count
(
messageQueryWrapper
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment