|  | @@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.ImGroupResultDto;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.ImGroupSearchDto;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.ImGroup;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.entity.ImUserFriend;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.ImGroupMemberRoleType;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.MK;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.ImGroupMemberService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.ImGroupService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.ImUserFriendService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.SysUserService;
 | 
	
	
		
			
				|  | @@ -32,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestParam;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  import javax.validation.Valid;
 | 
	
		
			
				|  |  |  import java.util.HashSet;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
	
		
			
				|  | @@ -51,14 +54,17 @@ public class ImGroupController extends BaseController {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 服务对象
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  |      private ImGroupService imGroupService;
 | 
	
		
			
				|  |  | -    @Autowired
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  |      private SysUserService sysUserService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ImUserFriendService imUserFriendService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ImGroupMemberService imGroupMemberService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("创建群聊")
 | 
	
		
			
				|  |  |      @PostMapping(value = "/create")
 | 
	
		
			
				|  |  |      public HttpResponseResult create(@Valid @RequestBody ImGroupWrapper.ImGroup imGroup, BindingResult bindingResult) throws Exception {
 | 
	
	
		
			
				|  | @@ -123,7 +129,7 @@ public class ImGroupController extends BaseController {
 | 
	
		
			
				|  |  |      @PostMapping(value = "/quit/{groupId}")
 | 
	
		
			
				|  |  |      public HttpResponseResult quit(@ApiParam(value = "群编号", required = true) @PathVariable("groupId") String groupId,
 | 
	
		
			
				|  |  |                                     @RequestParam(value = "quit",required = false, defaultValue = "false") boolean quit
 | 
	
		
			
				|  |  | -                                   ) throws Exception {
 | 
	
		
			
				|  |  | +    ) throws Exception {
 | 
	
		
			
				|  |  |          imGroupService.quit(groupId, sysUserService.getUserId(), ClientEnum.TEACHER, quit);
 | 
	
		
			
				|  |  |          return succeed();
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -135,6 +141,14 @@ public class ImGroupController extends BaseController {
 | 
	
		
			
				|  |  |          if (group == null) {
 | 
	
		
			
				|  |  |              return failed(HttpStatus.NO_CONTENT, "群组不存在");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        ImGroupMember admin = imGroupMemberService.lambdaQuery()
 | 
	
		
			
				|  |  | +                .eq(ImGroupMember::getGroupId, group.getId())
 | 
	
		
			
				|  |  | +                .eq(ImGroupMember::getUserId, sysUserService.getUser().getId())
 | 
	
		
			
				|  |  | +                .last("limit 1").one();
 | 
	
		
			
				|  |  | +        if (admin == null) {
 | 
	
		
			
				|  |  | +            // 该用户不在该群,无权限查看,处理用户退出群后,查看历史消息校验
 | 
	
		
			
				|  |  | +            return failed(HttpStatus.NO_CONTENT, "群组不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return succeed(group);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |