Commit ebdec5e6 by 黄超华

商品订单创建直接返回订单详情信息

1 parent 84096b67
...@@ -28,7 +28,7 @@ public interface ShopmallOrderApiService { ...@@ -28,7 +28,7 @@ public interface ShopmallOrderApiService {
* @return * @return
*/ */
@PostMapping(value = CREATE_ORDER, produces = MediaType.APPLICATION_JSON_VALUE) @PostMapping(value = CREATE_ORDER, produces = MediaType.APPLICATION_JSON_VALUE)
public CreateOrderResponse createOrder(@RequestBody CreateOrderRequest req); public QueryOrderDetailResponse createOrder(@RequestBody CreateOrderRequest req);
/** /**
* 预占确认订单接口 * 预占确认订单接口
......
...@@ -27,7 +27,7 @@ public class OrderApiController implements ShopmallOrderApiService { ...@@ -27,7 +27,7 @@ public class OrderApiController implements ShopmallOrderApiService {
@Operation(summary = "提交订单接口", description = "提交订单信息到云中鹤商城平台") @Operation(summary = "提交订单接口", description = "提交订单信息到云中鹤商城平台")
@Override @Override
public CreateOrderResponse createOrder(@Valid CreateOrderRequest req) { public QueryOrderDetailResponse createOrder(@Valid CreateOrderRequest req) {
return orderService.createOrder(req); return orderService.createOrder(req);
} }
......
...@@ -107,7 +107,7 @@ public class OrderChildService { ...@@ -107,7 +107,7 @@ public class OrderChildService {
*/ */
@Async @Async
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<OrderChildOrderDetailItem> createOrderChild(String tparOrderCode, String parentOrderCode) { public QueryOrderDetailResponse createOrderChild(String tparOrderCode, String parentOrderCode) {
QueryOrderDetailResponse orderDetail = cloudCraneService.queryOrderDetail(QueryOrderDetailRequest.builder().parentOrderCode(parentOrderCode).build()); QueryOrderDetailResponse orderDetail = cloudCraneService.queryOrderDetail(QueryOrderDetailRequest.builder().parentOrderCode(parentOrderCode).build());
...@@ -166,7 +166,7 @@ public class OrderChildService { ...@@ -166,7 +166,7 @@ public class OrderChildService {
} }
orderChildMapper.insertList(orderChildList); orderChildMapper.insertList(orderChildList);
orderChildGoodsMapper.insertList(orderChildGoodsList); orderChildGoodsMapper.insertList(orderChildGoodsList);
return orderDetail.getChildOrderList(); return orderDetail;
} }
public void updateOrderChildByExample(List<OrderChild> orderClidList) { public void updateOrderChildByExample(List<OrderChild> orderClidList) {
......
...@@ -48,7 +48,7 @@ public class OrderService { ...@@ -48,7 +48,7 @@ public class OrderService {
* @date 2023/4/11 14:25 * @date 2023/4/11 14:25
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CreateOrderResponse createOrder(CreateOrderRequest req) { public QueryOrderDetailResponse createOrder(CreateOrderRequest req) {
Assert.notNull(req, "订单信息不能为空"); Assert.notNull(req, "订单信息不能为空");
Assert.notEmpty(req.getGoodsSkuList(), "商品信息不能为空"); Assert.notEmpty(req.getGoodsSkuList(), "商品信息不能为空");
...@@ -89,11 +89,11 @@ public class OrderService { ...@@ -89,11 +89,11 @@ public class OrderService {
stopWatch.start("task4-异步处理子订单"); stopWatch.start("task4-异步处理子订单");
//生成子订单及订单商品数据 //生成子订单及订单商品数据
orderChildService.createOrderChild(tparOrderCode, parentOrderCode); QueryOrderDetailResponse detailResponse = orderChildService.createOrderChild(tparOrderCode, parentOrderCode);
stopWatch.stop(); stopWatch.stop();
log.info(stopWatch.prettyPrint()); log.info(stopWatch.prettyPrint());
return createOrderResponse; return detailResponse;
} }
/** /**
......
...@@ -63,7 +63,7 @@ public class OrderServiceTest { ...@@ -63,7 +63,7 @@ public class OrderServiceTest {
.invoiceState(1001)//是否需要开具发票(1001:不开发 票,1002:开发票) .invoiceState(1001)//是否需要开具发票(1001:不开发 票,1002:开发票)
.goodsSkuList(Lists.newArrayList(goodsSkuModel1, goodsSkuModel2)) .goodsSkuList(Lists.newArrayList(goodsSkuModel1, goodsSkuModel2))
.build(); .build();
CreateOrderResponse response = orderService.createOrder(createOrderRequest); QueryOrderDetailResponse response = orderService.createOrder(createOrderRequest);
System.out.println(JSONUtil.toJsonStr(response)); System.out.println(JSONUtil.toJsonStr(response));
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!