zouxuan 2 vuotta sitten
vanhempi
commit
ec4620fec6

+ 0 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceControlDto.java

@@ -19,9 +19,6 @@ public class ImNetworkDeviceControlDto {
 	@ApiModelProperty(value = "用户ID",required = true)
 	private String userId;
 
-	@ApiModelProperty(value = "IM用户ID",required = true)
-	private String imUserId;
-
 	@ApiModelProperty(value = "ticket",required = true)
 	private String ticket;
 

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java

@@ -406,7 +406,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentService.getDao().queryByCourseId(Long.parseLong(deviceControl.getRoomId()));
 
                 for (CourseScheduleStudentPayment studentPayment : studentPayments) {
-                    deviceControl.setImUserId(imGroupService.getImUserId(String.valueOf(studentPayment.getUserId()), ClientEnum.STUDENT.name()));
+                    deviceControl.setUserId(imGroupService.getImUserId(String.valueOf(studentPayment.getUserId()), ClientEnum.STUDENT.name()));
                     controlDevice(deviceControl);
                 }
 
@@ -416,7 +416,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                         .eq(ImNetworkRoomMember::getRole,RoleEnum.RoleStudent.getValue()).list();
                 if (!CollectionUtils.isEmpty(roomMembers)) {
                     for (ImNetworkRoomMember roomMember : roomMembers) {
-                        deviceControl.setImUserId(roomMember.getUserId());
+                        deviceControl.setUserId(roomMember.getUserId());
                         controlDevice(deviceControl);
                     }
                 }
@@ -431,11 +431,10 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         SysUser sysUser = sysUserService.getUser();
         String roomId = deviceControl.getRoomId();
 
-        String[] values = deviceControl.getImUserId().split(":");
+        String imUserId = deviceControl.getUserId();
         // 学生信息
-        Long userId = Long.parseLong(values[0]);
         Boolean enable = deviceControl.getEnable();
-        log.info("controlDevice: roomId:{} ,deviceType:{} ,enable:{} ,userId:{}", roomId,deviceControl.getDeviceType(),enable,userId);
+        log.info("controlDevice: roomId:{} ,deviceType:{} ,enable:{} ,imUserId:{}", roomId,deviceControl.getDeviceType(),enable,imUserId);
 
         // RTC服务对象
         CourseSchedule courseSchedule = courseScheduleService.getById(roomId);
@@ -444,6 +443,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
 
         deviceControl.setServiceProvider(courseSchedule.getServiceProvider());
 
+        long userId = Long.parseLong(imGroupService.analysisImUserId(imUserId));
         if(enable){
             long scheduleId = Long.parseLong(roomId);
             switch (deviceControl.getDeviceType()) {

+ 10 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImServiceImpl.java

@@ -213,7 +213,7 @@ public class ImServiceImpl implements ImService {
                 .builder()
                 .type(deviceControl.getDeviceType().ordinal())
                 .enable(deviceControl.getEnable())
-                .targetId(deviceControl.getImUserId())
+                .targetId(deviceControl.getUserId())
                 .targetName(teacher.getRealName())
                 .songId(Optional.ofNullable(deviceControl.getAccompanimentId()).map(String::valueOf).orElse(null))
                 .songVolume(deviceControl.getSoundVolume())
@@ -227,7 +227,7 @@ public class ImServiceImpl implements ImService {
         // 腾讯云消息推送
         RTCRoomMessage message = RTCRoomMessage.builder()
                 .objectName(RTCRoomMessage.CONTROL_DEVICE_NOTIFY_MESSAGE)
-                .fromUserId(deviceControl.getImUserId())
+                .fromUserId(deviceControl.getUserId())
                 .toChatRoomId(roomId)
                 .content(notifyContent)
                 .isPersisted(1)
@@ -236,14 +236,14 @@ public class ImServiceImpl implements ImService {
 
         if(deviceControl.getEnable()){
             ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceControl.getDeviceType().ordinal(),true);
-            deviceResourceMessage.setUserId(deviceControl.getImUserId());
+            deviceResourceMessage.setUserId(deviceControl.getUserId());
             switch (deviceControl.getDeviceType()) {
                 case EXAM_SONG:
-                    ImNetworkRoomMusicSheetDownloadData msg = imNetworkRoomMemberStatusService.getMemberExamSong(roomId, deviceControl.getImUserId());
+                    ImNetworkRoomMusicSheetDownloadData msg = imNetworkRoomMemberStatusService.getMemberExamSong(roomId, deviceControl.getUserId());
                     msg.setEnable(true);
                     imNetworkRoomMemberStatusService.lambdaUpdate()
                                     .eq(ImNetworkRoomMemberStatus::getRoomId,roomId)
-                                            .eq(ImNetworkRoomMemberStatus::getImUserId,deviceControl.getImUserId())
+                                            .eq(ImNetworkRoomMemberStatus::getImUserId,deviceControl.getUserId())
                                                     .set(ImNetworkRoomMemberStatus::getMusicSheetDownloadJson,JSON.toJSONString(msg)).update();
 
                     // 消息发送
@@ -252,13 +252,13 @@ public class ImServiceImpl implements ImService {
                         pluginService.sendChatRoomMessage(message.objectName(RTCRoomMessage.CONTROL_DEVICE_NOTIFY_MESSAGE).content(notifyContent));
                     } else {
                         // 融云推送
-                        imHelper.publishMessage(deviceControl.getImUserId(), roomId, deviceResourceMessage, 1);
+                        imHelper.publishMessage(deviceControl.getUserId(), roomId, deviceResourceMessage, 1);
                     }
                     break;
                 case MUSIC_SHEET:
                 case ACCOMPANIMENT:
                     deviceResourceMessage.setMusicSheetAccompanimentId(deviceControl.getAccompanimentId());
-                    deviceResourceMessage.setUserId(deviceControl.getImUserId());
+                    deviceResourceMessage.setUserId(deviceControl.getUserId());
                     deviceResourceMessage.setSoundVolume(deviceControl.getSoundVolume());
                     if (TencentCloudRTCPlugin.PLUGIN_NAME.equals(pluginService.pluginName())) {
                         // 腾讯云推送
@@ -280,14 +280,14 @@ public class ImServiceImpl implements ImService {
                         message1.setType(deviceControl.getDeviceType().ordinal());
                         message1.setOpUserId(teacher.getImUserId());
                         message1.setOpUserName(teacher.getRealName());
-                        imHelper.publishMessage(teacher.getImUserId(), deviceControl.getImUserId(), roomId, message1);
+                        imHelper.publishMessage(teacher.getImUserId(), deviceControl.getUserId(), roomId, message1);
                     }
                     break;
             }
         }else {
             ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.lambdaQuery()
                             .eq(ImNetworkRoomMember::getRoomId,roomId)
-                    .eq(ImNetworkRoomMember::getUserId,deviceControl.getImUserId())
+                    .eq(ImNetworkRoomMember::getUserId,deviceControl.getUserId())
                     .eq(ImNetworkRoomMember::getRole,RoleEnum.RoleStudent.getValue()).last("LIMIT 1").one())
                     .orElseThrow(()-> new BizException("用户不在房间内"));
             switch (deviceControl.getDeviceType()) {
@@ -323,7 +323,7 @@ public class ImServiceImpl implements ImService {
             } else {
                 // 融云消息
                 ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceControl.getDeviceType().ordinal(),deviceControl.getEnable());
-                deviceResourceMessage.setUserId(deviceControl.getImUserId());
+                deviceResourceMessage.setUserId(deviceControl.getUserId());
                 deviceResourceMessage.setUserName(teacher.getRealName());
                 imHelper.publishMessage(teacher.getImUserId(), roomId, deviceResourceMessage, 1);
             }