|
|
@@ -1,5 +1,8 @@
|
|
|
package org.dromara.order.controller.pc;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import jakarta.validation.constraints.NotNull;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
@@ -13,14 +16,14 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
import org.dromara.customer.api.RemoteCustomerService;
|
|
|
import org.dromara.customer.api.domain.CustomerApiVo;
|
|
|
-import org.dromara.order.domain.bo.OrderMainBo;
|
|
|
-import org.dromara.order.domain.bo.OrderProductBo;
|
|
|
-import org.dromara.order.domain.bo.PcCheckOrderBo;
|
|
|
-import org.dromara.order.domain.bo.PcSubmitOrderBo;
|
|
|
+import org.dromara.order.domain.OrderCustomerFlowLink;
|
|
|
+import org.dromara.order.domain.bo.*;
|
|
|
import org.dromara.order.domain.dto.OrderPayDto;
|
|
|
import org.dromara.order.domain.vo.OrderMainVo;
|
|
|
import org.dromara.order.domain.vo.OrderProductVo;
|
|
|
import org.dromara.order.domain.vo.OrderStatusStats;
|
|
|
+import org.dromara.order.service.IOrderCustomerFlowLinkService;
|
|
|
+import org.dromara.order.service.IOrderCustomerFlowService;
|
|
|
import org.dromara.order.service.IOrderMainService;
|
|
|
import org.dromara.product.api.RemoteProductService;
|
|
|
import org.dromara.product.api.RemoteProductShoppingCartService;
|
|
|
@@ -29,8 +32,6 @@ import org.dromara.product.api.domain.RemoteProductShoppingCartVo;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import jakarta.validation.constraints.NotNull;
|
|
|
-
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -61,6 +62,11 @@ public class PcOrderController extends BaseController {
|
|
|
@DubboReference
|
|
|
private RemoteProductShoppingCartService remoteProductShoppingCartService;
|
|
|
|
|
|
+ //客户订单流程
|
|
|
+ private final IOrderCustomerFlowService orderCustomerFlowService;
|
|
|
+
|
|
|
+ private final IOrderCustomerFlowLinkService orderCustomerFlowLinkService;
|
|
|
+
|
|
|
private final IOrderMainService orderMainService;
|
|
|
|
|
|
/**
|
|
|
@@ -310,6 +316,8 @@ public class PcOrderController extends BaseController {
|
|
|
// 5. 保存订单(关键:成功后再删除购物车)
|
|
|
Long orderId = orderMainService.insertByBo(mainBo);
|
|
|
if (orderId != null && orderId > 0) {
|
|
|
+ //初始化审批流程
|
|
|
+ orderCustomerFlowService.initOrderFlow(orderId);
|
|
|
// 成功下单后,删除对应的购物车项
|
|
|
remoteProductShoppingCartService.deleteWithValidByIds(productShoppingCartIds);
|
|
|
} else {
|
|
|
@@ -374,17 +382,21 @@ public class PcOrderController extends BaseController {
|
|
|
@Log(title = "PC端-订单审核", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/checkOrder")
|
|
|
public R<?> checkOrder(@RequestBody @Validated PcCheckOrderBo checkOrderBo) {
|
|
|
- Long customerId = LoginHelper.getLoginUser().getCustomerId();
|
|
|
-
|
|
|
- Long userId = LoginHelper.getLoginUser().getUserId();
|
|
|
-
|
|
|
- // 调用 Service,返回结果
|
|
|
- Boolean checkOrderResult = orderMainService.checkOrder(
|
|
|
- customerId,
|
|
|
- userId,
|
|
|
- checkOrderBo
|
|
|
- );
|
|
|
+// Long customerId = LoginHelper.getLoginUser().getCustomerId();
|
|
|
+//
|
|
|
+// Long userId = LoginHelper.getLoginUser().getUserId();
|
|
|
+
|
|
|
+ OrderCustomerFlowLinkBo bo = new OrderCustomerFlowLinkBo();
|
|
|
+ List<OrderCustomerFlowLink> flowLinks = orderCustomerFlowLinkService.list(new LambdaQueryWrapper<OrderCustomerFlowLink>().eq(OrderCustomerFlowLink::getOrderId, checkOrderBo.getOrderId()));
|
|
|
+ if (CollUtil.isNotEmpty(flowLinks)) {
|
|
|
+ bo.setNodeId(flowLinks.get(0).getNodeId());
|
|
|
+ }
|
|
|
+ bo.setOrderId(checkOrderBo.getOrderId());
|
|
|
+ bo.setReviewStatus(Long.valueOf(checkOrderBo.getCheckStatus()));
|
|
|
+ bo.setReason(checkOrderBo.getCheckRemark());
|
|
|
+ bo.setReason(checkOrderBo.getCheckRemark());
|
|
|
+ orderCustomerFlowService.auditOrderFlow(bo);
|
|
|
|
|
|
- return R.ok(checkOrderResult);
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
}
|