Commit 1d80e6f7 authored by 吴春's avatar 吴春

1

parent 7c337143
......@@ -48,6 +48,7 @@ namespace REBORN.HuaTuQUART
public async Task StartAsync()
{
string cronExpression = "0 0 10 * * ?"; // 修改为每天10:00执行
//string cronExpression = "0 */5 * * * ?";//每10分钟执行一次
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
......@@ -93,50 +94,94 @@ namespace REBORN.HuaTuQUART
/// </summary>
/// <param name="context"></param>
public Task Execute(IJobExecutionContext context)
{
LogHelper.WriteInfo("我进来定时任务来了");
try
{
var mpcList = repository.GetList(new RB_MessagePushConfig());//消息推送配置
string groupId = "";
LogHelper.WriteInfo("mpcList配置信息条数:" + (mpcList?.Count() ?? 0));
if (mpcList != null && mpcList.Any())
{
groupId = string.Join(",", mpcList.Select(x => x.RB_Group_Id ?? 0).Distinct());
#region 订单信息
StringBuilder builder = new StringBuilder();
List<RB_Travel_Order_Extend> orderList = new List<RB_Travel_Order_Extend>();
List<RB_Sell_VisaOrder_Extend> visaOrderList = new List<RB_Sell_VisaOrder_Extend>();
List<RB_Customer_HotelOrder_Extend> hotelOrderList = new List<RB_Customer_HotelOrder_Extend>();
List<RB_Customer_TicketOrder_Extend> ticketOrderList = new List<RB_Customer_TicketOrder_Extend>();
List<RB_CRMTicket_Order_Extend> cRMTicket_OrderList = new List<RB_CRMTicket_Order_Extend>();
try
{
//跟团游订单
StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT A.RB_Group_id,A.OrderSource,A.OrderId,A.GuestNum,A.EnterID,b.StartDate,B.PriceTeamType,c.Title,A.FinalPriceTips from rb_travel_order AS A INNER JOIN rb_travel_price AS B ON A.TCID=B.TCID
LEFT JOIN rb_travel_config as c on c.ID=b.ConfigID
where FinalPriceTips>0 and ifnull(a.IsChargeLossOrders,0)=0 and a.OrderState<>4 and b.StartDate>NOW() and a.RB_Group_Id in({groupId})
where FinalPriceTips>0 AND DATE_SUB(b.StartDate, INTERVAL A.FinalPriceTips DAY) < NOW() and ifnull(a.IsChargeLossOrders,0)=0 and a.OrderState<>4 and b.StartDate>NOW() and a.RB_Group_Id in({groupId})
and (IFNULL(a.PreferPrice,0)-IFNULL(a.Income,0)-IFNULL(a.ZaiTuMoney,0)+IFNULL(a.Refund,0)-IFNULL(a.PlatformTax,0)-IFNULL(a.ZaiTuMoney,0)-IFNULL(a.DiscountMoney,0)-IFNULL(a.RedEnvelopeMoney,0))<> 0
");
var orderList = orderRepository.Get<RB_Travel_Order_Extend>(builder.ToString()).ToList();
orderList = orderRepository.Get<RB_Travel_Order_Extend>(builder.ToString()).ToList();
LogHelper.WriteInfo("跟团游订单Sql:" + builder.ToString());
}
catch (Exception ex)
{
LogHelper.Write(ex, "跟团游订单");
}
try
{
//签证订单
StringBuilder builderVisaOrder = new StringBuilder();
builderVisaOrder.AppendFormat($@"SELECT A.RB_Group_id,A.Id,a.PeopleNum,a.CreateBy,b.`Name`,a.SignOutTime,A.FinalPriceTips from rb_sell_visaorder as a
LEFT JOIN RB_Sell_VisaProduct as b on a.VisaId=b.Id where FinalPriceTips>0 and a.RB_Group_Id in({groupId}) and a.VisaOrderStatus <>2 and IFNULL(a.TotalPrice,0) <> (IFNULL(a.Income,0) + IFNULL(a.PlatformTax,0)+ IFNULL(a.PlatformTax,0) - IFNULL(a.RefundMoney,0)) and a.SignOutTime>NOW()");
var visaOrderList = sellVisaOrderRepository.Get<RB_Sell_VisaOrder_Extend>(builderVisaOrder.ToString()).ToList();
LEFT JOIN RB_Sell_VisaProduct as b on a.VisaId=b.Id where FinalPriceTips>0 and a.RB_Group_Id in({groupId}) and a.VisaOrderStatus <>2 and IFNULL(a.TotalPrice,0) <> (IFNULL(a.Income,0) + IFNULL(a.PlatformTax,0)+ IFNULL(a.PlatformTax,0) - IFNULL(a.RefundMoney,0)) and a.SignOutTime>NOW() AND DATE_SUB(a.SignOutTime, INTERVAL A.FinalPriceTips DAY) < NOW()");
visaOrderList = sellVisaOrderRepository.Get<RB_Sell_VisaOrder_Extend>(builderVisaOrder.ToString()).ToList();
LogHelper.WriteInfo("签证订单Sql:" + builderVisaOrder.ToString());
}
catch (Exception ex)
{
LogHelper.Write(ex, "签证订单");
}
try
{
//酒店
StringBuilder builderHotelOrder = new StringBuilder();
builderHotelOrder.AppendFormat($@"SELECT A.RB_Group_id,a.OrderNo,A.EnterID,c.`Name` as HotelName,a.CheckIn,A.FinalPriceTips from rb_customer_hotelorder as a
builderHotelOrder.AppendFormat($@"SELECT A.RB_Group_id,a.OrderNo,a.OrderId,A.EnterID,c.`Name` as HotelName,a.CheckIn,A.FinalPriceTips from rb_customer_hotelorder as a
LEFT JOIN rb_customer_hotelorderdetail as b on a.OrderId=b.OrderId INNER JOIN rb_hotel as c on c.ID=b.HotelId where FinalPriceTips>0 and a.GroupId in({groupId}) and a.CheckIn>NOW()
and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund)
and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) AND DATE_SUB(a.CheckIn, INTERVAL A.FinalPriceTips DAY) < NOW()
");
var hotelOrderList = customer_HotelOrderRepository.Get<RB_Customer_HotelOrder_Extend>(builderHotelOrder.ToString()).ToList();
hotelOrderList = customer_HotelOrderRepository.Get<RB_Customer_HotelOrder_Extend>(builderHotelOrder.ToString()).ToList();
LogHelper.WriteInfo("酒店订单Sql:" + builderHotelOrder.ToString());
}
catch (Exception ex)
{
LogHelper.Write(ex, "酒店订单");
}
try
{
//邮轮订单
StringBuilder builderTicketOrder = new StringBuilder();
builderTicketOrder.AppendFormat($@"SELECT A.GroupId,A.OrderNo,a.EnterID,b.`Name` as CouponsName,a.UseDate,A.FinalPriceTips from rb_customer_ticketorder as a
LEFT JOIN rb_ticketcoupons as b on a.CouponsId=b.ID where FinalPriceTips>0 and a.GroupId in({groupId}) and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) and a.UseDate>NOW()");
var ticketOrderList = customerTicketOrderRepository.Get<RB_Customer_TicketOrder_Extend>(builderTicketOrder.ToString()).ToList();
builderTicketOrder.AppendFormat($@"SELECT A.GroupId,A.OrderNo,a.OrderId,a.EnterID,b.`Name` as CouponsName,a.UseDate,A.FinalPriceTips from rb_customer_ticketorder as a
LEFT JOIN rb_ticketcoupons as b on a.CouponsId=b.ID where a.FinalPriceTips>0 AND DATE_SUB(a.UseDate, INTERVAL A.FinalPriceTips DAY) < NOW() and a.GroupId in({groupId}) and a.OrderStatus <>3 and a.Money <> (a.Income + a.PlatformTax+a.PlatformMoney - a.Refund) and a.UseDate>NOW()");
ticketOrderList = customerTicketOrderRepository.Get<RB_Customer_TicketOrder_Extend>(builderTicketOrder.ToString()).ToList();
LogHelper.WriteInfo("邮轮订单Sql:" + builderTicketOrder.ToString());
}
catch (Exception ex)
{
LogHelper.Write(ex, "邮轮订单");
}
try
{
//单机票订单
StringBuilder builderCRMTicketOrder = new StringBuilder();
builderCRMTicketOrder.AppendFormat($@"SELECT A.GroupId,A.GuestCount,A.DepartTime,A.EnterID,A.FinalPriceTips from {(Config.IsOnline ? "uat_reborn_sell" : "reborn_sell")}.RB_Ticket_Order as A
where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.OrderStatus <>2 and a.Money <> (a.IncomeMoney + a.TaxMoney+a.PlatformMoney - a.BackMoney)");
var cRMTicket_OrderList = cRMTicket_OrderRepository.Get<RB_CRMTicket_Order_Extend>(builderCRMTicketOrder.ToString()).ToList();
builderCRMTicketOrder.AppendFormat($@"SELECT A.GroupId,A.GuestCount,a.OrderId,A.DepartTime,A.EnterID,A.FinalPriceTips from {(Config.IsOnline ? "uat_reborn_sell" : "reborn_sell")}.RB_Ticket_Order as A
where a.FinalPriceTips>0 and a.DepartTime>NOW() AND DATE_SUB(a.DepartTime, INTERVAL A.FinalPriceTips DAY) < NOW() and a.GroupId in({groupId}) and a.OrderStatus <>2 and a.Money <> (a.IncomeMoney + a.TaxMoney+a.PlatformMoney - a.BackMoney)");
cRMTicket_OrderList = cRMTicket_OrderRepository.Get<RB_CRMTicket_Order_Extend>(builderCRMTicketOrder.ToString()).ToList();
LogHelper.WriteInfo("单机票订单Sql:" + builderCRMTicketOrder.ToString());
}
catch (Exception ex)
{
LogHelper.Write(ex, "单机票订单");
}
#endregion
#region 员工信息
......@@ -228,7 +273,6 @@ where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.
if (hotelOrderList != null && hotelOrderList.Any())
{
foreach (var item in hotelOrderList)
{
if (IsSend(item.FinalPriceTips, item.CheckIn.Value))
......@@ -255,7 +299,6 @@ where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.
{
if (IsSend(item.FinalPriceTips, item.UseDate.Value))
{
Dictionary<string, string> dic = new Dictionary<string, string>
{
{ "订单类型", "邮轮产品" },
......@@ -292,7 +335,12 @@ where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.
}
}
#endregion
Console.WriteLine("执行了没有?");
LogHelper.WriteInfo("任务结束");
}
}
catch (Exception ex)
{
LogHelper.Write(ex, "Execute");
}
return null;
}
......@@ -307,22 +355,6 @@ where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.
{
var nowDay = DateTime.Now;
bool result = false;
//if (reminderDays > 0 && oldStartDate.HasValue)
//{
// DateTime startDate = oldStartDate.Value;
// DateTime reminderStartDate = startDate.AddDays(-reminderDays);
// // 计算当前时间与提醒开始日期之间的天数差
// double daysSinceReminderStart = (nowDay - reminderStartDate).TotalDays;
// // 检查是否在提醒期内且满足每隔2天的条件
// if (daysSinceReminderStart >= 0 && daysSinceReminderStart <= reminderDays)
// {
// // 检查是否每隔2天(包括第0天)
// if (daysSinceReminderStart % 2 == 0)
// {
// result = true;
// }
// }
//}
if (reminderDays > 0 && oldStartDate.HasValue)
{
DateTime reminderStartDate = oldStartDate.Value.AddDays(-reminderDays);
......@@ -360,10 +392,13 @@ where FinalPriceTips>0 and a.DepartTime>NOW() and a.GroupId in({groupId}) and a.
{
foreach (var mpcModel in mpcList)
{
//LogHelper.WriteInfo("我是发送企业微信消息");
int sendType = (int)mSendType;
var sendTypeList = StringHelper.StringToListInt(mpcModel?.SendType ?? "");
//LogHelper.WriteInfo("我是发送企业微信消息1:[sendType]:"+ sendType + "[WeChatBotWebhookUrl]" + (mpcModel?.WeChatBotWebhookUrl ?? "")+ "[WeChatBotEnabled]:" + (mpcModel?.WeChatBotEnabled ?? 0));
if (!string.IsNullOrWhiteSpace(mpcModel?.WeChatBotWebhookUrl ?? "") && sendTypeList != null && (sendTypeList.Any(x => x == sendType)) && (mpcModel?.WeChatBotEnabled ?? 0) == 1)
{//新增订单,推送消息
//LogHelper.WriteInfo("我是发送企业微信消息2");
try
{
Common.Plugin.QYWorkHelper.BalancePaymentMessagePush(dic, mpcModel?.WeChatBotWebhookUrl);
......
......@@ -53,7 +53,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.14.0" newVersion="8.0.14.0" />
<bindingRedirect oldVersion="0.0.0.0-6.9.12.0" newVersion="6.9.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
......@@ -109,4 +109,9 @@
</providers>
</roleManager>
</system.web>
</configuration>
\ No newline at end of file
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
\ No newline at end of file
......@@ -36,6 +36,9 @@
<Reference Include="log4net, Version=2.0.9.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.10\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.12\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.Common, Version=1.6.6.1, Culture=neutral, PublicKeyToken=6c80000676988ebb, processorArchitecture=MSIL">
<HintPath>..\packages\SuperSocket.1.6.6.1\lib\net45\SuperSocket.Common.dll</HintPath>
</Reference>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.10" targetFramework="net461" />
<package id="MySql.Data" version="6.9.12" targetFramework="net461" />
<package id="SuperSocket" version="1.6.6.1" targetFramework="net461" />
<package id="SuperSocket.Engine" version="1.6.6.1" targetFramework="net461" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment