zouxuan 5 years ago
parent
commit
f732f62dcf

+ 1 - 1
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/service/SysUserService.java

@@ -101,6 +101,6 @@ public interface SysUserService extends BaseService<Integer, SysUser> {
 	 * 学员注册
 	 * @return
 	 */
-	SysUserInfo initUser(LoginEntity loginEntity);
+	void initUser(LoginEntity loginEntity);
 
 }

+ 2 - 2
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/service/impl/SysUserServiceImpl.java

@@ -143,10 +143,10 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public SysUserInfo initUser(LoginEntity loginEntity) {
+	public void initUser(LoginEntity loginEntity) {
 		if(StringUtils.equalsIgnoreCase(loginEntity.getClientId(),"STUDENT")){
 			eduUserFeignService.studentApply(loginEntity.getOrganId(),loginEntity.getPhone());
-			return queryUserInfoByPhone(loginEntity.getPhone());
+//			return queryUserInfoByPhone(loginEntity.getPhone());
 		}
 		throw new UsernameNotFoundException("404.9");
 	}

+ 6 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/controller/RoomController.java

@@ -35,6 +35,12 @@ public class RoomController{
         return new BaseResponse<>(roomResult);
     }
 
+    @RequestMapping(value = "/roomQuery", method = RequestMethod.POST)
+    public Object signIn(String roomId) throws Exception {
+        roomService.roomQuery(roomId);
+        return new BaseResponse<>();
+    }
+
     @RequestMapping(value = "/signIn", method = RequestMethod.POST)
     public Object signIn(Long roomId){
         roomService.signIn(roomId);

+ 4 - 1
edu-im/edu-im-server/src/main/java/com/keao/edu/im/http/HttpHelper.java

@@ -3,6 +3,7 @@ package com.keao.edu.im.http;
 import com.keao.edu.im.config.IMProperties;
 import com.keao.edu.im.utils.CodeUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -171,7 +172,9 @@ public class HttpHelper {
         conn.setRequestProperty("Nonce", nonce);
         conn.setRequestProperty("Timestamp", timestamp);
         conn.setRequestProperty("Signature", sign);
-        conn.setRequestProperty("Room-Id", roomId);
+        if(StringUtils.isNotEmpty(roomId)){
+            conn.setRequestProperty("Room-Id", roomId);
+        }
         conn.setRequestProperty("Content-Type", contentType);
         return conn;
     }

+ 24 - 2
edu-im/edu-im-server/src/main/java/com/keao/edu/im/mec/im/IMHelper.java

@@ -7,6 +7,7 @@ import com.keao.edu.im.http.HttpHelper;
 import com.keao.edu.im.pojo.IMApiResultInfo;
 import com.keao.edu.im.pojo.IMTokenInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -288,6 +289,27 @@ public class IMHelper {
         return JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
     }
 
+    /**
+     * 查询房间状态
+     * @param roomId
+     * @return
+     * @throws Exception
+     */
+    public IMApiResultInfo roomQuery(String roomId) throws Exception {
+        if (StringUtils.isEmpty(roomId)) {
+            throw new IllegalArgumentException("Paramer 'roomId' is required");
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("roomId=").append(URLEncoder.encode(roomId, UTF8));
+        String body = sb.toString();
+
+        HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/room/query", "application/x-www-form-urlencoded",null);
+        httpHelper.setBodyParameter(body, conn);
+        String returnResult = httpHelper.returnResult(conn, body);
+        return null;
+    }
+
 
     /**
      * 发送群组消息方法(以一个用户身份向群组发送消息,单条消息最大 128k.每秒钟最多发送 20 条消息,每次最多向 3 个群组发送,如:一次向 3 个群组发送消息,示为 3 条消息。)
@@ -360,11 +382,11 @@ public class IMHelper {
         sb.append("&content=").append(URLEncoder.encode(msgStr, UTF8));
 
         if (pushContent != null) {
-            sb.append("&pushContent=").append(URLEncoder.encode(pushContent.toString(), UTF8));
+            sb.append("&pushContent=").append(URLEncoder.encode(pushContent, UTF8));
         }
 
         if (pushData != null) {
-            sb.append("&pushData=").append(URLEncoder.encode(pushData.toString(), UTF8));
+            sb.append("&pushData=").append(URLEncoder.encode(pushData, UTF8));
         }
 
         if (isPersisted != null) {

+ 5 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -76,6 +76,11 @@ public class RoomServiceImpl implements RoomService {
     @Autowired
     private StudentAttendanceDao studentAttendanceDao;
 
+    @Override
+    public void roomQuery(String roomId) throws Exception {
+        imHelper.roomQuery(roomId);
+    }
+
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     @Override
     public RoomResult joinRoom(String roomId, boolean isAudience, boolean isDisableCamera,boolean isMusicMode) throws ApiException, Exception {

+ 2 - 0
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/RoomService.java

@@ -15,6 +15,8 @@ public interface RoomService {
 
     void signIn(Long roomId);
 
+    void roomQuery(String roomId) throws Exception;
+
     void signOut(Long roomId);
 
     public Boolean leaveRoom(String roomId,String userId) throws ApiException, Exception;