|
|
@ -322,7 +322,47 @@ namespace BBWY.Server.Business |
|
|
|
CheckSkuRepeat(pt, nextPromotionTaskList); |
|
|
|
} |
|
|
|
|
|
|
|
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows(); |
|
|
|
|
|
|
|
#region 清空后代
|
|
|
|
var waitList = fsql.Select<PromotionTask>().Where(pt1 => pt1.ShopId == pt.ShopId && |
|
|
|
pt1.Id != pt.Id && |
|
|
|
pt1.PreTaskId != null && |
|
|
|
pt1.Status == Enums.PromitionTaskStatus.等待).ToList(pt1 => new PromotionTask { Id = pt1.Id, PreTaskId = pt1.PreTaskId }); |
|
|
|
|
|
|
|
var childIdList = GetChildTaskIdList(pt.Id, waitList, null); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows(); |
|
|
|
if (childIdList.Count() > 0) |
|
|
|
fsql.Update<PromotionTask>(childIdList.ToArray()).Set(pt1 => pt1.PreTaskId, null).ExecuteAffrows(); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 递归找子级任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="taskId"></param>
|
|
|
|
/// <param name="waitList"></param>
|
|
|
|
/// <param name="childIdList"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public IList<long> GetChildTaskIdList(long taskId, IList<PromotionTask> waitList, IList<long> childIdList) |
|
|
|
{ |
|
|
|
if (childIdList == null) |
|
|
|
childIdList = new List<long>(); |
|
|
|
|
|
|
|
var childTaskList = waitList.Where(w => w.PreTaskId == taskId).ToList(); |
|
|
|
if (childTaskList.Count() != 0) |
|
|
|
{ |
|
|
|
foreach (var childTask in childTaskList) |
|
|
|
{ |
|
|
|
childIdList.Add(childTask.Id); |
|
|
|
GetChildTaskIdList(childTask.Id, waitList, childIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
return childIdList; |
|
|
|
} |
|
|
|
|
|
|
|
private void CheckSkuRepeat(PromotionTask pt, IList<PromotionTask> waitCheckList) |
|
|
|