音视频
This commit is contained in:
36
hd-glasses-app/package-lock.json
generated
36
hd-glasses-app/package-lock.json
generated
@@ -23,6 +23,7 @@
|
||||
"process": "^0.11.10",
|
||||
"scp2": "^0.5.0",
|
||||
"swiper": "5.4.5",
|
||||
"uuid": "^9.0.1",
|
||||
"vant": "^2.13.1",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.6.5"
|
||||
@@ -7605,6 +7606,7 @@
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"devOptional": true,
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
@@ -10146,6 +10148,15 @@
|
||||
"websocket-driver": "^0.7.4"
|
||||
}
|
||||
},
|
||||
"node_modules/sockjs/node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
|
||||
@@ -10914,10 +10925,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
@@ -17762,7 +17772,8 @@
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"devOptional": true
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
@@ -19740,6 +19751,14 @@
|
||||
"faye-websocket": "^0.11.3",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket-driver": "^0.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
@@ -20358,10 +20377,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.4.0",
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
"dependencies": {
|
||||
"amfe-flexible": "^2.2.1",
|
||||
"axios": "^1.5.1",
|
||||
"scp2": "^0.5.0",
|
||||
"ora": "^4.0.0",
|
||||
"chalk": "^3.0.0",
|
||||
"core-js": "^3.8.3",
|
||||
"dayjs": "^1.11.10",
|
||||
@@ -23,10 +21,13 @@
|
||||
"less-loader": "^11.1.3",
|
||||
"lib-flexible": "^0.3.2",
|
||||
"ol": "^8.1.0",
|
||||
"ora": "^4.0.0",
|
||||
"plot-ol": "^1.0.1",
|
||||
"postcss-pxtorem": "^5.1.1",
|
||||
"process": "^0.11.10",
|
||||
"scp2": "^0.5.0",
|
||||
"swiper": "5.4.5",
|
||||
"uuid": "^9.0.1",
|
||||
"vant": "^2.13.1",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.6.5"
|
||||
|
||||
@@ -48,6 +48,7 @@ import 'swiper/css/swiper.min.css' // 注意这里的引入
|
||||
import {Notify, Dialog} from 'vant';
|
||||
import service from "@/utils/service";
|
||||
import {getStatisFileUrl, getUrlParam} from '../utils/publicFun'
|
||||
import {v4 as uuidv4} from 'uuid';
|
||||
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
@@ -86,10 +87,11 @@ export default {
|
||||
showConfirmDialog: 0,
|
||||
inviteName: 0,
|
||||
showInviteConfirmDialog: 0,
|
||||
videoTitle:"视频",
|
||||
tuid:"",
|
||||
isForce:"0",
|
||||
hasVideo:"1"
|
||||
videoTitle: "视频",
|
||||
tuid: "",
|
||||
isForce: "0",
|
||||
hasVideo: "1",
|
||||
callSessionId: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -112,7 +114,6 @@ export default {
|
||||
this.isForce = getUrlParam("isForce");
|
||||
|
||||
|
||||
|
||||
this.voiceImg = getStatisFileUrl("/media/voice_open.png")
|
||||
this.cameraImg = getStatisFileUrl("/media/camera_open.png")
|
||||
this.switchCameraImg = getStatisFileUrl("/media/switch.png")
|
||||
@@ -123,7 +124,7 @@ export default {
|
||||
this.constraints.video = false
|
||||
this.isCloseCamera = true
|
||||
this.cameraImg = getStatisFileUrl("/media/camera_close.png")
|
||||
this.videoTitle="语音"
|
||||
this.videoTitle = "语音"
|
||||
|
||||
}
|
||||
|
||||
@@ -138,6 +139,7 @@ export default {
|
||||
message: `${this.inviteName}邀请你加入${this.videoTitle}聊天`,
|
||||
})
|
||||
.then(() => {
|
||||
this.callBegin();
|
||||
this.init();
|
||||
// on confirm
|
||||
})
|
||||
@@ -153,6 +155,7 @@ export default {
|
||||
}).then(() => {
|
||||
console.log("确认")
|
||||
try {
|
||||
this.callSessionId = uuidv4();
|
||||
this.sendInvite();
|
||||
this.init();
|
||||
} catch (e) {
|
||||
@@ -178,7 +181,7 @@ export default {
|
||||
this.leaveRoom();
|
||||
},
|
||||
methods: {
|
||||
sendInvite(){
|
||||
sendInvite() {
|
||||
|
||||
let roomInfo = {
|
||||
roomId: this.uid,//后面改成发起人的手机号或者id
|
||||
@@ -190,8 +193,8 @@ export default {
|
||||
isOver: 0,
|
||||
webrtcUrl: process.env.VUE_APP_SRS_URL + this.uid + "/" + this.uid,
|
||||
invitedUserList: [this.tuid],
|
||||
isForce:this.isForce,
|
||||
hasVideo:this.hasVideo
|
||||
isForce: this.isForce,
|
||||
hasVideo: this.hasVideo,
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +210,6 @@ export default {
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
init() {
|
||||
Notify({
|
||||
@@ -382,8 +384,8 @@ export default {
|
||||
topVideo.volume = 0
|
||||
topVideo.play();
|
||||
};
|
||||
}else {
|
||||
if(this.isPublish==0){
|
||||
} else {
|
||||
if (this.isPublish == 0) {
|
||||
const topVideo = this.$refs.videoStreamtopVideo
|
||||
topVideo.srcObject = sdk.stream;
|
||||
topVideo.onloadedmetadata = function (e) {
|
||||
@@ -448,6 +450,61 @@ export default {
|
||||
type: 'webrtc'
|
||||
},
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
callBegin() {
|
||||
|
||||
let roomInfo = {
|
||||
id:uuidv4(),
|
||||
inviteId: this.roomId,//后面改成发起人的手机号或者id
|
||||
roomId: this.roomId,
|
||||
passiveId: this.uid,
|
||||
isForce: this.isForce,
|
||||
type: this.hasVideo == 1 ? "video" : "voice",
|
||||
}
|
||||
|
||||
axios({
|
||||
method: "post",
|
||||
url: process.env.VUE_APP_IM_API_URL + "/im_call_history/callBegin",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
// mode: 'no-cors',
|
||||
data: roomInfo,
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
callHangUp() {
|
||||
|
||||
let roomInfo = {
|
||||
sessionId: this.roomId,
|
||||
roomId:this.roomId
|
||||
}
|
||||
|
||||
axios({
|
||||
method: "post",
|
||||
url: process.env.VUE_APP_IM_API_URL + "/im_call_history/callHangUp",
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
},
|
||||
// mode: 'no-cors',
|
||||
data: roomInfo,
|
||||
}).then(res => {
|
||||
|
||||
service.post(`/api/im/app/wsMsg`, {
|
||||
msgType: "10000",
|
||||
msgId: JSON.stringify(roomInfo),
|
||||
cmd: "hangUp",
|
||||
msgTxt: this.uname || ""
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
@@ -524,18 +581,12 @@ export default {
|
||||
console.log("============videoDownAction")
|
||||
console.log("============videoDownAction")
|
||||
|
||||
service.post(`/api/im/app/wsMsg`, {
|
||||
msgType: "10000",
|
||||
msgId: JSON.stringify(roomInfo),
|
||||
cmd: "hangUp",
|
||||
msgTxt: this.uname || ""
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
this.callHangUp();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
|
||||
|
||||
// location.href = "uniwebview://action?function=restartCamera";
|
||||
// location.href = "uniwebview://action?function=refuseVideoInvite";
|
||||
//
|
||||
|
||||
@@ -271,16 +271,6 @@ export default {
|
||||
});
|
||||
|
||||
|
||||
const wmsLayer_1 = new TileLayer({
|
||||
source: new TileWMS({
|
||||
// 设置 Geoserver 服务的 URL
|
||||
url: process.env.VUE_APP_MAP_URL + "/wms",
|
||||
params: {
|
||||
LAYERS: "china:yangjianghedian_dt",
|
||||
TILED: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
// 切片方案(0-18级
|
||||
@@ -843,7 +833,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', ''],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(155, 155, 155)',
|
||||
@@ -867,7 +857,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', ''],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(22, 206, 129)',
|
||||
@@ -887,7 +877,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', '', `${alarmNum}条告警未接受`, 'bold 16px sans-serif',],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', '', `${alarmNum}条告警未接受`, 'bold 16px sans-serif',],
|
||||
font: 'bold 16px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(54, 159, 255)',
|
||||
|
||||
@@ -982,7 +982,7 @@ export default {
|
||||
|
||||
service.get(`/api/patrol/area/list`, {
|
||||
params:{
|
||||
id:"";
|
||||
id:"",
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
|
||||
@@ -129,6 +129,7 @@ export default {
|
||||
isCanDraw: true,
|
||||
from: "",
|
||||
detailsId: "",
|
||||
alarmId: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -138,8 +139,10 @@ export default {
|
||||
this.pageType = getUrlParam("type");
|
||||
this.from = getUrlParam("from");
|
||||
this.detailsId = getUrlParam("detailsId");
|
||||
this.alarmId = getUrlParam("alarmId");
|
||||
|
||||
this.token = getUrlParam("token")
|
||||
|
||||
if (this.token != null) {
|
||||
localStorage.setItem("hd_token", this.token)
|
||||
}
|
||||
@@ -229,8 +232,8 @@ export default {
|
||||
break
|
||||
default:
|
||||
this.getAreaList()
|
||||
this.queryAlarmList()
|
||||
// this.planningPath()
|
||||
// this.queryAlarmList()
|
||||
// this.queryAllEquipment()
|
||||
}
|
||||
|
||||
@@ -701,14 +704,9 @@ export default {
|
||||
},
|
||||
queryAlarmList() {
|
||||
|
||||
service.get(`/api/alarm/list`, {
|
||||
service.get(`/api/alarm/queryById`, {
|
||||
params: {
|
||||
sendStatus: "1",
|
||||
disposition: "0",
|
||||
pageNo: 1,
|
||||
pageSize: 50,
|
||||
column: "createTime",
|
||||
order: "desc",
|
||||
id:this.alarmId
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
@@ -716,16 +714,13 @@ export default {
|
||||
this.alarmAnimation = null
|
||||
this.map.removeLayer(this.alarmLayer)
|
||||
this.alarmLayer = {};
|
||||
res.data.result.records.map((record, index) => {
|
||||
|
||||
try {
|
||||
if (record.location != null) {
|
||||
this.addPointWidthCoordinate(record.location, "alarm", record, index + 1)
|
||||
|
||||
if (res.data.result.location != null) {
|
||||
this.addPointWidthCoordinate(res.data.result.location, "alarm", res.data.result, 0 + 1)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
@@ -844,7 +839,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', ''],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(155, 155, 155)',
|
||||
@@ -868,7 +863,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', ''],
|
||||
font: 'bold 20px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(22, 206, 129)',
|
||||
@@ -888,7 +883,7 @@ export default {
|
||||
}),
|
||||
text: new Text({
|
||||
testAlign: 'center',
|
||||
text: [record.equipmentName, 'bold 16px sans-serif', '\n', '', `${alarmNum}条告警未接受`, 'bold 16px sans-serif',],
|
||||
text: [record.nickname, 'bold 16px sans-serif', '\n', '', `${alarmNum}条告警未接受`, 'bold 16px sans-serif',],
|
||||
font: 'bold 16px 微软雅黑',
|
||||
fill: new Fill({
|
||||
color: 'rgb(54, 159, 255)',
|
||||
@@ -986,7 +981,7 @@ export default {
|
||||
|
||||
service.get(`/api/patrol/area/list`, {
|
||||
params:{
|
||||
id:this.detailsId;
|
||||
id:this.detailsId,
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.status == 200) {
|
||||
|
||||
@@ -320,17 +320,62 @@ export default {
|
||||
});
|
||||
|
||||
|
||||
const wmsLayer_1 = new TileLayer({
|
||||
source: new TileWMS({
|
||||
// 设置 Geoserver 服务的 URL
|
||||
url: process.env.VUE_APP_MAP_URL + "/wms",
|
||||
params: {
|
||||
LAYERS: "china:yangjianghedian_dt",
|
||||
TILED: true
|
||||
|
||||
|
||||
// 切片方案(0-18级
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const projectionExtent = projection.getExtent();
|
||||
const size = getWidth(projectionExtent) / 256;
|
||||
const resolutions = new Array(19);
|
||||
const matrixIds = new Array(19);
|
||||
for (let z = 0; z < 19; ++z) {
|
||||
resolutions[z] = size / Math.pow(2, z);
|
||||
matrixIds[z] = "EPSG:3857:" + z;
|
||||
}
|
||||
|
||||
|
||||
var style = '';
|
||||
var format = 'image/png';
|
||||
var layerName = 'china:yangjianghedian_dt';
|
||||
let baseParams = ['VERSION', 'LAYER', 'STYLE', 'TILEMATRIX', 'TILEMATRIXSET', 'SERVICE', 'FORMAT'];
|
||||
|
||||
let params = {
|
||||
'VERSION': '1.0.0',
|
||||
'LAYER': layerName,
|
||||
'STYLE': style,
|
||||
'TILEMATRIX': matrixIds,
|
||||
'TILEMATRIXSET': projection,
|
||||
'SERVICE': 'WMTS',
|
||||
'FORMAT': format
|
||||
};
|
||||
var url = process.env.VUE_APP_MAP_URL + "/gwc/service/wmts?authkey=" + process.env.VUE_APP_MAP_AUTHKEY + "&"
|
||||
for (var param in params) {
|
||||
if (baseParams.indexOf(param.toUpperCase()) < 0) {
|
||||
url = url + param + '=' + params[param] + '&';
|
||||
}
|
||||
}
|
||||
url = url.slice(0, -1);
|
||||
|
||||
|
||||
const wmtsLayer_1 = new TileLayer({
|
||||
opacity: 1, //图层透明度
|
||||
source: new WMTS({
|
||||
url: url,
|
||||
layer: "china:yangjianghedian_dt",
|
||||
matrixSet: 'EPSG:3857',
|
||||
format: 'image/png', // 默认:'image/jpeg'
|
||||
projection: projection,
|
||||
tileGrid: new WMTSTileGrid({
|
||||
origin: getTopLeft(projectionExtent),
|
||||
resolutions: resolutions,
|
||||
matrixIds: matrixIds,
|
||||
}),
|
||||
style: '',
|
||||
wrapX: true
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
this.map = new Map({
|
||||
target: "map",
|
||||
layers: [
|
||||
@@ -339,13 +384,14 @@ export default {
|
||||
// url: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",
|
||||
// }),
|
||||
// }),
|
||||
wmsLayer_1,
|
||||
wmtsLayer_1,
|
||||
wmsLayer_0,
|
||||
],
|
||||
view: new View({
|
||||
projection: "EPSG:3857",
|
||||
resolutions: resolutions,
|
||||
projection: projection,
|
||||
center: [12497018.585823221, 2476783.2447665134],
|
||||
zoom: 15,
|
||||
zoom: 16,
|
||||
}),
|
||||
});
|
||||
this.map.on('singleclick', e => {
|
||||
@@ -1061,6 +1107,16 @@ export default {
|
||||
},
|
||||
moveFromStartToEnd() {
|
||||
|
||||
if (Object.keys(this.vectorLayer).length == 0) {
|
||||
// 创建图层
|
||||
this.vectorLayer = new VectorLayer({
|
||||
source: new VectorSource(),
|
||||
});
|
||||
// 图层添加到地图上
|
||||
this.map.removeLayer(this.vectorLayer);
|
||||
}
|
||||
|
||||
|
||||
this.geometryMove = new Point(this.route.getFirstCoordinate());
|
||||
|
||||
this.featureMove = new Feature({
|
||||
|
||||
@@ -1,13 +1,89 @@
|
||||
package com.lld.im.service.call.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.lld.im.common.ResponseVO;
|
||||
import com.lld.im.service.call.dao.ImCallHistoryEntity;
|
||||
import com.lld.im.service.call.dao.mapper.ImCallHistoryMapper;
|
||||
import com.lld.im.service.call.model.HistoryListReq;
|
||||
import com.lld.im.service.call.service.ImCallHistoryService;
|
||||
import com.lld.im.service.message.service.P2PMessageService;
|
||||
import com.lld.im.service.user.dao.ImUserDataEntity;
|
||||
import com.lld.im.service.user.service.ImUserService;
|
||||
import com.lld.im.service.utils.SnowflakeIdWorker;
|
||||
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 java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("v1/im_call_history")
|
||||
public class ImCallHistoryController {
|
||||
@Autowired
|
||||
ImCallHistoryService callHistoryService;
|
||||
|
||||
@Autowired
|
||||
ImUserService imUserService;
|
||||
|
||||
@Autowired
|
||||
ImCallHistoryMapper callHistoryMapper;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/queryList")
|
||||
public ResponseVO queryList(@RequestBody HistoryListReq req) {
|
||||
|
||||
if(req.getLimit()!=null){
|
||||
Page<ImCallHistoryEntity> objectPage = new Page<>(req.getOffset(),req.getLimit());
|
||||
QueryWrapper<ImCallHistoryEntity> query=new QueryWrapper<>();
|
||||
query.eq("invite_id",req.getUid());
|
||||
query.orderByDesc("create_time");
|
||||
IPage<ImCallHistoryEntity> imCallHistoryEntityIPage=callHistoryMapper.selectPage(objectPage,query);
|
||||
|
||||
return ResponseVO.successResponse(imCallHistoryEntityIPage);
|
||||
}else {
|
||||
return ResponseVO.errorResponse();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/callBegin")
|
||||
public ResponseVO callBegin(@RequestBody ImCallHistoryEntity imCallHistoryEntity) {
|
||||
imCallHistoryEntity.setCreateTime(new Date());
|
||||
imCallHistoryEntity.setStatus("1");
|
||||
|
||||
ResponseVO<ImUserDataEntity> inviteUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getRoomId(), 10000);
|
||||
ResponseVO<ImUserDataEntity> passiveUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getPassiveId(), 10000);
|
||||
|
||||
imCallHistoryEntity.setInviteName(inviteUserInfo.getData().getNickName());
|
||||
imCallHistoryEntity.setPassiveName(passiveUserInfo.getData().getNickName());
|
||||
|
||||
|
||||
imCallHistoryEntity.setSessionId(imCallHistoryEntity.getRoomId());
|
||||
|
||||
|
||||
|
||||
callHistoryService.add(imCallHistoryEntity);
|
||||
|
||||
return ResponseVO.successResponse(imCallHistoryEntity);
|
||||
}
|
||||
|
||||
@PostMapping("/callHangUp")
|
||||
public ResponseVO callHangUp(@RequestBody ImCallHistoryEntity imCallHistoryEntity) {
|
||||
callHistoryService.updateBySessionId(imCallHistoryEntity);
|
||||
|
||||
return ResponseVO.successResponse("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ public class ImCallHistoryEntity {
|
||||
|
||||
// 通话唯一uuid
|
||||
private String sessionId;
|
||||
private String type;
|
||||
|
||||
// 待开始,正在进行中,已结束
|
||||
private String status;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
private Date endTime;
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.lld.im.service.call.dao.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lld.im.service.call.dao.ImCallHistoryEntity;
|
||||
import com.lld.im.service.user.dao.ImUserDataEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.lld.im.service.call.model;
|
||||
|
||||
import com.lld.im.common.model.RequestBase;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class HistoryListReq extends RequestBase {
|
||||
@NotBlank(message = "用户不能为空")
|
||||
private String uid;
|
||||
|
||||
|
||||
//单次拉取数量
|
||||
private Integer limit;
|
||||
|
||||
//第几页
|
||||
private Integer offset;
|
||||
}
|
||||
@@ -1,8 +1,107 @@
|
||||
package com.lld.im.service.call.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.lld.im.common.ResponseVO;
|
||||
import com.lld.im.common.enums.DelFlagEnum;
|
||||
import com.lld.im.service.call.dao.ImCallHistoryEntity;
|
||||
import com.lld.im.service.call.dao.mapper.ImCallHistoryMapper;
|
||||
import com.lld.im.service.conversation.service.ConversationService;
|
||||
import com.lld.im.service.friendship.dao.mapper.ImFriendShipMapper;
|
||||
import com.lld.im.service.message.model.req.SendMessageReq;
|
||||
import com.lld.im.service.message.service.P2PMessageService;
|
||||
import com.lld.im.service.user.dao.ImUserDataEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ImCallHistoryService {
|
||||
@Autowired
|
||||
ImCallHistoryMapper callHistoryMapper;
|
||||
|
||||
@Autowired
|
||||
P2PMessageService p2PMessageService;
|
||||
|
||||
|
||||
|
||||
public void add(ImCallHistoryEntity callHistory){
|
||||
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("session_id",callHistory.getSessionId());
|
||||
queryWrapper.eq("status","1");
|
||||
|
||||
List<ImCallHistoryEntity> imCallHistoryEntityList = callHistoryMapper.selectList(queryWrapper);
|
||||
|
||||
for(ImCallHistoryEntity imCallHistory: imCallHistoryEntityList){
|
||||
imCallHistory.setStatus("2");
|
||||
callHistoryMapper.updateById(imCallHistory);
|
||||
}
|
||||
|
||||
callHistoryMapper.insert(callHistory);
|
||||
}
|
||||
public void updateBySessionId(ImCallHistoryEntity callHistory){
|
||||
Date _now=new Date();
|
||||
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("session_id",callHistory.getSessionId());
|
||||
queryWrapper.eq("status","1");
|
||||
|
||||
// end_time
|
||||
ImCallHistoryEntity imCallHistory = callHistoryMapper.selectOne(queryWrapper);
|
||||
|
||||
if(!ObjectUtils.isEmpty(imCallHistory)){
|
||||
imCallHistory.setEndTime(_now);
|
||||
imCallHistory.setStatus("2");
|
||||
Duration duration = Duration.between(imCallHistory.getCreateTime().toInstant(),_now.toInstant());
|
||||
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration.toMillis());
|
||||
Integer i = Long.valueOf(seconds).intValue();
|
||||
imCallHistory.setContinueSecond(i);
|
||||
|
||||
log.error("===================结束之后通知客户端");
|
||||
log.error("===================结束之后通知客户端");
|
||||
log.error("===================结束之后通知客户端");
|
||||
|
||||
|
||||
|
||||
//TODO 结束之后通知客户端
|
||||
SendMessageReq req= new SendMessageReq();
|
||||
|
||||
req.setAppId(10000);
|
||||
req.setFromId(imCallHistory.getInviteId());
|
||||
req.setToId(imCallHistory.getPassiveId());
|
||||
req.setMessageTime(System.currentTimeMillis());
|
||||
|
||||
// req.setMessageRandom();
|
||||
|
||||
req.setMessageBody(JSONObject.toJSONString(imCallHistory));
|
||||
req.setMessageId(UUID.randomUUID().toString().replace("-", ""));
|
||||
|
||||
|
||||
|
||||
req.setImei("uniapp");
|
||||
req.setClientType(1);
|
||||
|
||||
p2PMessageService.send(req);
|
||||
|
||||
|
||||
callHistoryMapper.updateById(imCallHistory);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/v1/user/login")
|
||||
.excludePathPatterns("/v1/file/**")
|
||||
.excludePathPatterns("/v1/room/**")
|
||||
.excludePathPatterns("/v1/im_call_history/**")
|
||||
.excludePathPatterns("/v1/message/checkSend");
|
||||
}
|
||||
|
||||
|
||||
@@ -46,4 +46,8 @@ public class MessageController {
|
||||
return messageSyncService.syncOfflineMessage(req);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -51,24 +51,7 @@ public class RoomController {
|
||||
@PostMapping("/unpublish")
|
||||
public ResponseVO unpublish(@RequestBody SRSCallBackReq callBackReq) {
|
||||
log.info(callBackReq.toString());
|
||||
/*
|
||||
POST /api/v1/streams HTTP/1.1
|
||||
Content-Type: application-json
|
||||
Body:
|
||||
{
|
||||
"server_id": "vid-0xk989d",
|
||||
"action": "on_publish",
|
||||
"client_id": "341w361a",
|
||||
"ip": "127.0.0.1",
|
||||
"vhost": "__defaultVhost__",
|
||||
"app": "live",
|
||||
"tcUrl": "rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__",
|
||||
"stream": "livestream",
|
||||
"param": "",
|
||||
"stream_url": "video.test.com/live/livestream",
|
||||
"stream_id": "vid-124q9y3"
|
||||
}
|
||||
*/
|
||||
|
||||
try {
|
||||
ImRoomEntity roomEntity = new ImRoomEntity();
|
||||
roomEntity.setRoomId(callBackReq.getApp());
|
||||
|
||||
@@ -8,7 +8,7 @@ spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
password: beAs0LHX2GyTxMw4
|
||||
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
|
||||
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=UTF8
|
||||
username: root
|
||||
|
||||
redis:
|
||||
|
||||
@@ -8,7 +8,7 @@ spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
password: beAs0LHX2GyTxMw4
|
||||
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
|
||||
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=UTF8
|
||||
username: root
|
||||
|
||||
redis:
|
||||
|
||||
@@ -8,7 +8,7 @@ spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
password: Mars@23600800
|
||||
url: jdbc:mysql://172.16.2.3:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
|
||||
url: jdbc:mysql://172.16.2.3:3306/im-core?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=UTF8
|
||||
username: root
|
||||
|
||||
redis:
|
||||
@@ -101,7 +101,8 @@ mqQueueName: 123
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 会正常输出日志
|
||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
mapper-locations: classpath*:mapper/*.xml
|
||||
global-config:
|
||||
db-config:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export default class config{
|
||||
static prod="online_not"
|
||||
static prod="online"
|
||||
static getZnzqApiUrl(){
|
||||
if(process.env.NODE_ENV === 'development' ){
|
||||
return 'http://work.ii999.live:19002/znzq'
|
||||
|
||||
Reference in New Issue
Block a user