fix(优化):订单显示手机号功能,视频流生成下发任务时一起下发
This commit is contained in:
-20
@@ -1,20 +0,0 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.central.order.service.LiveStreamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/live")
|
||||
public class LiveStreamController {
|
||||
|
||||
@Autowired
|
||||
private LiveStreamService liveStreamService;
|
||||
|
||||
@GetMapping("/stream-urls")
|
||||
public Map<String, String> getStreamUrls(@RequestParam String deviceId) {
|
||||
return liveStreamService.generateStreamUrls(deviceId);
|
||||
}
|
||||
}
|
||||
+1
@@ -559,6 +559,7 @@ public class OrderController {
|
||||
detailMap.put("orderAmount", appendPriceStr(order.getOrderAmount()));
|
||||
detailMap.put("createTime", sdf.format(order.getCreateTime()));
|
||||
detailMap.put("deviceSn", order.getDeviceSn());
|
||||
detailMap.put("mobile", order.getMobile());
|
||||
|
||||
// 景区信息
|
||||
Map<String, Object> tourismMap = new HashMap<>();
|
||||
|
||||
@@ -38,6 +38,7 @@ public class Order extends SuperEntity {
|
||||
|
||||
private transient String createdTime;
|
||||
private transient String fileMd5;
|
||||
private transient String mobile;
|
||||
|
||||
private String codeId;
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.central.order.service;
|
||||
|
||||
import com.central.order.util.TencentLiveUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class LiveStreamService {
|
||||
|
||||
@Value("${tencent.live.push-domain}")
|
||||
private String pushDomain;
|
||||
@Value("${tencent.live.play-domain}")
|
||||
private String playDomain;
|
||||
@Value("${tencent.live.app-name}")
|
||||
private String appName;
|
||||
@Value("${tencent.live.key}")
|
||||
private String key;
|
||||
@Value("${tencent.live.expire-seconds:3600}")
|
||||
private long expireSeconds;
|
||||
|
||||
/**
|
||||
* 生成设备推流和拉流地址
|
||||
*/
|
||||
public Map<String, String> generateStreamUrls(String deviceId) {
|
||||
long expire = System.currentTimeMillis() / 1000 + expireSeconds;
|
||||
String pushUrl = TencentLiveUtil.generatePushUrl(pushDomain, appName, deviceId, key, expire);
|
||||
String playRtmpUrl = TencentLiveUtil.generatePlayUrl(playDomain, appName, deviceId, "rtmp");
|
||||
String playFlvUrl = TencentLiveUtil.generatePlayUrl(playDomain, appName, deviceId, "flv");
|
||||
String playM3u8Url = TencentLiveUtil.generatePlayUrl(playDomain, appName, deviceId, "m3u8");
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("pushUrl", pushUrl);
|
||||
result.put("playRtmpUrl", playRtmpUrl);
|
||||
result.put("playFlvUrl", playFlvUrl);
|
||||
result.put("playM3u8Url", playM3u8Url);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -7,13 +7,13 @@ import com.central.common.model.PageResult;
|
||||
import com.central.common.service.impl.SuperServiceImpl;
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.event.OrderStatusChangeEvent;
|
||||
import com.central.order.feign.UserCenterService;
|
||||
import com.central.order.mapper.OrderFileMapper;
|
||||
import com.central.order.mapper.OrderMapper;
|
||||
import com.central.order.mapper.TourismMapper;
|
||||
import com.central.order.model.Order;
|
||||
import com.central.order.model.OrderFile;
|
||||
import com.central.order.model.OrderRanking;
|
||||
import com.central.order.service.IMessageService;
|
||||
import com.central.order.service.IOrderService;
|
||||
import com.central.order.util.DateUtils;
|
||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
@@ -67,7 +67,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
|
||||
@Autowired
|
||||
private IMessageService messageService;
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -78,6 +78,9 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
||||
public PageResult<Order> findList(Map<String, Object> params){
|
||||
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||
List<Order> list = baseMapper.findList(page, params);
|
||||
for (Order order : list){
|
||||
order.setMobile(userCenterService.findUserById(order.getUserId()).getMobile());
|
||||
}
|
||||
return PageResult.<Order>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.central.order.util;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
public class TencentLiveUtil {
|
||||
|
||||
/**
|
||||
* 生成推流地址
|
||||
*/
|
||||
public static String generatePushUrl(String pushDomain, String appName, String streamName, String key, long expireTime) {
|
||||
String txTime = Long.toHexString(expireTime).toUpperCase();
|
||||
String txSecret = DigestUtils.md5Hex(key + streamName + txTime).toLowerCase();
|
||||
return String.format("rtmp://%s/%s/%s?txSecret=%s&txTime=%s", pushDomain, appName, streamName, txSecret, txTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成拉流地址
|
||||
*/
|
||||
public static String generatePlayUrl(String playDomain, String appName, String streamName, String type) {
|
||||
switch (type.toLowerCase()) {
|
||||
case "flv":
|
||||
return String.format("http://%s/%s/%s.flv", playDomain, appName, streamName);
|
||||
case "m3u8":
|
||||
return String.format("http://%s/%s/%s.m3u8", playDomain, appName, streamName);
|
||||
case "rtmp":
|
||||
default:
|
||||
return String.format("rtmp://%s/%s/%s", playDomain, appName, streamName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,12 +60,8 @@ tencent:
|
||||
async-pool-size: 5
|
||||
api:
|
||||
profit-sharing-url: https://api.mch.weixin.qq.com/v3/profitsharing/orders
|
||||
live:
|
||||
push-domain: 208280.push.tlivecloud.com
|
||||
play-domain: goflytec.com
|
||||
app-name: live
|
||||
key: 06b20e5b7d637c1128fa1b48ea91a13e
|
||||
expire-seconds: 3600000
|
||||
|
||||
|
||||
file:
|
||||
oss-url: goflyapp.oss-cn-beijing.aliyuncs.com
|
||||
cdn-url: cdn.goflytec.com
|
||||
|
||||
Reference in New Issue
Block a user