jiangqs
2023-06-24 ec09e9f2c72ff37654076c327008ac89ed32a8c3
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppGoodsController.java
@@ -4,24 +4,25 @@
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.goods.domain.vo.AppShoppingCartVo;
import com.ruoyi.system.api.domain.dto.AppBaseBathDto;
import com.ruoyi.goods.domain.dto.AppGoodsInfoGetDto;
import com.ruoyi.goods.domain.dto.AppShoppingCartAddDto;
import com.ruoyi.goods.domain.dto.AppShoppingCartChangeDto;
import com.ruoyi.goods.domain.vo.AppGoodsInfoVo;
import com.ruoyi.goods.domain.vo.AppShoppingCartVo;
import com.ruoyi.goods.service.goods.GoodsService;
import com.ruoyi.goods.service.goods.ShoppingCartService;
import com.ruoyi.system.api.constant.AppErrorConstant;
import com.ruoyi.system.api.domain.dto.AppBaseBathDto;
import com.ruoyi.system.api.domain.poji.member.Member;
import com.ruoyi.system.api.service.RemoteMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -36,13 +37,13 @@
@RequestMapping("/app/goods")
public class AppGoodsController extends BaseController {
    @Autowired
    @Resource
    private GoodsService goodsService;
    @Autowired
    @Resource
    private RemoteMemberService memberService;
    @Autowired
    @Resource
    private ShoppingCartService shoppingCartService;
    @RequestMapping(value = "/getGoodsInfo", method = RequestMethod.POST)
@@ -54,9 +55,12 @@
            if(member!=null&&member.getRelationShopId()!=null){
                appGoodsInfoGetDto.setShopId(member.getRelationShopId());
            }else{
                throw new ServiceException("请先获取附近商户定位");
                appGoodsInfoGetDto.setShopId(appGoodsInfoGetDto.getPositionShopId());
            }
        }
        if(appGoodsInfoGetDto.getShopId()==null){
            throw new ServiceException(AppErrorConstant.NO_POSITION);
        }
        AppGoodsInfoVo appGoodsInfoVo = goodsService.getGoodsInfo(appGoodsInfoGetDto);
        return R.ok(appGoodsInfoVo);
    }