|
@@ -75,9 +75,9 @@ public class SecondGoodsController {
|
|
|
log.info("SecondGoodsController.updateSecondGoods?secondGoods={}", secondGoods.toString());
|
|
|
// 添加商品 0 创建 1 更新
|
|
|
if (!secondGoodsService.createBasicInfo(secondGoods,1)) {
|
|
|
- return R.fail("添加二手商品失败");
|
|
|
+ return R.fail("修改二手商品失败");
|
|
|
}
|
|
|
- return R.success("添加二手商品成功");
|
|
|
+ return R.success("修改二手商品成功");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -106,183 +106,6 @@ public class SecondGoodsController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 搜索商品列表(包含商品信息、图片、用户信息),按距离和创建时间倒序
|
|
|
- */
|
|
|
- @PostMapping("/search")
|
|
|
- @ApiOperation("搜索结果-商品列表")
|
|
|
- public R<IPage<SecondGoodsVo>> searchGoodsList(
|
|
|
- @ApiParam("二手商品搜索条件") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
- log.info("SecondGoodsController.searchGoodsList?secondGoodsVo={}", secondGoodsVo.toString());
|
|
|
- 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");
|
|
|
- String phone = data.getString("phone");
|
|
|
- secondGoodsVo.setUserPhone(phone);
|
|
|
- result = R.data(secondGoodsService.searchGoodsList(page, userId,secondGoodsVo), "查询成功");
|
|
|
- }
|
|
|
- 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("获取用户屏蔽的商品列表(分页)")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getShieldedGoodsPage(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getShieldedGoodsPage?page={},size={},", pageNum,pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum, pageSize);
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getShieldedGoodsPage(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 我收藏的商品列表-分页
|
|
|
- */
|
|
|
- @GetMapping("/getCollectGoodsPage")
|
|
|
- @ApiOperation("我收藏的商品列表-分页")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getCollectGoodsPage(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getCollectGoodsPage?page={},size={},", pageNum,pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum,pageSize);
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getCollectGoodsPage(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 我的商品-个人主页用户发布的商品
|
|
|
- */
|
|
|
- @GetMapping("/getMyGoodsPage")
|
|
|
- @ApiOperation("我的商品-个人主页用户发布的商品")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getMyGoodsPage(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getMyGoodsPage?page={},size={},", pageNum,pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum,pageSize);
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getMyGoodsPage(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取商品草稿列表
|
|
|
- */
|
|
|
- @GetMapping("/getDraftList")
|
|
|
- @ApiOperation("获取商品草稿列表")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getDraftList(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getDraftList?page={},size={},", pageNum,pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum,pageSize);
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getDraftList(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 我购买的商品列表-分页
|
|
|
- */
|
|
|
- @GetMapping("/getBuyGoodsPage")
|
|
|
- @ApiOperation("我购买的商品列表-分页")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getBuyGoodsPage(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getDraftList?page={},size={},", pageNum,pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum, pageNum);
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- result = R.data(secondGoodsService.getBuyGoodsPage(page,userId));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 他的商品-个人主页用户发布的商品
|
|
|
- */
|
|
|
- @GetMapping("/getUserGoodsPage")
|
|
|
- @ApiOperation("他的商品-个人主页用户发布的商品")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "userId", value = "主页用户id", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getUserGoodsPage(
|
|
|
- @RequestParam Integer userId,
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getDraftList?userId={},page={},size={},",userId, pageNum,pageSize);
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum, pageSize);
|
|
|
- return R.data(secondGoodsService.getUserGoodsPage(page, userId));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取商品草稿数量
|
|
|
- */
|
|
|
- @GetMapping("/getDraftCount")
|
|
|
- @ApiOperation("获取商品草稿数量")
|
|
|
- public R<Integer> getDraftCount(@ApiParam("商品id") @RequestParam Integer goodsId) {
|
|
|
- log.info("SecondGoodsController.getDraftCount?goodsId={}", goodsId);
|
|
|
- // 获取商品草稿数量
|
|
|
- QueryWrapper<SecondGoods> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda()
|
|
|
- .eq(SecondGoods::getId, goodsId)
|
|
|
- .eq(SecondGoods::getGoodsStatus, 0); // 0-草稿
|
|
|
- return R.data(secondGoodsService.count(queryWrapper));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 商品审核状态查询-消息跳转用
|
|
|
*/
|
|
|
@GetMapping("/getGoodsAuditStatus")
|
|
@@ -296,46 +119,4 @@ public class SecondGoodsController {
|
|
|
return R.data(secondGoodsService.getOne(queryWrapper).getGoodsStatus());
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 我的 - 点赞商品列表
|
|
|
- */
|
|
|
- @GetMapping("/getLikeGoodsPage")
|
|
|
- @ApiOperation("我的 - 点赞商品列表")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "size", value = "分页条数", dataType = "Integer", paramType = "query", required = true)})
|
|
|
- public R<IPage<SecondGoodsVo>> getLikeGoodsPage(
|
|
|
- @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
- @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
- log.info("SecondGoodsController.getLikeGoodsPage?page={},size={},", pageNum,pageSize);
|
|
|
- IPage<SecondGoodsVo> page = new Page<>(pageNum, pageSize);
|
|
|
- R<IPage<SecondGoodsVo>> result = new R<>();
|
|
|
- JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
|
- if (null != data) {
|
|
|
- int userId = data.getInteger("userId");
|
|
|
- String phone = data.getString("phone");
|
|
|
- result = R.data(secondGoodsService.getLikeGoodsPage(page,userId,phone));
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 我的 - 交易列表
|
|
|
- * 我卖出的商品列表-分页
|
|
|
- */
|
|
|
- @GetMapping("/getSellGoodsPage")
|
|
|
- @ApiOperation("根据商品状态获取商品列表 - 0:草稿(我的草稿列表) 1:审核中 2:审核失败 3:已上架 4:已下架 5:已售出(我卖出的商品列表) -分页")
|
|
|
- public R<IPage<SecondGoodsVo>> getSellGoodsPage(
|
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
- log.info("SecondGoodsController.getSellGoodsPage?secondGoodsVo={}", secondGoodsVo.toString());
|
|
|
- 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;
|
|
|
- }
|
|
|
}
|