Bläddra i källkod

Merge branch 'zx_online_0910' of http://git.dayaedu.com/yonge/cooleshow into develop-new

zouxuan 9 månader sedan
förälder
incheckning
00bef0bef3

+ 10 - 9
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/ImGroupNoticeController.java

@@ -6,16 +6,11 @@ import com.yonge.cooleshow.biz.dal.service.ImGroupNoticeService;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.Map;
 
 /**
@@ -31,7 +26,7 @@ public class ImGroupNoticeController extends BaseController {
     /**
      * 服务对象
      */
-    @Autowired
+    @Resource
     private ImGroupNoticeService imGroupNoticeService;
 
     @ApiImplicitParams({
@@ -42,5 +37,11 @@ public class ImGroupNoticeController extends BaseController {
     public HttpResponseResult<PageInfo<ImGroupNoticeDto>> queryPage(@RequestBody Map<String,Object> params) throws Exception {
         return succeed(imGroupNoticeService.queryPage(params));
     }
+
+    @ApiOperation("获取群公告")
+    @GetMapping(value = "/get/{noticeId}")
+    public HttpResponseResult<ImGroupNoticeDto> get(@ApiParam(value = "群公告编号", required = true) @PathVariable("noticeId") Long noticeId){
+        return succeed(imGroupNoticeService.getNotice(noticeId));
+    }
 }
 

+ 2 - 2
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/ImGroupNoticeController.java

@@ -49,8 +49,8 @@ public class ImGroupNoticeController extends BaseController {
 
     @ApiOperation("获取群公告")
     @GetMapping(value = "/get/{noticeId}")
-    public HttpResponseResult<ImGroupNotice> get(@ApiParam(value = "群公告编号", required = true) @PathVariable("noticeId") Long noticeId){
-        return succeed(imGroupNoticeService.getById(noticeId));
+    public HttpResponseResult<ImGroupNoticeDto> get(@ApiParam(value = "群公告编号", required = true) @PathVariable("noticeId") Long noticeId){
+        return succeed(imGroupNoticeService.getNotice(noticeId));
     }
 
     @ApiOperation("修改群公告")

+ 2 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/ImGroupNoticeService.java

@@ -32,5 +32,7 @@ public interface ImGroupNoticeService extends IService<ImGroupNotice> {
     void del(Long noticeId);
 
     PageInfo<ImGroupNoticeDto> queryPage(Map<String,Object> params);
+
+    ImGroupNoticeDto getNotice(Long noticeId);
 }
 

+ 14 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImGroupNoticeServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
@@ -110,6 +111,19 @@ public class ImGroupNoticeServiceImpl extends ServiceImpl<ImGroupNoticeDao, ImGr
     }
 
     @Override
+    public ImGroupNoticeDto getNotice(Long noticeId) {
+        ImGroupNotice imGroupNotice = baseMapper.selectById(noticeId);
+        if(Objects.isNull(imGroupNotice)){
+            throw new BizException("群公告不存在");
+        }
+        ImGroupNoticeDto imGroupNoticeDto = JSON.parseObject(JSON.toJSONString(imGroupNotice), ImGroupNoticeDto.class);
+        SysUser sysUser = sysUserFeignService.queryUserById(imGroupNotice.getOperatorId());
+        imGroupNoticeDto.setUsername(sysUser.getUsername());
+        imGroupNoticeDto.setAvatar(sysUser.getAvatar());
+        return imGroupNoticeDto;
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
     public void modify(ImGroupNotice imGroupNotice) {
         if(Objects.isNull(baseMapper.selectById(imGroupNotice.getId()))){