|
@@ -42,25 +42,24 @@ public class ProductController {
|
|
|
try {
|
|
|
Integer id = productService.addOrUpdateProduct(productAddDTO);
|
|
|
records.setData(id);
|
|
|
+ } catch (BusinessException e) {
|
|
|
+ return Response.error(e.getErrorCode(), e.getMessage());
|
|
|
}
|
|
|
- catch (BusinessException e){
|
|
|
- return Response.error(e.getErrorCode(),e.getMessage());
|
|
|
- }
|
|
|
return Response.success(records);
|
|
|
}
|
|
|
|
|
|
@checkLogin
|
|
|
@Operation(summary = "关注产品")
|
|
|
@PostMapping("/follow")
|
|
|
- public Response follow(@RequestBody AssoPersonProductDTO assoPersonProductDTO){
|
|
|
+ public Response follow(@RequestBody AssoPersonProductDTO assoPersonProductDTO) {
|
|
|
Records records = new Records();
|
|
|
Integer id = assoPersonProductService.add(assoPersonProductDTO);
|
|
|
- if(id ==null){
|
|
|
- return Response.noPermissions("已超过可关注数量");
|
|
|
- }
|
|
|
- if(id.equals(-2)){
|
|
|
- return Response.noPermissions("无关注产品的权益");
|
|
|
- }
|
|
|
+ if (id == null) {
|
|
|
+ return Response.noPermissions("已超过可关注数量");
|
|
|
+ }
|
|
|
+ if (id.equals(-2)) {
|
|
|
+ return Response.noPermissions("无关注产品的权益");
|
|
|
+ }
|
|
|
records.setData(id);
|
|
|
return Response.success(records);
|
|
|
}
|
|
@@ -68,7 +67,7 @@ public class ProductController {
|
|
|
|
|
|
@Operation(summary = "取消关注产品")
|
|
|
@GetMapping("/unFollow")
|
|
|
- public Response unFollow(Integer productId){
|
|
|
+ public Response unFollow(Integer productId) {
|
|
|
Records records = new Records();
|
|
|
Integer id = assoPersonProductService.cancel(productId);
|
|
|
if (id.equals(-1)) {
|
|
@@ -93,7 +92,12 @@ public class ProductController {
|
|
|
@Operation(summary = "添加或更新爆款产品")
|
|
|
@PostMapping("/addOrUpdateHotProduct")
|
|
|
public Response addOrUpdateHotProduct(@RequestBody HotProductAddDTO hotProductAddDTO) {
|
|
|
- Integer id = productService.addOrUpdateHotProduct(hotProductAddDTO);
|
|
|
+ Integer id =null;
|
|
|
+ try {
|
|
|
+ id = productService.addOrUpdateHotProduct(hotProductAddDTO);
|
|
|
+ } catch (BusinessException e) {
|
|
|
+ return Response.error(e.getErrorCode(),e.getMessage());
|
|
|
+ }
|
|
|
return Response.success(id);
|
|
|
}
|
|
|
|
|
@@ -102,7 +106,7 @@ public class ProductController {
|
|
|
@PostMapping("/queryHotProductDetail")
|
|
|
public Response queryHotProductDetail(Integer id) {
|
|
|
ProductVO productVO = productService.queryHotProductDetail(id);
|
|
|
- Records records =new Records();
|
|
|
+ Records records = new Records();
|
|
|
records.setData(productVO);
|
|
|
return Response.success(records);
|
|
|
}
|
|
@@ -112,7 +116,7 @@ public class ProductController {
|
|
|
@Operation(summary = "上下架产品")
|
|
|
@PostMapping("/updateProductIfShow")
|
|
|
public Response updateProductIfShow(UpdateProductShowDTO updateProductShowDTO) {
|
|
|
- List<Integer> ids= productService.updateProductIfShow(updateProductShowDTO);
|
|
|
+ List<Integer> ids = productService.updateProductIfShow(updateProductShowDTO);
|
|
|
return Response.success(ids);
|
|
|
}
|
|
|
|
|
@@ -120,7 +124,7 @@ public class ProductController {
|
|
|
@Operation(summary = "删除产品")
|
|
|
@PostMapping("/deleteHotProduct")
|
|
|
public Response deleteHotProduct(HotProductDeleteDTO hotProductDeleteDTO) {
|
|
|
- List<Integer> ids= productService.deleteHotProduct(hotProductDeleteDTO);
|
|
|
+ List<Integer> ids = productService.deleteHotProduct(hotProductDeleteDTO);
|
|
|
return Response.success(ids);
|
|
|
}
|
|
|
}
|