| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | if(null!=supplier && StringUtils.isNotBlank(supplier.getUserId())){ |
| | | flowerCommentDO.setSupplierUserId(supplier.getUserId()); |
| | | } |
| | | |
| | | // 设置显示状态为显示 |
| | | flowerCommentDO.setShowFlag(FlowerCommentShowEnum.SHOW.getFlag()); |
| | | return baseMapper.insert(flowerCommentDO)>0; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |