Browse Source

Merge remote-tracking branch 'origin/master'

Joburgess 5 years ago
parent
commit
5cbe992326

+ 27 - 16
edu-im/edu-im-server/src/main/java/com/keao/edu/im/service/Impl/RoomServiceImpl.java

@@ -137,10 +137,10 @@ public class RoomServiceImpl implements RoomService {
         }
         if (memberList.isEmpty()) {
             saveRoomMember(userId,sysUser.getAvatar(), realName, recordedRoomId, Student.getValue(), true,true, date);
-            IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, recordedRoomId, recordedRoomId);
+            /*IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, recordedRoomId, recordedRoomId);
             if (!resultInfo.isSuccess()) {
                 throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
-            }
+            }*/
             userResult.setMicrophone(true);
             userResult.setCamera(true);
             userResult.setHandUp(false);
@@ -221,14 +221,14 @@ public class RoomServiceImpl implements RoomService {
         List<Room> roomList = roomDao.findByRid(roomId);
         if (roomList.isEmpty()) {
             saveRoom(roomId, roomId, curTime, null);
-            IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{userId}, roomId, roomId);
+            /*IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{userId}, roomId, roomId);
             if (!resultInfo.isSuccess()) {
                 log.error("joinRoom IM error: roomId={}, {}", roomId, resultInfo.getErrorMessage());
                 throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
             }
-//            else {
-//                scheduleManager.addExpiredTask(this, roomId);
-//            }
+            else {
+                scheduleManager.addExpiredTask(this, roomId);
+            }*/
         }/* else {
             display = roomList.get(0).getDisplay();
         }*/
@@ -252,10 +252,10 @@ public class RoomServiceImpl implements RoomService {
                 roleEnum = Student;
             }
             saveRoomMember(userId,sysUser.getAvatar(), realName, roomId, roleEnum.getValue(), !isDisableCamera,!isMusicMode, curTime);
-            IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, roomId, roomId);
+            /*IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, roomId, roomId);
             if (!resultInfo.isSuccess()) {
                 throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
-            }
+            }*/
             userResult.setMicrophone(true);
             userResult.setCamera(!isDisableCamera);
             userResult.setHandUp(false);
@@ -499,8 +499,12 @@ public class RoomServiceImpl implements RoomService {
         }*/
 
         if (roomMemberDao.countByRid(roomId) == 1) {
-            IMApiResultInfo apiResultInfo = null;
+            roomMemberDao.deleteUserByRidAndUid(roomId, userId);
+            roomDao.deleteByRid(roomId);
+            /*IMApiResultInfo apiResultInfo = null;
             try {
+                roomMemberDao.deleteUserByRidAndUid(roomId, userId);
+                roomDao.deleteByRid(roomId);
                 apiResultInfo = imHelper.dismiss(userId, roomId);
                 if (apiResultInfo.getCode() == 200) {
                     roomMemberDao.deleteUserByRidAndUid(roomId, userId);
@@ -514,9 +518,11 @@ public class RoomServiceImpl implements RoomService {
             } catch (Exception e) {
                 log.error("{} exit {} room error: {}", userId, roomId, e.getMessage());
                 throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, e.getMessage());
-            }
+            }*/
         } else {
-            IMApiResultInfo apiResultInfo = null;
+            roomMemberDao.deleteUserByRidAndUid(roomId, userId);
+
+            /*IMApiResultInfo apiResultInfo = null;
             try {
                 apiResultInfo = imHelper.quit(new String[]{userId}, roomId);
                 if (apiResultInfo.isSuccess()) {
@@ -532,7 +538,7 @@ public class RoomServiceImpl implements RoomService {
             } catch (Exception e) {
                 log.error("leave room error: roomId={}, {}", roomId, e.getMessage());
                 throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR);
-            }
+            }*/
         }
         userDao.deleteByUid(userId);
 //        this.signOut(Long.parseLong(roomId));
@@ -568,7 +574,10 @@ public class RoomServiceImpl implements RoomService {
         log.info("levelRecorded: roomId={}, role={}", roomId, RoleEnum.getEnumByValue(userRole));
 
         if (roomMemberDao.countByRid(roomId) == 1) {
-            IMApiResultInfo apiResultInfo = null;
+            roomMemberDao.deleteUserByRidAndUid(roomId, userId);
+            roomDao.deleteByRid(roomId);
+
+            /*IMApiResultInfo apiResultInfo = null;
             try {
                 apiResultInfo = imHelper.dismiss(userId, roomId);
                 if (apiResultInfo.getCode() == 200) {
@@ -582,9 +591,11 @@ public class RoomServiceImpl implements RoomService {
             } catch (Exception e) {
                 log.error("levelRecorded {} exit {} room error: {}", userId, roomId, e.getMessage());
                 throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, e.getMessage());
-            }
+            }*/
         } else {
-            IMApiResultInfo apiResultInfo = null;
+            roomMemberDao.deleteUserByRidAndUid(roomId, userId);
+
+            /*IMApiResultInfo apiResultInfo = null;
             try {
                 apiResultInfo = imHelper.quit(new String[]{userId}, roomId);
                 if (apiResultInfo.isSuccess()) {
@@ -600,7 +611,7 @@ public class RoomServiceImpl implements RoomService {
             } catch (Exception e) {
                 log.error("levelRecorded leave room error: roomId={}, {}", roomId, e.getMessage());
                 throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR);
-            }
+            }*/
         }
         userDao.deleteByUid(userId);
         if(registrationId != null){

+ 6 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRegistrationDao.java

@@ -144,4 +144,10 @@ public interface ExamRegistrationDao extends BaseDAO<Long, ExamRegistration> {
                                      @Param("subjectId") Integer subjectId, @Param("level") Integer level,
                                      @Param("statusEnumList") List<StudentRegistrationStatusEnum> statusEnumList);
 
+    /**
+     * 获取学员机构列表
+     * @param userId
+     * @return
+     */
+    List<Integer> queryStudentTenantId(Integer userId);
 }

+ 14 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamSongServiceImpl.java

@@ -1,20 +1,21 @@
 package com.keao.edu.user.service.impl;
 
+import com.keao.edu.auth.api.client.SysUserFeignService;
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.page.QueryInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.ExamRegistrationDao;
 import com.keao.edu.user.dao.ExamSongDao;
 import com.keao.edu.user.entity.ExamSong;
 import com.keao.edu.user.page.ExamSongQueryInfo;
 import com.keao.edu.user.service.ExamSongService;
 import com.keao.edu.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 import java.util.*;
 
@@ -23,6 +24,10 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
 	
 	@Autowired
 	private ExamSongDao examSongDao;
+	@Autowired
+	private ExamRegistrationDao examRegistrationDao;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
 
 	@Override
 	public BaseDAO<Integer, ExamSong> getDAO() {
@@ -72,8 +77,15 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
     @Override
     public PageInfo<ExamSong> querySongPage(ExamSongQueryInfo queryInfo) {
         PageInfo<ExamSong> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+	    //获取学员所在机构
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        List<Integer> tenantIds = examRegistrationDao.queryStudentTenantId(sysUser.getId());
+        if(tenantIds == null || tenantIds.size() == 0){
+            return pageInfo;
+        }
         Map<String, Object> params = new HashMap<String, Object>();
         MapUtil.populateMap(params, queryInfo);
+        params.put("tenantIds",tenantIds);
 
         List<ExamSong> dataList = new ArrayList<>();
         int count = examSongDao.countSongPage(params);

+ 4 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -548,4 +548,8 @@
         </where>
         LIMIT 1
     </select>
+    <select id="queryStudentTenantId" resultType="java.lang.Integer">
+		SELECT DISTINCT tenant_id_ FROM exam_registration
+		WHERE student_id_ = #{userId} AND tenant_id_ IS NOT NULL
+	</select>
 </mapper>

+ 4 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRoomMapper.xml

@@ -21,6 +21,7 @@
 		<result column="exam_end_time_" property="examEndTime" />
 		<result column="del_flag_" property="delFlag" />
 		<result column="organ_id_" property="organId"/>
+		<result column="open_flag_" property="openFlag"/>
 		<result column="exam_plan_push_flag_" property="examPlanPushFlag" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler"/>
 		<result column="exam_room_student_num_" property="examRoomStudentNum"/>
 		<result column="create_time_" property="createTime" />
@@ -72,6 +73,9 @@
 			<if test="delFlag != null">
 				del_flag_ = #{delFlag},
 			</if>
+			<if test="openFlag != null">
+				open_flag_ = #{openFlag},
+			</if>
 			<if test="examinationBasicId != null">
 				examination_basic_id_ = #{examinationBasicId},
 			</if>

+ 19 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -125,11 +125,28 @@
 		AND level_list_=#{level}
 		AND type_=#{songType, typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
     </select>
+	<sql id="querySongPageMap">
+		<where>
+			es.del_flag_ = 0
+			<if test="subjectList != null">
+				AND FIND_IN_SET(#{subjectList},es.subject_list_)
+			</if>
+			<if test="level != null">
+				AND FIND_IN_SET(#{subjectList},es.subject_list_)
+			</if>
+			<if test="tenantIds != null">
+				AND FIND_IN_SET(#{tenantIds},es.tenant_id_)
+			</if>
+		</where>
+	</sql>
 	<select id="countSongPage" resultType="java.lang.Integer">
-
+		SELECT COUNT(es.id_) FROM exam_song es
+		<include refid="querySongPageMap"/>
 	</select>
 	<select id="querySongPage" resultMap="ExamSong">
-
+		SELECT es.* FROM exam_song es
+		<include refid="querySongPageMap"/>
+		<include refid="global.limit"/>
 	</select>
 
 	<select id="getWithIds" resultMap="ExamSong">