修改异步方法

DataMaintenance
zhangbin 2025-04-11 16:39:26 +08:00
parent fed60bc680
commit b0bd18ec40
2 changed files with 19 additions and 8 deletions

View File

@ -443,7 +443,7 @@ namespace OpenAuth.App.ServiceApp.DataMaintenance
/// <param name="shpFilePath"></param>
/// <param name="shpFilePathzip"></param>
/// <exception cref="Exception"></exception>
public async void ExportShapefile(TableDataReq tableDataReq, string shpFilePath, string shpFilePathzip, List<ModuleColumn> headers)
public async Task ExportShapefile(TableDataReq tableDataReq, string shpFilePath, string shpFilePathzip, List<ModuleColumn> headers)
{
var data = await GetDataAllList(tableDataReq);
if (data == null || data.Count == 0)

View File

@ -13,6 +13,7 @@ using OpenAuth.Repository.Domain.DataMaintenance;
using OpenAuth.WebApi.Model.CustomAttribute;
using System.Data;
using OpenAuth.App.CodeTable;
using System.Threading.Tasks;
namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
{
@ -160,7 +161,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public IActionResult ExportShapefile(TableDataReq tableDataReq)
public async Task<IActionResult> ExportShapefile(TableDataReq tableDataReq)
{
try
{
@ -175,7 +176,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
}
string shpFilePath = Path.Combine(Path.GetTempPath(), $"数据信息{DateTime.Now:yyyyMMddHHmmss}.shp");
string shpFilePathzip = Path.Combine(Path.GetTempPath(), $"数据信息{DateTime.Now:yyyyMMddHHmmss}.zip");
_app.ExportShapefile(tableDataReq, shpFilePath, shpFilePathzip, cl);
await _app.ExportShapefile(tableDataReq, shpFilePath, shpFilePathzip, cl);
byte[] fileBytes = System.IO.File.ReadAllBytes(shpFilePathzip);
return File(fileBytes, "application/octet-stream", $"数据信息{DateTime.Now:yyyyMMddHHmmss}.zip");
}
@ -192,9 +193,19 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
/// <returns></returns>
[HttpPost]
public async Task<Response<bool>> UpdateBatch(UpdateBatchDataReq req)
{
var result = new Response<bool>();
try
{
return await _app.UpdateBatch(req);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.Message;
}
return result;
}
#endregion
}
}