| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yonge.cooleshow.tenant.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.core.metadata.IPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.microsvc.toolkit.common.response.paging.PageInfo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -7,13 +8,16 @@ import com.microsvc.toolkit.common.response.paging.QueryInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.microsvc.toolkit.common.response.template.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.auth.api.client.SysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.auth.api.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.entity.ImGroup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.entity.TenantGroup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.cooleshow.biz.dal.service.ImGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.service.TenantGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.tenant.vo.TenantGroupVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.validation.annotation.Validated; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Validated 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,11 +46,31 @@ public class TenantGroupController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysUserFeignService sysUserFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ImGroupService imGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "详情", notes = "机构小组表-根据详情ID查询单条, 传入id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/detail/{id}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public R<TenantGroup> detail(@PathVariable("id") Long id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R<TenantGroupWrapper.TenantGroup> detail(@PathVariable("id") Long id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         TenantGroup wrapper = tenantGroupService.detail(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return R.from(wrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (wrapper == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.from(new TenantGroupWrapper.TenantGroup()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TenantGroupWrapper.TenantGroup group = TenantGroupWrapper.TenantGroup.from(JSON.toJSONString(wrapper)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(wrapper.getImGroupId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ImGroup imGroup = imGroupService.getById(wrapper.getImGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (imGroup != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                group.setImGroupExist(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<TenantGroupWrapper.TenantGroupMember> members = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tenantGroupService.queryGroupMember(wrapper.getTenantId(), id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> userIds = members.stream().map(TenantGroupWrapper.TenantGroupMember::getUserId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        group.setUserIds(userIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        group.setGroupUserCount(members.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        group.setUserList(members); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.from(group); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "查询机构群成员", notes = "查询机构群成员") 
			 |