Browse Source

Merge branch 'seec' of http://gogs.seec.seecoder.cn/WuXinyu/SEEC-PORTAL into seec

 Conflicts:
	seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/service/CommunicationService.java
	seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/serviceImpl/CommunicationServiceImpl.java
	seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/web/rest/CommunicationController.java
191250028 3 years ago
parent
commit
6a1a754a76

+ 19 - 8
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/service/CommunicationService.java

@@ -1,22 +1,33 @@
 package cn.seecoder.seecoderportalserver.service;
 
+import cn.seecoder.seecoderportalcommon.enums.CommunicationSortStrategyEnum;
 import cn.seecoder.seecoderportalcommon.vo.CommunicationVO;
 import cn.seecoder.seecoderportalcommon.vo.PageVO;
-import cn.seecoder.seecoderportalserver.utility.OkResponse;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
+import cn.seecoder.seecoderportalcommon.vo.UserVO;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
 
 /**
  * @author fanyanpeng
  * @date 2023/7/11 12:21
  */
 public interface CommunicationService {
+    String uploadCommunicationFile(MultipartFile file);
+
+    CommunicationVO postCommunication(CommunicationVO communicationVO);
+
+    CommunicationVO getCommunicationDetail(Integer communicationId);
+
+    PageVO<CommunicationVO> getCommunicationPageByUserId(String userId, Integer page, Integer size);
+
+    PageVO<CommunicationVO> getCommunicationPage(Integer page, Integer size, CommunicationSortStrategyEnum sort);
+
+    Boolean starCommunication(Integer communicationId, Integer userId);
 
+    Boolean cancelStarCommunication(Integer communicationId, Integer userId);
 
-    PageVO<CommunicationVO> getCommunicationPageByUserId(String userId,
-                                                         Integer page,
-                                                         Integer size);
+    PageVO<CommunicationVO> getStarredCommunicationPage(Integer userId, Integer page, Integer size);
 
+    List<UserVO> starredUsers(Integer communicationId);
 }

+ 64 - 1
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/serviceImpl/CommunicationServiceImpl.java

@@ -1,11 +1,26 @@
 package cn.seecoder.seecoderportalserver.serviceImpl;
 
+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.seecoderportalcommon.vo.CommunicationVO;
+import cn.seecoder.seecoderportalcommon.vo.PageVO;
+import cn.seecoder.seecoderportalserver.domain.Communication;
+import cn.seecoder.seecoderportalserver.mapper.CommunicationMapper;
+import cn.seecoder.seecoderportalserver.repository.CommunicationRepository;
 import cn.seecoder.seecoderportalserver.domain.Communication;
 import cn.seecoder.seecoderportalserver.mapper.CommunicationMapper;
 import cn.seecoder.seecoderportalserver.repository.CommunicationRepository;
 import cn.seecoder.seecoderportalserver.service.CommunicationService;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.List;
 import cn.seecoder.seecoderportalserver.utility.OkResponse;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -23,7 +38,6 @@ import java.util.List;
 @Service
 public class CommunicationServiceImpl implements CommunicationService {
 
-
     private final CommunicationRepository communicationRepository;
     private final CommunicationMapper communicationMapper;
 
@@ -68,4 +82,53 @@ public class CommunicationServiceImpl implements CommunicationService {
     }
 
 
+
+
+
+    @Override
+    public String uploadCommunicationFile(MultipartFile file) {
+        return null;
+    }
+
+    @Override
+    public CommunicationVO postCommunication(CommunicationVO communicationVO) {
+        return null;
+    }
+
+    @Override
+    public CommunicationVO getCommunicationDetail(Integer communicationId) {
+        return null;
+    }
+
+    @Override
+    public PageVO<CommunicationVO> getCommunicationPageByUserId(String userId, Integer page, Integer size) {
+        return null;
+    }
+
+    @Override
+    public PageVO<CommunicationVO> getCommunicationPage(Integer page, Integer size, CommunicationSortStrategyEnum sort) {
+        return null;
+    }
+
+    @Override
+    public Boolean starCommunication(Integer communicationId, Integer userId) {
+        return null;
+    }
+
+    @Override
+    public Boolean cancelStarCommunication(Integer communicationId, Integer userId) {
+        return null;
+    }
+
+    @Override
+    public PageVO<CommunicationVO> getStarredCommunicationPage(Integer userId, Integer page, Integer size) {
+        return null;
+    }
+
+    @Override
+    public List<UserVO> starredUsers(Integer communicationId) {
+        return null;
+    }
+
+
 }

+ 21 - 15
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/web/rest/CommunicationController.java

@@ -1,11 +1,12 @@
 package cn.seecoder.seecoderportalserver.web.rest;
 import cn.seecoder.seecoderportalcommon.enums.CommunicationSortStrategyEnum;
-import cn.seecoder.seecoderportalcommon.vo.CommunicationFileVO;
 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;
 
@@ -19,22 +20,25 @@ import java.util.List;
 @RequestMapping("/api/communication")
 public class CommunicationController {
 
+    @Autowired
+    CommunicationService communicationService;
+
     @ApiOperation("上传交流文件")
     @PostMapping("/upload")
-    public OkResponse<CommunicationFileVO> 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("分页获取用户发布的交流")
@@ -42,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("分页获取交流列表")
@@ -50,34 +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,
-                                                                           @RequestParam(value = "page") Integer page,
+    public OkResponse<PageVO<CommunicationVO>> getStarredCommunicationPage(@PathVariable(value = "userId") Integer userId,
+                                                                           @RequestParam(value = "page")Integer page,
                                                                            @RequestParam(value = "size")Integer size){
-        return null;
+        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));
     }
 }