|
@@ -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,7 +8,9 @@ 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;
|
|
@@ -26,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@Validated
|
|
@@ -40,11 +44,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 (wrapper.getImGroupId() != null) {
|
|
|
+ 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 = "查询机构群成员")
|