Browse Source

修复产地

liangku_skuoptimazation
shanji 1 year ago
parent
commit
f6710e41e8
  1. 14
      BBWYB.Server.Business/DataRepair/DataRepairBusiness.cs
  2. 29
      BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs
  3. 3
      BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs

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

@ -1009,14 +1009,20 @@ namespace BBWYB.Server.Business
public void SyncPurchaserName()
{
List<IUpdate<Purchaser>> updatePurchaserList = new List<IUpdate<Purchaser>>();
var dbPurchaserList = fsql.Select<Purchaser>().Where(p => string.IsNullOrEmpty(p.Tag)).ToList();
var pspList = fsql.Select<PurchaseSchemeProduct>()
.GroupBy(psp2 => psp2.PurchaserId)
.WithTempQuery(g => new { MaxId = g.Max(g.Value.Id), PurchaserId = g.Key })
var pspList = fsql.Select<PurchaseSchemeProduct, Purchaser>()
.InnerJoin((psp2, p) => psp2.PurchaserId == p.Id)
.Where((psp2, p) => string.IsNullOrEmpty(p.Location))
.GroupBy((psp2, p) => psp2.PurchaserId)
.WithTempQuery(g => new { MaxId = g.Max(g.Value.Item1.Id), PurchaserId = g.Key })
.From<PurchaseSchemeProduct>()
.InnerJoin((psp2, psp1) => psp2.MaxId == psp1.Id)
.ToList((psp2, psp1) => psp1);
//var pspList = fsql.Select<PurchaseSchemeProduct>(432883091529819).ToList();
var purchaserIdList = pspList.Select(x => x.PurchaserId).Distinct().ToList();
var dbPurchaserList = fsql.Select<Purchaser>(purchaserIdList).ToList();
var index = 0;
foreach (var psp in pspList)
{

29
BBWYB.Server.Business/PurchaseScheme/PurchaseProductAPIService.cs

@ -6,6 +6,7 @@ using BBWYB.Server.Model.Db;
using BBWYB.Server.Model.Dto;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json.Linq;
using System.Net.Http.Headers;
using System.Text.RegularExpressions;
namespace BBWYB.Server.Business
@ -309,10 +310,38 @@ namespace BBWYB.Server.Business
if (jobject["data"][locationIdList[i]] != null)
{
location = jobject["data"][locationIdList[i]]["data"]["location"].ToString();
if (string.IsNullOrEmpty(location))
continue;
break;
}
}
if (string.IsNullOrEmpty(location))
{
var jobjectdata = jobject["data"] as JObject;
foreach (var jproperty in jobjectdata.Properties())
{
if (jobjectdata[jproperty.Name].Value<string>("componentType") == "@ali/tdmod-od-pc-attribute-new")
{
location = jobjectdata[jproperty.Name]["data"].FirstOrDefault(x => x.Value<string>("name") == "产地")?.Value<string>("value");
if (!string.IsNullOrEmpty(location))
break;
}
}
if (string.IsNullOrEmpty(location))
{
if (purchaserName.Contains("市") && purchaserName.Contains("区"))
{
location = purchaserName.Substring(0, purchaserName.IndexOf("区") + 1);
}
else if (purchaserName.Contains("市"))
{
location = purchaserName.Substring(0, purchaserName.IndexOf("市") + 1);
}
}
}
var purchaser = new Purchaser()
{
Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(),

3
BBWYB.Server.Business/Purchaser/PurchaserBusiness.cs

@ -33,6 +33,9 @@ namespace BBWYB.Server.Business
public ListResponse<PurchaserResponse> QueryPurchaserList(QueryPurchaserRequest request)
{
//默认ShopId为空
request.ShopId = null;
#region 数据验证
if (request.RecentDayCondition != null && request.RecentDayCondition.RecentDay > 0)
{

Loading…
Cancel
Save