shanji 2 years ago
parent
commit
83fb919479
  1. 38
      BBWY.Server.Business/EvaluationAssistant/EvaluationAssistantBusiness.cs

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

@ -26,8 +26,9 @@ namespace BBWY.Server.Business
private DingDingBusiness dingDingBusiness;
private NLogManager nLogManager;
private List<Enums.OrderState> validOrderStateList;
private ProductBusiness productBusiness;
public EvaluationAssistantBusiness(RestApiService restApiService, IOptions<GlobalConfig> options, YunDingBusiness yunDingBusiness, IFreeSql fsql, IIdGenerator idGenerator, TaskSchedulerManager taskSchedulerManager, VenderBusiness venderBusiness, DingDingBusiness dingDingBusiness, NLogManager nLogManager) : base(restApiService, options, yunDingBusiness)
public EvaluationAssistantBusiness(RestApiService restApiService, IOptions<GlobalConfig> options, YunDingBusiness yunDingBusiness, IFreeSql fsql, IIdGenerator idGenerator, TaskSchedulerManager taskSchedulerManager, VenderBusiness venderBusiness, DingDingBusiness dingDingBusiness, NLogManager nLogManager, ProductBusiness productBusiness) : base(restApiService, options, yunDingBusiness)
{
this.fsql = fsql;
this.idGenerator = idGenerator;
@ -35,6 +36,7 @@ namespace BBWY.Server.Business
this.venderBusiness = venderBusiness;
this.dingDingBusiness = dingDingBusiness;
this.nLogManager = nLogManager;
this.productBusiness = productBusiness;
validOrderStateList = new List<Enums.OrderState>()
{
Enums.OrderState.,
@ -622,20 +624,36 @@ namespace BBWY.Server.Business
IList<OrderSku> orderSkuList,
IList<PromotionTaskSkuRecord> promotionTaskSkuRecordList)
{
var loggerName = $"库存预警-{shop.ShopName}";
var loggerName = $"评价助手任务监控-{shop.ShopName}";
List<IUpdate<PromotionTask>> updatePromotionTaskList = new List<IUpdate<PromotionTask>>();
List<PromotionTaskSkuRecord> insertPromotionTaskSkuRecordList = new List<PromotionTaskSkuRecord>();
IList<long> jobDoneTaskIdList = new List<long>();
foreach (var promotionTask in runningTaskList)
{
var motherSkuList = new List<string>();
if (!string.IsNullOrEmpty(promotionTask.CustomMotherSku))
motherSkuList.AddRange(promotionTask.CustomMotherSku.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
if (!string.IsNullOrEmpty(promotionTask.MainProductSku))
motherSkuList.AddRange(promotionTask.MainProductSku.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
var productSkuList = new List<string>();
var newOrderSkuList = orderSkuList.Where(osku => motherSkuList.Contains(osku.SkuId) &&
#region 读取主商品sku
{
var productResponseSkuList = productBusiness.GetProductSkuList(new SearchProductSkuRequest()
{
AppKey = shop.AppKey2,
AppSecret = shop.AppSecret2,
AppToken = shop.AppToken2,
IsContainSource = false,
Platform = Enums.Platform.,
Spu = promotionTask.MainProductSpu
});
if (productResponseSkuList == null || productResponseSkuList.Count() == 0)
{
LogMonitorError(shop, loggerName, $"{promotionTask.Id}-监控任务-查询主商品sku", "未查询到主商品sku信息");
continue;
}
productSkuList.AddRange(productResponseSkuList.Select(p => p.Id));
}
#endregion
var newOrderSkuList = orderSkuList.Where(osku => productSkuList.Contains(osku.SkuId) &&
osku.CreateTime > promotionTask.StartTime &&
promotionTaskSkuRecordList.Count(psr => psr.PromotionTaskId == promotionTask.Id &&
psr.OrderId == osku.OrderId) == 0).ToList();
@ -694,14 +712,14 @@ namespace BBWY.Server.Business
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
{
LogMonitorError(shop, loggerName, "自动任务-暂停京东活动", httpResult.Content);
LogMonitorError(shop, loggerName, $"{promotionTask.Id}-监控任务-暂停京东活动", httpResult.Content);
}
else
{
var response = JsonConvert.DeserializeObject<ApiResponse>(httpResult.Content);
if (!response.Success)
{
LogMonitorError(shop, loggerName, "自动任务-暂停京东活动", response.Msg);
LogMonitorError(shop, loggerName, $"{promotionTask.Id}-监控任务-暂停京东活动", response.Msg);
}
}
}

Loading…
Cancel
Save