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

package com.tuoheng.admin.controller; package com.tuoheng.admin.controller;



import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.dto.InspectionDto; import com.tuoheng.admin.dto.InspectionDto;
import com.tuoheng.admin.entity.FlightData; 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.admin.service.inspection.IInspectionService;
import com.tuoheng.common.core.common.OperationEnum;
import com.tuoheng.common.core.utils.JsonResult; import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.validation.Valid;

/** /**
* 巡检任务前端控制器 * 巡检任务前端控制器
* *


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


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




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


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

/** /**
* 重新提交巡检任务 * 重新提交巡检任务
*/ */


/** /**
* 立即执行 * 立即执行
*
* @param id * @param id
* @return * @return
*/ */


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



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

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

* @since 2021-09-18 * @since 2021-09-18
*/ */
@RestController @RestController
@RequestMapping("/cloudbox")
@RequestMapping("/cloudbox/callback")
public class CloudBoxCallbackoxController { public class CloudBoxCallbackoxController {


@Autowired @Autowired
* @param entity * @param entity
* @return * @return
*/ */
@PostMapping("/callback")
public OperationEnum addCallback(@RequestBody FlightData entity) { public OperationEnum addCallback(@RequestBody FlightData entity) {
flightDataService.addCallback(entity); flightDataService.addCallback(entity);
return OperationEnum.OPERATION_SUCCESS; return OperationEnum.OPERATION_SUCCESS;

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

* @since 2021-09-01 * @since 2021-09-01
*/ */
@RestController @RestController
@RequestMapping("/dsp")
@RequestMapping("/dsp/callback")
public class DspCallbackController { public class DspCallbackController {


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

Loading…
Cancel
Save