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 CreateConverters() => new List { 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; } } }