|
|
@ -24,6 +24,7 @@ import org.apache.http.impl.client.HttpClients; |
|
|
|
import org.apache.http.util.EntityUtils; |
|
|
|
import org.dromara.business.api.domain.RemoteBusinessAlertRequest; |
|
|
|
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; |
|
|
|
import org.dromara.common.core.domain.R; |
|
|
|
import org.dromara.common.core.utils.file.MimeTypeUtils; |
|
|
|
import org.dromara.common.oss.core.OssClient; |
|
|
|
import org.dromara.common.oss.entity.UploadResult; |
|
|
@ -164,9 +165,22 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
@Override |
|
|
|
public Map<String, Object> startEngine(Map<String, Object> objectMap){ |
|
|
|
System.out.println("objectMap" + objectMap); |
|
|
|
|
|
|
|
String deviceSn = MapUtil.getStr(objectMap, "deviceSn", ""); |
|
|
|
String type = MapUtil.getStr(objectMap, "type", ""); // objectMap.get("type").toString();
|
|
|
|
DeviceDTO deviceDTO = deviceService.getDeviceBySn(deviceSn).orElse(null); |
|
|
|
//获取rtmpUrl + 默认记录上传 pushDeptId
|
|
|
|
String rtmpUrl = ""; |
|
|
|
Long pushDeptId = null; |
|
|
|
if (deviceDTO != null) { |
|
|
|
String childDeviceRtmpUrl = deviceService.getChildDeviceStreamUrlByDeviceSn(deviceDTO.getChildDeviceSn()); |
|
|
|
rtmpUrl = childDeviceRtmpUrl; |
|
|
|
pushDeptId = deviceDTO.getPushDeptId(); |
|
|
|
} |
|
|
|
// String configKey = remoteSystemFeign.getConfigKey("xingluo.auto.submit");//通
|
|
|
|
// System.out.println("configKey"+configKey);
|
|
|
|
EngineRecordEntity record = new EngineRecordEntity(); |
|
|
|
record.setPushDeptId(pushDeptId); |
|
|
|
// String ip = remoteConfigService.selectStreamIp();
|
|
|
|
String ip = remoteConfigFeign.getConfigKey("stream"); |
|
|
|
System.out.println(ip); |
|
|
@ -185,21 +199,12 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
String algorithmResponseBody = null; |
|
|
|
String taskId = ""; |
|
|
|
String missionBatch = ""; |
|
|
|
String deviceSn = MapUtil.getStr(objectMap, "deviceSn", ""); |
|
|
|
//获取rtmpUrl
|
|
|
|
String rtmpUrl = ""; |
|
|
|
DeviceDTO deviceDTO = deviceService.getDeviceBySn(deviceSn).orElse(null); |
|
|
|
if (deviceDTO != null) { |
|
|
|
String childDeviceRtmpUrl = deviceService.getChildDeviceStreamUrlByDeviceSn(deviceDTO.getChildDeviceSn()); |
|
|
|
rtmpUrl = childDeviceRtmpUrl; |
|
|
|
} |
|
|
|
|
|
|
|
//查询用户开通的场景
|
|
|
|
Object rtmpUrlParam = objectMap.get("rtmpUrl"); |
|
|
|
String pushUrl = "rtmp://" + ip + "/live/livesteam/" + rtmpUrl + "ai1"; |
|
|
|
if (StringUtils.isNotEmpty(token)){ |
|
|
|
JSONObject jsonObj2 = new JSONObject(); |
|
|
|
String type = objectMap.get("type").toString(); |
|
|
|
if (StringUtils.isNotEmpty(type)){ //2004_ext 算法名称
|
|
|
|
List<String> list = Arrays.asList(type.split(",")); |
|
|
|
jsonObj2.put("scene", "可见光"); // sanitize函数见下文
|
|
|
@ -266,6 +271,8 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
taskJobEntity.setJobId(jobIdStr); |
|
|
|
taskJobEntity.setTaskId(objectMap.get("task_id").toString()); |
|
|
|
taskJobEntity.setDeviceSn(deviceSn); |
|
|
|
taskJobEntity.setExtraType(type); |
|
|
|
taskJobEntity.setPushDeptId(pushDeptId); |
|
|
|
taskJobMapper.insert(taskJobEntity); |
|
|
|
return map; |
|
|
|
} |
|
|
@ -363,7 +370,8 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
// .eq(WarningRecordEntity::getTrackIds, trackIds)
|
|
|
|
// .count();
|
|
|
|
LambdaQueryWrapper<WarningRecordEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(WarningRecordEntity::getTaskId, taskIdStr) |
|
|
|
queryWrapper |
|
|
|
.eq(WarningRecordEntity::getTaskId, taskIdStr) |
|
|
|
.eq(WarningRecordEntity::getExtraType, extraTypeStr) |
|
|
|
.eq(WarningRecordEntity::getTrackIds, trackIds); |
|
|
|
Long count = sampleWarningRecordMapper.selectCount(queryWrapper); |
|
|
@ -391,6 +399,8 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
String activeProfile = "w_nantong"; |
|
|
|
ArrayList<RemoteBusinessAlertVo> alertVoList = new ArrayList<>(); |
|
|
|
|
|
|
|
Long pushDeptId = null; |
|
|
|
String pushDeptName = ""; |
|
|
|
for (WarningRecordEntity warningRecordEntity : warningRecordList) { |
|
|
|
RemoteBusinessAlertVo remoteBusinessAlertVo = new RemoteBusinessAlertVo(); |
|
|
|
if(ObjectUtil.isEmpty(warningRecordEntity.getTaskId())){ continue;} //空数据跳过
|
|
|
@ -405,9 +415,11 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
TaskJobEntity taskJobEntity = taskJobMapper.selectOne(taskJobquery); |
|
|
|
|
|
|
|
String deviceSn = ""; |
|
|
|
|
|
|
|
if(BeanUtil.isNotEmpty(taskJobEntity)){ |
|
|
|
String jobId = taskJobEntity.getJobId(); |
|
|
|
deviceSn = taskJobEntity.getDeviceSn(); |
|
|
|
pushDeptId = taskJobEntity.getPushDeptId(); |
|
|
|
if(StrUtil.equals("-1",jobId)){ //没有jobId,给个默认名称
|
|
|
|
remoteBusinessAlertVo.setJobId("-1"); |
|
|
|
remoteBusinessAlertVo.setJobName("手动飞行" + "-" +remoteBusinessAlertVo.getLabelCn()+ DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
|
|
@ -445,13 +457,15 @@ public class SampleEngineRecordServiceImpl implements ISampleEngineRecordService |
|
|
|
//businessAlertConstructInfo数据
|
|
|
|
alertVoList.add(remoteBusinessAlertVo); |
|
|
|
} |
|
|
|
|
|
|
|
// 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); |
|
|
|
requestObj.set("pushDeptId", pushDeptId); |
|
|
|
Boolean booleanR = remoteBusinessAlertFeign.saveBusinessAlert(requestObj); |
|
|
|
|
|
|
|
return callBackVo.getEvents().size(); |
|
|
|
} |
|
|
|