You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

62 lines
2.0 KiB

using DealerSelection.Api.CommonUtil;
using DealerSelection.Api.Infrastructure.BatchJob;
using DealerSelection.Api.Infrastructure.Mulesoft;
using DealerSelection.Api.Interface;
using DealerSelection.Api.Models.Enum;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using static iTextSharp.text.pdf.AcroFields;
public class BatchJobApi : IBatchJobApi
{
private readonly ILogger _logger;
private DealerSelection.Api.Infrastructure.BatchJob.IRepository Repository { get; }
private IMulesoftApi MulesoftApi { get; }
public BatchJobApi(DealerSelection.Api.Infrastructure.BatchJob.IRepository repository, ILogger<MulesoftApi> logger, IMulesoftApi mulesoftApi)
{
Repository = repository;
_logger = logger;
MulesoftApi = mulesoftApi;
}
public async Task Process24HrOldRecords()
{
try
{
List<MulesoftCustomerInfoDto> customerInfo = await Repository.Get24HrOldRecordsForJobProcessing();
foreach (var item in customerInfo)
{
CustomCfg cfg = CustomCfg.GetCustomCfg(item.BuId);
item.DealerCode = cfg.DeafaultDealerCode;
item.DealerSelectedMode = DealerSelectedMode.Dummy.ToString();
await MulesoftApi.InsertLSQData(item);
}
}
catch (Exception ex)
{
_logger.LogError($"DS Api:-Api:- BatchJob:- " + ex.StackTrace.ToString());
}
}
public async Task LeadCreateApiCall(int buId)
{
try
{
List<MulesoftCustomerInfoDto> lsqCustomerDataList =
await Repository.GetDataForLsqPush(buId);
foreach (var lsqCustomerData in lsqCustomerDataList)
{
await MulesoftApi.InsertLSQData(lsqCustomerData);
// await MulesoftApi.CallBookingApi(buId, lsqCustomerData);
}
}
catch (Exception ex)
{
_logger.LogError("PendingStatusUpdateApi LeadCreateApiCall " + ex.Message.ToString());
}
}
}