|
|
@ -65,7 +65,30 @@ namespace BBWY.Server.Business.Sync |
|
|
|
ShopId = shopId |
|
|
|
}); |
|
|
|
} |
|
|
|
fsql.Insert(insertList).ExecuteAffrows(); |
|
|
|
|
|
|
|
#region 新增pin保存逻辑
|
|
|
|
var pinList = jArray.Select(j => j.Value<string>("pin")).Distinct().ToList(); |
|
|
|
var dbPinList = fsql.Select<JdShopPin>().Where(p => p.ShopId == shopId).ToList(p => p.AccessPin); |
|
|
|
var pinchajiList = pinList.Except(dbPinList).ToList(); |
|
|
|
List<JdShopPin> insertJDShopPinList = null; |
|
|
|
if (pinchajiList.Count() > 0) |
|
|
|
{ |
|
|
|
insertJDShopPinList = pinchajiList.Select(pin => new JdShopPin() |
|
|
|
{ |
|
|
|
Id = idGenerator.NewLong(), |
|
|
|
AccessPin = pin, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
ShopId = shopId |
|
|
|
}).ToList(); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
if (insertJDShopPinList != null) |
|
|
|
fsql.Insert(insertJDShopPinList).ExecuteAffrows(); |
|
|
|
fsql.Insert(insertList).ExecuteAffrows(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void SyncShopPopularizeRecord(ShopResponse shop, DateTime startDate, DateTime endDate, int pageIndex, out int currentCount) |
|
|
@ -117,7 +140,12 @@ namespace BBWY.Server.Business.Sync |
|
|
|
private void DeleteOldData(IList<ShopResponse> shops, DateTime startDate, DateTime endDate) |
|
|
|
{ |
|
|
|
var shopIds = shops.Select(s => Convert.ToInt64(s.ShopId)).ToList(); |
|
|
|
fsql.Delete<Shoppopularize>().Where(s => shopIds.Contains(s.ShopId.Value) && s.Date >= startDate && s.Date <= endDate).ExecuteAffrows(); |
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Delete<JdShopPin>().Where(p => shopIds.Contains(p.ShopId.Value)).ExecuteAffrows(); |
|
|
|
fsql.Delete<Shoppopularize>().Where(s => shopIds.Contains(s.ShopId.Value) && s.Date >= startDate && s.Date <= endDate).ExecuteAffrows(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public void SyncAllShopPopularizeRecord() |
|
|
|