| | |
| | | package com.ruoyi.order.controller.inner; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.OrderStatusEnum; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.security.annotation.InnerAuth; |
| | | import com.ruoyi.order.service.IOrderService; |
| | |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderUpdDTO; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.system.api.domain.vo.MgtPromotionWishRecommendVO; |
| | | import com.ruoyi.system.api.domain.vo.OrderVO; |
| | | import com.ruoyi.system.api.feignClient.PromotionClient; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | /** |
| | |
| | | public class OrderController { |
| | | |
| | | private final IOrderService orderService; |
| | | private final PromotionClient promotionClient; |
| | | @PostMapping("/saveOrderOne") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<T> saveOrderOne(@RequestBody OrderDTO OrderDTO) { |
| | | orderService.saveOrderOne(OrderDTO); |
| | | return R.ok(); |
| | | public R<Long> saveOrderOne(@RequestBody OrderDTO OrderDTO) { |
| | | return R.ok(orderService.saveOrderOne(OrderDTO)); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/getOrderOne") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<Order> getOrderOne(@RequestBody OrderDTO OrderDTO) { |
| | | |
| | | LambdaQueryWrapper<Order> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Order::getMemberId,OrderDTO.getMemberId()); |
| | | wrapper.eq(Order::getOrderFrom,4); |
| | | wrapper.eq(Order::getAuctionOrderType,2 ); |
| | | wrapper.eq(Order::getGoodsSkuId,OrderDTO.getGoodsSkuId()); |
| | | wrapper.eq(Order::getDelFlag,0); |
| | | wrapper.orderByDesc(Order::getCancelTime); |
| | | Order page1 = orderService.getOne(wrapper); |
| | | |
| | | return R.ok(page1); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/getOrderOne1") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<Order> getOrderOne1(@RequestBody OrderDTO OrderDTO) { |
| | | |
| | | LambdaQueryWrapper<Order> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Order::getMemberId,OrderDTO.getMemberId()); |
| | | wrapper.eq(Order::getOrderFrom,4); |
| | | wrapper.eq(Order::getAuctionOrderType,1 ); |
| | | wrapper.eq(Order::getGoodsSkuId,OrderDTO.getGoodsSkuId()); |
| | | wrapper.eq(Order::getDelFlag,0); |
| | | wrapper.orderByDesc(Order::getCancelTime); |
| | | Order page1 = orderService.getOne(wrapper); |
| | | |
| | | return R.ok(page1); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/getOrderOne2") |
| | | @ResponseBody |
| | | @InnerAuth |
| | | public R<Order> getOrderOne2(@RequestBody OrderDTO OrderDTO) { |
| | | |
| | | LambdaQueryWrapper<Order> wrapper= Wrappers.lambdaQuery(); |
| | | wrapper.eq(Order::getMemberId,OrderDTO.getMemberId()); |
| | | wrapper.eq(Order::getOrderFrom,OrderDTO.getOrderFrom()); |
| | | wrapper.eq(Order::getGoodsSkuId,OrderDTO.getGoodsSkuId()); |
| | | wrapper.eq(Order::getDelFlag,0); |
| | | wrapper.orderByDesc(Order::getCancelTime); |
| | | List<Order> list = orderService.list(wrapper); |
| | | return R.ok(list.get(0)); |
| | | |
| | | } |
| | | |
| | |
| | | R<Order> getOrderByGroupPurchaseMemberId(@RequestBody HomeGoodsSkuDTO homeGoodsSkuDTO){ |
| | | return R.ok(orderService.getOrderByGroupPurchaseMemberId(homeGoodsSkuDTO)); |
| | | } |
| | | @InnerAuth |
| | | @ResponseBody |
| | | @PostMapping("/getOrderByGroupPurchaseMemberId1") |
| | | R<Order> getOrderByGroupPurchaseMemberId1(@RequestBody HomeGoodsSkuDTO homeGoodsSkuDTO){ |
| | | return R.ok(orderService.getOrderByGroupPurchaseMemberId1(homeGoodsSkuDTO)); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @ResponseBody |
| | | @PostMapping("/getOrderByGroupPurchaseMemberId2") |
| | | R<Order> getOrderByGroupPurchaseMemberId2(@RequestBody HomeGoodsSkuDTO homeGoodsSkuDTO){ |
| | | return R.ok(orderService.getOrderByGroupPurchaseMemberId2(homeGoodsSkuDTO)); |
| | | } |
| | | |
| | | |
| | | @InnerAuth |
| | | @ResponseBody |
| | | @PostMapping("/getOrderByGroupPurchaseMemberList") |
| | | R<List<OrderVO>> getOrderByGroupPurchaseMemberList(@RequestBody HomeGoodsSkuDTO homeGoodsSkuDTO){ |
| | | return R.ok(orderService.getOrderByGroupPurchaseMemberList(homeGoodsSkuDTO)); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @ResponseBody |
| | | @PostMapping("/getOrderByGroupPurchaseMemberList1") |
| | | R<List<OrderVO>> getOrderByGroupPurchaseMemberList1(@RequestBody HomeGoodsSkuDTO homeGoodsSkuDTO){ |
| | | return R.ok(orderService.getOrderByGroupPurchaseMemberList1(homeGoodsSkuDTO)); |
| | | } |
| | | |
| | | |
| | |
| | | orderService.updateBatchById(orders); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据优惠券id集合查询订单列表 |
| | | * |
| | | * @param couponIds 优惠券id集合 |
| | | * @return List<Order> |
| | | */ |
| | | @PostMapping("/list-by-coupon") |
| | | R<List<Order>> getOrderByCouponIds(@RequestBody Collection<Long> couponIds) { |
| | | return R.ok(orderService.getOrderByCouponIds(couponIds)); |
| | | } |
| | | @InnerAuth |
| | | @GetMapping("/autoCancelOrder/{id}") |
| | | R<?> autoCancelOrder(@PathVariable("id") Long oid) { |
| | | Order byId = orderService.getById(oid); |
| | | if (byId.getOrderStatus().getCode()==1){ |
| | | byId.setOrderStatus(OrderStatusEnum.CANCELED); |
| | | orderService.updateById(byId); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping("/getOrderListByMubres") |
| | | R<List<Order>> getOrderListByMubres(@RequestBody List<String> mubres) { |
| | | return R.ok(orderService.getOrderListByMubres(mubres)); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping("/updOrderStatusByMubres") |
| | | R<?> updateOrderStatusByMubres(@RequestBody List<String> formedGroupMubres) { |
| | | orderService.updateOrderStatusByMubres(formedGroupMubres); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping("/updOrderStatusByMubres1") |
| | | R<?> updateOrderStatusByMubres1(@RequestBody String formedGroupMubres) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | orderService.updateOrderStatusByMubres1(formedGroupMubres); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @InnerAuth |
| | | @PostMapping("/updOrderStatusByMubres2") |
| | | R<List<Order>> updateOrderStatusByMubres2(@RequestBody String formedGroupMubres) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | orderService.updateOrderStatusByMubres2(formedGroupMubres); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 根据skuId获取心愿求购详情数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @InnerAuth |
| | | @GetMapping("/getWishDataBySkuId/{id}") |
| | | R<MgtPromotionWishRecommendVO> getWishDataBySkuId(@PathVariable("id") Long id) { |
| | | return R.ok(orderService.getWishDataBySkuId(id)); |
| | | } |
| | | } |