Infrastructure/OpenAuth.WebApi/Controllers/ServiceControllers/DroneCaseinfoController.cs

147 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Infrastructure;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using OpenAuth.App.ServiceApp.DroneCaseInfo;
using OpenAuth.App.ServiceApp.InsTaskHallManager;
using OpenAuth.App.ServiceApp.Request;
using OpenAuth.App.ServiceApp.Response;
namespace OpenAuth.WebApi.Controllers.ServiceControllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class DroneCaseinfoController : ControllerBase
{
private readonly DroneCaseinfoApp _app;
public DroneCaseinfoController(DroneCaseinfoApp app)
{
_app = app;
}
[HttpGet]
public string Test(string txt)
{
return _app.Test(txt);
}
/// <summary>
/// 无人机添加案件
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public Response<string> AddDroneCaseByDrone([FromBody] AddDroneCaseByDroneReq req)
{
Response<string> response = new Response<string>();
try
{
response.Result = _app.AddDroneCaseByDrone(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 案件详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public Response<AddOrUpdateDroneCaseInfoDataBaseReqExt> GetCaseInfo(string id)
{
Response<AddOrUpdateDroneCaseInfoDataBaseReqExt> response = new Response<AddOrUpdateDroneCaseInfoDataBaseReqExt>();
try
{
response.Result = _app.GetCaseInfo(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 获取GeoJson
/// PC获取图层的GeoJson判读页面用
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public Response<JToken> GetDroneGeoJson(string id)
{
Response<JToken> response = new Response<JToken>();
try
{
response.Result = _app.GetDroneGeoJson(id);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 案件判读
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public Response<string> UpdateDroneCaseInfoIntact([FromBody] AddOrUpdateDroneCaseInfoDataBaseReq req)
{
Response<string> response = new Response<string>();
try
{
response.Result = _app.UpdateDroneCaseInfoIntact(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
/// <summary>
/// 上报案件
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public Response<string> AddDroneCaseInfo([FromBody] AddOrUpdateDroneCaseInfoReq req)
{
Response<string> response = new Response<string>();
try
{
if (string.IsNullOrEmpty(req.info.Id))
{
//新增
response.Result = _app.AddDroneCaseInfo(req);
}
else
{
//修改
response.Result = _app.UpdateDroneCaseInfo(req);
}
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
}
}