소스 검색

修改直播权限查询功能

hgw 3 년 전
부모
커밋
c1dd3874ca

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -16,6 +16,7 @@ import com.ym.mec.biz.dal.dao.LiveGoodsMapperDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.ImLiveBroadcastRoomDto;
 import com.ym.mec.biz.dal.dto.RoomReservationUserSearch;
+import com.ym.mec.biz.dal.dto.SysUserDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.page.LiveRoomGoodsOrderQueryInfo;
@@ -1127,8 +1128,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
      */
     public Map<String, Object> test(String roomUid) {
         Map<String, Object> map = new HashMap<>();
+        TenantContextHolder.setTenantId(1);
         map.put("roomUid", roomUid);
-        imLiveRoomPurviewService.selectRoomPurviewStudent(map);
+        map.put("groupIds", "22053019304300001,1141,1");
+        map.put("subjectIds", "2,5,4");
+        PageInfo<SysUserDto> sysUserDtoPageInfo = imLiveRoomPurviewService.selectRoomPurviewStudent(map);
+        System.out.println(sysUserDtoPageInfo);
 
         //test
         Map<String, Object> result = new HashMap<>();

+ 5 - 6
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveRoomPurviewServiceImpl.java

@@ -70,7 +70,7 @@ public class ImLiveRoomPurviewServiceImpl extends ServiceImpl<ImLiveRoomPurviewD
         }
         Stream<Integer> userIdList = studentList.stream().map(SysUserDto::getUserId).map(Long::intValue);
         //添加学员
-        batchInsert(userIdList, roomUid, "STUDENT");
+        batchStudentInsert(userIdList, roomUid);
     }
 
     /**
@@ -99,10 +99,10 @@ public class ImLiveRoomPurviewServiceImpl extends ServiceImpl<ImLiveRoomPurviewD
         if (CollectionUtils.isEmpty(userIdList)) {
             return;
         }
-        batchInsert(userIdList.stream(), roomUid, "STUDENT");
+        batchStudentInsert(userIdList.stream(), roomUid);
     }
 
-    private void batchInsert(Stream<Integer> stream, String roomUid, String type) {
+    private void batchStudentInsert(Stream<Integer> stream, String roomUid) {
         if (Objects.isNull(stream)) {
             return;
         }
@@ -112,7 +112,7 @@ public class ImLiveRoomPurviewServiceImpl extends ServiceImpl<ImLiveRoomPurviewD
             ImLiveRoomPurview imLiveRoomPurview = new ImLiveRoomPurview();
             imLiveRoomPurview.setRoomUid(roomUid);
             imLiveRoomPurview.setUserId(id);
-            imLiveRoomPurview.setType(type);
+            imLiveRoomPurview.setType("STUDENT");
             imLiveRoomPurview.setCreatedBy(userId);
             imLiveRoomPurview.setCreatedTime(date);
             return imLiveRoomPurview;
@@ -153,11 +153,10 @@ public class ImLiveRoomPurviewServiceImpl extends ServiceImpl<ImLiveRoomPurviewD
     @Override
     public PageInfo<SysUserDto> queryStudent(Map<String, Object> param) {
         WrapperUtil.toStr(param, "roomUid", "房间uid不能为空");
-        param.put("in", 1);
+        param.put("inExist", 1);
         param.put("tenantId", TenantContextHolder.getTenantId());
         Page<SysUserDto> pageInfo = PageUtil.getPageInfo(param);
         return PageUtil.pageInfo(baseMapper.selectRoomPurviewStudent(pageInfo, param));
-
     }
 
     /**

+ 5 - 8
mec-biz/src/main/resources/config/mybatis/ImLiveRoomPurviewMapper.xml

@@ -48,7 +48,7 @@
                   left join im_group_member b on a.id_ = b.im_group_id_
                  <where>
                      <if test="param.groupIds != null">
-                         and a.id_ in (#{param.groupIds})
+                         and find_in_set(a.id_, #{param.groupIds})
                      </if>
                  </where>
         group by b.user_id_) gm on s.user_id_ = gm.user_id_
@@ -72,7 +72,7 @@
                 student_registration b  on a.id_ = b.music_group_id_
                 where b.music_group_status_ != 'QUIT'
                 <if test="param.teamIds != null">
-                     and a.id_ in (#{param.teamIds})
+                     and find_in_set(a.id_ ,#{param.teamIds})
                 </if>
         group by b.user_id_) sr on sr.user_id_ = s.user_id_
         <where>
@@ -80,16 +80,13 @@
                 AND s.tenant_id_ = #{param.tenantId}
             </if>
             <choose>
-                <when test="param.in != null and param.roomUid != null">
-                    AND s.user_id_ in
+                <when test="param.inExist != null ">
+                    AND s.user_id_ in (select user_id_ from im_live_room_purview where room_uid_ = #{param.roomUid})
                 </when>
                 <otherwise>
-                    AND s.user_id_ not in
+                    AND s.user_id_ not in (select user_id_ from im_live_room_purview where room_uid_ = #{param.roomUid})
                 </otherwise>
             </choose>
-            <if test="param.roomUid != null">
-                (select user_id_ from im_live_room_purview where room_uid_ = #{param.roomUid})
-            </if>
             <if test="param.organIds != null and param.organIds != ''">
                 AND FIND_IN_SET(su.organ_id_,#{param.organIds})
             </if>

+ 3 - 3
mec-web/src/main/java/com/ym/mec/web/controller/ImLiveRoomPurviewController.java

@@ -40,15 +40,15 @@ public class ImLiveRoomPurviewController extends BaseController {
             @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播间UID", required = true)
     })
     @ApiOperation("批量添加/根据查询条件添加房间观看权限")
-    @GetMapping("/add")
-    @PreAuthorize("@pcs.hasPermissions('imLiveRoomPurview/add')")
+    @PostMapping("/addByCondition")
+    @PreAuthorize("@pcs.hasPermissions('imLiveRoomPurview/addByCondition')")
     public HttpResponseResult<Object> addByCondition(@RequestBody Map<String, Object> param){
         imLiveRoomPurviewService.addByCondition(param);
         return succeed();
     }
 
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "ids", dataType = "String", value = "删除的id,学员id,群id, 逗号分开", required = true),
+            @ApiImplicitParam(name = "ids", dataType = "String", value = "学员id逗号分开", required = true),
             @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播间UID", required = true),
     })
     @ApiOperation("指定多个学员id添加观看权限数据")