|
@@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
|
-import io.swagger.annotations.ApiSort;
|
|
|
|
|
|
+import io.swagger.annotations.*;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -39,6 +36,7 @@ public class SecondGoodsController {
|
|
@GetMapping("/getSecondGoodsById")
|
|
@GetMapping("/getSecondGoodsById")
|
|
@ApiOperation("根据ID获取二手商品 - 商品编辑回显")
|
|
@ApiOperation("根据ID获取二手商品 - 商品编辑回显")
|
|
public R<SecondGoodsVo> getSecondGoodsById(@ApiParam("根据ID获取二手商品 - 商品编辑回显") @RequestParam Integer id) {
|
|
public R<SecondGoodsVo> getSecondGoodsById(@ApiParam("根据ID获取二手商品 - 商品编辑回显") @RequestParam Integer id) {
|
|
|
|
+ log.info("SecondGoodsController.getSecondGoodsById?id={}", id);
|
|
return R.data(secondGoodsService.getSecondGoodsById(id), "获取成功");
|
|
return R.data(secondGoodsService.getSecondGoodsById(id), "获取成功");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -48,6 +46,7 @@ public class SecondGoodsController {
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
@ApiOperation("发布二手商品")
|
|
@ApiOperation("发布二手商品")
|
|
public R<Void> addSecondGoods(@ApiParam("二手商品信息") @RequestBody SecondGoodsVo secondGoods) {
|
|
public R<Void> addSecondGoods(@ApiParam("二手商品信息") @RequestBody SecondGoodsVo secondGoods) {
|
|
|
|
+ log.info("SecondGoodsController.addSecondGoods?secondGoods={}", secondGoods.toString());
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
if (null != data) {
|
|
if (null != data) {
|
|
int userId = data.getInteger("userId");
|
|
int userId = data.getInteger("userId");
|
|
@@ -73,6 +72,7 @@ public class SecondGoodsController {
|
|
@PostMapping("/edit")
|
|
@PostMapping("/edit")
|
|
@ApiOperation("更新二手商品")
|
|
@ApiOperation("更新二手商品")
|
|
public R<Void> updateSecondGoods(@ApiParam("二手商品信息") @RequestBody SecondGoodsVo secondGoods) {
|
|
public R<Void> updateSecondGoods(@ApiParam("二手商品信息") @RequestBody SecondGoodsVo secondGoods) {
|
|
|
|
+ log.info("SecondGoodsController.updateSecondGoods?secondGoods={}", secondGoods.toString());
|
|
// 添加商品 0 创建 1 更新
|
|
// 添加商品 0 创建 1 更新
|
|
if (!secondGoodsService.createBasicInfo(secondGoods,1)) {
|
|
if (!secondGoodsService.createBasicInfo(secondGoods,1)) {
|
|
return R.fail("添加二手商品失败");
|
|
return R.fail("添加二手商品失败");
|
|
@@ -87,6 +87,7 @@ public class SecondGoodsController {
|
|
@PostMapping("/shelve")
|
|
@PostMapping("/shelve")
|
|
@ApiOperation("上架二手商品")
|
|
@ApiOperation("上架二手商品")
|
|
public R<Void> shelveSecondGoods(@ApiParam("上架二手商品") @RequestBody SecondGoodsVo secondGoods) {
|
|
public R<Void> shelveSecondGoods(@ApiParam("上架二手商品") @RequestBody SecondGoodsVo secondGoods) {
|
|
|
|
+ log.info("SecondGoodsController.shelveSecondGoods?secondGoods={}", secondGoods.toString());
|
|
// 修改商品状态为3 - 已上架
|
|
// 修改商品状态为3 - 已上架
|
|
secondGoods.setGoodsStatus(3);
|
|
secondGoods.setGoodsStatus(3);
|
|
secondGoodsService.updateById(secondGoods);
|
|
secondGoodsService.updateById(secondGoods);
|
|
@@ -99,6 +100,7 @@ public class SecondGoodsController {
|
|
@PostMapping("/delete")
|
|
@PostMapping("/delete")
|
|
@ApiOperation("删除二手商品")
|
|
@ApiOperation("删除二手商品")
|
|
public R<Void> deleteSecondGoods(@ApiParam("删除二手商品") @RequestBody SecondGoodsVo secondGoods) {
|
|
public R<Void> deleteSecondGoods(@ApiParam("删除二手商品") @RequestBody SecondGoodsVo secondGoods) {
|
|
|
|
+ log.info("SecondGoodsController.deleteSecondGoods?secondGoods={}", secondGoods.toString());
|
|
secondGoodsService.removeById(secondGoods.getId());
|
|
secondGoodsService.removeById(secondGoods.getId());
|
|
return R.success("删除成功");
|
|
return R.success("删除成功");
|
|
}
|
|
}
|
|
@@ -110,6 +112,7 @@ public class SecondGoodsController {
|
|
@ApiOperation("搜索结果-商品列表")
|
|
@ApiOperation("搜索结果-商品列表")
|
|
public R<IPage<SecondGoodsVo>> searchGoodsList(
|
|
public R<IPage<SecondGoodsVo>> searchGoodsList(
|
|
@ApiParam("二手商品搜索条件") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
@ApiParam("二手商品搜索条件") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
|
+ log.info("SecondGoodsController.searchGoodsList?secondGoodsVo={}", secondGoodsVo.toString());
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
@@ -145,10 +148,14 @@ public class SecondGoodsController {
|
|
*/
|
|
*/
|
|
@GetMapping("/getShieldedGoodsPage")
|
|
@GetMapping("/getShieldedGoodsPage")
|
|
@ApiOperation("获取用户屏蔽的商品列表(分页)")
|
|
@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(
|
|
public R<IPage<SecondGoodsVo>> getShieldedGoodsPage(
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
|
|
|
+ @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
|
+ log.info("SecondGoodsController.getShieldedGoodsPage?page={},size={},", pageNum,pageSize);
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
- IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(pageNum, pageSize);
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
if (null != data) {
|
|
if (null != data) {
|
|
int userId = data.getInteger("userId");
|
|
int userId = data.getInteger("userId");
|
|
@@ -162,10 +169,14 @@ public class SecondGoodsController {
|
|
*/
|
|
*/
|
|
@GetMapping("/getCollectGoodsPage")
|
|
@GetMapping("/getCollectGoodsPage")
|
|
@ApiOperation("我收藏的商品列表-分页")
|
|
@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(
|
|
public R<IPage<SecondGoodsVo>> getCollectGoodsPage(
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
|
|
|
+ @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
|
+ log.info("SecondGoodsController.getCollectGoodsPage?page={},size={},", pageNum,pageSize);
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
- IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(pageNum,pageSize);
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
if (null != data) {
|
|
if (null != data) {
|
|
int userId = data.getInteger("userId");
|
|
int userId = data.getInteger("userId");
|
|
@@ -175,31 +186,61 @@ public class SecondGoodsController {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 我卖出的商品列表-分页
|
|
|
|
|
|
+ * 我的商品-个人主页用户发布的商品
|
|
*/
|
|
*/
|
|
- @GetMapping("/getSellGoodsPage")
|
|
|
|
- @ApiOperation("根据商品状态获取商品列表 - 0:草稿(我的草稿列表) 1:审核中 2:审核失败 3:已上架 4:已下架 5:已售出(我卖出的商品列表) -分页")
|
|
|
|
- public R<IPage<SecondGoodsVo>> getSellGoodsPage(
|
|
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
|
|
|
+ @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<>();
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
- IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(pageNum,pageSize);
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
if (null != data) {
|
|
if (null != data) {
|
|
int userId = data.getInteger("userId");
|
|
int userId = data.getInteger("userId");
|
|
- result = R.data(secondGoodsService.getSellGoodsPage(page,secondGoodsVo,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;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 我购买的商品列表-分页
|
|
* 我购买的商品列表-分页
|
|
*/
|
|
*/
|
|
@GetMapping("/getBuyGoodsPage")
|
|
@GetMapping("/getBuyGoodsPage")
|
|
@ApiOperation("我购买的商品列表-分页")
|
|
@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(
|
|
public R<IPage<SecondGoodsVo>> getBuyGoodsPage(
|
|
- @ApiParam("分页参数") @RequestBody SecondGoodsVo secondGoodsVo) {
|
|
|
|
|
|
+ @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
+ @RequestParam(defaultValue = "10") Integer pageSize) {
|
|
|
|
+ log.info("SecondGoodsController.getDraftList?page={},size={},", pageNum,pageSize);
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
R<IPage<SecondGoodsVo>> result = new R<>();
|
|
- IPage<SecondGoodsVo> page = new Page<>(secondGoodsVo.getPageNum(), secondGoodsVo.getPageSize());
|
|
|
|
|
|
+ IPage<SecondGoodsVo> page = new Page<>(pageNum, pageNum);
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
JSONObject data = JwtUtil.getCurrentUserInfo();
|
|
if (null != data) {
|
|
if (null != data) {
|
|
int userId = data.getInteger("userId");
|
|
int userId = data.getInteger("userId");
|
|
@@ -213,10 +254,17 @@ public class SecondGoodsController {
|
|
*/
|
|
*/
|
|
@GetMapping("/getUserGoodsPage")
|
|
@GetMapping("/getUserGoodsPage")
|
|
@ApiOperation("他的商品-个人主页用户发布的商品")
|
|
@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(
|
|
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));
|
|
|
|
|
|
+ @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));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -225,6 +273,7 @@ public class SecondGoodsController {
|
|
@GetMapping("/getDraftCount")
|
|
@GetMapping("/getDraftCount")
|
|
@ApiOperation("获取商品草稿数量")
|
|
@ApiOperation("获取商品草稿数量")
|
|
public R<Integer> getDraftCount(@ApiParam("商品id") @RequestParam Integer goodsId) {
|
|
public R<Integer> getDraftCount(@ApiParam("商品id") @RequestParam Integer goodsId) {
|
|
|
|
+ log.info("SecondGoodsController.getDraftCount?goodsId={}", goodsId);
|
|
// 获取商品草稿数量
|
|
// 获取商品草稿数量
|
|
QueryWrapper<SecondGoods> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<SecondGoods> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.lambda()
|
|
queryWrapper.lambda()
|
|
@@ -233,4 +282,60 @@ public class SecondGoodsController {
|
|
return R.data(secondGoodsService.count(queryWrapper));
|
|
return R.data(secondGoodsService.count(queryWrapper));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 商品审核状态查询-消息跳转用
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getGoodsAuditStatus")
|
|
|
|
+ @ApiOperation("商品审核状态查询-消息跳转用(商品状态 0:草稿 1:审核中 2:审核失败 3:已上架 4:已下架 5:已售出)")
|
|
|
|
+ public R<Integer> getGoodsAuditStatus(@ApiParam("商品id") @RequestParam Integer goodsId) {
|
|
|
|
+ log.info("SecondGoodsController.getGoodsAuditStatus?goodsId={}", goodsId);
|
|
|
|
+ // 获取商品审核状态
|
|
|
|
+ QueryWrapper<SecondGoods> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda()
|
|
|
|
+ .eq(SecondGoods::getId, goodsId);
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
}
|
|
}
|