Browse Source

产业带合并准备

liangku_skuoptimazation
shanji 1 year ago
parent
commit
392501b5e1
  1. 6
      BBWYB.Server.API/Controllers/DataRepairController.cs
  2. 72
      BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs
  3. 11
      BBWYB.Server.Model/Db/Purchaser/PurchaserExtendedInfo.cs
  4. 2
      QuanTan.SDK/Models/Supplier/Response/Product/QuanTan_Supplier_ProductCategoryResponse.cs
  5. 1
      SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs
  6. 2
      SDKAdapter/OperationPlatform/Models/Response/Product/OP_ProductCategoryResponse.cs

6
BBWYB.Server.API/Controllers/DataRepairController.cs

@ -115,5 +115,11 @@ namespace BBWYB.Server.API.Controllers
{ {
dataRepairBusiness.SyncPurchaserCategory(); dataRepairBusiness.SyncPurchaserCategory();
} }
[HttpGet]
public void Test()
{
dataRepairBusiness.Test();
}
} }
} }

72
BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs

@ -12,6 +12,7 @@ using SDKAdapter.OperationPlatform.Models;
using SDKAdapter.PurchasePlatform.Client; using SDKAdapter.PurchasePlatform.Client;
using SDKAdapter.PurchasePlatform.Models; using SDKAdapter.PurchasePlatform.Models;
using System.Data; using System.Data;
using System.Text.RegularExpressions;
using Yitter.IdGenerator; using Yitter.IdGenerator;
namespace BBWYB.Server.Business namespace BBWYB.Server.Business
@ -972,7 +973,7 @@ namespace BBWYB.Server.Business
var request = new OP_QueryProductCategoryRequest() var request = new OP_QueryProductCategoryRequest()
{ {
PageIndex = 1, PageIndex = 1,
PageSize = 50, PageSize = 500,
AppKey = "BBWYB2023022501", AppKey = "BBWYB2023022501",
AppSecret = "3a1521deccc6819d61788a0d6baae49e9", AppSecret = "3a1521deccc6819d61788a0d6baae49e9",
AppToken = "9" 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(); //var newCategoryList = qtCategoryList.Where(c => !dbCategoryList.Any(dc => dc.Id == long.Parse(c.CategoryId))).ToList();
if (newCategoryList.Count() > 0) //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,
Id = long.Parse(c.CategoryId), CreateTime = DateTime.Now,
Name = c.CategoryName, Type = Enums.PurchaserBasicInfoType.,
CreateTime = DateTime.Now, ExtendInfo = c.CategoryPath
Type = Enums.PurchaserBasicInfoType. }).ToList());
}).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;
}
} }
} }

11
BBWYB.Server.Model/Db/Purchaser/PurchaserExtendedInfo.cs

@ -8,19 +8,22 @@ namespace BBWYB.Server.Model.Db
{ {
[Column(DbType = "bigint", IsPrimary = true)] [Column(DbType = "bigint", IsPrimary = true)]
public long Id { get; set; } public long Id { get; set; }
[Column(DbType = "datetime")] [Column(DbType = "datetime")]
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
[Column(StringLength = 50)] [Column(StringLength = 50)]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 类型 主营类目=0 标签=1 /// 类型 主营类目=0 标签=1
/// </summary> /// </summary>
[Column(MapType = typeof(int?))] [Column(MapType = typeof(int?))]
public Enums.PurchaserBasicInfoType? Type { get; set; } public Enums.PurchaserBasicInfoType? Type { get; set; }
[Column(StringLength = 50)]
public string ExtendInfo { get; set; }
} }

2
QuanTan.SDK/Models/Supplier/Response/Product/QuanTan_Supplier_ProductCategoryResponse.cs

@ -5,5 +5,7 @@
public string CategoryId { get; set; } public string CategoryId { get; set; }
public string CategoryName { get; set; } public string CategoryName { get; set; }
public string CategoryPath { get; set; }
} }
} }

1
SDKAdapter/OperationPlatform/Client/Impl/OP_QuanTanClient.cs

@ -261,6 +261,7 @@ namespace SDKAdapter.OperationPlatform.Client
{ {
CategoryId = x.CategoryId, CategoryId = x.CategoryId,
CategoryName = x.CategoryName, CategoryName = x.CategoryName,
CategoryPath = x.CategoryPath
}).ToList() : null }).ToList() : null
}; };
} }

2
SDKAdapter/OperationPlatform/Models/Response/Product/OP_ProductCategoryResponse.cs

@ -5,5 +5,7 @@
public string CategoryId { get; set; } public string CategoryId { get; set; }
public string CategoryName { get; set; } public string CategoryName { get; set; }
public string CategoryPath { get; set; }
} }
} }

Loading…
Cancel
Save