| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Arrays; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | orderInfo.setPaymentType(createOrderDTO.getPaymentType()); |
| | | orderInfo.setPaymentStatus("未支付"); |
| | | orderInfo.setBuyerRemarks(createOrderDTO.getBuyerRemarks()); |
| | | orderInfo.setIsEvaluate("未评价"); |
| | | orderInfo.setCreatedAt(LocalDateTime.now()); |
| | | orderInfo.setUpdatedAt(LocalDateTime.now()); |
| | | |
| | |
| | | orderInfo.setUpdatedAt(LocalDateTime.now()); |
| | | return this.updateById(orderInfo); |
| | | } |
| | | |
| | | @Override |
| | | public boolean existsCompletedNotCancelledOrderByProductId(String productId) { |
| | | if (!StringUtils.hasText(productId)) { |
| | | throw new BusinessException("产品ID不能为空"); |
| | | } |
| | | QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("product_id", productId); |
| | | // 未取消:逻辑未删除 |
| | | wrapper.eq("deleted", 0); |
| | | // 审核中:状态不为 已完成 或 已取消 |
| | | wrapper.notIn("order_status", Arrays.asList("已完成", "已取消")); |
| | | Long count = this.baseMapper.selectCount(wrapper); |
| | | return count != null && count > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateOrderIsEvaluate(String orderId) { |
| | | if (!StringUtils.hasText(orderId)) { |
| | | throw new BusinessException("订单ID不能为空"); |
| | | } |
| | | OrderInfo orderInfo = this.getById(orderId); |
| | | if (orderInfo == null) { |
| | | throw new BusinessException("订单不存在"); |
| | | } |
| | | orderInfo.setIsEvaluate("已评价"); |
| | | return this.updateById(orderInfo); |
| | | } |
| | | } |