hjl
2024-05-27 f991c73f56f35665bcbe8ce2252c04ea82032b10
ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java
@@ -3,7 +3,6 @@
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.*;
@@ -169,7 +168,7 @@
     * 兑换记录
     */
    @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());
@@ -203,7 +202,7 @@
     * 新增收货地址/修改收货地址
     */
    @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));
@@ -213,7 +212,7 @@
     * 删除收货地址
     */
    @GetMapping("/addressDelete")
    @ApiOperation(value = "删除收货地址", tags = {"删除收货地址"})
    @ApiOperation(value = "学习端-删除收货地址", tags = {"学习端-删除收货地址"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "地址信息id", name = "id", dataType = "String", required = true)
    })
@@ -227,7 +226,7 @@
     * @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)
@@ -242,7 +241,7 @@
     * 收货地址省市区三级联动
     */
    @GetMapping("/addressTree")
    @ApiOperation(value = "收货地址省市区三级联动", tags = {"收货地址省市区三级联动"})
    @ApiOperation(value = "学习端-收货地址省市区三级联动", tags = {"学习端-收货地址省市区三级联动"})
    public R<List<Region>> addressTree() {
        return R.ok(regionService.addressTree());
    }
@@ -252,7 +251,7 @@
     * 远程调用
     */
    @GetMapping("/goodRecommend")
    @ApiOperation(value = "可兑换商品推荐", tags = {"可兑换商品推荐"})
    @ApiOperation(value = "学习端-可兑换商品推荐", tags = {"学习端-可兑换商品推荐"})
    public R<List<TGoodsVO>> goodRecommend() {
        return R.ok(goodsService.goodRecommend(tokenService.getLoginUserStudy().getUserid()));
    }
@@ -263,7 +262,7 @@
     * @param goodId 商品id
     */
    @GetMapping("/goodDetail")
    @ApiOperation(value = "商品详情", tags = {"商品详情"})
    @ApiOperation(value = "学习端-商品详情", tags = {"学习端-商品详情"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true)
    })
@@ -281,7 +280,7 @@
     * 商城-立即兑换
     */
    @GetMapping("/redeemNow")
    @ApiOperation(value = "商城-立即兑换", tags = {"立即兑换"})
    @ApiOperation(value = "学习端-商城立即兑换", tags = {"学习端-商城立即兑换"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true)
    })
@@ -299,7 +298,7 @@
     * @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));