|
@@ -37,6 +37,7 @@ import com.yonge.cooleshow.biz.dal.service.SysConfigService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysUserService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.im.ImGroupWrapper;
|
|
|
+import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
import com.yonge.toolset.base.util.ThreadPool;
|
|
|
import io.rong.RongCloud;
|
|
@@ -229,6 +230,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
imGroup.setMemberNum(1);
|
|
|
imGroup.setCreateTime(now);
|
|
|
imGroup.setUpdateTime(now);
|
|
|
+ imGroup.setImg(sysConfigService.findConfigValue(SysConfigConstant.ICON_FANS_GROUP_DEFAULT));
|
|
|
String imGroupId = UUID.randomUUID() + imGroup.getType().getCode();
|
|
|
imGroup.setId(imGroupId);
|
|
|
this.baseMapper.insert(imGroup);
|
|
@@ -236,7 +238,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
List<ImGroupMember> groupMembers = imGroupMemberService.initGroupMember(imGroupId, imGroup.getCreateBy(),
|
|
|
true, ImGroupMemberRoleType.TEACHER);
|
|
|
//创建融云群
|
|
|
- this.rtcCreate(imGroup.getCreateBy(), imGroupId, imGroup.getName());
|
|
|
+ this.rtcCreate(imGroup.getCreateBy(), imGroupId, imGroup.getName(),imGroup.getImg());
|
|
|
//加入融云群
|
|
|
imGroupMemberService.join(groupMembers, imGroupId);
|
|
|
}
|
|
@@ -264,6 +266,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
imGroup.setMemberNum(studentIds.size() + 1);
|
|
|
imGroup.setName(courseGroup.getName());
|
|
|
imGroup.setType(ImGroupType.COURSE);
|
|
|
+ imGroup.setImg(sysConfigService.findConfigValue(SysConfigConstant.ICON_COURSE_GROUP_DEFAULT));
|
|
|
imGroup.setCreateTime(now);
|
|
|
imGroup.setUpdateTime(now);
|
|
|
String imGroupId = UUID.randomUUID() + imGroup.getType().getCode();
|
|
@@ -280,7 +283,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
groupMembers.addAll(imGroupMemberService.initGroupMembers(imGroupId, studentIds,
|
|
|
ImGroupMemberRoleType.STUDENT));
|
|
|
//创建融云群
|
|
|
- this.rtcCreate(courseGroup.getTeacherId(), imGroupId, imGroup.getName());
|
|
|
+ this.rtcCreate(courseGroup.getTeacherId(), imGroupId, imGroup.getName(),imGroup.getImg());
|
|
|
//加入融云群
|
|
|
imGroupMemberService.join(groupMembers, imGroupId);
|
|
|
return imGroupId;
|
|
@@ -288,12 +291,12 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
|
|
|
|
|
|
//创建融云群
|
|
|
- private void rtcCreate(Long userId, String imGroupId, String imGroupName) throws Exception {
|
|
|
- rtcCreate(userId, imGroupId, imGroupName, ClientEnum.TEACHER);
|
|
|
+ private void rtcCreate(Long userId, String imGroupId, String imGroupName,String img) throws Exception {
|
|
|
+ rtcCreate(userId, imGroupId, imGroupName, ClientEnum.TEACHER,img);
|
|
|
}
|
|
|
|
|
|
//创建融云群
|
|
|
- private void rtcCreate(Long userId, String imGroupId, String imGroupName, ClientEnum clientType) throws Exception {
|
|
|
+ private void rtcCreate(Long userId, String imGroupId, String imGroupName, ClientEnum clientType,String img) throws Exception {
|
|
|
//创建群
|
|
|
SysUser user = sysUserService.findUserById(userId);
|
|
|
|
|
@@ -307,7 +310,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
.groupId(imGroupId)
|
|
|
.userId(userId)
|
|
|
.clientType(clientType.getCode())
|
|
|
- .avatar(null)
|
|
|
+ .avatar(img)
|
|
|
.nickname(user.getUsername())
|
|
|
.isAdmin(true)
|
|
|
.imUserId(getImUserId(userId.toString(), clientType.getCode()))
|
|
@@ -506,6 +509,8 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
imGroup.setName(sysUser.getUsername() + "的粉丝群");
|
|
|
imGroup.setType(ImGroupType.FAN);
|
|
|
imGroup.setCreateTime(new Date());
|
|
|
+
|
|
|
+ imGroup.setImg(sysConfigService.findConfigValue(SysConfigConstant.ICON_FANS_GROUP_DEFAULT));
|
|
|
imGroup.setUpdateTime(new Date());
|
|
|
imGroup.setCreateBy(teacher.getUserId());
|
|
|
String imGroupId = UUID.randomUUID() + imGroup.getType().getCode();
|
|
@@ -518,7 +523,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
ImGroupMemberRoleType.STUDENT));
|
|
|
}
|
|
|
//创建融云群
|
|
|
- this.rtcCreate(sysUser.getId(), imGroupId, imGroup.getName());
|
|
|
+ this.rtcCreate(sysUser.getId(), imGroupId, imGroup.getName(),imGroup.getImg());
|
|
|
//加入融云群
|
|
|
imGroupMemberService.join(groupMembers, imGroupId);
|
|
|
|
|
@@ -658,7 +663,7 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
@Override
|
|
|
public void importInfo(List<ImHistoryMessage> info) throws Exception {
|
|
|
|
|
|
- info.stream().forEach(i -> {
|
|
|
+ info.forEach(i -> {
|
|
|
//判断消息类型
|
|
|
Integer type = i.getTargetType();
|
|
|
if (type == 1) {
|
|
@@ -670,13 +675,13 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
//根据发送者分场景讨论
|
|
|
String id = i.getFromUserId();
|
|
|
String imUserId;
|
|
|
- if (id.contains(":student")) {
|
|
|
+ if (id.contains(":STUDENT")) {
|
|
|
String[] split = id.split(":");
|
|
|
String userId = split[0];
|
|
|
String clientType = split[1];
|
|
|
imUserId = getImUserId(userId, clientType);
|
|
|
} else {
|
|
|
- imUserId = getImUserId(id, "teacher");
|
|
|
+ imUserId = getImUserId(id, "TEACHER");
|
|
|
}
|
|
|
|
|
|
privateImportMessage.setFromAccount(imUserId);
|
|
@@ -720,10 +725,10 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
});*/
|
|
|
if (list.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:TxtMsg")) {
|
|
|
//文本对象
|
|
|
- list.stream().forEach(item -> item.setMsgType("TIMTextElem"));
|
|
|
+ list.forEach(item -> item.setMsgType("TIMTextElem"));
|
|
|
} else if (list.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:ImgMsg")) {
|
|
|
//图文对象
|
|
|
- list.stream().forEach(item -> item.setMsgType("TIMImageElem"));
|
|
|
+ list.forEach(item -> item.setMsgType("TIMImageElem"));
|
|
|
}
|
|
|
privateImportMessage.setTencentMessageBody(list);
|
|
|
try {
|
|
@@ -744,13 +749,13 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
String imUserId;
|
|
|
String id = i.getFromUserId();
|
|
|
//根据发送者分场景讨论
|
|
|
- if (id.contains(":student")) {
|
|
|
+ if (id.contains(":STUDENT")) {
|
|
|
String[] split = id.split(":");
|
|
|
String userId = split[0];
|
|
|
String clientType = split[1];
|
|
|
imUserId = getImUserId(userId, clientType);
|
|
|
} else {
|
|
|
- imUserId = getImUserId(id, "teacher");
|
|
|
+ imUserId = getImUserId(id, "TEACHER");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -786,10 +791,10 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
|
|
|
//文本对象
|
|
|
if (bodyList.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:TxtMsg")) {
|
|
|
- bodyList.stream().forEach(item -> item.setMsgType("TIMTextElem"));
|
|
|
+ bodyList.forEach(item -> item.setMsgType("TIMTextElem"));
|
|
|
} else if (bodyList.stream().map(TencentRequest.MessageBody::getMsgType).collect(Collectors.toList()).get(0).equals("RC:ImgMsg")) {
|
|
|
//暂未支持图文对象
|
|
|
- bodyList.stream().forEach(item -> item.setMsgType("TIMCustomElem"));
|
|
|
+ bodyList.forEach(item -> item.setMsgType("TIMCustomElem"));
|
|
|
}
|
|
|
|
|
|
data1.setTencentMessageBody(bodyList);
|