浏览代码

修改黑名单及直播间关闭聊天功能逻辑

hgw 3 年之前
父节点
当前提交
45ba8dde55

+ 10 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -267,14 +267,21 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
     @Transactional(rollbackFor = Exception.class)
     public void update(ImLiveBroadcastRoomDto dto) {
         Date now = new Date();
+        Integer userId = getSysUser().getId();
+        ImLiveBroadcastRoom obj = this.getById(dto.getId());
+        obj.setUpdatedBy(userId);
+        obj.setUpdatedTime(now);
+        //如果直播已经则只能修改是否全员禁麦 和聊天功能
+        if (obj.getLiveState() == 1) {
+            obj.setRoomConfig(JSONObject.toJSONString(dto.getRoomConfig()));
+            this.updateById(obj);
+            return;
+        }
         if (now.getTime() > dto.getLiveStartTime().getTime()) {
             throw new BizException("设置的直播开始时间不能小于当前时间");
         }
-        ImLiveBroadcastRoom obj = this.getById(dto.getId());
         BeanUtils.copyProperties(dto, obj);
         obj.setRoomConfig(JSONObject.toJSONString(dto.getRoomConfig()));
-        obj.setUpdatedBy(getSysUser().getId());
-        obj.setUpdatedTime(now);
         log.info("update room  >>>  :{}", JSONObject.toJSONString(obj));
         this.updateById(obj);
     }

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

@@ -55,7 +55,7 @@ public class ImLiveRoomBlackServiceImpl extends ServiceImpl<ImLiveRoomBlackDao,
         pageInfo.setDesc("a.id_");
         Integer tenantId = TenantContextHolder.getTenantId();
         //管理员机构id 是-1
-        if (Objects.nonNull(tenantId) && tenantId == -1) {
+        if (Objects.nonNull(tenantId) && tenantId != -1) {
             param.put("tenantId", tenantId);
         }
         return PageUtil.pageInfo(baseMapper.queryStudent(pageInfo, param));

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/ImLiveRoomBlackMapper.xml

@@ -25,7 +25,7 @@
     </insert>
 
     <select id="queryStudent" parameterType="object" resultType="com.ym.mec.auth.api.entity.SysUser">
-        select a.id_        as id,
+        select distinct a.id_        as id,
              a.username_  as username,
              a.real_name_ as realName,
              a.phone_     as phone
@@ -34,7 +34,7 @@
         <if test="param.roomUid != null">
             and b.room_uid_ = #{param.roomUid}
         </if>
-        where a.user_type_ like '%STUDENT%'
+        where find_in_set('STUDENT', a.user_type_)
         and a.lock_flag_ = 0
         and a.del_flag_ = 0
         <if test="param.tenantId != null ">
@@ -61,7 +61,7 @@
           and a.room_uid_ = #{param.roomUid}
         <if test="param.search != null ">
             and (
-            b.`user_id_` LIKE CONCAT('%', #{param.search},'%')
+            a.`user_id_` LIKE CONCAT('%', #{param.search},'%')
             OR b.`username_` LIKE CONCAT('%', #{param.search},'%')
             OR b.`phone_` LIKE CONCAT('%', #{param.search},'%')
             )