云库数据上传
This commit is contained in:
1 parent
cd82a1ec15
commit
dc977c45d8
12 files changed
+275
-96
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using AllBase.Model.Result.PDDResult;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -38,5 +39,26 @@ namespace TemuKJD.BLL.ImportConverts
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static PDDFrontProductInfo5 SetContentConvert(string content)
|
||||
{
|
||||
|
||||
foreach (IGoodsConverter item in _converters)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.SetContent(content.ParseToString());
|
||||
if (item.IsMatch())
|
||||
{
|
||||
return item.Convert();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,16 +31,21 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
/// 支持的平台类型
|
||||
/// </summary>
|
||||
PlatformType Platform { get; }
|
||||
/// <summary>
|
||||
/// 读取内容
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
void ReadContent(string filePath);
|
||||
/// <summary>
|
||||
/// 判断是否匹配当前转换器
|
||||
/// </summary>
|
||||
/// <returns>是否匹配</returns>
|
||||
bool IsMatch();
|
||||
/// <summary>
|
||||
/// 读取内容
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
void ReadContent(string filePath);
|
||||
/// <summary>
|
||||
/// 直接赋值内容
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
void SetContent(string content);
|
||||
/// <summary>
|
||||
/// 判断是否匹配当前转换器
|
||||
/// </summary>
|
||||
/// <returns>是否匹配</returns>
|
||||
bool IsMatch();
|
||||
|
||||
/// <summary>
|
||||
/// 转换为标准商品模型
|
||||
@@ -56,11 +61,15 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
public abstract string ConverterName { get; }
|
||||
public abstract PlatformType Platform { get; }
|
||||
|
||||
void IGoodsConverter.ReadContent(string filePath)
|
||||
{
|
||||
ReadContent(filePath);
|
||||
}
|
||||
protected virtual void ReadContent(string filePath)
|
||||
void IGoodsConverter.ReadContent(string filePath)
|
||||
{
|
||||
ReadContent(filePath);
|
||||
}
|
||||
void IGoodsConverter.SetContent(string content)
|
||||
{
|
||||
SetContent(content);
|
||||
}
|
||||
protected virtual void ReadContent(string filePath)
|
||||
{
|
||||
if (File.Exists(filePath) == false) throw new Exception("文件不存在");
|
||||
FilePath = filePath;
|
||||
@@ -69,9 +78,12 @@ namespace TemuKJD.BLL.ImportConverters
|
||||
RawData = sr.ReadToEnd();
|
||||
}
|
||||
}
|
||||
protected virtual void SetContent(string content)
|
||||
{
|
||||
RawData = content;
|
||||
}
|
||||
|
||||
|
||||
public virtual bool IsMatch()
|
||||
public virtual bool IsMatch()
|
||||
{
|
||||
_isMatch = true;
|
||||
return IsMatchProvider();
|
||||
|
||||
Reference in new issue
Block a user