From 24e21f8ce1a28a78a58f9a95cc6438b4a9c737a6 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期六, 12 十月 2024 11:09:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master-v2' into master-v2
---
src/main/java/com/mzl/flower/service/impl/comment/FlowerCommentServiceImpl.java | 40 +++++++++++++++++++++++++++++++++++-----
1 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/impl/comment/FlowerCommentServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/comment/FlowerCommentServiceImpl.java
index f0982c1..92efe4c 100644
--- a/src/main/java/com/mzl/flower/service/impl/comment/FlowerCommentServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/comment/FlowerCommentServiceImpl.java
@@ -5,10 +5,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.config.security.SecurityUtils;
-import com.mzl.flower.dto.request.comment.CreateFlowerCommentBatchDTO;
-import com.mzl.flower.dto.request.comment.CreateFlowerCommentDTO;
-import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO;
-import com.mzl.flower.dto.request.comment.UpdateFlowerCommentDTO;
+import com.mzl.flower.dto.request.comment.*;
import com.mzl.flower.dto.response.comment.FlowerCommentStatisVO;
import com.mzl.flower.dto.response.comment.FlowerCommentVO;
import com.mzl.flower.entity.FlowerCommentDO;
@@ -16,6 +13,8 @@
import com.mzl.flower.entity.payment.Order;
import com.mzl.flower.entity.payment.OrderItem;
import com.mzl.flower.entity.supplier.Supplier;
+import com.mzl.flower.enums.FlowerCommentShowEnum;
+import com.mzl.flower.enums.TrueOrFalseEnum;
import com.mzl.flower.mapper.comment.FlowerCommentMapper;
import com.mzl.flower.mapper.comment.FlowerCommentMapperCustom;
import com.mzl.flower.mapper.customer.CustomerMapper;
@@ -32,6 +31,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.List;
/**
@@ -97,6 +97,9 @@
if(null!=supplier && StringUtils.isNotBlank(supplier.getUserId())){
flowerCommentDO.setSupplierUserId(supplier.getUserId());
}
+
+ // 设置显示状态为显示
+ flowerCommentDO.setShowFlag(FlowerCommentShowEnum.SHOW.getFlag());
return baseMapper.insert(flowerCommentDO)>0;
}
@@ -188,10 +191,37 @@
vo.setAvg(supplierAvgScore);
//当前商家评论总数
- final Integer amount = baseMapper.selectCount(new QueryWrapper<FlowerCommentDO>().lambda().eq(FlowerCommentDO::getSupplierId, supplierId));
+ final Integer amount = baseMapper.selectCount(new QueryWrapper<FlowerCommentDO>().lambda()
+ .eq(FlowerCommentDO::getDeleted, TrueOrFalseEnum.FALSE)
+ .eq(FlowerCommentDO::getShowFlag,FlowerCommentShowEnum.SHOW.getFlag())
+ .eq(FlowerCommentDO::getSupplierId, supplierId));
vo.setCommentAmount(amount);
return vo;
}
+ @Override
+ public boolean updateShowFlowerComment(ShowFlowerCommentDTO dto) {
+ FlowerCommentDO flowerCommentDO = baseMapper.selectById(dto.getId());
+ if (null == flowerCommentDO) {
+ throw new ValidationException("评论不存在");
+ }
+ flowerCommentDO.setShowFlag(dto.getShowFalg());
+ flowerCommentDO.setUpdateBy(SecurityUtils.getUserId());
+ return baseMapper.updateById(flowerCommentDO)>0;
+ }
+
+ @Override
+ public boolean updateReplayFlowerComment(ReplayFlowerCommentDTO dto) {
+ FlowerCommentDO flowerCommentDO = baseMapper.selectById(dto.getId());
+ if (null == flowerCommentDO) {
+ throw new ValidationException("评论不存在");
+ }
+ flowerCommentDO.setReplayContent(dto.getReplayContent());
+ flowerCommentDO.setReplayBy(SecurityUtils.getUserId());
+ flowerCommentDO.setReplayTime(LocalDateTime.now());
+ flowerCommentDO.setUpdateBy(SecurityUtils.getUserId());
+ return baseMapper.updateById(flowerCommentDO)>0;
+ }
+
}
--
Gitblit v1.9.3