|
|
@@ -1,38 +1,34 @@
|
|
|
package me.zhengjie.application.admin.controller;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+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.application.bank.service.OrderRoomIdService;
|
|
|
-import me.zhengjie.application.bank.service.TencentPushService;
|
|
|
-import me.zhengjie.base.util.StatusEnum.StepStatusEnum;
|
|
|
-import me.zhengjie.base.util.DownloadUtils;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.OrderRoomIdMapper;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.PushDataMapper;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
-//"stream_id":"1400574616_166123743_2222_aux" 这个是app的
|
|
|
-//"stream_id":"1400574616_166123743_share_45_main" 这个是PC的
|
|
|
@Controller
|
|
|
+@RequiredArgsConstructor
|
|
|
public class TencentPushController {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(TencentPushController.class);
|
|
|
-
|
|
|
- @Autowired
|
|
|
- TencentPushService pushService;
|
|
|
- @Autowired
|
|
|
- OrderRoomIdService orderRoomIdService;
|
|
|
+ private final PushDataMapper pushDataMapper;
|
|
|
+ private final OrderRoomIdMapper orderRoomIdMapper;
|
|
|
|
|
|
@AnonymousPostMapping("/tencentpush")
|
|
|
@ResponseBody
|
|
|
@@ -50,14 +46,14 @@ public class TencentPushController {
|
|
|
pushData.setTypeName(json.get("appname"));
|
|
|
pushData.setData(JSON.toJSONString(json));
|
|
|
pushData.setPath(json.get("video_url"));
|
|
|
- pushService.save(pushData);
|
|
|
+ pushDataMapper.insert(pushData);
|
|
|
log.info("pc端的推送信息:" + JSON.toJSON(json));
|
|
|
// 文件fileId
|
|
|
String roomId = map.get("groupid");
|
|
|
QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
|
|
|
orderRoomQuery.eq("roomId", roomId);
|
|
|
orderRoomQuery.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomId = orderRoomIdService.list(orderRoomQuery);
|
|
|
+ List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
|
|
|
// 这里通过订单查询相关信息
|
|
|
if (orderRoomId != null && orderRoomId.size() > 0) {
|
|
|
OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
|
|
|
@@ -68,7 +64,7 @@ public class TencentPushController {
|
|
|
update.setPcFileId(fileId);
|
|
|
update.setPcVideoUrl(fileName);
|
|
|
update.setId(orderRoomIdEntity.getId());
|
|
|
- orderRoomIdService.updateById(update);
|
|
|
+ orderRoomIdMapper.updateById(update);
|
|
|
}
|
|
|
}
|
|
|
if (channelId.contains("aux")) {
|
|
|
@@ -80,14 +76,14 @@ public class TencentPushController {
|
|
|
pushData.setTypeName(json.get("appname"));
|
|
|
pushData.setData(JSON.toJSONString(json));
|
|
|
pushData.setPath(json.get("video_url"));
|
|
|
- pushService.save(pushData);
|
|
|
+ pushDataMapper.insert(pushData);
|
|
|
log.info("app的视频推送:" + JSON.toJSON(json));
|
|
|
// 文件fileId
|
|
|
String roomId = map.get("groupid");
|
|
|
QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
|
|
|
orderRoomQuery.eq("roomId", roomId);
|
|
|
orderRoomQuery.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomId = orderRoomIdService.list(orderRoomQuery);
|
|
|
+ List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
|
|
|
// 这里通过订单查询相关信息
|
|
|
if (orderRoomId != null && orderRoomId.size() > 0) {
|
|
|
OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
|
|
|
@@ -98,7 +94,7 @@ public class TencentPushController {
|
|
|
update.setAppFileId(fileId);
|
|
|
update.setAppVideoUrl(fileName);
|
|
|
update.setId(orderRoomIdEntity.getId());
|
|
|
- orderRoomIdService.updateById(update);
|
|
|
+ orderRoomIdMapper.updateById(update);
|
|
|
}
|
|
|
}
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
@@ -131,7 +127,7 @@ public class TencentPushController {
|
|
|
query.eq("file_id", fileId);
|
|
|
query.eq("push_type", "app");
|
|
|
query.eq("type_name", "live");
|
|
|
- List<PushDataEntity> file = pushService.list(query);
|
|
|
+ List<PushDataEntity> file = pushDataMapper.selectList(query);
|
|
|
if (file != null && file.size() > 0) {
|
|
|
String pushData = file.get(0).getData();
|
|
|
JSONObject jsonObj = JSONObject.parseObject(pushData);
|
|
|
@@ -146,14 +142,16 @@ public class TencentPushController {
|
|
|
DownloadUtils.downloadFile(videoUrl.get("Url").toString(), fileName);
|
|
|
orderRoomId.setAppVideoUrl(fileName);
|
|
|
//
|
|
|
- orderRoomIdService.update(orderRoomId, "roomId", roomId);
|
|
|
+ UpdateWrapper<OrderRoomIdEntity> updateQw = new UpdateWrapper<>();
|
|
|
+ updateQw.eq("roomId", roomId);
|
|
|
+ orderRoomIdMapper.update(orderRoomId, updateQw);
|
|
|
PushDataEntity pushDataEntity = new PushDataEntity();
|
|
|
pushDataEntity.setFileId(fileId);
|
|
|
pushDataEntity.setPushType("app");
|
|
|
pushDataEntity.setData(JSON.toJSONString(json));
|
|
|
pushDataEntity.setPath(videoUrl.get("Url").toString());
|
|
|
pushDataEntity.setTypeName("ProcedureStateChangeEvent");
|
|
|
- pushService.save(pushDataEntity);
|
|
|
+ pushDataMapper.insert(pushDataEntity);
|
|
|
} else {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("success", false);
|
|
|
@@ -179,7 +177,7 @@ public class TencentPushController {
|
|
|
QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
|
|
|
orderRoomQuery.eq("roomId", roomId);
|
|
|
orderRoomQuery.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomId = orderRoomIdService.list(orderRoomQuery);
|
|
|
+ List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
|
|
|
|
|
|
if (orderRoomId != null && orderRoomId.size() > 0) {
|
|
|
OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
|
|
|
@@ -191,7 +189,7 @@ public class TencentPushController {
|
|
|
update.setPcFileId(fileId);
|
|
|
update.setAppVideoUrl(fileName);
|
|
|
update.setId(orderRoomIdEntity.getId());
|
|
|
- orderRoomIdService.updateById(update);
|
|
|
+ orderRoomIdMapper.updateById(update);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -202,7 +200,7 @@ public class TencentPushController {
|
|
|
PushDataEntity.setData(JSON.toJSONString(json));
|
|
|
PushDataEntity.setPath(path);
|
|
|
PushDataEntity.setTypeName(eventType);
|
|
|
- pushService.save(PushDataEntity);
|
|
|
+ pushDataMapper.insert(PushDataEntity);
|
|
|
// 保存推送过来的视频
|
|
|
|
|
|
} else {
|
|
|
@@ -215,14 +213,14 @@ public class TencentPushController {
|
|
|
pushDataEntity.setData(JSON.toJSONString(json));
|
|
|
pushDataEntity.setPath(json.getString("video_url"));
|
|
|
pushDataEntity.setTypeName(json.getString("appname"));
|
|
|
- pushService.save(pushDataEntity);
|
|
|
+ pushDataMapper.insert(pushDataEntity);
|
|
|
} else {
|
|
|
PushDataEntity pushDataEntity = new PushDataEntity();
|
|
|
pushDataEntity.setFileId("");
|
|
|
pushDataEntity.setPushType("app");
|
|
|
pushDataEntity.setData(JSON.toJSONString(json));
|
|
|
pushDataEntity.setPath("");
|
|
|
- pushService.save(pushDataEntity);
|
|
|
+ pushDataMapper.insert(pushDataEntity);
|
|
|
}
|
|
|
|
|
|
}
|