Bläddra i källkod

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.3.1
wanjing 1 år sedan
förälder
incheckning
d56597b485
6 ändrade filer med 45 tillägg och 52 borttagningar
  1. +11
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/dto/AirportDto.java
  2. +2
    -10
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java
  3. +6
    -19
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/execute/ExecuteTaskService.java
  4. +8
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airport/TZHLGetAirportListService.java
  5. +4
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java
  6. +14
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/log/FlyLogBySuccessService.java

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/dto/GetAirportListDto.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/dto/AirportDto.java Visa fil

@@ -8,7 +8,7 @@ import lombok.Data;
* @Date 2023/8/9
*/
@Data
public class GetAirportListDto {
public class AirportDto {

/**
* 海拔高度:绝对高度米
@@ -90,6 +90,16 @@ public class GetAirportListDto {
*/
private Integer landingMode;

/**
* 无人机推流视频
*/
private String uvaPushUrl;

/**
* 无人机播放视频
*/
private String uvaPlayUrl;

/**
* 方舱外推流视频
*/

+ 2
- 10
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/execute/ExecuteInspectionService.java Visa fil

@@ -55,9 +55,8 @@ public class ExecuteInspectionService {
log.info("进入立即执行任务业务");
User user = CurrentUserUtil.getUserInfo();
String userId = user.getId();
String tenantId = user.getTenantId();

JsonResult result = this.check(userId, tenantId, id);
JsonResult result = this.check(user, id);
if (0 != result.getCode()) {
log.info("立即执行任务业务:校验参数失败:{}", result.getMsg());
return result;
@@ -79,7 +78,7 @@ public class ExecuteInspectionService {
* @param id
* @return
*/
private JsonResult check(String userId, String tenantId, String id) {
private JsonResult check(User user, String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(ExecuteInspectionCodeEnum.ID_IS_NULL.getCode(), ExecuteInspectionCodeEnum.ID_IS_NULL.getMsg());
}
@@ -87,16 +86,9 @@ public class ExecuteInspectionService {
if (null == inspection) {
return JsonResult.error(ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg());
}

if (2 == inspection.getExecutionStatus()) {
return JsonResult.error(ExecuteInspectionCodeEnum.INSPECTION_CANNOT_REPEATED_EXECUTE.getCode(), ExecuteInspectionCodeEnum.INSPECTION_CANNOT_REPEATED_EXECUTE.getMsg());
}

User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getId, userId)
.eq(User::getMark, 1));

if (!user.getDeptId().equals(inspection.getDeptId())) {
return JsonResult.error(ExecuteInspectionCodeEnum.USER_ONLY_EXECUTE_DEPARTMENT_TASK.getCode(), ExecuteInspectionCodeEnum.USER_ONLY_EXECUTE_DEPARTMENT_TASK.getMsg());
}

+ 6
- 19
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/execute/ExecuteTaskService.java Visa fil

@@ -1,34 +1,21 @@
package com.tuoheng.admin.service.third.airport.execute;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.dto.GetAirportListDto;
import com.tuoheng.admin.dto.AirportDto;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionHistory;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.code.inspection.ExecuteInspectionCodeEnum;
import com.tuoheng.admin.mapper.InspectionHistoryMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.service.third.dsp.IDspService;
import com.tuoheng.admin.tzhl.config.TZHLConfig;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.response.TZHLAirportLineResponse;
import com.tuoheng.admin.tzhl.response.TZHLOnlineUavResponse;
import com.tuoheng.admin.tzhl.response.TZHLShelterTaskResponse;
import com.tuoheng.admin.tzhl.service.airport.TZHLGetAirportListService;
import com.tuoheng.admin.tzhl.service.airportline.TZHLGetAirportLineListService;
import com.tuoheng.admin.tzhl.service.fly.onlineuav.OnlineUavService;
import com.tuoheng.admin.tzhl.service.task.FlightTaskService;
import com.tuoheng.admin.tzhl.service.task.ShelterTaskService;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

@Slf4j
@@ -82,13 +69,13 @@ public class ExecuteTaskService {
}

private JsonResult check(Inspection inspection) {
GetAirportListDto airportListDto = tzhlGetAirportListService.getAirport(inspection.getAirportId());
if (ObjectUtil.isEmpty(airportListDto)) {
AirportDto airportDto = tzhlGetAirportListService.getAirport(inspection.getAirportId());
if (ObjectUtil.isEmpty(airportDto)) {
log.info("泰州海陵区城管,执行任务,机场不存在,inspectionId:{}, airportId", inspection.getId(), inspection.getAirportId());
return JsonResult.error("泰州海陵区城管,执行任务,航线不存在");
return JsonResult.error("泰州海陵区城管,执行任务,机场不存在");
}

if (1 == airportListDto.getShelterStatus()) {
if (1 == airportDto.getShelterStatus()) {
log.info("泰州海陵区城管,执行任务,机场被禁用,inspectionId:{}, airportId", inspection.getId(), inspection.getAirportId());
return JsonResult.error("泰州海陵区城管,执行任务,机场被禁用");
}
@@ -96,7 +83,7 @@ public class ExecuteTaskService {
TZHLAirportLineResponse tzhlAirportLineResponse = tzhlGetAirportLineListService.getAirportLineById(inspection.getInspectionLine());
if (ObjectUtil.isEmpty(tzhlAirportLineResponse)) {
log.info("泰州海陵区城管,执行任务,航线不存在,inspectionId:{}, airportLineId", inspection.getId(), tzhlAirportLineResponse.getId());
return JsonResult.error("泰州海陵区城管,航线不存在");
return JsonResult.error("泰州海陵区城管,执行任务,航线不存在");
}
return JsonResult.success();
}

+ 8
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airport/TZHLGetAirportListService.java Visa fil

@@ -2,7 +2,7 @@ package com.tuoheng.admin.tzhl.service.airport;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.tuoheng.admin.dto.GetAirportListDto;
import com.tuoheng.admin.dto.AirportDto;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.request.TZHLAirportLineListRequest;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
@@ -38,14 +38,14 @@ public class TZHLGetAirportListService {
String url = TZHLConstant.TIAN_YI_API_AIRPORT_LIST ;

String data = callTianYiPlatformService.callGet(url, request);
List<GetAirportListDto> getAirportListDtoList = JSON.parseArray(data, GetAirportListDto.class);
if(ObjectUtil.isNull(getAirportListDtoList)){
List<AirportDto> airportDtoList = JSON.parseArray(data, AirportDto.class);
if(ObjectUtil.isNull(airportDtoList)){
return JsonResult.error("查询机场列表数据为空");
}
return JsonResult.success(getAirportListDtoList);
return JsonResult.success(airportDtoList);
}

public GetAirportListDto getAirport(Long id){
public AirportDto getAirport(Long id){
Long[] idArr = new Long[ ]{id};
TZHLAirportLineListRequest request = new TZHLAirportLineListRequest();
request.setIds(Arrays.toString(idArr));
@@ -54,11 +54,11 @@ public class TZHLGetAirportListService {
String url = TZHLConstant.TIAN_YI_API_AIRPORT_LIST ;

String data = callTianYiPlatformService.callGet(url, request);
List<GetAirportListDto> getAirportListDtoList = JSON.parseArray(data, GetAirportListDto.class);
if(ObjectUtil.isNull(getAirportListDtoList)){
List<AirportDto> airportDtoList = JSON.parseArray(data, AirportDto.class);
if(ObjectUtil.isNull(airportDtoList)){
log.info("查询机场列表数据为空");
return null;
}
return getAirportListDtoList.get(0);
return airportDtoList.get(0);
}
}

+ 4
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java Visa fil

@@ -5,17 +5,15 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.dto.GetAirportListDto;
import com.tuoheng.admin.dto.AirportDto;
import com.tuoheng.admin.entity.FlightDataHl;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.FlightDataHlMapper;
import com.tuoheng.admin.tzhl.constant.TZHLConstant;
import com.tuoheng.admin.tzhl.response.TZHLAirportFlightDataResponse;
import com.tuoheng.admin.tzhl.response.TZHLTokenResponse;
import com.tuoheng.admin.tzhl.service.CallTianYiPlatformService;
import com.tuoheng.admin.tzhl.service.airport.TZHLGetAirportListService;
import com.tuoheng.admin.tzhl.service.token.TZHLGetTokenService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
@@ -110,10 +108,10 @@ public class FlyDataService {
//根据任务获取对应的部门
Long recordId = inspection.getRecordId();

GetAirportListDto airportListDto = getAirportListService.getAirport(inspection.getAirportId());
AirportDto airportDto = getAirportListService.getAirport(inspection.getAirportId());
Long deptId = 0L;
if (ObjectUtil.isNotEmpty(airportListDto)) {
deptId = airportListDto.getDeptId();
if (ObjectUtil.isNotEmpty(airportDto)) {
deptId = airportDto.getDeptId();
}

JSONObject jsonObject = new JSONObject();

+ 14
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/log/FlyLogBySuccessService.java Visa fil

@@ -1,15 +1,16 @@
package com.tuoheng.admin.tzhl.service.fly.log;

import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.admin.dto.AirportDto;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.service.third.dsp.IDspService;
import com.tuoheng.admin.tzhl.response.TZHLFlyLogResponse;
import com.tuoheng.admin.tzhl.response.TZHLOnlineUavResponse;
import com.tuoheng.admin.tzhl.service.fly.onlineuav.OnlineUavService;
import com.tuoheng.admin.tzhl.service.airport.TZHLGetAirportListService;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -22,7 +23,7 @@ public class FlyLogBySuccessService {
private InspectionMapper inspectionMapper;

@Autowired
private OnlineUavService onlineUavService;
private TZHLGetAirportListService tzhlGetAirportListService;

@Autowired
private IDspService dspService;
@@ -41,16 +42,21 @@ public class FlyLogBySuccessService {

log.info("获取飞行日志,status=success,修改任务状态,status={}", inspection.getStatus());

TZHLOnlineUavResponse tzhlOnlineUavResponse = onlineUavService.getOnlineUav();
if (ObjectUtil.isEmpty(tzhlOnlineUavResponse)) {
log.info("泰州海陵区城管,执行任务,获取推流地址失败,inspectionId={}", inspection.getId());
AirportDto airportDto = tzhlGetAirportListService.getAirport(inspection.getAirportId());
if (ObjectUtil.isEmpty(airportDto)) {
log.info("获取飞行日志,获取推流地址失败,inspectionId={}", inspection.getId());
return;
}

if (StringUtils.isEmpty(airportDto.getUvaPushUrl())) {
log.info("获取飞行日志,获取推流地址为空,inspectionId={}", inspection.getId());
return;
}

// 通知DSP
JsonResult result = dspService.startAI(inspection, tzhlOnlineUavResponse.getPushUrl(), tzhlOnlineUavResponse.getPushUrl());
JsonResult result = dspService.startAI(inspection, airportDto.getUvaPushUrl(), airportDto.getUvaPushUrl());
if (0 != result.getCode()) {
log.info("泰州海陵区城管,执行任务,通知DSP失败");
log.info("获取飞行日志,获取推流地址,通知DSP失败");
inspection.setStatus(InspectionStatusEnum.FLIGHT_FAILED.getCode());
}
}

Laddar…
Avbryt
Spara