| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 导入Excel |
| | | [HttpPost] |
| | | public async Task<IActionResult> ImportExcel([FromBody] ApiAction action) |
| | | { |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(await DI.Resolve<IImportExcel>().Import(action.NewDataEntity(),action.Data?.ToString())); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = action.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导入Excel前验证 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ValidateTableImport([FromBody] ApiAction<ImportEntityValidate> action) |
| | | { |
| | | ApiAction response; |
| | | try |
| | | { |
| | | response = action.GetResponse(await DI.Resolve<IImportExcel>().ValidateTableImport(action.NewDataEntity(), action.Data)); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = action.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | #endregion |
| | | } |
| | | } |