From 7e40833bb714986928fb7f45de5c4c69d84c7189 Mon Sep 17 00:00:00 2001 From: yang <2119157836@qq.com> Date: Sat, 15 Feb 2025 18:01:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(resource):=20=E8=AF=84=E8=AE=BA=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysAdviceController.java | 48 +++-- mcwl-memberCenter/pom.xml | 6 + .../consumer/EmptyPointsRemindConsumer.java | 6 +- .../consumer/MemberBillingConsumer.java | 4 +- mcwl-resource/pom.xml | 7 + .../com/mcwl/resource}/domain/SysAdvice.java | 26 ++- .../resource/domain/dto/ModelCommentRes.java | 2 +- .../mcwl/resource}/domain/vo/AdviceVo.java | 4 +- .../resource/domain/vo/CommentAdviceVo.java | 62 +++++++ .../resource}/mapper/SysAdviceMapper.java | 7 +- .../resource}/service/ISysAdviceService.java | 10 +- .../service/impl/ModelCommentServiceImpl.java | 47 ++++- .../impl/ModelImageCommentServiceImpl.java | 47 ++++- .../impl/ModelImageLikeServiceImpl.java | 21 ++- .../service/impl/SysAdviceServiceImpl.java | 164 ++++++++++++++++++ .../impl/WorkFlowCommentServiceImpl.java | 45 ++++- .../mapper/resource/ModelImageLikeMapper.xml | 2 +- .../mcwl/system/domain/enums/AdviceEnum.java | 34 ++-- .../service/impl/SysAdviceServiceImpl.java | 70 -------- 19 files changed, 472 insertions(+), 140 deletions(-) rename {mcwl-system/src/main/java/com/mcwl/system => mcwl-resource/src/main/java/com/mcwl/resource}/domain/SysAdvice.java (76%) rename {mcwl-system/src/main/java/com/mcwl/system => mcwl-resource/src/main/java/com/mcwl/resource}/domain/vo/AdviceVo.java (84%) create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/CommentAdviceVo.java rename {mcwl-system/src/main/java/com/mcwl/system => mcwl-resource/src/main/java/com/mcwl/resource}/mapper/SysAdviceMapper.java (59%) rename {mcwl-system/src/main/java/com/mcwl/system => mcwl-resource/src/main/java/com/mcwl/resource}/service/ISysAdviceService.java (59%) create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysAdviceServiceImpl.java delete mode 100644 mcwl-system/src/main/java/com/mcwl/system/service/impl/SysAdviceServiceImpl.java diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysAdviceController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysAdviceController.java index 31dde5b..ad84123 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysAdviceController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysAdviceController.java @@ -1,15 +1,22 @@ package com.mcwl.web.controller.system; -import com.mcwl.common.core.domain.AjaxResult; -import com.mcwl.system.domain.vo.AdviceVo; -import com.mcwl.system.service.ISysAdviceService; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.vo.AdviceVo; +import com.mcwl.resource.domain.vo.CommentAdviceVo; +import com.mcwl.resource.service.ISysAdviceService; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; import java.util.List; +/** + * 消息通知 + */ @RestController @RequestMapping("system/advice") @RequiredArgsConstructor @@ -18,39 +25,52 @@ public class SysAdviceController { private final ISysAdviceService sysAdviceService; /** - * 根据当前用户获取新消息提醒 + * 根据当前用户获取新消息通知 */ @GetMapping("getUserNewMsg") - public AjaxResult getUserNewMsg() { + public R> getUserNewMsg() { List adviceVo = sysAdviceService.getUserNewMsg(); - return AjaxResult.success(adviceVo); + return R.ok(adviceVo); } /** * 根据当前用户获取系统公告 */ @GetMapping("getUserSystemNotice") - public AjaxResult getUserSystemNotice() { + public R> getUserSystemNotice() { List adviceVo = sysAdviceService.getUserSystemNotice(); - return AjaxResult.success(adviceVo); + return R.ok(adviceVo); } /** - * 根据当前用户获取所有消息 + * 根据当前用户获取所有通知 */ @GetMapping("getUserAllMsg") - public AjaxResult getUserAllMsg() { + public R> getUserAllMsg() { List adviceVo = sysAdviceService.getUserAllMsg(); - return AjaxResult.success(adviceVo); + return R.ok(adviceVo); } /** - * 获取所有消息 + * 获取所有通知 */ @GetMapping("getAllMsg") - public AjaxResult getAllMsg() { + public R> getAllMsg() { List adviceVo = sysAdviceService.getAllMsg(); - return AjaxResult.success(adviceVo); + return R.ok(adviceVo); + } + + + /** + * 获取评论通知 + */ + @GetMapping("getCommentMsg") + public R> getCommentMsg(@Valid + @NotNull(message = "类型不能为空") + @ApiParam(value = "类型 0模型 1工作流 2图片 3全部", required = true) + Integer productType) { + List adviceVo = sysAdviceService.getCommentMsg(productType); + return R.ok(adviceVo); } diff --git a/mcwl-memberCenter/pom.xml b/mcwl-memberCenter/pom.xml index edfee9b..f774532 100644 --- a/mcwl-memberCenter/pom.xml +++ b/mcwl-memberCenter/pom.xml @@ -45,6 +45,12 @@ spring-boot-starter-amqp 3.1.2 + + com.mcwl + mcwl-resource + 3.8.8 + compile + \ No newline at end of file diff --git a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/EmptyPointsRemindConsumer.java b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/EmptyPointsRemindConsumer.java index 0557381..b298cc0 100644 --- a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/EmptyPointsRemindConsumer.java +++ b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/EmptyPointsRemindConsumer.java @@ -2,12 +2,10 @@ package com.mcwl.memberCenter.consumer; import com.mcwl.common.constant.QueueConstants; import com.mcwl.common.core.domain.entity.SysUser; -import com.mcwl.common.utils.SecurityUtils; import com.mcwl.memberCenter.domain.Member; -import com.mcwl.memberCenter.service.MemberService; -import com.mcwl.system.domain.SysAdvice; +import com.mcwl.resource.domain.SysAdvice; +import com.mcwl.resource.service.ISysAdviceService; import com.mcwl.system.domain.enums.AdviceEnum; -import com.mcwl.system.service.ISysAdviceService; import com.mcwl.system.service.ISysUserService; import com.rabbitmq.client.Channel; import org.springframework.amqp.core.Message; diff --git a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/MemberBillingConsumer.java b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/MemberBillingConsumer.java index e39bd00..d9ecb64 100644 --- a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/MemberBillingConsumer.java +++ b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/consumer/MemberBillingConsumer.java @@ -3,9 +3,9 @@ package com.mcwl.memberCenter.consumer; import com.mcwl.common.constant.QueueConstants; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.memberCenter.domain.Member; -import com.mcwl.system.domain.SysAdvice; +import com.mcwl.resource.domain.SysAdvice; import com.mcwl.system.domain.enums.AdviceEnum; -import com.mcwl.system.service.ISysAdviceService; +import com.mcwl.resource.service.ISysAdviceService; import com.mcwl.system.service.ISysUserService; import com.rabbitmq.client.Channel; import lombok.RequiredArgsConstructor; diff --git a/mcwl-resource/pom.xml b/mcwl-resource/pom.xml index 58efc12..ad7488d 100644 --- a/mcwl-resource/pom.xml +++ b/mcwl-resource/pom.xml @@ -32,5 +32,12 @@ mcwl-system + + + org.springframework.boot + spring-boot-starter-amqp + 3.1.2 + + diff --git a/mcwl-system/src/main/java/com/mcwl/system/domain/SysAdvice.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/SysAdvice.java similarity index 76% rename from mcwl-system/src/main/java/com/mcwl/system/domain/SysAdvice.java rename to mcwl-resource/src/main/java/com/mcwl/resource/domain/SysAdvice.java index 137eb59..8f8ff63 100644 --- a/mcwl-system/src/main/java/com/mcwl/system/domain/SysAdvice.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/SysAdvice.java @@ -1,4 +1,4 @@ -package com.mcwl.system.domain; +package com.mcwl.resource.domain; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -28,11 +28,6 @@ public class SysAdvice extends BaseEntity { */ private Long receiverId; - /** - * 消息类型 表示新消息提醒,系统公告等 - */ - private AdviceEnum type; - /** * 标题 */ @@ -44,9 +39,24 @@ public class SysAdvice extends BaseEntity { private String content; /** - * 是否已读 0 是 1 否 + * 商品id */ - private String isRead; + private Long productId; + + /** + * 商品类型 0模型 1工作流 2图片 + */ + private Integer productType; + + /** + * 是否已读 0否 1是 + */ + private Integer isRead; + + /** + * 消息类型 表示新消息提醒,系统公告等 + */ + private AdviceEnum type; diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelCommentRes.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelCommentRes.java index b3c1dac..e61cf8f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelCommentRes.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelCommentRes.java @@ -33,7 +33,7 @@ public class ModelCommentRes { /** * 回复人 */ - @ApiModelProperty(value = "回复人") + @ApiModelProperty(value = "回复人", required = true) private Long replyUserId; } diff --git a/mcwl-system/src/main/java/com/mcwl/system/domain/vo/AdviceVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/AdviceVo.java similarity index 84% rename from mcwl-system/src/main/java/com/mcwl/system/domain/vo/AdviceVo.java rename to mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/AdviceVo.java index 81fe383..f6509b9 100644 --- a/mcwl-system/src/main/java/com/mcwl/system/domain/vo/AdviceVo.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/AdviceVo.java @@ -1,4 +1,4 @@ -package com.mcwl.system.domain.vo; +package com.mcwl.resource.domain.vo; import com.mcwl.system.domain.enums.AdviceEnum; import lombok.Data; @@ -22,7 +22,7 @@ public class AdviceVo { private String content; /** - * 是否已读 0 是 1 否 + * 是否已读 0否 1是 */ private String isRead; diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/CommentAdviceVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/CommentAdviceVo.java new file mode 100644 index 0000000..750f90b --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/CommentAdviceVo.java @@ -0,0 +1,62 @@ +package com.mcwl.resource.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@ApiModel(description = "评论回复消息") +public class CommentAdviceVo { + + /** + * 通知id + */ + @ApiModelProperty(value = "通知id") + private Long id; + + /** + * 评论用户头像 + */ + @ApiModelProperty(value = "评论用户头像") + private String userAvatar; + + /** + * 内容 + */ + @ApiModelProperty(value = "内容") + private String content; + + + /** + * 评论的商品id + */ + @ApiModelProperty(value = "评论的商品id") + private Long productId; + + /** + * 评论的商品图片 + */ + @ApiModelProperty(value = "商品图片") + private String productImag; + + /** + * 评论的商品类型 0模型 1工作流 2图片 + */ + @ApiModelProperty(value = "评论的商品类型 0模型 1工作流 2图片") + private Integer productType; + + /** + * 是否已读 0否 1是 + */ + @ApiModelProperty(value = "是否已读 0否 1是") + private Integer isRead; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Date createTime; + +} diff --git a/mcwl-system/src/main/java/com/mcwl/system/mapper/SysAdviceMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/SysAdviceMapper.java similarity index 59% rename from mcwl-system/src/main/java/com/mcwl/system/mapper/SysAdviceMapper.java rename to mcwl-resource/src/main/java/com/mcwl/resource/mapper/SysAdviceMapper.java index 85f400a..ec8a52b 100644 --- a/mcwl-system/src/main/java/com/mcwl/system/mapper/SysAdviceMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/SysAdviceMapper.java @@ -1,12 +1,9 @@ -package com.mcwl.system.mapper; +package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.mcwl.system.domain.SysAdvice; -import com.mcwl.system.domain.SysConfig; +import com.mcwl.resource.domain.SysAdvice; import org.apache.ibatis.annotations.Mapper; -import java.util.List; - /** * 消息通知 */ diff --git a/mcwl-system/src/main/java/com/mcwl/system/service/ISysAdviceService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ISysAdviceService.java similarity index 59% rename from mcwl-system/src/main/java/com/mcwl/system/service/ISysAdviceService.java rename to mcwl-resource/src/main/java/com/mcwl/resource/service/ISysAdviceService.java index 136addb..50fb192 100644 --- a/mcwl-system/src/main/java/com/mcwl/system/service/ISysAdviceService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ISysAdviceService.java @@ -1,9 +1,9 @@ -package com.mcwl.system.service; +package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; -import com.mcwl.system.domain.SysAdvice; -import com.mcwl.system.domain.SysConfig; -import com.mcwl.system.domain.vo.AdviceVo; +import com.mcwl.resource.domain.SysAdvice; +import com.mcwl.resource.domain.vo.AdviceVo; +import com.mcwl.resource.domain.vo.CommentAdviceVo; import java.util.List; @@ -21,4 +21,6 @@ public interface ISysAdviceService extends IService { List getUserAllMsg(); List getAllMsg(); + + List getCommentMsg(Integer productType); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelCommentServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelCommentServiceImpl.java index 93dacaf..780706b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelCommentServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelCommentServiceImpl.java @@ -3,20 +3,27 @@ package com.mcwl.resource.service.impl; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.QueueConstants; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelComment; import com.mcwl.resource.domain.ModelCommentLike; +import com.mcwl.resource.domain.SysAdvice; import com.mcwl.resource.domain.WorkFlowComment; import com.mcwl.resource.domain.dto.ModelCommentRes; import com.mcwl.resource.domain.vo.ModelCommentVo; import com.mcwl.resource.mapper.ModelCommentMapper; import com.mcwl.resource.mapper.ModelImageMapper; +import com.mcwl.resource.service.ISysAdviceService; import com.mcwl.resource.service.ModelCommentLikeService; import com.mcwl.resource.service.ModelCommentService; +import com.mcwl.system.domain.enums.AdviceEnum; 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; import java.util.*; import java.util.function.Function; @@ -37,10 +44,15 @@ public class ModelCommentServiceImpl extends ServiceImpl responseModelImageList = modelImageMapper.imageList(pageVo); + + List modelImageLikeIds = new ArrayList<>(); + + List modelImageLikes = baseMapper.selectList(new LambdaQueryWrapper() + .eq(ModelImageLike::getUserId, SecurityUtils.getUserId())); + for (ModelImageLike modelImageLike : modelImageLikes) { + modelImageLikeIds.add(modelImageLike.getModelImageId()); + } + + for (ResponseModelImage responseModelImage : responseModelImageList) { String[] split = responseModelImage.getImagePaths().split(","); responseModelImage.setPath(split[0]); - //查询模型是否点赞 - ModelImageLike likeImage = baseMapper.getLikeImage(SecurityUtils.getUserId(), responseModelImage.getId()); - if (likeImage == null){ + //查询是否点赞 + if (!modelImageLikeIds.contains(responseModelImage.getId())){ responseModelImage.setIsLike(0); }else { responseModelImage.setIsLike(1); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysAdviceServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysAdviceServiceImpl.java new file mode 100644 index 0000000..a3e897a --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysAdviceServiceImpl.java @@ -0,0 +1,164 @@ +package com.mcwl.resource.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.core.domain.entity.SysUser; +import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.resource.domain.ModelImage; +import com.mcwl.resource.domain.ModelProduct; +import com.mcwl.resource.domain.WorkFlow; +import com.mcwl.resource.service.ModelImageService; +import com.mcwl.resource.service.ModelService; +import com.mcwl.resource.service.WorkFlowService; +import com.mcwl.resource.domain.SysAdvice; +import com.mcwl.system.domain.enums.AdviceEnum; +import com.mcwl.resource.domain.vo.AdviceVo; +import com.mcwl.resource.domain.vo.CommentAdviceVo; +import com.mcwl.resource.mapper.SysAdviceMapper; +import com.mcwl.resource.service.ISysAdviceService; +import com.mcwl.system.service.ISysUserService; +import lombok.RequiredArgsConstructor; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 消息管理 业务层处理 + */ +@Service +@RequiredArgsConstructor +public class SysAdviceServiceImpl extends ServiceImpl implements ISysAdviceService { + + private final ISysUserService sysUserService; + + private final ModelService modelService; + + private final WorkFlowService workFlowService; + + private final ModelImageService modelImageService; + + private final Map modelProductMap = new ConcurrentHashMap<>(); + private final Map workFlowMap = new ConcurrentHashMap<>(); + private final Map modelImageMap = new ConcurrentHashMap<>(); + + + @Override + public List getUserNewMsg() { + + Long userId = SecurityUtils.getUserId(); + + List sysAdvices = baseMapper.selectList(lambdaQuery() + .eq(SysAdvice::getReceiverId, userId) + .eq(SysAdvice::getType, AdviceEnum.NEW_MESSAGE_REMIND)); + + return BeanUtil.copyToList(sysAdvices, AdviceVo.class); + } + + @Override + public List getUserSystemNotice() { + Long userId = SecurityUtils.getUserId(); + + List sysAdvices = baseMapper.selectList(lambdaQuery() + .eq(SysAdvice::getReceiverId, userId) + .eq(SysAdvice::getType, AdviceEnum.SYSTEM_NOTICE)); + + return BeanUtil.copyToList(sysAdvices, AdviceVo.class); + } + + @Override + public List getUserAllMsg() { + Long userId = SecurityUtils.getUserId(); + + List sysAdvices = baseMapper.selectList(lambdaQuery() + .eq(SysAdvice::getReceiverId, userId)); + + return BeanUtil.copyToList(sysAdvices, AdviceVo.class); + } + + @Override + public List getAllMsg() { + + List sysAdvices = baseMapper.selectList(null); + + return BeanUtil.copyToList(sysAdvices, AdviceVo.class); + } + + @Override + public List getCommentMsg(Integer productType) { + + this.postConstruct(); + + List sysAdviceList = baseMapper.selectList(new LambdaQueryWrapper() + .eq(SysAdvice::getType, AdviceEnum.COMMENT_REMIND) + .eq(SysAdvice::getReceiverId, SecurityUtils.getUserId()) + .eq(productType != 3, SysAdvice::getProductType, productType)); + + List commentAdviceVoList = new ArrayList<>(); + for (SysAdvice sysAdvice : sysAdviceList) { + CommentAdviceVo commentAdviceVo = BeanUtil.copyProperties(sysAdvice, CommentAdviceVo.class); + + Long senderId = sysAdvice.getSenderId(); + SysUser senderUser = sysUserService.selectUserById(senderId); + commentAdviceVo.setUserAvatar(senderUser.getAvatar()); + if (productType == 0) { + ModelProduct modelProduct = modelProductMap.get(sysAdvice.getProductId()); + if (Objects.nonNull(modelProduct)) { + commentAdviceVo.setProductImag(modelProduct.getSurfaceUrl()); + } + } else if (productType == 1) { + WorkFlow workFlow = workFlowMap.get(sysAdvice.getProductId()); + if (Objects.nonNull(workFlow)) { + commentAdviceVo.setProductImag(workFlow.getCoverPath()); + } + } else if (productType == 2) { + ModelImage modelImage = modelImageMap.get(sysAdvice.getProductId()); + if (Objects.nonNull(modelImage)) { + commentAdviceVo.setProductImag(modelImage.getImagePaths().split(",")[0]); + } + } + + commentAdviceVoList.add(commentAdviceVo); + } + + return commentAdviceVoList; + } + + + public void postConstruct() { + Long userId = SecurityUtils.getUserId(); + + // 并行加载数据 + CompletableFuture> productsFuture = CompletableFuture.supplyAsync(() -> + modelService.lambdaQuery().eq(ModelProduct::getUserId, userId).list() + ); + + CompletableFuture> workflowsFuture = CompletableFuture.supplyAsync(() -> + workFlowService.lambdaQuery().eq(WorkFlow::getUserId, userId).list() + ); + + CompletableFuture> imagesFuture = CompletableFuture.supplyAsync(() -> + modelImageService.lambdaQuery().eq(ModelImage::getUserId, userId).list() + ); + + // 等待所有任务完成 + CompletableFuture.allOf(productsFuture, workflowsFuture, imagesFuture).join(); + + // 更新缓存 + modelProductMap.clear(); + productsFuture.join().forEach(p -> modelProductMap.put(p.getId(), p)); + + workFlowMap.clear(); + workflowsFuture.join().forEach(w -> workFlowMap.put(w.getId(), w)); + + modelImageMap.clear(); + imagesFuture.join().forEach(i -> modelImageMap.put(i.getId(), i)); + + } + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java index 28f18e8..2c29ac0 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java @@ -5,13 +5,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; +import com.mcwl.resource.domain.ModelImageComment; +import com.mcwl.resource.domain.SysAdvice; import com.mcwl.resource.domain.WorkFlowComment; import com.mcwl.resource.domain.WorkFlowCommentLike; import com.mcwl.resource.domain.dto.WorkFlowCommentRes; import com.mcwl.resource.domain.vo.WorkFlowCommentVo; import com.mcwl.resource.mapper.WorkFlowCommentMapper; +import com.mcwl.resource.service.ISysAdviceService; import com.mcwl.resource.service.WorkFlowCommentLikeService; import com.mcwl.resource.service.WorkFlowCommentService; +import com.mcwl.system.domain.enums.AdviceEnum; import com.mcwl.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,6 +48,10 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl update model_image_like set del_flag = #{delFlag} - where user_id = #{userId} and model_image_id = #{imageId} + where user_id = #{userId} and model_image_id = #{modelImageId}