zouxuan 5 years ago
parent
commit
bc323be310

+ 7 - 0
mec-im/src/main/java/com/ym/controller/GroupController.java

@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * Created by weiqinxiao on 2019/2/25.
  */
@@ -55,6 +57,11 @@ public class GroupController{
         return groupService.groupCreate(groupModel);
     }
 
+    @RequestMapping(value = "/batchCreate", method = RequestMethod.POST)
+    public Object batchCreate(@RequestBody List<GroupModel> groupModels) throws Exception {
+        return groupService.batchCreate(groupModels);
+    }
+
     @RequestMapping(value = "/get", method = RequestMethod.POST)
     public Object get(@RequestBody GroupModel groupModel) throws Exception {
         return groupService.groupGet(groupModel);

+ 14 - 0
mec-im/src/main/java/com/ym/controller/UserController.java

@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * Created by weiqinxiao on 2019/2/25.
  */
@@ -23,6 +25,18 @@ public class UserController {
         return userService.register(userModel);
     }
 
+    @RequestMapping(value = "/batchRegister", method = RequestMethod.POST)
+    public Object register(@RequestBody List<UserModel> userModels){
+        userModels.forEach(e->{
+            try {
+                userService.register(e);
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        });
+        return null;
+    }
+
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     public Object update(@RequestBody UserModel userModel) throws Exception {
         return userService.update(userModel);

+ 9 - 0
mec-im/src/main/java/com/ym/service/GroupService.java

@@ -5,6 +5,8 @@ import io.rong.models.conversation.ConversationModel;
 import io.rong.models.group.GroupModel;
 import io.rong.models.group.UserGroup;
 
+import java.util.List;
+
 public interface GroupService {
 
     //群组模块   群组
@@ -54,4 +56,11 @@ public interface GroupService {
     Result conversationUnmute(ConversationModel conversationModel) throws Exception;
 
     Result conversationGet(ConversationModel conversationModel) throws Exception;
+
+    /**
+     * 初始化群数据
+     * @param groupModels
+     * @return
+     */
+    Result batchCreate(List<GroupModel> groupModels);
 }

+ 8 - 0
mec-im/src/main/java/com/ym/service/Impl/GroupServiceImpl.java

@@ -15,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Slf4j
 @Service
 public class GroupServiceImpl implements GroupService {
@@ -141,4 +143,10 @@ public class GroupServiceImpl implements GroupService {
     public Result conversationGet(ConversationModel conversationModel) throws Exception {
         return getConversation().get(conversationModel);
     }
+
+    @Override
+    public Result batchCreate(List<GroupModel> groupModels) {
+//        return getGroup().create();
+        return null;
+    }
 }