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 538f1d5ce8..8e11f24694 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; @@ -269,6 +271,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); // 判断自动发货还是手动发货 根据在售产品查询产品配置中的发货类型 @@ -392,6 +396,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) {