Commit ece2881b by 南千昊

程序后台下未接到音视频通话记录返回

parent 4e44f341
......@@ -86,8 +86,8 @@ public class RtcAction {
@ApiOperation("未接音视频")
@ActionMapping("/missedConversation")
public WsResponse<MissedRtcRecordVO> missedConversation(){
MissedRtcRecordVO missedRtcRecord = rtcRecordService.getMissedRtcRecord();
public WsResponse<MissedRtcRecordVO> missedConversation(String userId){
MissedRtcRecordVO missedRtcRecord = rtcRecordService.getMissedRtcRecord(userId);
return WsResponse.ok(missedRtcRecord);
}
}
......@@ -12,10 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author nanqianhao
......@@ -39,9 +36,9 @@ public class ImRtcRecordController extends BaseController {
}
@ApiOperation("未接音视频")
@PostMapping("/missedConversation")
ApiResult<MissedRtcRecordVO> missedConversation(){
MissedRtcRecordVO missedRtcRecord = rtcRecordService.getMissedRtcRecord();
@GetMapping("/missedConversation")
ApiResult<MissedRtcRecordVO> missedConversation(@RequestParam("userId") String userId){
MissedRtcRecordVO missedRtcRecord = rtcRecordService.getMissedRtcRecord(userId);
// 如果没有记录 则状态为4
if (missedRtcRecord==null){
MissedRtcRecordVO missedRtcRecordVO = new MissedRtcRecordVO();
......
......@@ -40,5 +40,5 @@ public interface ImRtcRecordService extends BaseService<ImRtcRecord> {
/**
* 获取应用后台下未接受的音视频通话
*/
MissedRtcRecordVO getMissedRtcRecord();
MissedRtcRecordVO getMissedRtcRecord(String userId);
}
......@@ -121,8 +121,8 @@ public class ImRtcRecordServiceImpl extends BaseServiceImpl<ImRtcRecordMapper, I
}
@Override
public MissedRtcRecordVO getMissedRtcRecord() {
ImClient currentClient = imClientService.getCurrentClient();
public MissedRtcRecordVO getMissedRtcRecord(String userId) {
ImClient currentClient = imClientService.getCacheImClient(SecurityUtils.getCurrentAppId(), userId);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
......@@ -187,4 +187,9 @@ public class ResourcePathConstants {
public static final String ADD_OR_MODIFY_CONVERSATION_ATTRIBUTE_REQUEST = "/api/conversation/sdk" +
"/addOrModifyAttribute";
/**
* 后台状态下未接到音视频判断
*/
public static final String GET_MISSED_RTCRECORD="/api/rtcRecord/missedConversation";
}
......@@ -395,4 +395,13 @@ public interface WecloudIm {
* @Return
*/
Boolean singleUserNotification(SingleUserNotification singleUserNotification);
/**
* 后台状态下未接到音视频判断
* @Author nanqianhao
* @Date 2022年05月25日 09:36:47
* @param
* @Return
*/
MissedRtcRecord getMissedRtcRecord(String UserId);
}
......@@ -358,6 +358,13 @@ public class WecloudImClient implements WecloudIm {
return imSystemNotificationOperation.singleUserNotification(singleUserNotificationRequest);
}
@Override
public MissedRtcRecord getMissedRtcRecord(String UserId) {
MissedRtcRecordParam missedRtcRecordParam =
MissedRtcRecordParam.builder().userId(UserId).build();
return imRtcRecordOperation.getMissedRtcRecord(missedRtcRecordParam);
}
private void initOperations() {
this.imUserOperation = new WecloudImUserOperation(apiDomain, appKey, appSecret);
......
......@@ -4,14 +4,13 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.wecloud.im.sdk.common.HttpMethod;
import com.wecloud.im.sdk.common.RequestMessage;
import com.wecloud.im.sdk.model.ImRtcRecord;
import com.wecloud.im.sdk.model.PageResult;
import com.wecloud.im.sdk.model.RtcRecordRequest;
import com.wecloud.im.sdk.model.*;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import static com.wecloud.im.sdk.ResourcePathConstants.GET_MISSED_RTCRECORD;
import static com.wecloud.im.sdk.ResourcePathConstants.LIST_RTC_RECORDS_REQUEST;
/**
......@@ -59,5 +58,21 @@ public class WecloudImRtcRecordOperation extends WecloudImOperation {
return rtcRecords;
}
public MissedRtcRecord getMissedRtcRecord(MissedRtcRecordParam missedRtcRecordParam){
Map<String, Object> param = new HashMap<>();
param.put("userId",missedRtcRecordParam.getUserId()+"");
// 发送请求
RequestMessage request = new WecloudRequestMessageBuilder().setEndpoint(GET_MISSED_RTCRECORD)
.setMethod(HttpMethod.GET).setParameters(param)
.setOriginalRequest(missedRtcRecordParam).build();
Object result = doOperation(request);
TypeReference<MissedRtcRecord> typeReference = new TypeReference<MissedRtcRecord>() {
};
MissedRtcRecord rtcRecords = JSON.parseObject(JSON.toJSONString(result), typeReference);
return rtcRecords;
}
}
package com.wecloud.im.sdk.model;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
/**
* @author nanqianhao
* @date 2022/6/16
* @apiNote
*/
@Getter
@Setter
@Builder
public class MissedRtcRecordParam extends WebServiceRequest{
/**
* 用户id
*/
private String userId;
}
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 to comment