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

147 lines
4.3 KiB
C#
Raw Normal View History

2024-11-14 13:56:04 +08:00
using Infrastructure;
using Microsoft.AspNetCore.Http;
2024-11-14 10:36:06 +08:00
using Microsoft.AspNetCore.Mvc;
2024-11-14 13:56:04 +08:00
using Newtonsoft.Json.Linq;
2024-11-14 10:36:06 +08:00
using OpenAuth.App.ServiceApp.DroneCaseInfo;
using OpenAuth.App.ServiceApp.InsTaskHallManager;
2024-11-14 13:56:04 +08:00
using OpenAuth.App.ServiceApp.Request;
using OpenAuth.App.ServiceApp.Response;
2024-11-14 10:36:06 +08:00
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);
}
2024-11-14 13:56:04 +08:00
/// <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;
}
2024-11-14 14:33:41 +08:00
/// <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;
}
2024-11-14 10:36:06 +08:00
}
}