|
|
@@ -37,7 +37,7 @@ import java.util.concurrent.locks.Lock;
|
|
|
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
-@Api(value = "商品列表", tags ={"商品列表"} )
|
|
|
+@Api(value = "商品列表", tags = {"商品列表"})
|
|
|
@RequestMapping(value = "/goods", produces = "application/json; charset=utf-8")
|
|
|
public class GoodsController {
|
|
|
@Resource
|
|
|
@@ -58,9 +58,9 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "分类列表(树形)")
|
|
|
public ResponseHelper<List<CategoryBean>> category(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "是否显示在服务页 true/false",required = false) @RequestParam(required = false) Boolean isServiceShow
|
|
|
+ @ApiParam(value = "是否显示在服务页 true/false", required = false) @RequestParam(required = false) Boolean isServiceShow
|
|
|
) throws Exception {
|
|
|
- List<CategoryBean> categoryBeans = categoryLogic.queryAll(request,isServiceShow);
|
|
|
+ List<CategoryBean> categoryBeans = categoryLogic.queryAll(request, isServiceShow);
|
|
|
return ResponseHelper.success(categoryBeans);
|
|
|
}
|
|
|
|
|
|
@@ -68,8 +68,8 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "获取一级分类列表")
|
|
|
public ResponseHelper<List<GoodsCategory>> categoryFirst(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "是否显示在服务页",required = false) @RequestParam(required = false) Boolean isServiceShow) throws Exception {
|
|
|
- List<GoodsCategory> categoryBeans = categoryLogic.queryFirst(request,isServiceShow);
|
|
|
+ @ApiParam(value = "是否显示在服务页", required = false) @RequestParam(required = false) Boolean isServiceShow) throws Exception {
|
|
|
+ List<GoodsCategory> categoryBeans = categoryLogic.queryFirst(request, isServiceShow);
|
|
|
return ResponseHelper.success(categoryBeans);
|
|
|
}
|
|
|
|
|
|
@@ -77,9 +77,9 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "获取二级分类列表")
|
|
|
public ResponseHelper<List<GoodsCategory>> categorySecond(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "一级分类id",required = true) @RequestParam(required = true) String categoryId
|
|
|
+ @ApiParam(value = "一级分类id", required = true) @RequestParam(required = true) String categoryId
|
|
|
) throws Exception {
|
|
|
- List<GoodsCategory> categoryBeans = categoryLogic.querySecond(request , categoryId);
|
|
|
+ List<GoodsCategory> categoryBeans = categoryLogic.querySecond(request, categoryId);
|
|
|
return ResponseHelper.success(categoryBeans);
|
|
|
}
|
|
|
|
|
|
@@ -89,19 +89,18 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "分类列表")
|
|
|
public ResponseHelper<List<GoodsCategory>> category(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "分类id",required = false) @RequestParam(required = false) String parentId,
|
|
|
- @ApiParam(value = "类型 1=商品分类 2=服务分类",required = false) @RequestParam(required = false) Integer type,
|
|
|
- @ApiParam(value = "分类名称",required = false) @RequestParam(required = false) String name,
|
|
|
- @ApiParam(value = "是否只查询以旧换新的分类",required = false) @RequestParam(required = false) Boolean yjhx
|
|
|
+ @ApiParam(value = "分类id", required = false) @RequestParam(required = false) String parentId,
|
|
|
+ @ApiParam(value = "类型 1=商品分类 2=服务分类", required = false) @RequestParam(required = false) Integer type,
|
|
|
+ @ApiParam(value = "分类名称", required = false) @RequestParam(required = false) String name
|
|
|
) throws Exception {
|
|
|
- List<GoodsCategory> list = categoryLogic.list(request,parentId,type,name,yjhx);
|
|
|
+ List<GoodsCategory> list = categoryLogic.list(request, parentId, type, name);
|
|
|
return ResponseHelper.success(list);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/category/brand")
|
|
|
@ApiOperation(value = "品牌列表-根据一级分类查询")
|
|
|
public ResponseHelper<List<Brand>> brand(
|
|
|
- @ApiParam(value = "一级分类id",required = false) @RequestParam(required = false) String categoryId
|
|
|
+ @ApiParam(value = "一级分类id", required = false) @RequestParam(required = false) String categoryId
|
|
|
) throws Exception {
|
|
|
//List<CategoryBean> categoryBeans = categoryLogic.queryAll(request);
|
|
|
List<Brand> brands = categoryLogic.brandList(categoryId);
|
|
|
@@ -112,11 +111,11 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "根据一级分类查询商品列表")
|
|
|
public ResponseHelper<IPage<Goods>> listByLevel1(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "一级分类id",required = true) @RequestParam(required = true) String categoryId,
|
|
|
- @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
|
|
|
- @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
|
|
|
+ @ApiParam(value = "一级分类id", required = true) @RequestParam(required = true) String categoryId,
|
|
|
+ @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
) throws Exception {
|
|
|
- IPage<Goods> categoryGoodBeans = categoryLogic.categoryGoodsList(request,categoryId,pageNum,pageSize);
|
|
|
+ IPage<Goods> categoryGoodBeans = categoryLogic.categoryGoodsList(request, categoryId, pageNum, pageSize);
|
|
|
return ResponseHelper.success(categoryGoodBeans);
|
|
|
}
|
|
|
|
|
|
@@ -124,18 +123,18 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "商品列表")
|
|
|
public ResponseHelper<IPage<GoodsNewBean>> page(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "品牌id",required = false) @RequestParam(required = false) List<String> brandId,
|
|
|
- @ApiParam(value = "最低价",required = false) @RequestParam(required = false) BigDecimal minPrice,
|
|
|
- @ApiParam(value = "最高价",required = false) @RequestParam(required = false) BigDecimal maxPrice,
|
|
|
- @ApiParam(value = "商品标签",required = false) @RequestParam(required = false) List<String> tag,
|
|
|
+ @ApiParam(value = "品牌id", required = false) @RequestParam(required = false) List<String> brandId,
|
|
|
+ @ApiParam(value = "最低价", required = false) @RequestParam(required = false) BigDecimal minPrice,
|
|
|
+ @ApiParam(value = "最高价", required = false) @RequestParam(required = false) BigDecimal maxPrice,
|
|
|
+ @ApiParam(value = "商品标签", required = false) @RequestParam(required = false) List<String> tag,
|
|
|
@ApiParam(value = "商品关键字") @RequestParam(required = false) String keyword,
|
|
|
- @ApiParam(value = "排序 0=综合 1=销量 2=价格升 3=价格降 4=上新") @RequestParam(required = false,defaultValue = "0") Integer sort,
|
|
|
+ @ApiParam(value = "排序 0=综合 1=销量 2=价格升 3=价格降 4=上新") @RequestParam(required = false, defaultValue = "0") Integer sort,
|
|
|
@ApiParam(value = "分类id") @RequestParam(required = false) String categoryId,
|
|
|
- @ApiParam(value = "是否只查询以旧换新的商品",required = false) @RequestParam(required = false) Boolean yjhx,
|
|
|
- @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
|
|
|
- @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
|
|
|
+ @ApiParam(value = "是否只查询以旧换新的商品", required = false) @RequestParam(required = false) Boolean yjhx,
|
|
|
+ @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
) throws Exception {
|
|
|
- IPage<GoodsNewBean> page = goodsLogic.page(request,brandId,minPrice,maxPrice,tag,keyword,categoryId,sort,yjhx, pageNum, pageSize);
|
|
|
+ IPage<GoodsNewBean> page = goodsLogic.page(request, brandId, minPrice, maxPrice, tag, keyword, categoryId, sort, yjhx, pageNum, pageSize);
|
|
|
return ResponseHelper.success(page);
|
|
|
}
|
|
|
|
|
|
@@ -143,18 +142,18 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "商品列表")
|
|
|
public ResponseHelper<IPage<GoodsNewBean>> page1(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "品牌id",required = false) @RequestParam(required = false) List<String> brandId,
|
|
|
- @ApiParam(value = "最低价",required = false) @RequestParam(required = false) BigDecimal minPrice,
|
|
|
- @ApiParam(value = "最高价",required = false) @RequestParam(required = false) BigDecimal maxPrice,
|
|
|
- @ApiParam(value = "商品标签",required = false) @RequestParam(required = false) List<String> tag,
|
|
|
+ @ApiParam(value = "品牌id", required = false) @RequestParam(required = false) List<String> brandId,
|
|
|
+ @ApiParam(value = "最低价", required = false) @RequestParam(required = false) BigDecimal minPrice,
|
|
|
+ @ApiParam(value = "最高价", required = false) @RequestParam(required = false) BigDecimal maxPrice,
|
|
|
+ @ApiParam(value = "商品标签", required = false) @RequestParam(required = false) List<String> tag,
|
|
|
@ApiParam(value = "商品关键字") @RequestParam(required = false) String keyword,
|
|
|
- @ApiParam(value = "排序 0=综合 1=销量 2=价格升 3=价格降 4=上新") @RequestParam(required = false,defaultValue = "0") Integer sort,
|
|
|
+ @ApiParam(value = "排序 0=综合 1=销量 2=价格升 3=价格降 4=上新") @RequestParam(required = false, defaultValue = "0") Integer sort,
|
|
|
@ApiParam(value = "分类id") @RequestParam(required = false) String categoryId,
|
|
|
- @ApiParam(value = "是否只查询以旧换新的商品",required = false) @RequestParam(required = false) Boolean yjhx,
|
|
|
- @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
|
|
|
- @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
|
|
|
+ @ApiParam(value = "是否只查询以旧换新的商品", required = false) @RequestParam(required = false) Boolean yjhx,
|
|
|
+ @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
) throws Exception {
|
|
|
- IPage<GoodsNewBean> page = goodsLogic.page(request,brandId,minPrice,maxPrice,tag,keyword,categoryId,sort, yjhx,pageNum, pageSize);
|
|
|
+ IPage<GoodsNewBean> page = goodsLogic.page(request, brandId, minPrice, maxPrice, tag, keyword, categoryId, sort, yjhx, pageNum, pageSize);
|
|
|
return ResponseHelper.success(page);
|
|
|
}
|
|
|
|
|
|
@@ -163,9 +162,9 @@ public class GoodsController {
|
|
|
@ApiOperation(value = "商品详情")
|
|
|
public ResponseHelper<GoodsBean> detail(
|
|
|
HttpServletRequest request,
|
|
|
- @ApiParam(value = "id",required = true) @RequestParam String goodsId,
|
|
|
- @ApiParam(value = "userId",required = false) @RequestParam(required = false) String userId,
|
|
|
- @ApiParam(value = "storageId",required = true) @RequestParam(required = false) String storageId
|
|
|
+ @ApiParam(value = "id", required = true) @RequestParam String goodsId,
|
|
|
+ @ApiParam(value = "userId", required = false) @RequestParam(required = false) String userId,
|
|
|
+ @ApiParam(value = "storageId", required = true) @RequestParam(required = false) String storageId
|
|
|
) throws RemoteServiceException {
|
|
|
GoodsBean detail = goodsLogic.detail(request, goodsId, userId, storageId);
|
|
|
return ResponseHelper.success(detail);
|
|
|
@@ -174,7 +173,7 @@ public class GoodsController {
|
|
|
@GetMapping("/qrcode")
|
|
|
@ApiOperation("获取商品二维码")
|
|
|
public ResponseHelper<String> qrcode(
|
|
|
- @ApiParam(value = "url",required = true) @RequestParam String url
|
|
|
+ @ApiParam(value = "url", required = true) @RequestParam String url
|
|
|
) throws IOException, RemoteServiceException {
|
|
|
|
|
|
byte[] bytes = QrCodeUtil.generatePng(url, 300, 300);
|
|
|
@@ -188,13 +187,13 @@ public class GoodsController {
|
|
|
@PostMapping("/advice/notice")
|
|
|
@ApiOperation("到货通知")
|
|
|
public ResponseHelper<String> qrcode(
|
|
|
- @ApiParam(value = "商品id",required = true) @RequestParam String goodsId,
|
|
|
- @ApiParam(value = "商品规格id",required = true) @RequestParam String goodsSpecId,
|
|
|
- @ApiParam(value = "仓库id",required = true) @RequestParam String storageId
|
|
|
+ @ApiParam(value = "商品id", required = true) @RequestParam String goodsId,
|
|
|
+ @ApiParam(value = "商品规格id", required = true) @RequestParam String goodsSpecId,
|
|
|
+ @ApiParam(value = "仓库id", required = true) @RequestParam String storageId
|
|
|
) throws Exception {
|
|
|
|
|
|
Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_COMMON + goodsId + goodsSpecId);
|
|
|
- if(!obtain.tryLock(10, TimeUnit.SECONDS)){
|
|
|
+ if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
|
|
|
return ResponseHelper.error("系统繁忙,请稍后再试");
|
|
|
}
|
|
|
try {
|
|
|
@@ -208,7 +207,7 @@ public class GoodsController {
|
|
|
@PostMapping("/documents")
|
|
|
@ApiOperation("商品文档")
|
|
|
public ResponseHelper<List<GoodsDocumentsRelaBean>> documents(
|
|
|
- @ApiParam(value = "商品id",required = true) @RequestParam String goodsId
|
|
|
+ @ApiParam(value = "商品id", required = true) @RequestParam String goodsId
|
|
|
) {
|
|
|
List<GoodsDocumentsRelaBean> list = goodsLogic.documents(goodsId);
|
|
|
return ResponseHelper.success(list);
|