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
3bcf6618
Commit
3bcf6618
authored
Feb 10, 2020
by
胡学良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加用户昵称头像更新
parent
5fe06029
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
130 additions
and
4 deletions
+130
-4
src/main/java/cn/meteor/beyondclouds/modules/question/listener/UserInfoChangeListener.java
+33
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionReplyCommentService.java
+12
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionReplyService.java
+12
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionService.java
+5
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionReplyCommentServiceImpl.java
+22
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionReplyServiceImpl.java
+22
-0
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionServiceImpl.java
+23
-3
src/main/resources/application.yml
+1
-1
No files found.
src/main/java/cn/meteor/beyondclouds/modules/question/listener/UserInfoChangeListener.java
View file @
3bcf6618
package
cn
.
meteor
.
beyondclouds
.
modules
.
question
.
listener
;
package
cn
.
meteor
.
beyondclouds
.
modules
.
question
.
listener
;
import
cn.meteor.beyondclouds.core.listener.DataItemChangeListener
;
import
cn.meteor.beyondclouds.core.listener.DataItemChangeListener
;
import
cn.meteor.beyondclouds.modules.question.service.IQuestionReplyCommentService
;
import
cn.meteor.beyondclouds.modules.question.service.IQuestionReplyService
;
import
cn.meteor.beyondclouds.modules.question.service.IQuestionService
;
import
cn.meteor.beyondclouds.modules.queue.message.DataItemChangeMessage
;
import
cn.meteor.beyondclouds.modules.queue.message.DataItemChangeMessage
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -13,8 +17,37 @@ import org.springframework.stereotype.Component;
...
@@ -13,8 +17,37 @@ import org.springframework.stereotype.Component;
@Component
(
"questionUserInfoChangeListener"
)
@Component
(
"questionUserInfoChangeListener"
)
public
class
UserInfoChangeListener
extends
DataItemChangeListener
{
public
class
UserInfoChangeListener
extends
DataItemChangeListener
{
private
IQuestionService
questionService
;
private
IQuestionReplyService
questionReplyService
;
private
IQuestionReplyCommentService
questionReplyCommentService
;
public
UserInfoChangeListener
(
IQuestionService
questionService
,
IQuestionReplyService
questionReplyService
,
IQuestionReplyCommentService
questionReplyCommentService
)
{
this
.
questionService
=
questionService
;
this
.
questionReplyService
=
questionReplyService
;
this
.
questionReplyCommentService
=
questionReplyCommentService
;
}
// @Autowired
// public void setQuestionService(IQuestionService questionService) {
// this.questionService = questionService;
// }
@Override
@Override
public
void
onUserAvatarUpdate
(
DataItemChangeMessage
dataItemChangeMessage
)
{
public
void
onUserAvatarUpdate
(
DataItemChangeMessage
dataItemChangeMessage
)
{
String
userId
=
(
String
)
dataItemChangeMessage
.
getItemId
();
questionReplyService
.
updateQuestionReplyUserAvatar
(
userId
);
questionReplyCommentService
.
updateQuestionReplyCommentUserAvatar
(
userId
);
log
.
debug
(
"question-用户头像更新:{}"
,
dataItemChangeMessage
);
log
.
debug
(
"question-用户头像更新:{}"
,
dataItemChangeMessage
);
}
}
@Override
public
void
onUserNickUpdate
(
DataItemChangeMessage
dataItemChangeMessage
)
{
String
userId
=
(
String
)
dataItemChangeMessage
.
getItemId
();
questionService
.
updateQuestionUserNick
(
userId
);
questionReplyService
.
updateQuestionReplyUserNick
(
userId
);
questionReplyCommentService
.
updateQuestionReplyCommentUserNick
(
userId
);
log
.
debug
(
"question-用户昵称更新:{}"
,
dataItemChangeMessage
);
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionReplyCommentService.java
View file @
3bcf6618
...
@@ -44,4 +44,16 @@ public interface IQuestionReplyCommentService extends IService<QuestionReplyComm
...
@@ -44,4 +44,16 @@ public interface IQuestionReplyCommentService extends IService<QuestionReplyComm
* @throws QuestionReplyCommentServiceException
* @throws QuestionReplyCommentServiceException
*/
*/
IPage
<
QuestionReplyComment
>
getReplyCommentPage
(
Integer
pageNumber
,
Integer
pageSize
,
String
replyId
,
String
parentId
)
throws
QuestionReplyCommentServiceException
;
IPage
<
QuestionReplyComment
>
getReplyCommentPage
(
Integer
pageNumber
,
Integer
pageSize
,
String
replyId
,
String
parentId
)
throws
QuestionReplyCommentServiceException
;
/**
* 更新用户昵称
* @param userId 用户ID
*/
void
updateQuestionReplyCommentUserNick
(
String
userId
);
/**
* 更新用户头像
* @param userId 用户ID
*/
void
updateQuestionReplyCommentUserAvatar
(
String
userId
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionReplyService.java
View file @
3bcf6618
...
@@ -58,4 +58,16 @@ public interface IQuestionReplyService extends IService<QuestionReply> {
...
@@ -58,4 +58,16 @@ public interface IQuestionReplyService extends IService<QuestionReply> {
* @return
* @return
*/
*/
IPage
<
String
>
participateQuestionIdPage
(
IPage
<
String
>
page
,
String
userId
);
IPage
<
String
>
participateQuestionIdPage
(
IPage
<
String
>
page
,
String
userId
);
/**
* 更新用户昵称
* @param userId 用户ID
*/
void
updateQuestionReplyUserNick
(
String
userId
);
/**
* 更新用户头像
* @param userId 用户ID
*/
void
updateQuestionReplyUserAvatar
(
String
userId
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/IQuestionService.java
View file @
3bcf6618
...
@@ -112,4 +112,9 @@ public interface IQuestionService extends IService<Question> {
...
@@ -112,4 +112,9 @@ public interface IQuestionService extends IService<Question> {
*/
*/
IPage
<
Question
>
getQuestionsByTagId
(
Integer
pageNumber
,
Integer
pageSize
,
String
tagId
)
throws
QuestionTagServiceException
;
IPage
<
Question
>
getQuestionsByTagId
(
Integer
pageNumber
,
Integer
pageSize
,
String
tagId
)
throws
QuestionTagServiceException
;
/**
* 更新用户昵称
* @param userId 用户ID
*/
void
updateQuestionUserNick
(
String
userId
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionReplyCommentServiceImpl.java
View file @
3bcf6618
...
@@ -14,6 +14,7 @@ import cn.meteor.beyondclouds.modules.question.util.QuestionUtils;
...
@@ -14,6 +14,7 @@ import cn.meteor.beyondclouds.modules.question.util.QuestionUtils;
import
cn.meteor.beyondclouds.modules.user.entity.User
;
import
cn.meteor.beyondclouds.modules.user.entity.User
;
import
cn.meteor.beyondclouds.modules.user.service.IUserService
;
import
cn.meteor.beyondclouds.modules.user.service.IUserService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
@@ -161,6 +162,27 @@ public class QuestionReplyCommentServiceImpl extends ServiceImpl<QuestionReplyCo
...
@@ -161,6 +162,27 @@ public class QuestionReplyCommentServiceImpl extends ServiceImpl<QuestionReplyCo
}
}
return
page
(
page
,
QuestionUtils
.
getWrapper
(
"parent_id"
,
parentId
));
return
page
(
page
,
QuestionUtils
.
getWrapper
(
"parent_id"
,
parentId
));
}
@Override
public
void
updateQuestionReplyCommentUserNick
(
String
userId
)
{
User
user
=
userService
.
getById
(
userId
);
if
(
null
!=
user
)
{
UpdateWrapper
<
QuestionReplyComment
>
replyCommentUpdateWrapper
=
new
UpdateWrapper
<>();
replyCommentUpdateWrapper
.
set
(
"user_nick"
,
user
.
getNickName
())
.
eq
(
"user_id"
,
user
.
getUserId
());
update
(
replyCommentUpdateWrapper
);
}
}
@Override
public
void
updateQuestionReplyCommentUserAvatar
(
String
userId
)
{
User
user
=
userService
.
getById
(
userId
);
if
(
null
!=
user
)
{
UpdateWrapper
<
QuestionReplyComment
>
replyCommentUpdateWrapper
=
new
UpdateWrapper
<>();
replyCommentUpdateWrapper
.
set
(
"user_avatar"
,
user
.
getUserAvatar
())
.
eq
(
"user_id"
,
user
.
getUserId
());
update
(
replyCommentUpdateWrapper
);
}
}
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionReplyServiceImpl.java
View file @
3bcf6618
...
@@ -197,4 +197,26 @@ public class QuestionReplyServiceImpl extends ServiceImpl<QuestionReplyMapper, Q
...
@@ -197,4 +197,26 @@ public class QuestionReplyServiceImpl extends ServiceImpl<QuestionReplyMapper, Q
public
IPage
<
String
>
participateQuestionIdPage
(
IPage
<
String
>
page
,
String
userId
)
{
public
IPage
<
String
>
participateQuestionIdPage
(
IPage
<
String
>
page
,
String
userId
)
{
return
questionReplyMapper
.
participateQuestionIdPage
(
page
,
userId
);
return
questionReplyMapper
.
participateQuestionIdPage
(
page
,
userId
);
}
}
@Override
public
void
updateQuestionReplyUserNick
(
String
userId
)
{
User
user
=
userService
.
getById
(
userId
);
if
(
null
!=
user
)
{
UpdateWrapper
<
QuestionReply
>
questionReplyUpdateWrapper
=
new
UpdateWrapper
<>();
questionReplyUpdateWrapper
.
set
(
"user_nick"
,
user
.
getNickName
())
.
eq
(
"user_id"
,
user
.
getUserId
());
update
(
questionReplyUpdateWrapper
);
}
}
@Override
public
void
updateQuestionReplyUserAvatar
(
String
userId
)
{
User
user
=
userService
.
getById
(
userId
);
if
(
null
!=
user
)
{
UpdateWrapper
<
QuestionReply
>
questionReplyUpdateWrapper
=
new
UpdateWrapper
<>();
questionReplyUpdateWrapper
.
set
(
"user_avatar"
,
user
.
getUserAvatar
())
.
eq
(
"user_id"
,
user
.
getUserId
());
update
(
questionReplyUpdateWrapper
);
}
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/question/service/impl/QuestionServiceImpl.java
View file @
3bcf6618
...
@@ -19,6 +19,7 @@ import cn.meteor.beyondclouds.modules.topic.entity.TopicReference;
...
@@ -19,6 +19,7 @@ import cn.meteor.beyondclouds.modules.topic.entity.TopicReference;
import
cn.meteor.beyondclouds.modules.topic.enums.TopicReferenceType
;
import
cn.meteor.beyondclouds.modules.topic.enums.TopicReferenceType
;
import
cn.meteor.beyondclouds.modules.topic.service.ITopicReferenceService
;
import
cn.meteor.beyondclouds.modules.topic.service.ITopicReferenceService
;
import
cn.meteor.beyondclouds.modules.topic.service.ITopicService
;
import
cn.meteor.beyondclouds.modules.topic.service.ITopicService
;
import
cn.meteor.beyondclouds.modules.user.entity.User
;
import
cn.meteor.beyondclouds.modules.user.service.IUserService
;
import
cn.meteor.beyondclouds.modules.user.service.IUserService
;
import
cn.meteor.beyondclouds.util.AbstractUtils
;
import
cn.meteor.beyondclouds.util.AbstractUtils
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
@@ -75,13 +76,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
...
@@ -75,13 +76,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
private
IMessageQueueService
messageQueueService
;
private
IMessageQueueService
messageQueueService
;
@Autowired
@Autowired
public
QuestionServiceImpl
(
IQuestionExtService
questionExtService
,
IQuestionCategoryService
questionCategoryService
,
ITopic
Service
topicService
,
ITopicReferenceService
topicReferenceService
,
QuestionMapper
questionMapper
,
IUserService
userService
)
{
public
QuestionServiceImpl
(
IQuestionExtService
questionExtService
,
IQuestionCategoryService
questionCategoryService
,
ITopic
ReferenceService
topicReferenceService
,
QuestionMapper
questionMapper
)
{
this
.
questionExtService
=
questionExtService
;
this
.
questionExtService
=
questionExtService
;
this
.
questionCategoryService
=
questionCategoryService
;
this
.
questionCategoryService
=
questionCategoryService
;
this
.
topicService
=
topicService
;
this
.
topicReferenceService
=
topicReferenceService
;
this
.
topicReferenceService
=
topicReferenceService
;
this
.
questionMapper
=
questionMapper
;
this
.
questionMapper
=
questionMapper
;
this
.
userService
=
userService
;
}
}
@Autowired
@Autowired
...
@@ -90,6 +89,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
...
@@ -90,6 +89,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}
}
@Autowired
@Autowired
public
void
setUserService
(
IUserService
userService
)
{
this
.
userService
=
userService
;
}
@Autowired
public
void
setTopicService
(
ITopicService
topicService
)
{
this
.
topicService
=
topicService
;
}
@Autowired
public
void
setQuestionReplyService
(
IQuestionReplyService
questionReplyService
)
{
public
void
setQuestionReplyService
(
IQuestionReplyService
questionReplyService
)
{
this
.
questionReplyService
=
questionReplyService
;
this
.
questionReplyService
=
questionReplyService
;
}
}
...
@@ -514,4 +523,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
...
@@ -514,4 +523,15 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}
}
return
questionPage
;
return
questionPage
;
}
}
@Override
public
void
updateQuestionUserNick
(
String
userId
)
{
User
user
=
userService
.
getById
(
userId
);
if
(
null
!=
user
)
{
UpdateWrapper
<
Question
>
questionUpdateWrapper
=
new
UpdateWrapper
<>();
questionUpdateWrapper
.
set
(
"user_nick"
,
user
.
getNickName
())
.
eq
(
"user_id"
,
user
.
getUserId
());
update
(
questionUpdateWrapper
);
}
}
}
}
src/main/resources/application.yml
View file @
3bcf6618
...
@@ -5,7 +5,7 @@ spring:
...
@@ -5,7 +5,7 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
username
:
root
username
:
root
password
:
1
00Centa30821%mysql
password
:
1
97442
# 邮箱
# 邮箱
mail
:
mail
:
...
...
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