|
@@ -1,5 +1,8 @@
|
|
|
package com.ym.service.Impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
|
|
|
+import com.ym.mec.common.entity.ImGroupModel;
|
|
|
import com.ym.service.GroupService;
|
|
|
import io.rong.RongCloud;
|
|
|
import io.rong.methods.conversation.Conversation;
|
|
@@ -12,6 +15,7 @@ import io.rong.models.conversation.ConversationModel;
|
|
|
import io.rong.models.group.GroupModel;
|
|
|
import io.rong.models.group.UserGroup;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -26,6 +30,9 @@ public class GroupServiceImpl implements GroupService {
|
|
|
@Value("${cn.rongcloud.im.secret}")
|
|
|
private String appSecret;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ClassGroupDao classGroupDao;
|
|
|
+
|
|
|
private Group getGroup(){
|
|
|
RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret);
|
|
|
return new Group(appKey,appSecret,rongCloud);
|
|
@@ -145,9 +152,18 @@ public class GroupServiceImpl implements GroupService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result batchCreate(List<GroupModel> groupModels) {
|
|
|
-
|
|
|
-// return getGroup().create();
|
|
|
+ public Result batchCreate() {
|
|
|
+ List<ImGroupModel> studentGroup = classGroupDao.queryStudentGroup();
|
|
|
+ List<ImGroupModel> teacherGroup = classGroupDao.queryTeacherGroup();
|
|
|
+ studentGroup.addAll(teacherGroup);
|
|
|
+ List<GroupModel> groupModels1 = JSONObject.parseArray(JSONObject.toJSONString(studentGroup), GroupModel.class);
|
|
|
+ groupModels1.forEach(e->{
|
|
|
+ try {
|
|
|
+ getGroup().join(e);
|
|
|
+ } catch (Exception e1) {
|
|
|
+ e1.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
return null;
|
|
|
}
|
|
|
}
|