| | |
| | | package com.ruoyi.order.controller; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | |
| | | List<MyShoppingOrderList> list = shoppingOrderService.getNoInvoicedOrder(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @PostMapping("/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | | shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); |
| | | shoppingOrder.setAppUserId(exchangeDto.getUserId()); |
| | | shoppingOrder.setOrderType(exchangeDto.getGoodType()); |
| | | if (exchangeDto.getGoodType()==1) { |
| | | shoppingOrder.setGoodsId(exchangeDto.getGoodId()); |
| | | }else { |
| | | shoppingOrder.setCouponId(exchangeDto.getGoodId()); |
| | | } |
| | | shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); |
| | | shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); |
| | | shoppingOrder.setOrderAmount(exchangeDto.getOrderPrice()); |
| | | if (exchangeDto.getCouponId()!=null) { |
| | | shoppingOrder.setAppCouponId(exchangeDto.getCouponId()); |
| | | } |
| | | shoppingOrder.setCouponDiscountAmount(exchangeDto.getDiscountPrice()); |
| | | shoppingOrder.setVipDiscount(new BigDecimal("0")); |
| | | shoppingOrder.setVipDiscountAmount(exchangeDto.getVipDiscount()); |
| | | shoppingOrder.setPaymentAmount(exchangeDto.getPayPrice()); |
| | | shoppingOrder.setPaymentStatus(1); |
| | | shoppingOrder.setPaymentType(exchangeDto.getPayMethod()); |
| | | shoppingOrder.setRemark(exchangeDto.getRemark()); |
| | | shoppingOrder.setStatus(1); |
| | | shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | shoppingOrder.setDelFlag(false); |
| | | shoppingOrderService.save(shoppingOrder); |
| | | |
| | | return R.ok(shoppingOrder); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/callBack") |
| | | public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo){ |
| | | shoppingOrderService.callBack(code,outTradeNo); |
| | | return R.ok(); |
| | | |
| | | } |
| | | } |
| | | |