Browse Source

重构回调接口命名

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
88353b3490
4 changed files with 68 additions and 35 deletions
  1. +14
    -31
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  2. +51
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/AirPortCallbackController.java
  3. +1
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/CloudBoxCallbackoxController.java
  4. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/DspCallbackController.java

+ 14
- 31
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java View File

@@ -1,20 +1,16 @@
package com.tuoheng.admin.controller;


import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.dto.InspectionDto;
import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspection.*;
import com.tuoheng.admin.request.inspection.AddInspectionRequest;
import com.tuoheng.admin.request.inspection.EditInspectionRequest;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.service.inspection.IInspectionService;
import com.tuoheng.common.core.common.OperationEnum;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* 巡检任务前端控制器
*
@@ -86,64 +82,49 @@ public class InspectionController {

/**
* 根据机场id查询任务
*
* @param dto
* @return
*/
@GetMapping("/listByAirportId")
public JsonResult getListByAirportId(InspectionDto dto){
public JsonResult getListByAirportId(InspectionDto dto) {
return iInspectionService.getListByAirportId(dto);
}

/**
* 根据id获取任务视频回放和直播
*
* @param id
* @return
*/
@GetMapping("/videoById/{id}")
public JsonResult videoById(@PathVariable("id") String id){
public JsonResult videoById(@PathVariable("id") String id) {
return iInspectionService.getVideoById(id);
}


/**
* 获取飞行轨迹
*
* @param id
* @return
*/
@GetMapping("/findFlightData/{id}")
public JsonResult finFlightData(@PathVariable("id") String id){
public JsonResult finFlightData(@PathVariable("id") String id) {
return iInspectionService.findFlightData(id);
}

/**
* 根据巡检id查询最新一条遥测数据
*
* @param inspectionId
* @return
*/
@GetMapping("/getFlightDataByInspectionId")
public FlightData getFlightDataByInspectionId(@RequestParam("inspectionId") String inspectionId){
public FlightData getFlightDataByInspectionId(@RequestParam("inspectionId") String inspectionId) {
return iInspectionService.getFlightDataByInspectionId(inspectionId);
}

/**
* 被硬件调用,存任务状态
*/
@PutMapping("/status")
public JsonResult updateStatus(@RequestBody @Valid MissionStatusRequest missionStatusRequest) {
log.info("被硬件调用,存任务状态:{}", JSONObject.toJSONString(missionStatusRequest));
return iInspectionService.updateStatus(missionStatusRequest);
}


/**
* 被硬件调用,存飞行轨迹
*/
@PostMapping("/track")
public OperationEnum track(@RequestBody @Valid InspectionRequest inspectionRequest) {
log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest));
return iInspectionService.track(inspectionRequest);
}

/**
* 重新提交巡检任务
*/
@@ -155,6 +136,7 @@ public class InspectionController {

/**
* 立即执行
*
* @param id
* @return
*/
@@ -166,11 +148,12 @@ public class InspectionController {

/**
* 根据用户id获取最新的五条任务信息
*
* @param
* @return
*/
@GetMapping("/getNewInspectionList")
public JsonResult getNewInspectionList(){
public JsonResult getNewInspectionList() {
return iInspectionService.getNewInspectionList();
}


+ 51
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/AirPortCallbackController.java View File

@@ -0,0 +1,51 @@
package com.tuoheng.admin.controller.callback;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.request.inspection.InspectionRequest;
import com.tuoheng.admin.request.inspection.MissionStatusRequest;
import com.tuoheng.admin.service.airport.AirportService;
import com.tuoheng.admin.service.inspection.IInspectionService;
import com.tuoheng.common.core.common.OperationEnum;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* 机场平台回调前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2022-12-23
*/
@Slf4j
@RestController
@RequestMapping("/airport/callback")
public class AirPortCallbackController {

@Autowired
private IInspectionService iInspectionService;

/**
* 被硬件调用,存任务状态
*/
@PutMapping("/status")
public JsonResult updateStatus(@RequestBody @Valid MissionStatusRequest missionStatusRequest) {
log.info("被硬件调用,存任务状态:{}", JSONObject.toJSONString(missionStatusRequest));
return iInspectionService.updateStatus(missionStatusRequest);
}


/**
* 被硬件调用,存飞行轨迹
*/
@PostMapping("/track")
public OperationEnum track(@RequestBody @Valid InspectionRequest inspectionRequest) {
log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest));
return iInspectionService.track(inspectionRequest);
}


}

+ 1
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/CloudBoxCallbackoxController.java View File

@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2021-09-18
*/
@RestController
@RequestMapping("/cloudbox")
@RequestMapping("/cloudbox/callback")
public class CloudBoxCallbackoxController {

@Autowired
@@ -30,7 +30,6 @@ public class CloudBoxCallbackoxController {
* @param entity
* @return
*/
@PostMapping("/callback")
public OperationEnum addCallback(@RequestBody FlightData entity) {
flightDataService.addCallback(entity);
return OperationEnum.OPERATION_SUCCESS;

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/DspCallbackController.java View File

@@ -17,7 +17,7 @@ import javax.validation.constraints.Pattern;
* @since 2021-09-01
*/
@RestController
@RequestMapping("/dsp")
@RequestMapping("/dsp/callback")
public class DspCallbackController {

@Autowired
@@ -29,7 +29,7 @@ public class DspCallbackController {
* @param dspCallbackRequest 回调请求体
* @return JsonResult
*/
@PostMapping("/{requestId}/callback")
@PostMapping("/{requestId}")
public JsonResult callback(@Valid @Pattern(regexp = "^[a-zA-Z0-9]{0,36}$")
@NotBlank @PathVariable String requestId,
@Valid @RequestBody DspCallbackRequest dspCallbackRequest) {

Loading…
Cancel
Save