2025-01-10 10:14:58 +08:00
|
|
|
|
using Infrastructure;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2025-01-10 10:14:58 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2025-04-14 10:57:27 +08:00
|
|
|
|
using OpenAuth.App;
|
|
|
|
|
|
using OpenAuth.App.Request;
|
2025-01-10 10:14:58 +08:00
|
|
|
|
using OpenAuth.App.ServiceApp.LayerManagerApp;
|
|
|
|
|
|
using OpenAuth.App.ServiceApp.LayerManagerApp.Request;
|
|
|
|
|
|
|
2025-01-13 16:44:16 +08:00
|
|
|
|
namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance;
|
2025-01-10 10:14:58 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 图层
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
public class LayerController : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly LayerApp _app;
|
|
|
|
|
|
|
|
|
|
|
|
public LayerController(LayerApp layerApp)
|
|
|
|
|
|
{
|
|
|
|
|
|
_app = layerApp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// excel 上传
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<bool>> UploadExcel(LayerReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.UploadExcel(req);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// shape文件上传
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<Response<bool>> UploadShape(LayerReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _app.UploadShape(req);
|
|
|
|
|
|
}
|
2025-04-14 10:57:27 +08:00
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public Response<Dictionary<string, object>> TableDataByTableName(string tablename,string type,string keyword,string keyvalue,int page=1,int limit = 10) {
|
|
|
|
|
|
return _app.TableDataByTableName(tablename,type, keyword,keyvalue, page,limit);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public IActionResult TempeleteByTableName(string tablename)
|
|
|
|
|
|
{
|
|
|
|
|
|
var res = new Response();
|
|
|
|
|
|
var excelRes = _app.TempeleteByTableName(tablename);
|
|
|
|
|
|
if (excelRes.Code == 200)
|
|
|
|
|
|
{
|
|
|
|
|
|
return File(excelRes.Result.ToArray(),
|
|
|
|
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
|
"数据导出" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
res.Code = excelRes.Code;
|
|
|
|
|
|
res.Message = "导出失败";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Ok(res);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public async Task<Response<bool>> UploadExcelAll([FromBody]UploadExcelReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Response<bool> response = new Response<bool>();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Result = await _app.UploadExcel1(req);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Code = 500;
|
|
|
|
|
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public Response<bool> UpdateTableData(UpdateTableReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Response<bool> response = new Response<bool>();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Result = _app.UpdateTableData(req);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Code = 500;
|
|
|
|
|
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public async Task<Response<bool>> AddUploadExcel([FromBody] UploadExcelReq req)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
Response<bool> response = new Response<bool>();
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Result = await _app.AddUploadExcel(req);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
response.Code = 500;
|
|
|
|
|
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-10 10:14:58 +08:00
|
|
|
|
}
|