From 4c4038a647f113fa9385eb713f4026f2b205ddaa Mon Sep 17 00:00:00 2001 From: Damonny <826010988@qq.com> Date: Sat, 11 Jan 2025 23:27:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=AE=A1=E6=A0=B8=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/haoka/enums/ErrorCodeConstants.java | 1 + .../haoka/service/orders/OrdersServiceImpl.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/ErrorCodeConstants.java b/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/ErrorCodeConstants.java index 5e32d9164a..a4d9b3263a 100644 --- a/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/ErrorCodeConstants.java +++ b/yudao-module-haoka/yudao-module-haoka-api/src/main/java/cn/iocoder/yudao/module/haoka/enums/ErrorCodeConstants.java @@ -29,6 +29,7 @@ public interface ErrorCodeConstants { ErrorCode ON_SALE_PRODUCT_NOT_EXISTS = new ErrorCode(1_801_001_021, "在售产品不存在"); ErrorCode ORDERS_NOT_EXISTS = new ErrorCode(1_805_001_001, "订单不存在"); + ErrorCode ORDERS_NOT_AUDIT = new ErrorCode(1_805_001_001, "订单不能进行审核"); ErrorCode ORDER_SOURCE_NOT_EXISTS = new ErrorCode(1_805_002_001, "订单来源配置不存在"); ErrorCode ORDER_SOURCE_LIVE_NOT_EXISTS = new ErrorCode(1_805_003_001, "订单来源-直播间配置不存在"); diff --git a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java index 783c566278..6274aac3ee 100644 --- a/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java +++ b/yudao-module-haoka/yudao-module-haoka-biz/src/main/java/cn/iocoder/yudao/module/haoka/service/orders/OrdersServiceImpl.java @@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.haoka.service.smstask.SmsTaskService; import cn.iocoder.yudao.module.haoka.utils.IdCardAgeCalculator; import cn.iocoder.yudao.module.haoka.utils.SnowflakeId; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; @@ -34,6 +35,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.haoka.dal.mysql.orders.OrdersMapper; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -268,6 +270,8 @@ public class OrdersServiceImpl extends ServiceImpl imple public void auditOrders(OrdersSaveReqVO updateReqVO) { // 校验存在 validateOrdersExists(updateReqVO.getId()); + // 校验是否可以审核 + validateOrdersIfAudit(updateReqVO.getId()); // 更新 OrdersDO updateObj = BeanUtils.toBean(updateReqVO, OrdersDO.class); // 判断自动发货还是手动发货 根据在售产品查询产品配置中的发货类型 @@ -390,6 +394,13 @@ public class OrdersServiceImpl extends ServiceImpl imple throw exception(ORDERS_NOT_EXISTS); } } + private void validateOrdersIfAudit(Long id) { + OrdersDO ordersDO = ordersMapper.selectById(id); + ArrayList longs = Lists.newArrayList(120L, 125L, 200L); + if (longs.contains(ordersDO.getStatus())) { + throw exception(ORDERS_NOT_AUDIT); + } + } @Override public OrdersDO getOrders(Long id) {