|
@@ -9,7 +9,10 @@ import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
9
|
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
9
|
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
10
|
import cn.lili.modules.order.cart.entity.vo.TradeParams;
|
10
|
import cn.lili.modules.order.cart.entity.vo.TradeParams;
|
11
|
import cn.lili.modules.order.cart.service.CartService;
|
11
|
import cn.lili.modules.order.cart.service.CartService;
|
|
|
12
|
+import cn.lili.modules.order.order.entity.dos.Trade;
|
12
|
import cn.lili.modules.order.order.entity.vo.ReceiptVO;
|
13
|
import cn.lili.modules.order.order.entity.vo.ReceiptVO;
|
|
|
14
|
+import cn.lili.modules.order.order.service.OrderService;
|
|
|
15
|
+import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
13
|
import io.swagger.annotations.Api;
|
16
|
import io.swagger.annotations.Api;
|
14
|
import io.swagger.annotations.ApiImplicitParam;
|
17
|
import io.swagger.annotations.ApiImplicitParam;
|
15
|
import io.swagger.annotations.ApiImplicitParams;
|
18
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -40,6 +43,12 @@ public class CartController {
|
40
|
@Autowired
|
43
|
@Autowired
|
41
|
private CartService cartService;
|
44
|
private CartService cartService;
|
42
|
|
45
|
|
|
|
46
|
+ /**
|
|
|
47
|
+ * 订单
|
|
|
48
|
+ */
|
|
|
49
|
+ @Autowired
|
|
|
50
|
+ private OrderService orderService;
|
|
|
51
|
+
|
43
|
|
52
|
|
44
|
@ApiOperation(value = "向购物车中添加一个产品")
|
53
|
@ApiOperation(value = "向购物车中添加一个产品")
|
45
|
@PostMapping
|
54
|
@PostMapping
|
|
@@ -242,7 +251,10 @@ public class CartController {
|
242
|
public ResultMessage<Object> crateTrade(@RequestBody TradeParams tradeParams) {
|
251
|
public ResultMessage<Object> crateTrade(@RequestBody TradeParams tradeParams) {
|
243
|
try {
|
252
|
try {
|
244
|
//读取选中的列表
|
253
|
//读取选中的列表
|
245
|
- return ResultUtil.data(this.cartService.createTrade(tradeParams));
|
|
|
|
|
254
|
+ Trade trade = this.cartService.createTrade(tradeParams);
|
|
|
255
|
+ // 自动完成支付
|
|
|
256
|
+ orderService.payOrder(trade.getSn(), PaymentMethodEnum.BANK_TRANSFER.paymentName(), "SYSTEM_AUTO_COMPLETE");
|
|
|
257
|
+ return ResultUtil.data(trade);
|
246
|
} catch (ServiceException se) {
|
258
|
} catch (ServiceException se) {
|
247
|
log.info(se.getMsg(), se);
|
259
|
log.info(se.getMsg(), se);
|
248
|
throw se;
|
260
|
throw se;
|