| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.goods.domain.*; |
| | |
| | | * 兑换记录 |
| | | */ |
| | | @GetMapping("/exchangeRecord") |
| | | @ApiOperation(value = "兑换记录", tags = {"兑换记录"}) |
| | | @ApiOperation(value = "学习端-兑换记录", tags = {"学习端-兑换记录"}) |
| | | public R<List<TOrder>> exchangeRecord() { |
| | | return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, tokenService.getLoginUserStudy().getUserid()) |
| | | .orderByDesc(TOrder::getCreateTime).list()); |
| | |
| | | * 新增收货地址/修改收货地址 |
| | | */ |
| | | @PostMapping("/addressSaveOrUpdate") |
| | | @ApiOperation(value = "新增收货地址/修改收货地址", tags = {"新增收货地址/修改收货地址"}) |
| | | @ApiOperation(value = "学习端-新增收货地址/修改收货地址", tags = {"新增收货地址/修改收货地址"}) |
| | | public R<String> addressSave(@RequestBody Recipient recipient) { |
| | | recipient.setUserId(tokenService.getLoginUserStudy().getUserid()); |
| | | return R.ok(recipientService.addressSaveOrUpdate(recipient)); |
| | |
| | | * 删除收货地址 |
| | | */ |
| | | @GetMapping("/addressDelete") |
| | | @ApiOperation(value = "删除收货地址", tags = {"删除收货地址"}) |
| | | @ApiOperation(value = "学习端-删除收货地址", tags = {"学习端-删除收货地址"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "String", required = true) |
| | | }) |
| | |
| | | * @param orderId 订单id |
| | | */ |
| | | @GetMapping("/updateOrderAddress") |
| | | @ApiOperation(value = "修改订单收货地址", tags = {"修改订单收货地址"}) |
| | | @ApiOperation(value = "学习端-修改订单收货地址", tags = {"学习端-修改订单收货地址"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true), |
| | | @ApiImplicitParam(value = "完整收货地址", name = "address", dataType = "String", required = true) |
| | |
| | | * 收货地址省市区三级联动 |
| | | */ |
| | | @GetMapping("/addressTree") |
| | | @ApiOperation(value = "收货地址省市区三级联动", tags = {"收货地址省市区三级联动"}) |
| | | @ApiOperation(value = "学习端-收货地址省市区三级联动", tags = {"学习端-收货地址省市区三级联动"}) |
| | | public R<List<Region>> addressTree() { |
| | | return R.ok(regionService.addressTree()); |
| | | } |
| | |
| | | * 远程调用 |
| | | */ |
| | | @GetMapping("/goodRecommend") |
| | | @ApiOperation(value = "可兑换商品推荐", tags = {"可兑换商品推荐"}) |
| | | @ApiOperation(value = "学习端-可兑换商品推荐", tags = {"学习端-可兑换商品推荐"}) |
| | | public R<List<TGoodsVO>> goodRecommend() { |
| | | return R.ok(goodsService.goodRecommend(tokenService.getLoginUserStudy().getUserid())); |
| | | } |
| | |
| | | * @param goodId 商品id |
| | | */ |
| | | @GetMapping("/goodDetail") |
| | | @ApiOperation(value = "商品详情", tags = {"商品详情"}) |
| | | @ApiOperation(value = "学习端-商品详情", tags = {"学习端-商品详情"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | * 商城-立即兑换 |
| | | */ |
| | | @GetMapping("/redeemNow") |
| | | @ApiOperation(value = "商城-立即兑换", tags = {"立即兑换"}) |
| | | @ApiOperation(value = "学习端-商城立即兑换", tags = {"学习端-商城立即兑换"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true) |
| | | }) |
| | |
| | | * @param goodExchange 商品信息 |
| | | */ |
| | | @PostMapping("/goodExchange") |
| | | @ApiOperation(value = "商品兑换-确认", tags = {"商品兑换-确认"}) |
| | | @ApiOperation(value = "学习端-商品兑换确认", tags = {"学习端-商品兑换确认"}) |
| | | public R<Boolean> goodExchange(@RequestBody GoodExchangeDTO goodExchange) { |
| | | Recipient recipient = recipientService.getById(goodExchange.getRecipientId()); |
| | | return R.ok(goodsService.goodExchange(goodExchange, recipient)); |