|
@@ -1,6 +1,5 @@
|
|
|
package shop.alien.second.controller;
|
|
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -43,41 +42,6 @@ public class SecondGoodsController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取用户屏蔽的商品列表(分页)
|
|
|
- */
|
|
|
- @GetMapping("/getShieldedGoodsPage")
|
|
|
- @ApiOperation("获取用户屏蔽的商品列表(分页)")
|
|
|
- public R<IPage<SecondGoodsVo>> getShieldedGoodsPage(
|
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getShieldedGoodsPage(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取商品热卖排行榜(前10名)
|
|
|
- */
|
|
|
- @GetMapping("/getHotSellingRanking")
|
|
|
- @ApiOperation("推荐 - 获取商品点赞热卖排行榜(前10名)")
|
|
|
- public R<List<SecondGoods>> getHotSellingRanking() {
|
|
|
- return R.data(secondGoodsService.getHotSellingRankingTop10(), "获取成功");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 大家都在看(前10名)
|
|
|
- */
|
|
|
- @GetMapping("/getCollectTop10")
|
|
|
- @ApiOperation("大家都在看 - 获取商品收藏排行榜(前10名)")
|
|
|
- public R<List<SecondGoods>> getCollectTop10() {
|
|
|
- return R.data(secondGoodsService.getCollectTop10(), "获取成功");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 添加二手商品
|
|
|
*/
|
|
|
@PostMapping("/save")
|
|
@@ -99,7 +63,7 @@ public class SecondGoodsController {
|
|
|
/**
|
|
|
* 更新二手商品
|
|
|
*/
|
|
|
- @PutMapping("/edit")
|
|
|
+ @PostMapping("/edit")
|
|
|
@ApiOperation("更新二手商品")
|
|
|
public R<Void> updateSecondGoods(@ApiParam("二手商品信息") @RequestBody SecondGoodsVo secondGoods) {
|
|
|
if (!secondGoodsService.createBasicInfo(secondGoods)) {
|
|
@@ -147,4 +111,103 @@ public class SecondGoodsController {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取商品热卖排行榜(前10名)
|
|
|
+ */
|
|
|
+ @GetMapping("/getHotSellingRanking")
|
|
|
+ @ApiOperation("推荐 - 获取商品点赞热卖排行榜(前10名)")
|
|
|
+ public R<List<SecondGoods>> getHotSellingRanking() {
|
|
|
+ return R.data(secondGoodsService.getHotSellingRankingTop10(), "获取成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大家都在看(前10名)
|
|
|
+ */
|
|
|
+ @GetMapping("/getCollectTop10")
|
|
|
+ @ApiOperation("大家都在看 - 获取商品收藏排行榜(前10名)")
|
|
|
+ public R<List<SecondGoods>> getCollectTop10() {
|
|
|
+ return R.data(secondGoodsService.getCollectTop10(), "获取成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户屏蔽的商品列表(分页)
|
|
|
+ */
|
|
|
+ @GetMapping("/getShieldedGoodsPage")
|
|
|
+ @ApiOperation("获取用户屏蔽的商品列表(分页)")
|
|
|
+ public R<IPage<SecondGoodsVo>> getShieldedGoodsPage(
|
|
|
+ @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
+ R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
+ JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
+ if (null != data) {
|
|
|
+ int userId = data.getInteger("userId");
|
|
|
+ result = R.data(secondGoodsService.getShieldedGoodsPage(page,userId));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我收藏的商品列表-分页
|
|
|
+ */
|
|
|
+ @GetMapping("/getCollectGoodsPage")
|
|
|
+ @ApiOperation("我收藏的商品列表-分页")
|
|
|
+ public R<IPage<SecondGoodsVo>> getCollectGoodsPage(
|
|
|
+ @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
+ R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
+ JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
+ if (null != data) {
|
|
|
+ int userId = data.getInteger("userId");
|
|
|
+ result = R.data(secondGoodsService.getCollectGoodsPage(page,userId));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我卖出的商品列表-分页
|
|
|
+ */
|
|
|
+ @GetMapping("/getSellGoodsPage")
|
|
|
+ @ApiOperation("根据商品状态获取商品列表 - 0:草稿(我的草稿列表) 1:审核中 2:审核失败 3:已上架 4:已下架 5:已售出(我卖出的商品列表) -分页")
|
|
|
+ public R<IPage<SecondGoodsVo>> getSellGoodsPage(
|
|
|
+ @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
+ R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
+ JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
+ if (null != data) {
|
|
|
+ int userId = data.getInteger("userId");
|
|
|
+ result = R.data(secondGoodsService.getSellGoodsPage(page,secondGoodsVo,userId));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我购买的商品列表-分页
|
|
|
+ */
|
|
|
+ @GetMapping("/getBuyGoodsPage")
|
|
|
+ @ApiOperation("我购买的商品列表-分页")
|
|
|
+ public R<IPage<SecondGoodsVo>> getBuyGoodsPage(
|
|
|
+ @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
+ R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
+ JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
+ if (null != data) {
|
|
|
+ int userId = data.getInteger("userId");
|
|
|
+ result = R.data(secondGoodsService.getBuyGoodsPage(page,userId));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 他的商品-个人主页用户发布的商品
|
|
|
+ */
|
|
|
+ @GetMapping("/getUserGoodsPage")
|
|
|
+ @ApiOperation("他的商品-个人主页用户发布的商品")
|
|
|
+ public R<IPage<SecondGoodsVo>> getUserGoodsPage(
|
|
|
+ @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
+ return R.data(secondGoodsService.getUserGoodsPage(page,secondGoodsVo));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|