Procházet zdrojové kódy

修复下载商品图片路径不正确问题20240817

ingredientmanage
gwbvipvip před 2 měsíci
rodič
revize
e30bbb9765
1 změnil soubory, kde provedl 19 přidání a 19 odebrání
  1. +19
    -19
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs

+ 19
- 19
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs Zobrazit soubor

@@ -2525,7 +2525,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
dataRow.CreateCell(3).SetCellValue(goodInfo.Price.ToString()); dataRow.CreateCell(3).SetCellValue(goodInfo.Price.ToString());
dataRow.CreateCell(4).SetCellValue(goodInfo.IsWeigh ? "是" : "否"); dataRow.CreateCell(4).SetCellValue(goodInfo.IsWeigh ? "是" : "否");
dataRow.CreateCell(5).SetCellValue(goodInfo.Descritption); dataRow.CreateCell(5).SetCellValue(goodInfo.Descritption);
if (!string.IsNullOrWhiteSpace(goodInfo.ImgUrl))
if (!string.IsNullOrWhiteSpace(goodInfo.ImgUrl) && goodInfo.ImgUrl.Contains("http"))
await InsertImage(goodSheet, goodInfo.ImgUrl, 1, 6); await InsertImage(goodSheet, goodInfo.ImgUrl, 1, 6);
var actions = actionList.Where(t => t.GoodsId == goodInfo.Id && t.DeviceId == exportDto.DeviceId).OrderBy(a => a.Order).ThenBy(b => b.Sort).GroupBy(c => c.GoodsAttributeId); var actions = actionList.Where(t => t.GoodsId == goodInfo.Id && t.DeviceId == exportDto.DeviceId).OrderBy(a => a.Order).ThenBy(b => b.Sort).GroupBy(c => c.GoodsAttributeId);
foreach (var action in actions) foreach (var action in actions)
@@ -2686,25 +2686,25 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
HttpResponseMessage response = await client.GetAsync(imagePath); HttpResponseMessage response = await client.GetAsync(imagePath);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
if (response.IsSuccessStatusCode)
{
using HttpContent content = response.Content;
imageData = await content.ReadAsByteArrayAsync();
}
else
{
imageData = null;
}
using HttpContent content = response.Content;
imageData = await content.ReadAsByteArrayAsync();
}
else
{
imageData = null;
}
if (imageData != null)
{
// 添加图片到工作表
int pictureIdx = sheet.Workbook.AddPicture(imageData, PictureType.JPEG);
// 创建图片位置
IDrawing patriarch = sheet.CreateDrawingPatriarch();
XSSFClientAnchor anchor = new(0, 0, 0, 0, columnIndex, rowIndex, columnIndex + 1, rowIndex + 1);
anchor.AnchorType = AnchorType.MoveAndResize;
IPicture picture = patriarch.CreatePicture(anchor, pictureIdx);
// 自动调整图片大小
//picture.Resize();
} }
// 添加图片到工作表
int pictureIdx = sheet.Workbook.AddPicture(imageData, PictureType.JPEG);
// 创建图片位置
IDrawing patriarch = sheet.CreateDrawingPatriarch();
XSSFClientAnchor anchor = new(0, 0, 0, 0, columnIndex, rowIndex, columnIndex + 1, rowIndex + 1);
anchor.AnchorType = AnchorType.MoveAndResize;
IPicture picture = patriarch.CreatePicture(anchor, pictureIdx);
// 自动调整图片大小
//picture.Resize();
} }


public static async Task DownloadRemoteFile(string url, string tempFolder, string fileName) public static async Task DownloadRemoteFile(string url, string tempFolder, string fileName)


Načítá se…
Zrušit
Uložit