Files
KJD/TEMUKJD/BLL/ImportConverters/ConvertToPddFactory.cs
T
2026-11-05 18:50:13 +08:00

69 lines
1.3 KiB
C#

using AllBase;
using AllBase.Model.Result.PDDResult;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TemuKJD.BLL.ImportConverters;
namespace TemuKJD.BLL.ImportConverts
{
public class ConverterToPddFactory
{
private static List<IGoodsConverter> CreateConverters() => new List<IGoodsConverter>
{
new ConverterToPddV5(),
new ConverterWXToPddV1(),
new ConverterWXToPddV2(),
new ConverterWXToPddV3(),
new ConverterWXToPddV4(),
new ConverterWXToPddV5(),
};
public static PDDFrontProductInfo5 Convert(string filePath)
{
foreach (IGoodsConverter item in CreateConverters())
{
try
{
item.ReadContent(filePath);
if (item.IsMatch())
{
return item.Convert();
}
}
catch (Exception ex)
{
LogSave.Add("wx导入失败---"+ex.Message);
throw ex;
}
}
return null;
}
public static PDDFrontProductInfo5 SetContentConvert(string content)
{
foreach (IGoodsConverter item in CreateConverters())
{
try
{
item.SetContent(content.ParseToString());
if (item.IsMatch())
{
return item.Convert();
}
}
catch (Exception ex)
{
throw ex;
}
}
return null;
}
}
}