修改异步方法
parent
fed60bc680
commit
b0bd18ec40
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
@ -105,12 +106,12 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
|
|||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Response<List<dynamic>> GetTableColumnList( string tableName)
|
||||
public Response<List<dynamic>> GetTableColumnList(string tableName)
|
||||
{
|
||||
var result = new Response<List<dynamic>>();
|
||||
try
|
||||
{
|
||||
result.Result = _app.GetTableAndViewColumnList( tableName);
|
||||
result.Result = _app.GetTableAndViewColumnList(tableName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -141,7 +142,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
|
|||
c.value = item.description.ToString();
|
||||
cl.Add(c);
|
||||
}
|
||||
var excelRes =await _app.ListToExcel(tableDataReq, cl);
|
||||
var excelRes = await _app.ListToExcel(tableDataReq, cl);
|
||||
if (excelRes.Code == 200)
|
||||
{
|
||||
return File(excelRes.Result.ToArray(),
|
||||
|
|
@ -150,7 +151,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
|
@ -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");
|
||||
}
|
||||
|
|
@ -193,7 +194,17 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance
|
|||
[HttpPost]
|
||||
public async Task<Response<bool>> UpdateBatch(UpdateBatchDataReq req)
|
||||
{
|
||||
return await _app.UpdateBatch(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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue