|
|
@ -12,6 +12,7 @@ using SDKAdapter.OperationPlatform.Models; |
|
|
|
using SDKAdapter.PurchasePlatform.Client; |
|
|
|
using SDKAdapter.PurchasePlatform.Models; |
|
|
|
using System.Data; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using Yitter.IdGenerator; |
|
|
|
|
|
|
|
namespace BBWYB.Server.Business |
|
|
@ -972,7 +973,7 @@ namespace BBWYB.Server.Business |
|
|
|
var request = new OP_QueryProductCategoryRequest() |
|
|
|
{ |
|
|
|
PageIndex = 1, |
|
|
|
PageSize = 50, |
|
|
|
PageSize = 500, |
|
|
|
AppKey = "BBWYB2023022501", |
|
|
|
AppSecret = "3a1521deccc6819d61788a0d6baae49e9", |
|
|
|
AppToken = "9" |
|
|
@ -985,19 +986,26 @@ namespace BBWYB.Server.Business |
|
|
|
|
|
|
|
|
|
|
|
//找出新增的类目
|
|
|
|
var newCategoryList = qtCategoryList.Where(c => !dbCategoryList.Any(dc => dc.Id == long.Parse(c.CategoryId))).ToList(); |
|
|
|
if (newCategoryList.Count() > 0) |
|
|
|
//var newCategoryList = qtCategoryList.Where(c => !dbCategoryList.Any(dc => dc.Id == long.Parse(c.CategoryId))).ToList();
|
|
|
|
//if (newCategoryList.Count() > 0)
|
|
|
|
//{
|
|
|
|
insertList.AddRange(qtCategoryList.Select(c => new PurchaserExtendedInfo() |
|
|
|
{ |
|
|
|
insertList.AddRange(newCategoryList.Select(c => new PurchaserExtendedInfo() |
|
|
|
{ |
|
|
|
Id = long.Parse(c.CategoryId), |
|
|
|
Name = c.CategoryName, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
Type = Enums.PurchaserBasicInfoType.主营类目 |
|
|
|
}).ToList()); |
|
|
|
} |
|
|
|
Id = long.Parse(c.CategoryId), |
|
|
|
Name = c.CategoryName, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
Type = Enums.PurchaserBasicInfoType.主营类目, |
|
|
|
ExtendInfo = c.CategoryPath |
|
|
|
}).ToList()); |
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Delete<PurchaserExtendedInfo>().Where(x => x.Type == Enums.PurchaserBasicInfoType.主营类目).ExecuteAffrows(); |
|
|
|
fsql.Insert(insertList).ExecuteAffrows(); |
|
|
|
}); |
|
|
|
|
|
|
|
fsql.Insert(insertList).ExecuteAffrows(); |
|
|
|
|
|
|
|
//找出接口丢失的类目
|
|
|
|
|
|
|
@ -1134,5 +1142,45 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void Test(string location) |
|
|
|
{ |
|
|
|
IDictionary<string, List<string>> provinceDictionary = new Dictionary<string, List<string>>() |
|
|
|
{ |
|
|
|
{ "省", new List<string>() |
|
|
|
{ |
|
|
|
"黑龙江","吉林","辽宁","河北","山西","陕西","甘肃","青海","河南","湖北","湖南","山东","江苏","安徽","浙江","江西","福建","台湾","贵州","四川","云南","广东","海南" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ "自治区", new List<string>(){ "内蒙古","西藏"}}, |
|
|
|
{ "回族自治区", new List<string>(){"宁夏"}}, |
|
|
|
{ "维吾尔自治区", new List<string>(){"新疆"}}, |
|
|
|
{ "壮族自治区", new List<string>(){"广西"}}, |
|
|
|
{ "特别行政区",new List<string>(){ "香港","澳门"}}, |
|
|
|
{ "市",new List<string>(){ "重庆","北京","天津","上海"}} |
|
|
|
}; |
|
|
|
|
|
|
|
foreach (var provincekey in provinceDictionary.Keys) |
|
|
|
{ |
|
|
|
var province = provinceDictionary[provincekey].FirstOrDefault(p => location.StartsWith(p)); |
|
|
|
} |
|
|
|
|
|
|
|
Console.WriteLine(); |
|
|
|
} |
|
|
|
|
|
|
|
private string NormalizeLocationString(string input) |
|
|
|
{ |
|
|
|
// 使用正则表达式移除多余的空格和省市之间的空格
|
|
|
|
string normalizedString = Regex.Replace(input, @"\s+", ""); |
|
|
|
|
|
|
|
// 如果字符串中没有省市的分隔符,则添加一个
|
|
|
|
if (!normalizedString.Contains("省") && !normalizedString.Contains("市")) |
|
|
|
{ |
|
|
|
int index = normalizedString.Length / 2; |
|
|
|
normalizedString = normalizedString.Insert(index, "省"); |
|
|
|
} |
|
|
|
|
|
|
|
return normalizedString; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|