Compare commits
2 Commits
7cf4de3530
...
a2090eecb8
Author | SHA1 | Date |
---|---|---|
|
a2090eecb8 | |
|
ef826ce25f |
|
@ -31,4 +31,39 @@ public class CodeMQConfig {
|
|||
return new Queue(QueueConstants.MEMBER_BILLING_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue modelLikeQueue() {
|
||||
return new Queue(QueueConstants.MODEL_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue modelCommentLikeQueue() {
|
||||
return new Queue(QueueConstants.MODEL_COMMENT_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue imageLikeQueue() {
|
||||
return new Queue(QueueConstants.IMAGE_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue imageCommentLikeQueue() {
|
||||
return new Queue(QueueConstants.IMAGE_COMMENT_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue workFlowLikeQueue() {
|
||||
return new Queue(QueueConstants.WORK_FLOW_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue workFlowCommentLikeQueue() {
|
||||
return new Queue(QueueConstants.WORK_FLOW_COMMENT_LIKE_QUEUE, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,25 @@ public class QueueConstants {
|
|||
// 会员账单队列
|
||||
public static final String MEMBER_BILLING_QUEUE = "memberBillingQueue";
|
||||
|
||||
// 模型点赞队列
|
||||
public static final String MODEL_LIKE_QUEUE = "modelLikeQueue";
|
||||
|
||||
// 模型评论点赞队列
|
||||
public static final String MODEL_COMMENT_LIKE_QUEUE = "modelCommentLikeQueue";
|
||||
|
||||
// 图片点赞队列
|
||||
public static final String IMAGE_LIKE_QUEUE = "imageLikeQueue";
|
||||
|
||||
// 图片评论点赞队列
|
||||
public static final String IMAGE_COMMENT_LIKE_QUEUE = "imageCommentLikeQueue";
|
||||
|
||||
// 工作流点赞队列
|
||||
public static final String WORK_FLOW_LIKE_QUEUE = "workFlowLikeQueue";
|
||||
|
||||
// 工作流评论点赞队列
|
||||
public static final String WORK_FLOW_COMMENT_LIKE_QUEUE = "workFlowCommentLikeQueue";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -89,22 +89,22 @@ public class RedisConfig extends CachingConfigurerSupport
|
|||
* redis心跳配置
|
||||
* @return RedisConnectionFactory
|
||||
*/
|
||||
@Bean
|
||||
public LettuceConnectionFactory redisConnectionFactory() {
|
||||
RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration(host, port);
|
||||
standaloneConfig.setPassword(RedisPassword.of(password));
|
||||
|
||||
LettuceClientConfiguration lettuceClientConfig = LettuceClientConfiguration.builder()
|
||||
.commandTimeout(Duration.ofSeconds(10))
|
||||
.shutdownTimeout(Duration.ZERO)
|
||||
.build();
|
||||
|
||||
// 创建 Lettuce 连接工厂,并同时设置服务器配置和客户端配置
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory(standaloneConfig, lettuceClientConfig);
|
||||
factory.afterPropertiesSet(); // 确保配置生效
|
||||
|
||||
return factory;
|
||||
}
|
||||
// @Bean
|
||||
// public LettuceConnectionFactory redisConnectionFactory() {
|
||||
// RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration(host, port);
|
||||
// standaloneConfig.setPassword(RedisPassword.of(password));
|
||||
//
|
||||
// LettuceClientConfiguration lettuceClientConfig = LettuceClientConfiguration.builder()
|
||||
// .commandTimeout(Duration.ofSeconds(10))
|
||||
// .shutdownTimeout(Duration.ZERO)
|
||||
// .build();
|
||||
//
|
||||
// // 创建 Lettuce 连接工厂,并同时设置服务器配置和客户端配置
|
||||
// LettuceConnectionFactory factory = new LettuceConnectionFactory(standaloneConfig, lettuceClientConfig);
|
||||
// factory.afterPropertiesSet(); // 确保配置生效
|
||||
//
|
||||
// return factory;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class EmptyPointsRemindConsumer {
|
|||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 积分清零提醒
|
||||
* 积分重置提醒
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.EMPTY_POINTS_REMIND_QUEUE, ackMode = "MANUAL")
|
||||
public void emptyPointsRemind(Member member, Channel channel, Message message) {
|
||||
|
@ -40,15 +40,12 @@ public class EmptyPointsRemindConsumer {
|
|||
sysAdvice.setSenderId(sysUser.getUserId());
|
||||
sysAdvice.setReceiverId(member.getUserId());
|
||||
sysAdvice.setType(AdviceEnum.SYSTEM_NOTICE);
|
||||
sysAdvice.setTitle("积分清零提醒");
|
||||
sysAdvice.setContent("您的积分月底前两天将清零,请及时消费");
|
||||
sysAdvice.setCreateBy(sysUser.getUserName());
|
||||
sysAdvice.setUpdateBy(sysUser.getUserName());
|
||||
sysAdvice.setUpdateTime(new Date());
|
||||
sysAdvice.setTitle("积分重置提醒");
|
||||
sysAdvice.setContent("您的积分月底将重置,请及时消费");
|
||||
sysAdviceService.save(sysAdvice);
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
log.error("处理积分清零提醒消息时出错: {}", e.getMessage(), e);
|
||||
log.error("处理积分重置提醒消息时出错: {}", e.getMessage(), e);
|
||||
try {
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException ex) {
|
||||
|
|
|
@ -0,0 +1,699 @@
|
|||
package com.mcwl.resource.consumer;
|
||||
|
||||
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.mapper.*;
|
||||
import com.mcwl.resource.service.ISysAdviceService;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LikeConsumer {
|
||||
|
||||
private final ModelMapper modelMapper;
|
||||
|
||||
|
||||
private final ModelLikeMapper modelLikeMapper;
|
||||
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final ModelCommentMapper modelCommentMapper;
|
||||
|
||||
private final ModelCommentLikeMapper modelCommentLikeMapper;
|
||||
|
||||
private final ModelImageCommentMapper modelImageCommentMapper;
|
||||
|
||||
private final ModelImageCommentLikeMapper modelImageCommentLikeMapper;
|
||||
|
||||
private final ModelImageMapper modelImageMapper;
|
||||
|
||||
private final ModelImageLikeMapper modelImageLikeMapper;
|
||||
|
||||
private final WorkFlowMapper workFlowMapper;
|
||||
|
||||
private final WorkFlowLikeMapper workFlowLikeMapper;
|
||||
|
||||
private final WorkFlowCommentMapper workFlowCommentMapper;
|
||||
|
||||
|
||||
private final WorkFlowCommentLikeMapper workFlowCommentLikeMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 模型点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.MODEL_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modelLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.modelLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("模型点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("模型点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型评论点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.MODEL_COMMENT_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modelCommentLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.modelCommentLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("模型评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("模型评论点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.IMAGE_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void imageLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.imageLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("图片点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("图片点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
/**s
|
||||
* 图片评论点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.IMAGE_COMMENT_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void imageCommentLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.imageCommentLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("图片评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("图片评论点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工作流点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.WORK_FLOW_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void workFlowLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.workFLowLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("工作流点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("工作流点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作流评论点赞消息消费
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.WORK_FLOW_COMMENT_LIKE_QUEUE, ackMode = "MANUAL")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void workFlowCommentLikeMsg(Map<String, Long> map, Channel channel, Message message) {
|
||||
try {
|
||||
Long userId = map.get("userId");
|
||||
Long productId = map.get("commentId");
|
||||
this.workFlowCommentLike(userId, productId);
|
||||
// 注册事务同步回调
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
// 事务提交后发送ACK
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (IOException e) {
|
||||
log.error("ACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (status == STATUS_ROLLED_BACK) {
|
||||
try {
|
||||
// 事务回滚后发送NACK
|
||||
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
|
||||
} catch (IOException e) {
|
||||
log.error("NACK失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("工作流评论点赞消息出错: {}", e.getMessage(), e);
|
||||
throw new ServiceException("工作流评论点赞消息出错");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void modelLike(Long userId, Long modelId) {
|
||||
ModelProduct model = modelMapper.selectById(modelId);
|
||||
if (Objects.isNull(model)) {
|
||||
throw new ServiceException("该模型不存在或已下架");
|
||||
}
|
||||
ModelLike modelLike = modelLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(modelLike)) {
|
||||
if (Objects.equals(modelLike.getDelFlag(), "0")) {
|
||||
modelLike.setDelFlag("2");
|
||||
int likeNum = model.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
model.setLikeNum(likeNum);
|
||||
} else {
|
||||
modelLike.setDelFlag("0");
|
||||
model.setLikeNum(model.getLikeNum() + 1);
|
||||
this.addLikeAdvice(model, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
modelLikeMapper.updateDelFlagById(modelLike);
|
||||
// 更新图片点赞数
|
||||
modelMapper.updateById(model);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelLike = new ModelLike();
|
||||
modelLike.setUserId(userId);
|
||||
modelLike.setModelId(modelId);
|
||||
modelLikeMapper.insert(modelLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
model.setNumbers(model.getLikeNum() + 1);
|
||||
modelMapper.updateById(model);
|
||||
|
||||
this.addLikeAdvice(model, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(ModelProduct model, Long userId) {
|
||||
|
||||
Long receiverUserId = model.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的模型:{}",
|
||||
sysUser.getNickName(), model.getModelName());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(model.getId());
|
||||
sysAdvice.setProductType(0);
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void modelCommentLike(Long userId, Long commentId) {
|
||||
ModelComment modelComment = modelCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
}
|
||||
ModelCommentLike modelCommentLike = modelCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(modelCommentLike)) {
|
||||
if (Objects.equals(modelCommentLike.getDelFlag(), "0")) {
|
||||
modelCommentLike.setDelFlag("2");
|
||||
int likeNum = modelComment.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
modelComment.setLikeNum(likeNum);
|
||||
} else {
|
||||
modelCommentLike.setDelFlag("0");
|
||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
||||
this.addLikeAdvice(modelComment, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
modelCommentLikeMapper.updateDelFlagById(modelCommentLike);
|
||||
// 更新图片评论点赞数
|
||||
modelCommentMapper.updateById(modelComment);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelCommentLike = new ModelCommentLike();
|
||||
modelCommentLike.setUserId(userId);
|
||||
modelCommentLike.setModelCommentId(commentId);
|
||||
modelCommentLikeMapper.insert(modelCommentLike);
|
||||
|
||||
// 更新模型点赞数
|
||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
||||
modelCommentMapper.updateById(modelComment);
|
||||
|
||||
this.addLikeAdvice(modelComment, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(ModelComment modelComment, Long userId) {
|
||||
|
||||
Long receiverUserId = modelComment.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
||||
sysUser.getNickName());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(modelComment.getModelId());
|
||||
sysAdvice.setProductType(0);
|
||||
sysAdvice.setCommentId(modelComment.getId());
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void imageLike(Long userId, Long imageId) {
|
||||
ModelImage modelImage = modelImageMapper.selectById(imageId);
|
||||
if (Objects.isNull(modelImage)) {
|
||||
throw new ServiceException("该图片不存在或已下架");
|
||||
}
|
||||
ModelImageLike modelImageLike = modelImageLikeMapper.getLikeImage(userId, imageId);
|
||||
if (Objects.nonNull(modelImageLike)) {
|
||||
if (Objects.equals(modelImageLike.getDelFlag(), "0")) {
|
||||
modelImageLike.setDelFlag("2");
|
||||
int likeNum = modelImage.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
modelImage.setLikeNum(likeNum);
|
||||
} else {
|
||||
modelImageLike.setDelFlag("0");
|
||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||
this.addLikeAdvice(modelImage, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
modelImageLikeMapper.updateDelFlagById(modelImageLike);
|
||||
// 更新图片点赞数
|
||||
modelImageMapper.updateById(modelImage);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelImageLike = new ModelImageLike();
|
||||
modelImageLike.setUserId(userId);
|
||||
modelImageLike.setModelImageId(imageId);
|
||||
modelImageLikeMapper.insert(modelImageLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||
modelImageMapper.updateById(modelImage);
|
||||
|
||||
this.addLikeAdvice(modelImage, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(ModelImage modelImage, Long userId) {
|
||||
|
||||
Long receiverUserId = modelImage.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的图片:{}",
|
||||
sysUser.getNickName(), modelImage.getTitle());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(modelImage.getId());
|
||||
sysAdvice.setProductType(2);
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void imageCommentLike(Long userId, Long commentId) {
|
||||
ModelImageComment modelImageComment = modelImageCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelImageComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
}
|
||||
ModelImageCommentLike modelImageCommentLike = modelImageCommentLikeMapper.getLikeImageComment(userId, commentId);
|
||||
if (Objects.nonNull(modelImageCommentLike)) {
|
||||
if (Objects.equals(modelImageCommentLike.getDelFlag(), "0")) {
|
||||
modelImageCommentLike.setDelFlag("2");
|
||||
int likeNum = modelImageComment.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
modelImageComment.setLikeNum(likeNum);
|
||||
} else {
|
||||
modelImageCommentLike.setDelFlag("0");
|
||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||
this.addLikeAdvice(modelImageComment, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
modelImageCommentLikeMapper.updateDelFlagById(modelImageCommentLike);
|
||||
// 更新图片评论点赞数
|
||||
modelImageCommentMapper.updateById(modelImageComment);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelImageCommentLike = new ModelImageCommentLike();
|
||||
modelImageCommentLike.setUserId(userId);
|
||||
modelImageCommentLike.setModelImageCommentId(commentId);
|
||||
modelImageCommentLikeMapper.insert(modelImageCommentLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||
modelImageCommentMapper.updateById(modelImageComment);
|
||||
|
||||
this.addLikeAdvice(modelImageComment, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(ModelImageComment modelImageComment, Long userId) {
|
||||
|
||||
Long receiverUserId = modelImageComment.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
||||
sysUser.getNickName());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(modelImageComment.getModelImageId());
|
||||
sysAdvice.setProductType(2);
|
||||
sysAdvice.setCommentId(modelImageComment.getId());
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void workFLowLike(Long userId, Long modelId) {
|
||||
WorkFlow workFlow = workFlowMapper.selectById(modelId);
|
||||
if (Objects.isNull(workFlow)) {
|
||||
throw new ServiceException("该工作流不存在或已下架");
|
||||
}
|
||||
WorkFlowLike workFlowLike = workFlowLikeMapper.getLike(userId, modelId);
|
||||
if (Objects.nonNull(workFlowLike)) {
|
||||
if (Objects.equals(workFlowLike.getDelFlag(), "0")) {
|
||||
workFlowLike.setDelFlag("2");
|
||||
int likeCount = workFlow.getLikeNum() - 1;
|
||||
likeCount = Math.max(likeCount, 0);
|
||||
workFlow.setLikeNum(likeCount);
|
||||
} else {
|
||||
workFlowLike.setDelFlag("0");
|
||||
workFlow.setLikeNum(workFlow.getLikeNum() + 1);
|
||||
this.addLikeAdvice(workFlow, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
workFlowLikeMapper.updateStatus(workFlowLike);
|
||||
// 更新图片点赞数
|
||||
workFlowMapper.updateById(workFlow);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
workFlowLike = new WorkFlowLike();
|
||||
workFlowLike.setUserId(userId);
|
||||
workFlowLike.setWorkFlowId(modelId);
|
||||
workFlowLikeMapper.insert(workFlowLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
workFlow.setLikeNum(workFlow.getLikeNum() + 1);
|
||||
workFlowMapper.updateById(workFlow);
|
||||
|
||||
this.addLikeAdvice(workFlow, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(WorkFlow workFlow, Long userId) {
|
||||
|
||||
Long receiverUserId = workFlow.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的工作流:{}",
|
||||
sysUser.getNickName(), workFlow.getWorkflowName());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(workFlow.getId());
|
||||
sysAdvice.setProductType(1);
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void workFlowCommentLike(Long userId, Long commentId) {
|
||||
WorkFlowComment workFlowComment = workFlowCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(workFlowComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
}
|
||||
WorkFlowCommentLike workFlowCommentLike = workFlowCommentLikeMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(workFlowCommentLike)) {
|
||||
if (Objects.equals(workFlowCommentLike.getDelFlag(), "0")) {
|
||||
workFlowCommentLike.setDelFlag("2");
|
||||
int likeNum = workFlowComment.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
workFlowComment.setLikeNum(likeNum);
|
||||
} else {
|
||||
workFlowCommentLike.setDelFlag("0");
|
||||
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
||||
this.addLikeAdvice(workFlowComment, userId);
|
||||
}
|
||||
// 更新点赞记录
|
||||
workFlowCommentLikeMapper.updateDelFlagById(workFlowCommentLike);
|
||||
// 更新图片评论点赞数
|
||||
workFlowCommentMapper.updateById(workFlowComment);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
workFlowCommentLike = new WorkFlowCommentLike();
|
||||
workFlowCommentLike.setUserId(userId);
|
||||
workFlowCommentLike.setWorkFlowCommentId(commentId);
|
||||
workFlowCommentLikeMapper.insert(workFlowCommentLike);
|
||||
|
||||
// 更新模型点赞数
|
||||
workFlowComment.setLikeNum(workFlowComment.getLikeNum() + 1);
|
||||
workFlowCommentMapper.updateById(workFlowComment);
|
||||
|
||||
this.addLikeAdvice(workFlowComment, userId);
|
||||
}
|
||||
|
||||
|
||||
private void addLikeAdvice(WorkFlowComment workFlowComment, Long userId) {
|
||||
|
||||
Long receiverUserId = workFlowComment.getUserId();
|
||||
|
||||
if (Objects.equals(userId, receiverUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
String content = StringUtils.format("恭喜!{}点赞了您的评论",
|
||||
sysUser.getNickName());
|
||||
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(userId);
|
||||
sysAdvice.setReceiverId(receiverUserId);
|
||||
sysAdvice.setContent(content);
|
||||
sysAdvice.setProductId(workFlowComment.getWorkFlowId());
|
||||
sysAdvice.setProductType(1);
|
||||
sysAdvice.setCommentId(workFlowComment.getId());
|
||||
sysAdvice.setIsRead(0);
|
||||
sysAdvice.setType(AdviceEnum.LIKE_REMIND);
|
||||
sysAdviceService.save(sysAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,11 +2,13 @@ package com.mcwl.resource.service.impl;
|
|||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelCommentLike;
|
||||
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
|
||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
||||
import com.mcwl.resource.util.MqttTemplate;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -23,12 +25,16 @@ public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMap
|
|||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void like(Long commentId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", commentId);
|
||||
mqttTemplate.publish("modelCommentLike", JSONUtil.toJsonStr(map), 0);
|
||||
// mqttTemplate.publish("modelCommentLike", JSONUtil.toJsonStr(map), 0);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.MODEL_COMMENT_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.mcwl.resource.service.impl;
|
|||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.util.MqttTemplate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -22,15 +24,18 @@ import java.util.Map;
|
|||
@RequiredArgsConstructor
|
||||
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
|
||||
|
||||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
private final MqttTemplate mqttTemplate;
|
||||
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public void like(Long commentId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", commentId);
|
||||
mqttTemplate.publish("imageCommentLike", JSONUtil.toJsonStr(map),0);
|
||||
// mqttTemplate.publish("imageCommentLike", JSONUtil.toJsonStr(map),0);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.IMAGE_COMMENT_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
|
@ -27,6 +28,7 @@ import com.mcwl.resource.util.MqttTemplate;
|
|||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -46,12 +48,16 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
|||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void like(Long imageId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", imageId);
|
||||
mqttTemplate.publish("imageLike", JSONUtil.toJsonStr(map),0);
|
||||
// mqttTemplate.publish("imageLike", JSONUtil.toJsonStr(map),0);
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
rabbitTemplate.convertAndSend(QueueConstants.IMAGE_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
|
@ -20,6 +21,7 @@ import com.mcwl.resource.mapper.ModelMapper;
|
|||
import com.mcwl.resource.service.ModelLikeService;
|
||||
import com.mcwl.resource.util.MqttTemplate;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -41,13 +43,17 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public void like(Long modelId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", modelId);
|
||||
mqttTemplate.publish("modelLike", JSONUtil.toJsonStr(map),0);
|
||||
// mqttTemplate.publish("modelLike", JSONUtil.toJsonStr(map), 0);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.MODEL_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,11 +2,13 @@ package com.mcwl.resource.service.impl;
|
|||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.WorkFlowCommentLike;
|
||||
import com.mcwl.resource.mapper.WorkFlowCommentLikeMapper;
|
||||
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
||||
import com.mcwl.resource.util.MqttTemplate;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -28,12 +30,16 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
|
|||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void like(Long commentId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", commentId);
|
||||
mqttTemplate.publish("workFlowCommentLike", JSONUtil.toJsonStr(map),0);
|
||||
// mqttTemplate.publish("workFlowCommentLike", JSONUtil.toJsonStr(map),0);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.WORK_FLOW_COMMENT_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
|
@ -20,6 +21,7 @@ import com.mcwl.resource.mapper.WorkFlowMapper;
|
|||
import com.mcwl.resource.service.WorkFlowLikeService;
|
||||
import com.mcwl.resource.util.MqttTemplate;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -48,12 +50,16 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
|||
@Autowired
|
||||
private MqttTemplate mqttTemplate;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void like(Long modelId) {
|
||||
Map<String, Long> map = new HashMap<>();
|
||||
map.put("userId", SecurityUtils.getUserId());
|
||||
map.put("commentId", modelId);
|
||||
mqttTemplate.publish("workFlowLike", JSONUtil.toJsonStr(map),0);
|
||||
// mqttTemplate.publish("workFlowLike", JSONUtil.toJsonStr(map),0);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.WORK_FLOW_LIKE_QUEUE, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue