Commit 4c74a506 authored by yuwenwen's avatar yuwenwen

解决冲突

parents 73f559ca eb362cd1
......@@ -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
......
......@@ -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
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs"/>
<property name="log.path" value="logs"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
......
......@@ -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("TanXiaoIng");
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();
}
}
}
}
......@@ -17,6 +17,7 @@
</view>
<view class="content">
<view class="text" v-if="!item.replyNickName" @click.stop="handleReplayComment(item)">{{item.content}}</view>
<view class="text" v-else @click.stop="handleReplayComment(item)">
回复<span style="color: #0058B6;">{{item.replyNickName}}</span>{{item.content}}
</view>
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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));
}
}
......@@ -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();
}
}
......@@ -96,9 +96,9 @@ public class BbsSensitiveWordController extends BaseController {
/**
* 修改敏感词库
* 导入敏感词库
*/
@ApiOperation("修改敏感词库")
@ApiOperation("导入敏感词库")
@PreAuthorize("@ss.hasPermi('bbs:word:edit')")
@Log(title = "敏感词库", businessType = BusinessType.IMPORT)
@PostMapping("/import")
......
......@@ -78,7 +78,7 @@ public class BbsMomentComment extends BaseEntity {
/** 回复的用户姓名 */
@Excel(name = "回复的用户姓名")
@ApiModelProperty("回复的用户姓名")
private String replyNikeName;
private String replyNickName;
/** 评论祖级路径(逗号分隔) */
@Excel(name = "评论祖级路径", readConverterExp = "逗=号分隔")
......
......@@ -28,7 +28,7 @@ public class BbsCommentDetailVO {
private String userName;
/** 回复评论用户名 */
private String replyNikeName;
private String replyNickName;
/** 回复评论内容 */
private String replyContent;
......
......@@ -74,9 +74,10 @@ public interface IBbsTopicService extends IService<BbsTopic> {
/**
* 查询热搜话题
*
* @param name 话题名称
* @return 话题
*/
List<BbsTopicListVO> getRankingTopic();
List<BbsTopicListVO> getRankingTopic(String name);
/**
......
......@@ -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)
);
......
......@@ -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.setReplyNikeName(dbParentComment.getNickName());
updComment.setReplyNickName(dbParentComment.getNickName());
updComment.setAncestorPath(dbParentComment.getAncestorPath() + "," + newComment.getId());
} else {
updComment.setAncestorPath(String.valueOf(newComment.getId()));
......
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;
}
......
......@@ -17,7 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.parent_id IS NULL
</if>
<if test="comment.momentContent != null and comment.momentContent != ''">
AND m.content LIKE CONCAT('%', #{comment.momentContent}, '%')
AND c.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
......
......@@ -20,10 +20,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.content LIKE CONCAT('%', #{moment.content}, '%')
</if>
<if test="moment.params.startTime != null and moment.params.startTime != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') >= #{moment.params.startTime}
AND DATE_FORMAT(m.create_time, '%Y-%m-%d') >= #{moment.params.startTime}
</if>
<if test="moment.params.endTime != null and moment.params.endTime != ''">
AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{moment.params.endTime}
AND DATE_FORMAT(m.create_time, '%Y-%m-%d') &lt;= #{moment.params.endTime}
</if>
</where>
ORDER BY
......
......@@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
bbs_moment_vote v
LEFT JOIN
qwmh_sys_user_view uv ON uv.user_name = v.user_name
sys_user uv ON uv.user_name = v.user_name
WHERE
v.moment_id = #{momentId} AND v.option_code = #{optionCode}
ORDER BY
......
......@@ -5,6 +5,7 @@ import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.enums.BusinessType;
import com.tangguo.domain.BbsPointsSetting;
import com.tangguo.enums.PointsSettingType;
import com.tangguo.service.IBbsPointsSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -12,6 +13,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -72,13 +74,32 @@ public class BbsPointsSettingController extends BaseController {
@ApiOperation("修改积分规则配置")
@PreAuthorize("@ss.hasPermi('points:points:edit')")
@Log(title = "积分规则配置", businessType = BusinessType.UPDATE)
@PutMapping("/status")
@PutMapping
public AjaxResult edit(@RequestBody BbsPointsSetting setting) {
this.bbsPointsSettingService.editSetting(setting);
return AjaxResult.success();
}
/**
* 修改积分规则配置
*/
@ApiOperation("修改积分规则配置")
@PreAuthorize("@ss.hasPermi('points:points:edit')")
@Log(title = "积分规则配置", businessType = BusinessType.UPDATE)
@PutMapping("/batch")
public AjaxResult batchEdit(@RequestBody Map<String, List<BbsPointsSetting>> pointMap) {
List<BbsPointsSetting> adds = pointMap.get(PointsSettingType.ADD.name());
List<BbsPointsSetting> decs = pointMap.get(PointsSettingType.DEC.name());
List<BbsPointsSetting> upds = new ArrayList<>(15);
upds.addAll(adds);
upds.addAll(decs);
this.bbsPointsSettingService.batchEditSetting(upds);
return AjaxResult.success();
}
/**
* 删除积分规则配置
*/
......
......@@ -98,4 +98,10 @@ public class BbsUserPoints extends BaseEntity {
@TableField(exist = false)
private Integer incrOrDecrPoints;
/**
* 备注
*/
@TableField(exist = false)
private String remarks;
}
......@@ -56,6 +56,14 @@ public interface IBbsPointsSettingService extends IService<BbsPointsSetting> {
void editSetting(BbsPointsSetting setting);
/**
* 修改积分配置
*
* @param settings 积分配置
*/
void batchEditSetting(List<BbsPointsSetting> settings);
/**
* 删除积分配置
*
......
......@@ -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);
}
......
......@@ -14,6 +14,7 @@ import com.tangguo.service.IBbsPointsSettingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
......@@ -158,6 +159,28 @@ public class BbsPointsSettingServiceImpl extends ServiceImpl<BbsPointsSettingMap
}
/**
* 修改积分配置
*
* @param settings 积分配置
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void batchEditSetting(List<BbsPointsSetting> settings) {
List<BbsPointsSetting> updSettings = new ArrayList<>(settings.size());
for (BbsPointsSetting setting : settings) {
BbsPointsSetting updSetting = new BbsPointsSetting();
updSetting.setId(setting.getId());
updSetting.setOperatePoints(setting.getOperatePoints());
updSetting.setLimitCount(setting.getLimitCount());
updSetting.setEnableStatus(setting.getEnableStatus());
updSettings.add(updSetting);
}
this.updateBatchById(updSettings);
this.initCachePointsSetting();
}
/**
* 删除积分配置
*
......
......@@ -34,6 +34,7 @@ public class BbsUserPointsDetailServiceImpl extends ServiceImpl<BbsUserPointsDet
return this.list(
Wrappers.lambdaQuery(BbsUserPointsDetail.class)
.eq(BbsUserPointsDetail::getUserName, userName)
.orderByDesc(BbsUserPointsDetail::getCreateTime)
);
}
......
......@@ -128,7 +128,8 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
detail.setUserName(userName);
detail.setDetailPoints(points.getIncrOrDecrPoints());
detail.setDetailName("后台手动增加");
detail.setDescription(String.format("管理员【%s】后台手动增加用户【%s】积分", SecurityUtils.getUsername(), userName));
// detail.setDescription(String.format("管理员【%s】后台手动增加用户【%s】积分", SecurityUtils.getUsername(), userName));
detail.setDescription(points.getRemarks());
this.incrUserPoints(detail);
}
......@@ -146,7 +147,8 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
detail.setUserName(userName);
detail.setDetailPoints(points.getIncrOrDecrPoints());
detail.setDetailName("后台手动扣减");
detail.setDescription(String.format("管理员【%s】后台手动扣减用户【%s】积分", SecurityUtils.getUsername(), userName));
// detail.setDescription(String.format("管理员【%s】后台手动扣减用户【%s】积分", SecurityUtils.getUsername(), userName));
detail.setDescription(points.getRemarks());
this.decrUserPoints(detail);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment