|
|
@@ -3,8 +3,10 @@ import cn.seecoder.seecoderportalcommon.enums.CommunicationSortStrategyEnum;
|
|
|
import cn.seecoder.seecoderportalcommon.vo.CommunicationVO;
|
|
|
import cn.seecoder.seecoderportalcommon.vo.PageVO;
|
|
|
import cn.seecoder.seecoderportalcommon.vo.UserVO;
|
|
|
+import cn.seecoder.seecoderportalserver.service.CommunicationService;
|
|
|
import cn.seecoder.seecoderportalserver.utility.OkResponse;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -18,22 +20,25 @@ import java.util.List;
|
|
|
@RequestMapping("/api/communication")
|
|
|
public class CommunicationController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ CommunicationService communicationService;
|
|
|
+
|
|
|
@ApiOperation("上传交流文件")
|
|
|
@PostMapping("/upload")
|
|
|
- public OkResponse<UserVO> uploadCommunicationFile(@RequestParam MultipartFile file) {
|
|
|
- return null;
|
|
|
+ public OkResponse<String> uploadCommunicationFile(@RequestParam MultipartFile file) {
|
|
|
+ return OkResponse.of(communicationService.uploadCommunicationFile(file));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("发布交流")
|
|
|
@PostMapping
|
|
|
public OkResponse<CommunicationVO> postCommunication(@RequestBody CommunicationVO communicationVO){
|
|
|
- return null;
|
|
|
+ return OkResponse.of(communicationService.postCommunication(communicationVO));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获得单个交流详情")
|
|
|
@GetMapping("/{communicationId}")
|
|
|
public OkResponse<CommunicationVO> getCommunicationDetail(@PathVariable(value = "communicationId")Integer communicationId){
|
|
|
- return null;
|
|
|
+ return OkResponse.of(communicationService.getCommunicationDetail(communicationId));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("分页获取用户发布的交流")
|
|
|
@@ -41,7 +46,7 @@ public class CommunicationController {
|
|
|
public OkResponse<PageVO<CommunicationVO>> getCommunicationPageByUserId(@PathVariable(value = "userId")String userId,
|
|
|
@RequestParam(value = "page") Integer page,
|
|
|
@RequestParam(value = "size")Integer size){
|
|
|
- return null;
|
|
|
+ return OkResponse.of(communicationService.getCommunicationPageByUserId(userId,page,size));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("分页获取交流列表")
|
|
|
@@ -49,32 +54,36 @@ public class CommunicationController {
|
|
|
public OkResponse<PageVO<CommunicationVO>> getCommunicationPage(@RequestParam(value = "page") Integer page,
|
|
|
@RequestParam(value = "size")Integer size,
|
|
|
@RequestParam(value = "sort") CommunicationSortStrategyEnum sort){
|
|
|
- return null;
|
|
|
+ return OkResponse.of(communicationService.getCommunicationPage(page,size,sort));
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("用户收藏交流")
|
|
|
@PostMapping("/{communicationId}/stars")
|
|
|
- public OkResponse<Boolean> starCommunication(@PathVariable(value = "communicationId")Integer communicationId){
|
|
|
- return null;
|
|
|
+ public OkResponse<Boolean> starCommunication(@PathVariable(value = "communicationId")Integer communicationId,
|
|
|
+ @RequestParam(value = "userId")Integer userId){
|
|
|
+ return OkResponse.of(communicationService.starCommunication(communicationId,userId));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("取消收藏交流")
|
|
|
@DeleteMapping("/{communicationId}/stars")
|
|
|
- public OkResponse<Boolean> cancelStarCommunication(@PathVariable(value = "communicationId")Integer communicationId){
|
|
|
- return null;
|
|
|
+ public OkResponse<Boolean> cancelStarCommunication(@PathVariable(value = "communicationId")Integer communicationId,
|
|
|
+ @RequestParam(value = "userId")Integer userId){
|
|
|
+ return OkResponse.of(communicationService.cancelStarCommunication(communicationId,userId));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("分页查看个人收藏夹")
|
|
|
@GetMapping("/stars/users/{userId}")
|
|
|
- public OkResponse<PageVO<CommunicationVO>> getStarredCommunicationPage(@PathVariable(value = "userId") String userId){
|
|
|
- return null;
|
|
|
+ public OkResponse<PageVO<CommunicationVO>> getStarredCommunicationPage(@PathVariable(value = "userId") Integer userId,
|
|
|
+ @RequestParam(value = "page")Integer page,
|
|
|
+ @RequestParam(value = "size")Integer size){
|
|
|
+ return OkResponse.of(communicationService.getStarredCommunicationPage(userId,page,size));
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("查看交流的收藏者")
|
|
|
@GetMapping("/{communicationId}/stars/users")
|
|
|
public OkResponse<List<UserVO>> starredUsers(@PathVariable(value = "communicationId")Integer communicationId){
|
|
|
- return null;
|
|
|
+ return OkResponse.of(communicationService.starredUsers(communicationId));
|
|
|
}
|
|
|
}
|