Kaynağa Gözat

应急任务回仓

tags/v1.2.0^2
chengwang 1 yıl önce
ebeveyn
işleme
89206cf5e3
5 değiştirilmiş dosya ile 84 ekleme ve 6 silme
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java
  2. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportService.java
  3. +7
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportServiceImpl.java
  4. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java
  5. +74
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ReversalFlightService.java

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java Dosyayı Görüntüle

@@ -69,7 +69,7 @@ public class AirPortController {
*/
@PostMapping("/reversalFlight")
public JsonResult reversalFlight(ReversalFlightRequest request){
return airportService.reversalFlight();
return airportService.reversalFlight(request);
}



+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportService.java Dosyayı Görüntüle

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

import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.AccidentFlightRequest;
import com.tuoheng.admin.request.accident.ReversalFlightRequest;
import com.tuoheng.common.core.utils.JsonResult;

public interface AirportService {
@@ -16,8 +17,7 @@ public interface AirportService {

JsonResult pointFlight(AccidentFlightRequest request);

JsonResult reversalFlight();


JsonResult reversalFlight(ReversalFlightRequest request);

}

+ 7
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/AirportServiceImpl.java Dosyayı Görüntüle

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

import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.request.accident.AccidentFlightRequest;
import com.tuoheng.admin.request.accident.ReversalFlightRequest;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -24,6 +25,9 @@ public class AirportServiceImpl implements AirportService {
@Autowired
private PointFlightService pointFlightService;

@Autowired
private ReversalFlightService reversalFlightService;

@Override
public JsonResult getAirportList() {
return getAirportListService.getAirportList();
@@ -50,7 +54,8 @@ public class AirportServiceImpl implements AirportService {
}

@Override
public JsonResult reversalFlight() {
return null;
public JsonResult reversalFlight(ReversalFlightRequest request) {
return reversalFlightService.reversalFlight(request);
}

}

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java Dosyayı Görüntüle

@@ -3,7 +3,6 @@ package com.tuoheng.admin.service.third.airport;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.ServiceException;
import com.google.gson.JsonObject;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.Tenant;

+ 74
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ReversalFlightService.java Dosyayı Görüntüle

@@ -0,0 +1,74 @@
package com.tuoheng.admin.service.third.airport;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.request.accident.ReversalFlightRequest;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
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.stereotype.Service;

/**
* @Author ChengWang
* @Date 2023/3/14
*/
@Slf4j
@Service
public class ReversalFlightService {

@Autowired
private InspectionMapper inspectionMapper;

/**
* 应急飞行(回仓)
* @param request
* @return
*/
public JsonResult reversalFlight(ReversalFlightRequest request) {

log.info("进入调用机场平台,执行定点飞行");
//校验传参
if(null == request.getAirportId()){
throw new ServiceException("机场id为空");
}
// if(null == request.getTaskId()){
// throw new ServiceException("任务id为空");
// }
//根据任务对应的机场查询对应任务id
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getAirportId, request.getAirportId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.eq(Inspection::getStatus, InspectionStatusEnum.IN_FLIGHT.getCode()));
if(ObjectUtils.isNotEmpty(inspection)){
request.setTaskId(Integer.valueOf(inspection.getId()));
}
request.setTaskId(Integer.valueOf(inspection.getId()));
request.setZhilin("03");
//调用机场平台让飞机返航
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_REVERSAL_FLIGH;
JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId",request.getTaskId());
jsonObject.put("airportId",request.getAirportId());
jsonObject.put("zhilin",request.getZhilin());
log.info("调用机场平台,无人机执行定点飞行返航:url:{}",url);
log.info("调用机场平台,原无人机执行定点飞行,jsonObject:{}",jsonObject);

String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if (StringUtils.isEmpty(airPortStr)) {
log.info("原无人机执行定点飞行返航:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject);
throw new ServiceException("机场接口返回数据为空,飞行失败");
}

return JsonResult.success();
}
}

Yükleniyor…
İptal
Kaydet