|
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.common.annotation.LogicIgnore;
|
|
|
import com.ruoyi.common.constant.StatusConstant;
|
|
|
+import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
+import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
@@ -356,4 +358,31 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
return detail(dto.getId());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void turnToRegularOrder(Long id) {
|
|
|
+ OrderInfo orderInfo = getById(id);
|
|
|
+ String exceptionType = orderInfo.getExceptionType();
|
|
|
+
|
|
|
+ if (Objects.equals(exceptionType, OrderExceptionTypeEnum.NORMAL.getKey().toString())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String s : exceptionType.split(",")) {
|
|
|
+ OrderExceptionTypeEnum orderExceptionTypeEnum = OrderExceptionTypeEnum.getEnum(Convert.toInt(s));
|
|
|
+ if (ObjectUtil.notEqual(orderExceptionTypeEnum, OrderExceptionTypeEnum.ORDER_CLOSURE)
|
|
|
+ && ObjectUtil.notEqual(orderExceptionTypeEnum, OrderExceptionTypeEnum.ORDER_ABORT)
|
|
|
+ && ObjectUtil.notEqual(orderExceptionTypeEnum, OrderExceptionTypeEnum.ORDER_EXCEPTION_HANDLING)) {
|
|
|
+ throw new ServiceException(orderExceptionTypeEnum.getValue() + ",无法转为正常订单");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ update(q -> q
|
|
|
+ .eq(BaseIdPo::getId, orderInfo.getId())
|
|
|
+ .set(OrderInfo::getExceptionType, OrderExceptionTypeEnum.NORMAL.getKey().toString())
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|