| | |
| | | import com.ruoyi.goods.domain.dto.AppRecommendGoodsPageDto; |
| | | import com.ruoyi.goods.domain.dto.AppSearchGoodsPageDto; |
| | | import com.ruoyi.goods.domain.dto.AppShopGoodsPageDto; |
| | | import com.ruoyi.goods.domain.vo.AppHomeActivityVo; |
| | | import com.ruoyi.goods.domain.vo.AppSimpleActivityGoodsVo; |
| | | import com.ruoyi.goods.domain.vo.AppSimpleGoodsVo; |
| | | import com.ruoyi.goods.service.goods.GoodsService; |
| | |
| | | private GoodsService goodsService; |
| | | |
| | | |
| | | @RequestMapping(value = "/pageActivityGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "热门活动") |
| | | public R<AppHomeActivityVo> pageActivityGoods(@RequestBody AppRecommendGoodsPageDto appRecommendGoodsPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long shopId = null; |
| | | Member member = null; |
| | | if(userId!=null){ |
| | | member = memberService.getMember(userId).getData(); |
| | | if(member!=null&&member.getRelationShopId()!=null){ |
| | | shopId = member.getRelationShopId(); |
| | | } |
| | | } |
| | | if(shopId==null){ |
| | | shopId = appRecommendGoodsPageDto.getPositionShopId(); |
| | | } |
| | | if(shopId==null){ |
| | | throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | } |
| | | // if(member!=null&&member.getBindingFlag()==0){ |
| | | // shopId = null; |
| | | // } |
| | | AppHomeActivityVo homeActivityVo = goodsService.pageActivityGoods(shopId); |
| | | return R.ok(homeActivityVo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pageRecommendGoods", method = RequestMethod.POST) |
| | | @ApiOperation(value = "推荐商品") |
| | | @ApiOperation(value = "商城精选") |
| | | public R<Page<AppSimpleGoodsVo>> pageRecommendGoods(@RequestBody AppRecommendGoodsPageDto appRecommendGoodsPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long shopId = null; |
| | |
| | | if(member!=null&&member.getRelationShopId()!=null){ |
| | | shopId = member.getRelationShopId(); |
| | | } |
| | | }else{ |
| | | } |
| | | if(shopId==null){ |
| | | shopId = appRecommendGoodsPageDto.getPositionShopId(); |
| | | } |
| | | if(shopId==null){ |
| | | //throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | shopId = 1L; |
| | | throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | } |
| | | Page<AppSimpleGoodsVo> page = new Page<>(); |
| | | page.setSize(appRecommendGoodsPageDto.getPageSize()); |
| | |
| | | @ApiOperation(value = "搜索活动商品") |
| | | public R<Page<AppSimpleActivityGoodsVo>> pageSearchActivityGoods(@RequestBody AppSearchGoodsPageDto appSearchGoodsPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Member member = null; |
| | | if(userId!=null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | member = memberService.getMember(userId).getData(); |
| | | if(member!=null&&member.getRelationShopId()!=null){ |
| | | appSearchGoodsPageDto.setShopId(member.getRelationShopId()); |
| | | }else{ |
| | |
| | | if(appSearchGoodsPageDto.getShopId()==null){ |
| | | throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | } |
| | | if(member!=null&&member.getBindingFlag()==0){ |
| | | appSearchGoodsPageDto.setShopId(null); |
| | | } |
| | | Page<AppSimpleActivityGoodsVo> page = new Page<>(); |
| | | page.setSize(appSearchGoodsPageDto.getPageSize()); |
| | | page.setCurrent(appSearchGoodsPageDto.getPageNum()); |