Browse Source

开关麦接口

刘俊驰 1 year ago
parent
commit
051387fe5f

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

@@ -49,6 +49,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
 import com.ym.mec.util.http.HttpUtil;
+import com.ym.mec.web.KLXFeignService;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.RandomStringUtils;
@@ -137,6 +138,9 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
     @Autowired
     private ImGroupCoreService imGroupCoreService;
 
+    @Autowired
+    private KLXFeignService klxFeignService;
+
 
     //待替换的变量
     public static final String USER_ID = "${userId}";
@@ -2775,6 +2779,11 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         roomConfig.setWhether_mic(whetherMic);
         imLiveBroadcastRoom.setRoomConfig(JSONObject.toJSONString(roomConfig));
         this.updateById(imLiveBroadcastRoom);
+
+        // 设置酷乐秀状态
+        CompletableFuture.runAsync(()->{
+            klxFeignService.whetherMic(roomUid,whetherMic);
+        });
     }
 
     /**
@@ -2822,7 +2831,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
             return true;
         }
 
-        return this.updateById(imLiveBroadcastRoom);
+        this.updateById(imLiveBroadcastRoom);
+
+        CompletableFuture.runAsync(()->{
+            klxFeignService.updateRoomStatus(JSON.parseObject(JSON.toJSONString(liveRoom), com.ym.mec.dto.LiveRoomStatus.class));
+        });
+        return true;
     }
 
 

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

@@ -177,6 +177,7 @@ public class ImUserFriendServiceImpl extends BaseServiceImpl<Long, ImUserFriend>
         ImUserFriendDto imUserFriendDto = imUserFriendDao.queryFriendDetail(userId, friendUserId);
 
         if (Objects.nonNull(imUserFriendDto) && Objects.nonNull(imUserFriendDto.getFriend())) {
+            imUserFriendDto.setImFriendId(imUserFriendDto.getFriendId().toString());
 
             List<String> userTypes = Lists.newArrayList(imUserFriendDto.getFriend().getUserType().split(","));
             if (userTypes.size() > 1

+ 42 - 0
mec-client-api/src/main/java/com/ym/mec/dto/LiveRoomStatus.java

@@ -0,0 +1,42 @@
+package com.ym.mec.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2023-03-09
+ */
+@Data
+//@ApiModel(value = "更新直播间状态")
+public class LiveRoomStatus {
+
+//    @ApiModelProperty(value = "房间uid",required = true)
+    @NotBlank(message = "房间号不能为空")
+    private String roomUid;
+
+//    @ApiModelProperty(value = "主播状态: 0离开;1在播")
+    private Integer speakerStatus;
+
+//    @ApiModelProperty(value = "推流状态: 0 暂停; 1在播")
+    private Integer pushStatus;
+
+//    @ApiModelProperty(value = "禁言状态: 0 取消;1禁言")
+    private Integer banStatus;
+
+//    @ApiModelProperty(value = "主播摄像头状态 1:开启 0:关闭")
+    private Integer cameraStatus;
+
+//    @ApiModelProperty(value = "连麦状态 1:开启 0:关闭")
+    private Integer linkMic;
+
+//    @ApiModelProperty(value = "直播时长")
+    private Integer liveTotalTime;
+
+//    @ApiModelProperty(value = "全员闭麦状态 1:开启 0:关闭")
+    private Integer micStatus;
+
+}

+ 13 - 0
mec-client-api/src/main/java/com/ym/mec/web/KLXFeignService.java

@@ -3,6 +3,7 @@ package com.ym.mec.web;
 import com.ym.mec.common.config.FeignConfiguration;
 import com.ym.mec.common.dto.SchoolDto;
 import com.ym.mec.common.entity.*;
+import com.ym.mec.dto.LiveRoomStatus;
 import com.ym.mec.dto.RoomMember;
 import com.ym.mec.dto.RoomMemberNumDto;
 import com.ym.mec.thirdparty.adapay.entity.BaseResult;
@@ -11,6 +12,7 @@ import com.ym.mec.web.fallback.WebFeignServiceFallback;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
@@ -29,4 +31,15 @@ public interface KLXFeignService {
     //("查询直播间人员列表")
     @PostMapping("/open/live/queryRoomMember")
     HttpResponseResult<List<RoomMember>> queryRoomMember(@RequestBody Map<String, Object> param) ;
+
+
+
+//    @ApiOperation("更新直播间状态")
+    @PostMapping("/open/live/updateRoomStatus")
+    public HttpResponseResult<Boolean> updateRoomStatus(@RequestBody LiveRoomStatus status );
+
+
+//    @ApiOperation("设置是否允许连麦")
+    @GetMapping("/open/live/whetherMic")
+    public HttpResponseResult<Object> whetherMic(@RequestParam("roomUid") String roomUid,@RequestParam("whetherMic") Integer whetherMic);
 }

+ 11 - 0
mec-client-api/src/main/java/com/ym/mec/web/fallback/KLXFeignServiceFallback.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.fallback;
 
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.dto.LiveRoomStatus;
 import com.ym.mec.dto.RoomMember;
 import com.ym.mec.dto.RoomMemberNumDto;
 import com.ym.mec.web.KLXFeignService;
@@ -20,4 +21,14 @@ public class KLXFeignServiceFallback implements KLXFeignService {
     public HttpResponseResult<List<RoomMember>> queryRoomMember(Map<String, Object> param) {
         return null;
     }
+
+    @Override
+    public HttpResponseResult<Boolean> updateRoomStatus(LiveRoomStatus status) {
+        return null;
+    }
+
+    @Override
+    public HttpResponseResult<Object> whetherMic(String roomUid, Integer whetherMic) {
+        return null;
+    }
 }