Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
万成波
safe-campus-bbs
Commits
1101ff07
Commit
1101ff07
authored
Sep 18, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复Bug
parent
db17bfb0
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
105 additions
and
20 deletions
+105
-20
safe-campus-admin/src/main/resources/application-dev.yml
safe-campus-admin/src/main/resources/application-dev.yml
+2
-2
safe-campus-admin/src/main/resources/application-test.yml
safe-campus-admin/src/main/resources/application-test.yml
+2
-2
safe-campus-admin/src/test/java/com/tangguo/ApplicationTest.java
...mpus-admin/src/test/java/com/tangguo/ApplicationTest.java
+59
-3
safe-campus-framework/src/main/java/com/tangguo/framework/activemq/ActiveMQConfig.java
...n/java/com/tangguo/framework/activemq/ActiveMQConfig.java
+1
-0
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsTopicController.java
...va/com/tangguo/controller/mobile/MBbsTopicController.java
+2
-2
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentCommentController.java
...com/tangguo/controller/pc/BbsMomentCommentController.java
+1
-2
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
...n/java/com/tangguo/controller/pc/BbsMomentController.java
+2
-1
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsSensitiveWordController.java
...com/tangguo/controller/pc/BbsSensitiveWordController.java
+2
-2
safe-campus-moment/src/main/java/com/tangguo/service/IBbsTopicService.java
...t/src/main/java/com/tangguo/service/IBbsTopicService.java
+2
-1
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentCommentServiceImpl.java
...com/tangguo/service/impl/BbsMomentCommentServiceImpl.java
+1
-1
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
...n/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
+11
-2
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
...in/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
+11
-1
safe-campus-moment/src/main/resources/mapper/BbsMomentCommentMapper.xml
...ment/src/main/resources/mapper/BbsMomentCommentMapper.xml
+6
-0
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
...in/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
+2
-1
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsDetailServiceImpl.java
.../tangguo/service/impl/BbsUserPointsDetailServiceImpl.java
+1
-0
No files found.
safe-campus-admin/src/main/resources/application-dev.yml
View file @
1101ff07
...
...
@@ -83,11 +83,11 @@ spring:
# ActiveMQ配置
activemq
:
broker-url
:
tcp://
127.0.0.1
:61616
broker-url
:
tcp://
47.110.32.247
:61616
packages
:
trust-all
:
true
user
:
admin
password
:
admin
password
:
admin
@2025.com
jms
:
listener
:
max-concurrency
:
3
...
...
safe-campus-admin/src/main/resources/application-test.yml
View file @
1101ff07
...
...
@@ -83,11 +83,11 @@ spring:
# ActiveMQ配置
activemq
:
broker-url
:
tcp://
127.0.0.1
:61616
broker-url
:
tcp://
47.110.32.247
:61616
packages
:
trust-all
:
true
user
:
admin
password
:
admin
password
:
admin
@2025.com
jms
:
listener
:
max-concurrency
:
3
...
...
safe-campus-admin/src/test/java/com/tangguo/ApplicationTest.java
View file @
1101ff07
...
...
@@ -2,11 +2,17 @@ package com.tangguo;
import
com.tangguo.common.constant.ActiveMQConstant
;
import
com.tangguo.common.domain.PointsDetail
;
import
me.chanjar.weixin.cp.api.WxCpService
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.jms.core.MessageCreator
;
import
org.springframework.jms.core.MessagePostProcessor
;
import
org.springframework.test.context.ActiveProfiles
;
import
javax.annotation.Resource
;
import
javax.jms.*
;
/**
*
...
...
@@ -14,22 +20,72 @@ import javax.annotation.Resource;
* @author 谈笑
* @createTime 2025-09-01 16:18:29 星期一
*/
@ActiveProfiles
(
"dev"
)
@SpringBootTest
public
class
ApplicationTest
{
@Resource
private
JmsTemplate
jmsTemplate
;
@Resource
private
WxCpService
wxCpService
;
@Test
public
void
test
()
{
PointsDetail
detail
=
new
PointsDetail
();
detail
.
setUserName
(
"TanXiao
Ing
"
);
detail
.
setUserName
(
"TanXiao"
);
detail
.
setDetailPoints
(
10
);
detail
.
setDetailName
(
"外部系统"
);
detail
.
setDescription
(
"外部系统"
);
this
.
jmsTemplate
.
convertAndSend
(
ActiveMQConstant
.
Points
.
INCR_USER_POINTS_QUEUE
,
detail
);
this
.
jmsTemplate
.
convertAndSend
(
ActiveMQConstant
.
Points
.
DECR_USER_POINTS_QUEUE
,
detail
);
this
.
jmsTemplate
.
convertAndSend
(
ActiveMQConstant
.
Points
.
DECR_USER_POINTS_QUEUE
,
detail
,
message
->
{
message
.
setStringProperty
(
"userName"
,
detail
.
getUserName
());
return
message
;
});
}
public
static
void
main
(
String
[]
args
)
{
// 连接到ActiveMQ
ActiveMQConnectionFactory
connectionFactory
=
new
ActiveMQConnectionFactory
(
"tcp://localhost:61616"
);
connectionFactory
.
setUserName
(
"admin"
);
connectionFactory
.
setPassword
(
"admin"
);
Connection
connection
=
null
;
try
{
connection
=
connectionFactory
.
createConnection
();
connection
.
start
();
// 创建会话
Session
session
=
connection
.
createSession
(
false
,
Session
.
AUTO_ACKNOWLEDGE
);
// 创建目标队列
Queue
queue
=
session
.
createQueue
(
ActiveMQConstant
.
Points
.
INCR_USER_POINTS_QUEUE
);
// 创建消息生产者
MessageProducer
producer
=
session
.
createProducer
(
queue
);
// 创建文本消息
TextMessage
message
=
session
.
createTextMessage
(
"Hello ActiveMQ!"
);
// 设置有效期为5秒(5000毫秒)
long
timeToLive
=
5000
;
// 5000毫秒
producer
.
send
(
message
,
DeliveryMode
.
PERSISTENT
,
Message
.
DEFAULT_PRIORITY
,
timeToLive
);
System
.
out
.
println
(
"消息发送成功,消息ID: "
+
message
.
getJMSMessageID
());
}
catch
(
JMSException
e
)
{
e
.
printStackTrace
();
}
finally
{
// 关闭连接
try
{
if
(
connection
!=
null
)
{
connection
.
close
();
}
}
catch
(
JMSException
e
)
{
e
.
printStackTrace
();
}
}
}
}
safe-campus-framework/src/main/java/com/tangguo/framework/activemq/ActiveMQConfig.java
View file @
1101ff07
...
...
@@ -8,6 +8,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.jms.annotation.EnableJms
;
import
org.springframework.jms.config.DefaultJmsListenerContainerFactory
;
import
org.springframework.jms.config.JmsListenerContainerFactory
;
import
org.springframework.jms.core.JmsTemplate
;
import
javax.jms.ConnectionFactory
;
import
javax.jms.Queue
;
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/mobile/MBbsTopicController.java
View file @
1101ff07
...
...
@@ -66,8 +66,8 @@ public class MBbsTopicController {
* @return 话题
*/
@GetMapping
(
"/ranking"
)
public
AjaxResult
getRankingTopic
()
{
List
<
BbsTopicListVO
>
dbTopics
=
this
.
topicService
.
getRankingTopic
();
public
AjaxResult
getRankingTopic
(
String
name
)
{
List
<
BbsTopicListVO
>
dbTopics
=
this
.
topicService
.
getRankingTopic
(
name
);
return
AjaxResult
.
success
(
dbTopics
);
}
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentCommentController.java
View file @
1101ff07
...
...
@@ -63,8 +63,7 @@ public class BbsMomentCommentController extends BaseController {
@Log
(
title
=
"动态评论记录"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
remove
(
@PathVariable
Long
id
)
{
this
.
bbsMomentCommentService
.
deleteMomentComments
(
id
);
return
AjaxResult
.
success
();
return
toAjax
(
this
.
bbsMomentCommentService
.
removeById
(
id
));
}
}
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
View file @
1101ff07
...
...
@@ -64,7 +64,8 @@ public class BbsMomentController extends BaseController {
@Log
(
title
=
"动态"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id}"
)
public
AjaxResult
remove
(
@PathVariable
Long
id
)
{
return
toAjax
(
bbsMomentService
.
removeById
(
id
));
this
.
bbsMomentService
.
deleteMoment
(
id
);
return
AjaxResult
.
success
();
}
}
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsSensitiveWordController.java
View file @
1101ff07
...
...
@@ -96,9 +96,9 @@ public class BbsSensitiveWordController extends BaseController {
/**
*
修改
敏感词库
*
导入
敏感词库
*/
@ApiOperation
(
"
修改
敏感词库"
)
@ApiOperation
(
"
导入
敏感词库"
)
@PreAuthorize
(
"@ss.hasPermi('bbs:word:edit')"
)
@Log
(
title
=
"敏感词库"
,
businessType
=
BusinessType
.
IMPORT
)
@PostMapping
(
"/import"
)
...
...
safe-campus-moment/src/main/java/com/tangguo/service/IBbsTopicService.java
View file @
1101ff07
...
...
@@ -74,9 +74,10 @@ public interface IBbsTopicService extends IService<BbsTopic> {
/**
* 查询热搜话题
*
* @param name 话题名称
* @return 话题
*/
List
<
BbsTopicListVO
>
getRankingTopic
();
List
<
BbsTopicListVO
>
getRankingTopic
(
String
name
);
/**
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentCommentServiceImpl.java
View file @
1101ff07
...
...
@@ -93,7 +93,7 @@ public class BbsMomentCommentServiceImpl extends ServiceImpl<BbsMomentCommentMap
*/
@Override
public
void
deleteMomentComments
(
Long
momentId
)
{
this
.
count
(
this
.
remove
(
Wrappers
.
lambdaQuery
(
BbsMomentComment
.
class
)
.
eq
(
BbsMomentComment:
:
getMomentId
,
momentId
)
);
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
View file @
1101ff07
...
...
@@ -342,6 +342,15 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
throw
new
ServiceException
(
"评论失败,当前动态未开启评论。"
);
}
// 检查评论内容
String
content
=
bo
.
getContent
();
FoundWord
fw
=
SensitiveWordUtils
.
getFoundFirstSensitive
(
content
);
if
(
Objects
.
nonNull
(
fw
))
{
String
msg
=
String
.
format
(
"评论失败,当前评论内容存在敏感词【%s】。"
,
fw
.
getFoundWord
());
throw
new
ServiceException
(
msg
);
}
// 回复评论
BbsMomentComment
dbParentComment
=
null
;
if
(
Objects
.
nonNull
(
bo
.
getParentId
()))
{
dbParentComment
=
this
.
commentService
.
getById
(
bo
.
getParentId
());
...
...
@@ -356,7 +365,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
newComment
.
setMomentId
(
dbMoment
.
getId
());
newComment
.
setUserName
(
dbUser
.
getUserName
());
newComment
.
setNickName
(
dbUser
.
getNickName
());
newComment
.
setContent
(
bo
.
getContent
()
);
newComment
.
setContent
(
content
);
newComment
.
setStatus
(
CommentStatus
.
ZC
.
getStatus
());
newComment
.
setIsFeatured
(
0
);
this
.
commentService
.
save
(
newComment
);
...
...
@@ -366,7 +375,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
updComment
.
setId
(
newComment
.
getId
());
if
(
Objects
.
nonNull
(
dbParentComment
))
{
updComment
.
setParentId
(
dbParentComment
.
getId
());
updComment
.
setReplyNi
ke
Name
(
dbParentComment
.
getNickName
());
updComment
.
setReplyNi
ck
Name
(
dbParentComment
.
getNickName
());
updComment
.
setAncestorPath
(
dbParentComment
.
getAncestorPath
()
+
","
+
newComment
.
getId
());
}
else
{
updComment
.
setAncestorPath
(
String
.
valueOf
(
newComment
.
getId
()));
...
...
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsTopicServiceImpl.java
View file @
1101ff07
package
com
.
tangguo
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.dfa.FoundWord
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
...
...
@@ -21,10 +22,12 @@ import com.tangguo.service.IBbsTopicService;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
* 话题Service业务层处理
...
...
@@ -56,6 +59,7 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
lqw
.
orderByDesc
(
BbsTopic:
:
getIsTop
);
lqw
.
orderByDesc
(
BbsTopic:
:
getTopTime
);
lqw
.
orderByAsc
(
BbsTopic:
:
getSort
);
lqw
.
orderByDesc
(
BbsTopic:
:
getCreateTime
);
return
bbsTopicMapper
.
selectList
(
lqw
);
}
...
...
@@ -175,15 +179,21 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
/**
* 查询热搜话题
*
* @param name 话题名称
* @return 话题
*/
@Override
public
List
<
BbsTopicListVO
>
getRankingTopic
()
{
public
List
<
BbsTopicListVO
>
getRankingTopic
(
String
name
)
{
List
<
BbsTopicListVO
>
topics
=
this
.
redisCache
.
getCacheObject
(
MomentConstant
.
HOT_TOPIC
);
if
(
CollUtil
.
isEmpty
(
topics
))
{
topics
=
this
.
baseMapper
.
selectRankingTopic
();
this
.
redisCache
.
setCacheObject
(
MomentConstant
.
HOT_TOPIC
,
topics
,
1
,
TimeUnit
.
HOURS
);
}
if
(
StrUtil
.
isNotBlank
(
name
))
{
topics
=
topics
.
stream
()
.
filter
(
t
->
t
.
getName
().
contains
(
name
)).
collect
(
Collectors
.
toList
());
}
return
topics
;
}
...
...
safe-campus-moment/src/main/resources/mapper/BbsMomentCommentMapper.xml
View file @
1101ff07
...
...
@@ -19,6 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"comment.momentContent != null and comment.momentContent != ''"
>
AND m.content LIKE CONCAT('%', #{comment.momentContent}, '%')
</if>
<if
test=
"comment.nickName != null and comment.nickName != ''"
>
AND c.nick_name LIKE CONCAT('%', #{comment.nickName}, '%')
</if>
<if
test=
"comment.userName != null and comment.userName != ''"
>
AND c.user_name LIKE CONCAT('%', #{comment.userName}, '%')
</if>
</where>
ORDER BY
c.create_time DESC
...
...
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsGradeServiceImpl.java
View file @
1101ff07
...
...
@@ -41,7 +41,8 @@ public class BbsGradeServiceImpl extends ServiceImpl<BbsGradeMapper, BbsGrade> i
LambdaQueryWrapper
<
BbsGrade
>
lqw
=
Wrappers
.
lambdaQuery
();
lqw
.
like
(
StringUtils
.
isNotBlank
(
grade
.
getName
()),
BbsGrade:
:
getName
,
grade
.
getName
());
lqw
.
eq
(
StringUtils
.
isNotBlank
(
grade
.
getCode
()),
BbsGrade:
:
getCode
,
grade
.
getCode
());
lqw
.
orderByAsc
(
BbsGrade:
:
getCreateTime
);
lqw
.
orderByAsc
(
BbsGrade:
:
getSort
);
lqw
.
orderByDesc
(
BbsGrade:
:
getCreateTime
);
return
bbsGradeMapper
.
selectList
(
lqw
);
}
...
...
safe-campus-points/src/main/java/com/tangguo/service/impl/BbsUserPointsDetailServiceImpl.java
View file @
1101ff07
...
...
@@ -34,6 +34,7 @@ public class BbsUserPointsDetailServiceImpl extends ServiceImpl<BbsUserPointsDet
return
this
.
list
(
Wrappers
.
lambdaQuery
(
BbsUserPointsDetail
.
class
)
.
eq
(
BbsUserPointsDetail:
:
getUserName
,
userName
)
.
orderByDesc
(
BbsUserPointsDetail:
:
getCreateTime
)
);
}
...
...
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