|
@@ -4,6 +4,11 @@ import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.entity.ClassGroup;
|
|
|
+import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
+import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
+import com.ym.mec.biz.service.ImGroupService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -11,9 +16,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.dao.ImGroupDao;
|
|
|
-import com.ym.mec.biz.dal.dao.ImGroupMemberDao;
|
|
|
-import com.ym.mec.biz.dal.dao.TeacherDao;
|
|
|
import com.ym.mec.biz.dal.entity.ImGroup;
|
|
|
import com.ym.mec.biz.dal.entity.ImGroupMember;
|
|
|
import com.ym.mec.biz.service.ImGroupMemberService;
|
|
@@ -35,9 +37,18 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
|
|
|
private ImGroupDao imGroupDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ClassGroupDao classGroupDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupDao musicGroupDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ImFeignService imFeignService;
|
|
|
|
|
|
@Autowired
|
|
@@ -53,7 +64,13 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
|
|
|
public boolean join(Long imGroupId, Integer userId, String roleType, boolean isAdmin) {
|
|
|
ImGroup imGroup = imGroupDao.getLocked(imGroupId);
|
|
|
if (imGroup == null) {
|
|
|
- throw new BizException("加入群组失败:群组[{}]不存在", imGroupId);
|
|
|
+ ClassGroup classGroup = classGroupDao.get(imGroupId.intValue());
|
|
|
+ String tags = classGroup.getName();
|
|
|
+ if(classGroup.getGroupType() == GroupType.MUSIC){
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
|
|
|
+ tags = musicGroup.getName();
|
|
|
+ }
|
|
|
+ imGroup = imGroupService.create(imGroupId, null, classGroup.getName(), null, null, tags, null, classGroup.getGroupType().getCode());
|
|
|
}
|
|
|
//检查用户是否已存在
|
|
|
List<ImGroupMember> imGroupMemberList = imGroupMemberDao.queryByImGroupIdAndUserId(imGroupId.toString(), userId.toString());
|
|
@@ -97,7 +114,13 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
|
|
|
public boolean join(Long imGroupId, Map<Integer, String> userRoleMap) {
|
|
|
ImGroup imGroup = imGroupDao.getLocked(imGroupId);
|
|
|
if (imGroup == null) {
|
|
|
- throw new BizException("加入群组失败:群组[{}]不存在", imGroupId);
|
|
|
+ ClassGroup classGroup = classGroupDao.get(imGroupId.intValue());
|
|
|
+ String tags = classGroup.getName();
|
|
|
+ if(classGroup.getGroupType() == GroupType.MUSIC){
|
|
|
+ MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
|
|
|
+ tags = musicGroup.getName();
|
|
|
+ }
|
|
|
+ imGroup = imGroupService.create(imGroupId, null, classGroup.getName(), null, null, tags, null, classGroup.getGroupType().getCode());
|
|
|
}
|
|
|
//检查用户是否已存在
|
|
|
List<Integer> existUserIdList = imGroupMemberDao.queryByImGroupIdAndUserId(imGroupId.toString(), userRoleMap.keySet().stream().filter(Objects::nonNull).map(Objects::toString)
|