AddressVerifController.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 
  2. using IoC;
  3. using Microsoft.AspNetCore.Mvc;
  4. using NPOI.HPSF;
  5. using System.Threading.Tasks;
  6. using XYY.Core.Standard.Mvc;
  7. using XYY.Service.Standard.Order;
  8. namespace XYY.Api.Order.Controllers
  9. {
  10. [Route("api/[controller]/[action]")]
  11. [ApiController]
  12. public class AddressVerifController : ApiControllerBase
  13. {
  14. IAddressVerifService _addressVerifService;
  15. public AddressVerifController(IAddressVerifService addressVerifService)
  16. {
  17. _addressVerifService = addressVerifService;
  18. }
  19. public async Task<IActionResult> LoadDHLAddressFile()
  20. {
  21. var filelist = (await Request.ReadFormAsync()).Files;
  22. if (filelist != null && filelist.Count > 0)
  23. {
  24. var file = filelist[0];
  25. var result= await _addressVerifService.DHLAddressVerify(file.OpenReadStream());
  26. string Path = System.IO.Path.Combine(HttpContext.Request.Host.Value,"temp", "DHLAddressVerifyResult", result+".xlsx");
  27. return Ok("http://"+Path);
  28. }
  29. else
  30. {
  31. return Error("请上传一个文件");
  32. }
  33. }
  34. }
  35. }