|
@@ -1,7 +1,6 @@
|
|
package com.gis.cms.controller;
|
|
package com.gis.cms.controller;
|
|
|
|
|
|
-import com.gis.cms.entity.dto.GoodsPageDto;
|
|
|
|
-import com.gis.cms.entity.dto.SortPageDto;
|
|
|
|
|
|
+import com.gis.cms.entity.dto.*;
|
|
import com.gis.cms.entity.po.GoodsEntity;
|
|
import com.gis.cms.entity.po.GoodsEntity;
|
|
import com.gis.cms.entity.po.VideoEntity;
|
|
import com.gis.cms.entity.po.VideoEntity;
|
|
import com.gis.cms.service.*;
|
|
import com.gis.cms.service.*;
|
|
@@ -12,8 +11,11 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -46,6 +48,12 @@ public class WebController {
|
|
@Autowired
|
|
@Autowired
|
|
StudentService studentService;
|
|
StudentService studentService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ BbsService bbsService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ BbsMessageService bbsMessageService;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -111,4 +119,77 @@ public class WebController {
|
|
return leaderService.search(param);
|
|
return leaderService.search(param);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "论坛-发帖列表")
|
|
|
|
+ @PostMapping("bbs/list")
|
|
|
|
+ public Result bbsList(@RequestBody BbsPageDto param) {
|
|
|
|
+ // 审核通过
|
|
|
|
+ param.setStatus(2);
|
|
|
|
+ return bbsService.search(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-发帖")
|
|
|
|
+ @PostMapping("bbs/save")
|
|
|
|
+ public Result bbsSave(@Valid @RequestBody BbsDto param) {
|
|
|
|
+ return bbsService.saveEntity(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-上传图片")
|
|
|
|
+ @PostMapping("bbs/upload")
|
|
|
|
+ public Result bbsUpload(MultipartFile file) {
|
|
|
|
+ return bbsService.upload(file);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-发帖浏览量")
|
|
|
|
+ @GetMapping("bbs/visit/{id}")
|
|
|
|
+ public Result bbsVisit(@PathVariable Long id) {
|
|
|
|
+ bbsService.addVisit(id);
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-留言")
|
|
|
|
+ @PostMapping("bbs/message/save")
|
|
|
|
+ public Result bbsMessage(@Valid @RequestBody BbsMessageDto param) {
|
|
|
|
+ return bbsMessageService.saveEntity(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-留言列表")
|
|
|
|
+ @PostMapping("bbs/message/list")
|
|
|
|
+ public Result bbsMessageList(@RequestBody BbsMessagePageDto param) {
|
|
|
|
+ return bbsMessageService.search(param);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-点赞", notes = "类型, bbs:发帖点赞, message:留言点赞")
|
|
|
|
+ @PostMapping("bbs/like/{type}/{id}")
|
|
|
|
+ public Result bbsLike(@PathVariable String type, @PathVariable Long id) {
|
|
|
|
+ List<String> list = Arrays.asList("bbs", "message");
|
|
|
|
+ if (!list.contains(type)){
|
|
|
|
+ return Result.failure("输入参数类型非法: " + type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("bbs".equals(type)){
|
|
|
|
+ bbsService.addLike(id);
|
|
|
|
+ } else {
|
|
|
|
+ bbsMessageService.addLike(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "论坛-踩", notes = "类型, bbs:发帖点赞, message:留言点赞")
|
|
|
|
+ @PostMapping("bbs/unLike/{type}/{id}")
|
|
|
|
+ public Result bbsUnLike(@PathVariable String type, @PathVariable Long id) {
|
|
|
|
+ List<String> list = Arrays.asList("bbs", "message");
|
|
|
|
+ if (!list.contains(type)) {
|
|
|
|
+ return Result.failure("输入参数类型非法: " + type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("bbs".equals(type)) {
|
|
|
|
+ bbsService.addUnLike(id);
|
|
|
|
+ } else {
|
|
|
|
+ bbsMessageService.addUnLike(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|