|
|
@@ -1,13 +1,17 @@
|
|
|
package me.zhengjie.application.admin.controller;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import me.zhengjie.annotation.rest.AnonymousPostMapping;
|
|
|
import me.zhengjie.base.AppBaseResponse;
|
|
|
import me.zhengjie.base.sms.CreateCloudRecording;
|
|
|
import me.zhengjie.base.sms.TrtcVo;
|
|
|
+import me.zhengjie.base.util.DownloadUtils;
|
|
|
+import me.zhengjie.dao.mybatis.entity.OrderRoomIdEntity;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.OrderRoomIdMapper;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@@ -15,17 +19,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import me.zhengjie.annotation.rest.AnonymousPostMapping;
|
|
|
-import me.zhengjie.base.util.DownloadUtils;
|
|
|
-import me.zhengjie.dao.mybatis.entity.OrderRoomIdEntity;
|
|
|
-import me.zhengjie.dao.mybatis.entity.PushDataEntity;
|
|
|
-import me.zhengjie.dao.mybatis.mapper.OrderRoomIdMapper;
|
|
|
-import me.zhengjie.dao.mybatis.mapper.PushDataMapper;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Controller
|
|
|
@RequiredArgsConstructor
|
|
|
@@ -33,85 +29,8 @@ import me.zhengjie.dao.mybatis.mapper.PushDataMapper;
|
|
|
public class AdminNoteVideoController {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(AdminNoteVideoController.class);
|
|
|
- private final PushDataMapper pushDataMapper;
|
|
|
private final OrderRoomIdMapper orderRoomIdMapper;
|
|
|
|
|
|
- @AnonymousPostMapping("/tencentpush")
|
|
|
- @ResponseBody
|
|
|
- public Map<String, Object> tencentpush(@RequestBody Map<String, String> json) throws Exception {
|
|
|
-
|
|
|
- log.info("推送信息:" + JSON.toJSON(json));
|
|
|
-
|
|
|
- String channelId = json.get("channel_id");
|
|
|
-
|
|
|
- if (channelId.contains("share")) {
|
|
|
- log.info("pc端的推送信息:" + JSON.toJSON(json));
|
|
|
- // 转成json形式
|
|
|
- Map<String, String> map = split(json.get("stream_param"));
|
|
|
- String fileId = (String) json.get("file_id");
|
|
|
- PushDataEntity pushData = new PushDataEntity();
|
|
|
- pushData.setFileId(fileId);
|
|
|
- pushData.setPushType("pc");
|
|
|
- pushData.setTypeName(json.get("appname"));
|
|
|
- pushData.setData(JSON.toJSONString(json));
|
|
|
- pushData.setPath(json.get("video_url"));
|
|
|
- pushDataMapper.insert(pushData);
|
|
|
- // 文件fileId
|
|
|
- String roomId = map.get("groupid");
|
|
|
- QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
|
|
|
- orderRoomQuery.eq("roomId", roomId);
|
|
|
- orderRoomQuery.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
|
|
|
- // 这里通过订单查询相关信息
|
|
|
- if (orderRoomId != null && orderRoomId.size() > 0) {
|
|
|
- OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
|
|
|
- String filePath = orderRoomIdEntity.getBusinessNo();
|
|
|
- String fileName = filePath + "/PC" + fileId + ".mp4";
|
|
|
- DownloadUtils.downloadFile(json.get("video_url"), fileName);
|
|
|
- OrderRoomIdEntity update = new OrderRoomIdEntity();
|
|
|
- update.setPcFileId(fileId);
|
|
|
- update.setPcVideoUrl(fileName);
|
|
|
- update.setId(orderRoomIdEntity.getId());
|
|
|
- orderRoomIdMapper.updateById(update);
|
|
|
- }
|
|
|
- }
|
|
|
- if (channelId.contains("aux")) {
|
|
|
- log.info("app的视频推送:" + JSON.toJSON(json));
|
|
|
- Map<String, String> map = split(json.get("stream_param"));
|
|
|
- // 转成json形式
|
|
|
- String fileId = (String) json.get("file_id");
|
|
|
- PushDataEntity pushData = new PushDataEntity();
|
|
|
- pushData.setFileId(fileId);
|
|
|
- pushData.setPushType("pc");
|
|
|
- pushData.setTypeName(json.get("appname"));
|
|
|
- pushData.setData(JSON.toJSONString(json));
|
|
|
- pushData.setPath(json.get("video_url"));
|
|
|
- pushDataMapper.insert(pushData);
|
|
|
- // 文件fileId
|
|
|
- String roomId = map.get("groupid");
|
|
|
- QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
|
|
|
- orderRoomQuery.eq("roomId", roomId);
|
|
|
- orderRoomQuery.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
|
|
|
- // 这里通过订单查询相关信息
|
|
|
- if (orderRoomId != null && orderRoomId.size() > 0) {
|
|
|
- OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
|
|
|
- String filePath = orderRoomIdEntity.getBusinessNo();
|
|
|
- String fileName = filePath + "/APP" + fileId + ".mp4";
|
|
|
- DownloadUtils.downloadFile(json.get("video_url"), fileName);
|
|
|
- OrderRoomIdEntity update = new OrderRoomIdEntity();
|
|
|
- update.setAppFileId(fileId);
|
|
|
- update.setAppVideoUrl(fileName);
|
|
|
- update.setId(orderRoomIdEntity.getId());
|
|
|
- orderRoomIdMapper.updateById(update);
|
|
|
- }
|
|
|
- }
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("success", true);
|
|
|
- result.put("code", 200);
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 录制PC端面谈笔录视频
|
|
|
*
|
|
|
@@ -203,31 +122,4 @@ public class AdminNoteVideoController {
|
|
|
result.put("code", 200);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * @param urlparam 带分隔的url参数
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Map<String, String> split(String urlparam) {
|
|
|
- Map<String, String> map = new HashMap<String, String>();
|
|
|
- String[] param = urlparam.split("&");
|
|
|
- for (String keyvalue : param) {
|
|
|
- String[] pair = keyvalue.split("=");
|
|
|
- if (pair.length == 2) {
|
|
|
- map.put(pair[0], pair[1]);
|
|
|
- }
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- @AnonymousPostMapping(value = "/uploadToken", produces = "text/plain")
|
|
|
- @ResponseBody
|
|
|
- public String uploadToken(String auth_token) throws Exception {
|
|
|
-
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- System.out.println("app_166375560_1663755604877".startsWith("app"));
|
|
|
- }
|
|
|
}
|