| | |
| | | { |
| | | await file.CopyToAsync(stream); |
| | | } |
| | | |
| | | return Ok(new { file.FileName, file.ContentType, file.Length, url= $@"{BizConfig.Configuration["DownloadAddress"]}/"+ file.FileName }); |
| | | var downloadAddress = entityName == "BAS_LABEL_TEMP" || entityName == "BAS_LABEL_VAR" ? "/Template" : ""; |
| | | return Ok(new { file.FileName, file.ContentType, file.Length, url= $@"{BizConfig.Configuration["DownloadAddress"]}{downloadAddress}/"+ file.FileName }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 导入Excel |
| | | [HttpPost] |
| | | public async Task<IActionResult> ImportExcel([FromBody] ApiAction<ImportInput> action) |
| | | { |
| | | ApiAction response; |
| | | try |
| | | { |
| | | IImportExcel import = DI.Resolve(action.Data.typeFullName) as IImportExcel; |
| | | response = action.GetResponse(await import.Import(action.NewDataEntity(),action.Data)); |
| | | } |
| | | 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<ImportValidateInput> action) |
| | | { |
| | | ApiAction response; |
| | | try |
| | | { |
| | | IImportExcel import = DI.Resolve(action.Data.typeFullName) as IImportExcel; |
| | | response = action.GetResponse(await import.ValidateTableImport(action.NewDataEntity(), action.Data)); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = action.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | #endregion |
| | | } |
| | | } |