Commit cac7f300 by huangjy

fix:生网api

parent f84148b3
......@@ -77,6 +77,20 @@ public class PlatAlarmRecordController {
return ApiResponseUtils.success(platAlarmRecordService.callingDevice());
}
@ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthRtm")
@AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthRtm(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
}
@ApiOperation("呼叫设备rtm")
@PostMapping("callingDeviceAuthIgnoreRtm")
@AuthIgnore
public ApiResponseEntity<PlatAlarmCallDeviceVO> callingDeviceAuthIgnoreRtm(@RequestBody BaseIdDTO baseIdDTO) {
return ApiResponseUtils.success(platAlarmRecordService.callingDeviceAuthIgnoreRtm(baseIdDTO.getId()));
}
// @Autowired
// private MailMsgSender mailMsgSender;
// @Autowired
......
......@@ -70,4 +70,6 @@ public interface PlatAlarmRecordService extends IService<PlatAlarmRecord> {
void misinformation(String id);
PlatAlarmCallDeviceVO callingDevice();
PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id);
}
......@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.entity.BaseBusEntity;
import com.makeit.common.entity.BaseEntity;
......@@ -43,6 +42,7 @@ import com.makeit.service.platform.space.PlatRoomBedDeviceService;
import com.makeit.service.platform.space.PlatRoomService;
import com.makeit.service.saas.PlatTenantService;
import com.makeit.shengwang.agora.media.RtcTokenBuilder2;
import com.makeit.shengwang.agora.rtm.RtmTokenBuilder2;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.data.convert.PageUtil;
import com.makeit.utils.data.convert.StreamUtil;
......@@ -587,4 +587,18 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
platAlarmCallDeviceVO.setChannelName(format);
return platAlarmCallDeviceVO;
}
@Override
public PlatAlarmCallDeviceVO callingDeviceAuthIgnoreRtm(String id) {
RtmTokenBuilder2 token = new RtmTokenBuilder2();
String result = token.buildToken(shengwangProperties.getAppId(), shengwangProperties.getAppCertificate(), id, shengwangProperties.getTokenExpirationInSeconds());
PlatAlarmCallDeviceVO platAlarmCallDeviceVO = new PlatAlarmCallDeviceVO();
platAlarmCallDeviceVO.setAccessToken(result);
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
String format = now.format(dateTimeFormatter);
platAlarmCallDeviceVO.setAccessToken(result);
platAlarmCallDeviceVO.setChannelName(format);
return platAlarmCallDeviceVO;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment