shanji 2 years ago
parent
commit
538414c733
  1. 50
      BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs
  2. 3
      BBWY.Server.Business/TaskSchedulerManager.cs

50
BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs

@ -316,24 +316,36 @@ namespace BBWY.Server.Business
if (prpt.Status != Enums.PromitionTaskStatus. && prpt.Status != Enums.PromitionTaskStatus.)
throw new BusinessException("前置任务状态必须为等待或进行中");
var nextPromotionTaskList = fsql.Select<PromotionTask>().Where(pt1 => pt1.PreTaskId == request.PreTaskId).ToList();
if (nextPromotionTaskList.Count() > 0)
{
CheckSkuRepeat(pt, nextPromotionTaskList);
}
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows();
}
private void CheckSkuRepeat(PromotionTask pt, IList<PromotionTask> waitCheckList)
{
var ptSkuList = new List<string>();
var prptSkuList = new List<string>();
var waitptSkuList = new List<string>();
if (!string.IsNullOrEmpty(pt.MainProductSku))
ptSkuList.AddRange(pt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
if (!string.IsNullOrEmpty(pt.CustomMotherSku))
ptSkuList.AddRange(pt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
if (!string.IsNullOrEmpty(prpt.MainProductSku))
prptSkuList.AddRange(prpt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
if (!string.IsNullOrEmpty(prpt.CustomMotherSku))
prptSkuList.AddRange(prpt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
var intersectSkuList = ptSkuList.Intersect(prptSkuList).ToList();
if (intersectSkuList != null && intersectSkuList.Count() > 0)
throw new BusinessException($"{string.Join(",", intersectSkuList)}存在重复");
fsql.Update<PromotionTask>(request.TaskId).Set(pt1 => pt1.PreTaskId, request.PreTaskId).ExecuteAffrows();
foreach (var waitPt in waitCheckList)
{
if (!string.IsNullOrEmpty(waitPt.MainProductSku))
waitptSkuList.AddRange(waitPt.MainProductSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
if (!string.IsNullOrEmpty(waitPt.CustomMotherSku))
waitptSkuList.AddRange(waitPt.CustomMotherSku.Split(spliter, StringSplitOptions.RemoveEmptyEntries));
var intersectSkuList = ptSkuList.Intersect(waitptSkuList).ToList();
if (intersectSkuList != null && intersectSkuList.Count() > 0)
throw new BusinessException($"任务1[{pt.ActivityName}]与任务2[{waitPt.ActivityName}]之间存在sku重复,{string.Join(",", intersectSkuList)}");
}
}
/// <summary>
@ -842,11 +854,27 @@ namespace BBWY.Server.Business
#region 开始后续任务
if (jobDoneTaskIdList.Count() > 0)
{
//var nextPromotionTaskList = fsql.Select<PromotionTask>().Where(pt => pt.ShopId == shopId &&
// pt.Status == Enums.PromitionTaskStatus.等待 &&
// jobDoneTaskIdList.Contains(pt.PreTaskId.Value)).ToList();
//if (nextPromotionTaskList.Count() > 0)
//{
// foreach (var task in nextPromotionTaskList)
// {
// }
//}
}
#endregion
}
private void AutoStart(long taskId, string appKey, string appSecret, string appToken)
{
}
private void LogMonitorError(ShopResponse shop, string loggerName, string step, string error)
{
nLogManager.GetLogger(loggerName).Error($"{step},{error}");

3
BBWY.Server.Business/TaskSchedulerManager.cs

@ -26,6 +26,8 @@ namespace BBWY.Server.Business
public LimitedConcurrencyLevelTaskScheduler JDPromotionMonitorTaskScheduler { get; private set; }
public LimitedConcurrencyLevelTaskScheduler JDPromotionAutoStartTaskScheduler { get; private set; }
public TaskSchedulerManager()
{
SyncOrderTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10);
@ -42,6 +44,7 @@ namespace BBWY.Server.Business
JDPromotionDelayTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10);
JDPromotionMonitorTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10);
JDPromotionAutoStartTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10);
}
}
}

Loading…
Cancel
Save