|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.github.pagehelper.PageInfo; | 
|---|
|  |  |  | import com.xzx.gc.common.Result; | 
|---|
|  |  |  | import com.xzx.gc.common.request.BaseController; | 
|---|
|  |  |  | import com.xzx.gc.model.JsonResult; | 
|---|
|  |  |  | import com.xzx.gc.shop.dto.AddGoodsOrderDto; | 
|---|
|  |  |  | import com.xzx.gc.shop.dto.XcxOrderListDto; | 
|---|
|  |  |  | import com.xzx.gc.shop.service.OrderService; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.XcxOrderDetailsVo; | 
|---|
|  |  |  | import com.xzx.gc.shop.vo.XcxOrderListVo; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiResponses; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PathVariable; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("积分商城下单") | 
|---|
|  |  |  | @PostMapping(value = "/goods/order/add") | 
|---|
|  |  |  | public Result<String> addOrder(@RequestBody AddGoodsOrderDto addGoodsOrderDto, HttpServletRequest request) { | 
|---|
|  |  |  | String userId = getUserId(request); | 
|---|
|  |  |  | addGoodsOrderDto.setUserId(userId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | orderService.addOrder(addGoodsOrderDto); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Result<String> result = Result.success(); | 
|---|
|  |  |  | result.setMsg("下单成功"); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("我的订单列表") | 
|---|
|  |  |  | @ApiResponses( | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "success", response = XcxOrderListVo.class) | 
|---|
|  |  |  | 
|---|
|  |  |  | xcxOrderListDto.setUserId(userId); | 
|---|
|  |  |  | return JsonResult.success(orderService.orderList(xcxOrderListDto)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("确认收货") | 
|---|
|  |  |  | @PostMapping(value = "/order/confirm/{id}") | 
|---|
|  |  |  | public Result<String> confirmOrder (@PathVariable("id") Long id, HttpServletRequest request) { | 
|---|
|  |  |  | orderService.confirmOrder(id, getUserId(request)); | 
|---|
|  |  |  | return Result.success(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("取消订单") | 
|---|
|  |  |  | @PostMapping(value = "/order/cancel/{id}") | 
|---|
|  |  |  | public Result<String> cancelOrder(@PathVariable("id") Long id, HttpServletRequest request) { | 
|---|
|  |  |  | orderService.cancelOrder(id, getUserId(request)); | 
|---|
|  |  |  | return Result.success(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("订单详情") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "success", response = XcxOrderDetailsVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(value = "/order/details/{id}") | 
|---|
|  |  |  | public JsonResult<XcxOrderDetailsVo> orderDetails(@PathVariable("id") Long id) { | 
|---|
|  |  |  | return JsonResult.success(orderService.orderDetails(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|