|
@ -14,7 +14,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import io.seata.common.util.StringUtils; |
|
|
import io.seata.common.util.StringUtils; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.dubbo.config.annotation.DubboReference; |
|
|
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse; |
|
|
import org.apache.http.client.methods.CloseableHttpResponse; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
import org.apache.http.client.methods.HttpPost; |
|
|
import org.apache.http.client.methods.HttpPost; |
|
@ -23,17 +22,18 @@ import org.apache.http.entity.StringEntity; |
|
|
import org.apache.http.impl.client.CloseableHttpClient; |
|
|
import org.apache.http.impl.client.CloseableHttpClient; |
|
|
import org.apache.http.impl.client.HttpClients; |
|
|
import org.apache.http.impl.client.HttpClients; |
|
|
import org.apache.http.util.EntityUtils; |
|
|
import org.apache.http.util.EntityUtils; |
|
|
import org.dromara.business.api.RemoteBusinessAlertService; |
|
|
import org.dromara.business.api.domain.RemoteBusinessAlertRequest; |
|
|
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; |
|
|
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; |
|
|
import org.dromara.common.core.utils.file.MimeTypeUtils; |
|
|
import org.dromara.common.core.utils.file.MimeTypeUtils; |
|
|
import org.dromara.common.oss.core.OssClient; |
|
|
import org.dromara.common.oss.core.OssClient; |
|
|
import org.dromara.common.oss.entity.UploadResult; |
|
|
import org.dromara.common.oss.entity.UploadResult; |
|
|
import org.dromara.common.oss.factory.OssFactory; |
|
|
import org.dromara.common.oss.factory.OssFactory; |
|
|
import org.dromara.common.sdk.mqtt.CommonTopicRequest; |
|
|
|
|
|
import org.dromara.sample.common.util.Md5Utils; |
|
|
import org.dromara.sample.common.util.Md5Utils; |
|
|
|
|
|
import org.dromara.sample.feign.RemoteBusinessAlertFeign; |
|
|
|
|
|
import org.dromara.sample.feign.RemoteConfigFeign; |
|
|
|
|
|
import org.dromara.sample.feign.RemoteSystemFeign; |
|
|
import org.dromara.sample.manage.config.XingluoApiConfig; |
|
|
import org.dromara.sample.manage.config.XingluoApiConfig; |
|
|
import org.dromara.sample.manage.config.XingluoApiEnum; |
|
|
import org.dromara.sample.manage.config.XingluoApiEnum; |
|
|
import org.dromara.sample.manage.mapper.IDeviceMapper; |
|
|
|
|
|
import org.dromara.sample.manage.mapper.ISampleEngineRecordMapper; |
|
|
import org.dromara.sample.manage.mapper.ISampleEngineRecordMapper; |
|
|
import org.dromara.sample.manage.mapper.ITaskJobMapper; |
|
|
import org.dromara.sample.manage.mapper.ITaskJobMapper; |
|
|
import org.dromara.sample.manage.mapper.SampleWarningRecordMapper; |
|
|
import org.dromara.sample.manage.mapper.SampleWarningRecordMapper; |
|
@ -43,19 +43,16 @@ import org.dromara.sample.manage.model.entity.TaskJobEntity; |
|
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
|
|
import org.dromara.sample.manage.model.entity.WarningRecordEntity; |
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
import org.dromara.sample.manage.service.IDeviceService; |
|
|
import org.dromara.sample.manage.service.ISampleEngineRecordService; |
|
|
import org.dromara.sample.manage.service.ISampleEngineRecordService; |
|
|
import org.dromara.sample.manage.service.ISampleWarningRecordService; |
|
|
|
|
|
import org.dromara.sample.media.constant.MinIOConstants; |
|
|
import org.dromara.sample.media.constant.MinIOConstants; |
|
|
import org.dromara.sample.wayline.mapper.IWaylineJobMapper; |
|
|
import org.dromara.sample.wayline.mapper.IWaylineJobMapper; |
|
|
import org.dromara.sample.wayline.model.entity.WaylineJobEntity; |
|
|
import org.dromara.sample.wayline.model.entity.WaylineJobEntity; |
|
|
import org.dromara.system.api.RemoteConfigService; |
|
|
|
|
|
import org.dromara.system.api.RemoteDictService; |
|
|
|
|
|
import org.json.JSONArray; |
|
|
import org.json.JSONArray; |
|
|
import org.json.JSONObject; |
|
|
import org.json.JSONObject; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import jakarta.annotation.Resource; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.net.URI; |
|
|
import java.net.URI; |
|
@ -93,12 +90,15 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
// @Autowired
|
|
|
// @Autowired
|
|
|
private final IWaylineJobMapper waylineJobMapper; |
|
|
private final IWaylineJobMapper waylineJobMapper; |
|
|
|
|
|
|
|
|
@DubboReference |
|
|
@Resource |
|
|
private RemoteConfigService remoteConfigService; |
|
|
private RemoteConfigFeign remoteConfigFeign; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private RemoteSystemFeign remoteSystemFeign; |
|
|
|
|
|
|
|
|
@DubboReference |
|
|
|
|
|
private final RemoteBusinessAlertService businessAlertService; |
|
|
@Resource |
|
|
|
|
|
private RemoteBusinessAlertFeign remoteBusinessAlertFeign; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -163,8 +163,14 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Map<String, Object> startEngine(Map<String, Object> objectMap){ |
|
|
public Map<String, Object> startEngine(Map<String, Object> objectMap){ |
|
|
|
|
|
System.out.println("objectMap" + objectMap); |
|
|
|
|
|
// String configKey = remoteSystemFeign.getConfigKey("xingluo.auto.submit");//通
|
|
|
|
|
|
// System.out.println("configKey"+configKey);
|
|
|
EngineRecordEntity record = new EngineRecordEntity(); |
|
|
EngineRecordEntity record = new EngineRecordEntity(); |
|
|
String ip = remoteConfigService.selectStreamIp(); |
|
|
// String ip = remoteConfigService.selectStreamIp();
|
|
|
|
|
|
String ip = remoteConfigFeign.getConfigKey("stream"); |
|
|
|
|
|
System.out.println(ip); |
|
|
|
|
|
ip = "121.237.182.235";//服务器使用ip
|
|
|
String md5 = Md5Utils.hash("xuzhou_ai"); //获取token + 设置请求Header和Body(如JSON)
|
|
|
String md5 = Md5Utils.hash("xuzhou_ai"); //获取token + 设置请求Header和Body(如JSON)
|
|
|
JSONObject jsonObj = new JSONObject(); |
|
|
JSONObject jsonObj = new JSONObject(); |
|
|
jsonObj.put("username", sanitize("xuzhou_ai")); // sanitize函数见下文
|
|
|
jsonObj.put("username", sanitize("xuzhou_ai")); // sanitize函数见下文
|
|
@ -213,10 +219,12 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
|
|
|
|
|
//测试环境,直接接收url,跳过无人机
|
|
|
//测试环境,直接接收url,跳过无人机
|
|
|
// Object rtmpUrlParam = objectMap.get("inputUrl");
|
|
|
// Object rtmpUrlParam = objectMap.get("inputUrl");
|
|
|
jsonObj2.put("input_url", "rtmp://114.235.183.163/live/livesteam/1581F6Q8X24CE00G02S4-81-0-0");//预览接口必须要传rtmp,不能是flv
|
|
|
// jsonObj2.put("input_url", "rtmp://114.235.183.163/live/livesteam/1581F6Q8X24CE00G02S4-81-0-0");//预览接口必须要传rtmp,不能是flv
|
|
|
jsonObj2.put("push_url", "rtmp://114.235.183.163/live/livesteam/1581F6Q8X24CE00G02S4-81-0-0ai1");//预览接口必须要传rtmp,不能是flv
|
|
|
// jsonObj2.put("push_url", "rtmp://114.235.183.163/live/livesteam/1581F6Q8X24CE00G02S4-81-0-0ai1");//预览接口必须要传rtmp,不能是flv
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println(jsonObj2.toString()); |
|
|
String responseBody2 = PostRequest(jsonObj2, xingluoApiConfig.getEngineStart(),token); //"http://60.204.247.65:8100/Third/Engine/Start"
|
|
|
String responseBody2 = PostRequest(jsonObj2, xingluoApiConfig.getEngineStart(),token); //"http://60.204.247.65:8100/Third/Engine/Start"
|
|
|
|
|
|
System.out.println(responseBody2); |
|
|
ObjectMapper mapper1 = new ObjectMapper(); |
|
|
ObjectMapper mapper1 = new ObjectMapper(); |
|
|
EngineResponse response = null; |
|
|
EngineResponse response = null; |
|
|
try { |
|
|
try { |
|
@ -336,6 +344,7 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
CallBackDTO callBackVo = JSONUtil.toBean(resObject, CallBackDTO.class); |
|
|
CallBackDTO callBackVo = JSONUtil.toBean(resObject, CallBackDTO.class); |
|
|
String taskIdStr = entries.getStr("taskId"); |
|
|
String taskIdStr = entries.getStr("taskId"); |
|
|
if(StrUtil.isBlank(taskIdStr)){return 0;} //无任务ID拦截
|
|
|
if(StrUtil.isBlank(taskIdStr)){return 0;} //无任务ID拦截
|
|
|
|
|
|
if(callBackVo.getEvents().isEmpty()){ return 0;} |
|
|
|
|
|
|
|
|
//基于历史记录,找相同设备- trackId是否相同,不同才保存, (每次记录中eventId都不同,所以不做参考)
|
|
|
//基于历史记录,找相同设备- trackId是否相同,不同才保存, (每次记录中eventId都不同,所以不做参考)
|
|
|
//同一图片上传可能包含多个物体,传值可能是 h1v93,或者fdi32,或者h1v93,fdi32, 只要trackIds不同,就保存记录
|
|
|
//同一图片上传可能包含多个物体,传值可能是 h1v93,或者fdi32,或者h1v93,fdi32, 只要trackIds不同,就保存记录
|
|
@ -436,7 +445,13 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
//businessAlertConstructInfo数据
|
|
|
//businessAlertConstructInfo数据
|
|
|
alertVoList.add(remoteBusinessAlertVo); |
|
|
alertVoList.add(remoteBusinessAlertVo); |
|
|
} |
|
|
} |
|
|
businessAlertService.saveBusinessAlert(alertVoList,activeProfile); //触发预警消息
|
|
|
// businessAlertService.saveBusinessAlert(alertVoList,activeProfile); //远程触发预警消息
|
|
|
|
|
|
RemoteBusinessAlertRequest remoteBusinessAlertRequest = new RemoteBusinessAlertRequest(); |
|
|
|
|
|
remoteBusinessAlertRequest.setAlertVoList(alertVoList); |
|
|
|
|
|
remoteBusinessAlertRequest.setActiveProfile(activeProfile); |
|
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject requestObj = new cn.hutool.json.JSONObject(remoteBusinessAlertRequest); |
|
|
|
|
|
remoteBusinessAlertFeign.saveBusinessAlert(requestObj); |
|
|
|
|
|
|
|
|
return callBackVo.getEvents().size(); |
|
|
return callBackVo.getEvents().size(); |
|
|
} |
|
|
} |
|
|