IM 聊天记录

This commit is contained in:
2023-11-30 11:02:36 +08:00
parent 90f1fb5c57
commit 2f39828c8f
11 changed files with 161 additions and 14 deletions

View File

@@ -2,6 +2,16 @@
<div id="content">
<div id="map" ref="map" style="width: 100vw; height: 100vh"/>
<div id="overlay-box"/>
<div class="timeSelectBox" v-if="page=='planningPath'">
<div class="timeSelectBoxItem">
<van-button :type="routeType=='car'?'primary':'default'" @click="routeType='car'">&emsp;</van-button>
</div>
<div class="timeSelectBoxItem">
<van-button :type="routeType=='foot'?'primary':'default'" @click="routeType='foot'">步行骑行</van-button>
</div>
</div>
<div class="addAlarmPoint" v-if="page=='addAlarmPoint'">
<div class="addAlarmPointNext" @click="addAlarmPointNextAction">下一步</div>
</div>
@@ -78,6 +88,12 @@ export default {
geometryMove: {},
featureMove: {},
styles: {
routeFoot: new Style({
stroke: new Stroke({
width: 6,
color: "#07FA66",
}),
}),
route: new Style({
stroke: new Stroke({
width: 6,
@@ -127,7 +143,8 @@ export default {
planningVectorLayer: {},
parentPostMessageData: [],
isCanDraw: true,
from: ""
from: "",
routeType: "car",
};
},
mounted() {
@@ -271,8 +288,6 @@ export default {
});
// 切片方案0-18级
const projection = getProjection('EPSG:3857');
const projectionExtent = projection.getExtent();
@@ -373,6 +388,95 @@ export default {
this.addPoints(e.coordinate);
}
});
},
planningPathFoot() {
const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857');
const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857');
let _url = "https://172.16.3.19/route/v1/driving/"
_url = _url + this.navigationStartPoint[0] + ","
_url = _url + this.navigationStartPoint[1] + ";"
_url = _url + this.navigationEndPoint[0] + ","
_url = _url + this.navigationEndPoint[1]
_url = _url + "?" + "overview=false&alternatives=true&steps=true";
axios({
method: "get",
url: _url,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
}).then(res => {
console.log("================================获取到了导航结果")
res=res.data;
/*
console.log(res)
if (res.code != "OK") {
return false;
}else {
console.log("================================获取到了导航结果,开始步行导航")
}
*/
let pathList = [startPoint];
const steps=res.routes[0].legs[0].steps
steps.map(item0=>{
item0.intersections.map(item1=>{
const _point = ol.proj.transform(item1.location,'EPSG:4326', 'EPSG:3857');
pathList.push(_point)
})
})
// let _list=res.route[0].legs[0].steps[0].intersections
//
// _list.map((item, index) => {
//
// })
pathList.push(endPoint)
console.log("==============================pathList")
console.log(pathList)
const route = new LineString(pathList)
const geometryMove = new Point(route.getFirstCoordinate());
const featureMove = new Feature({
type: "featureMove",
geometry: geometryMove,
});
// this.planningVectorLayer.set('id', 'planningVectorLayer');
//先清空 再清除
this.map.removeLayer(this.planningVectorLayer)
this.planningVectorLayer = new VectorLayer({
source: new VectorSource({
features: [
new Feature({
type: "routeFoot",
geometry: route,
}),
featureMove,
new Feature({
type: "icon",
geometry: new Point(route.getFirstCoordinate()),
}),
new Feature({
type: "icon",
geometry: new Point(route.getLastCoordinate()),
}),
],
}),
style: (feature) => {
return this.styles[feature.get("type")];
},
});
this.map.addLayer(this.planningVectorLayer)
})
},
planningPath() {
@@ -642,8 +746,8 @@ export default {
let pointList = []
featureGeoJson.geometry.coordinates.map(item => {
const _item1 = ol.proj.transform(item, 'EPSG:3857', 'EPSG:4326');
pointList.push(_item1)
const _item1 = ol.proj.transform(item, 'EPSG:3857', 'EPSG:4326');
pointList.push(_item1)
})
window.parent.postMessage(JSON.stringify(pointList), "*");
@@ -914,7 +1018,12 @@ export default {
this.navigationEndPoint = res.data.result.location.split(",")
this.addPointWidthCoordinate(res.data.result.location, "alarm", res.data.result)
setInterval(() => {
this.planningPath()
if (this.routeType == "car") {
this.planningPath()
}
if (this.routeType == "foot") {
this.planningPathFoot()
}
}, 2000)
}
@@ -1189,4 +1298,21 @@ export default {
}
}
}
.timeSelectBox {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
display: flex;
flex-direction: row;
justify-content: center;
z-index: 100;
display: flex;
flex-direction: row;
justify-content: space-around;
}
</style>

View File

@@ -187,7 +187,7 @@ export default {
this.patrolInstanceId = this.$route.query.patrolInstanceId||getUrlParam("patrolInstanceId");
this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
this.busId = this.$route.query.uerId||getUrlParam("busId");
this.busId = this.$route.query.busId||getUrlParam("busId");
this.token = getUrlParam("token")
@@ -1128,7 +1128,7 @@ export default {
service.get(`/middlegroundPeriodicWorkOrderInstance/queryById`, {
params: {
id: this.patrolInstanceId
id: this.busId
}
}).then((res) => {
if (res.status == 200) {

View File

@@ -86,6 +86,9 @@ import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service";
import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
import WMTSTileGrid from 'ol/tilegrid/WMTS.js';
import {get as getProjection} from 'ol/proj.js';
import {getTopLeft, getWidth} from 'ol/extent.js';
import dayjs from "dayjs"

View File

@@ -4,7 +4,7 @@ spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
password: beAs0LHX2GyTxMw4
url: jdbc:mysql://43.139.191.204:3306:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
username: root
redis:

View File

@@ -43,10 +43,11 @@ public class ImCallHistoryController {
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.eq("invite_id",req.getUid());
query.orderByDesc("create_time");
IPage<ImCallHistoryEntity> imCallHistoryEntityIPage=callHistoryMapper.selectPage(objectPage,query);
return ResponseVO.successResponse(imCallHistoryEntityIPage);
}else {
return ResponseVO.errorResponse();

View File

@@ -8,6 +8,7 @@ import com.lld.im.service.message.model.req.SendMessageReq;
import com.lld.im.service.message.model.resp.ImMessageHistoryVo;
import com.lld.im.service.message.service.MessageSyncService;
import com.lld.im.service.message.service.P2PMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
@@ -21,6 +22,7 @@ import java.util.List;
* @author: lld
* @version: 1.0
*/
@Slf4j
@RestController
@RequestMapping("v1/message")
public class MessageController {
@@ -73,6 +75,9 @@ public class MessageController {
@RequestMapping("/chatHistory")
public ResponseVO chatHistory(@RequestBody
@Validated ChatHistoryReq chatHistoryReq, Integer appId) {
chatHistoryReq.setAppId(appId);
List<ImMessageHistoryVo> imMessageHistoryVos = messageSyncService.chatHistory(chatHistoryReq);
return ResponseVO.successResponse(imMessageHistoryVos);

View File

@@ -35,6 +35,7 @@ import java.util.Objects;
* @author: lld
* @version: 1.0
*/
@Component
public class ChatOperateReceiver {

View File

@@ -179,6 +179,9 @@ public class MessageSyncService {
.orderByDesc(ImMessageHistoryEntity::getMessageKey);
Page<ImMessageHistoryEntity> imMessageHistoryEntities = imMessageHistoryMapper.selectPage(objectPage,and);
List<Long> messageKeys = imMessageHistoryEntities.getRecords().stream().map(x -> x.getMessageKey()).collect(Collectors.toList());
if (messageKeys.size() == 0) {
return new ArrayList<ImMessageHistoryVo>();
}
List<ImMessageBodyEntity> imMessageBodyEntities = imMessageBodyMapper.selectList(new LambdaQueryWrapper<ImMessageBodyEntity>().in(ImMessageBodyEntity::getMessageKey, messageKeys));
Map<Long, ImMessageBodyEntity> collect = imMessageBodyEntities.stream().collect(Collectors.toMap(ImMessageBodyEntity::getMessageKey, x -> x));

View File

@@ -13,8 +13,8 @@ public class SRSStreamTask {
@Scheduled(cron="0/5 * * * * ? ")
public void executeTask(){
String ip = System.getenv("SRS_HOST");
log.error("213132");
log.info("========定时任务");
//
// log.error("213132");
// log.info("========定时任务");
}
}

View File

@@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: prod

View File

@@ -314,6 +314,14 @@ export class ImClient {
})
}
public getChatMessageHistoryList(uid:String,offset:Long,limit:Long): Promise<any> {
return new Promise((resolve, _) => {
let api = new HttpApi(this.httpUrl);
let resp = api.call("/message/chatHistory", this.getRequestParams(), { userId: uid,appId:this.appId,offset:offset, limit:limit,operater:this.userId })
resolve(resp);
})
}
public createRoom(room:any): Promise<any> {
return new Promise((resolve,_)=>{