Commit b50ccb98 authored by 吴春's avatar 吴春

1

parent f3c7aa8f
......@@ -1101,140 +1101,147 @@ namespace REBORN.Module.SellModule
}
else
{
#region 新增订单
demodel.CustomerPayType = 2;
demodel.OpEmpId = hotelRepository.GetEntity(demodel?.DetailList?.FirstOrDefault()?.HotelId)?.UpdateBy ?? 0;//2023.04.14 add by:W 下单的时候 先默认 产品的创建人
demodel.OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + new Random().Next(1000, 9999);
demodel.OrderStatus = CustomerOrderStatusEnum.Confirm;
orderId = hotelOrderRepository.Insert(demodel);
if (orderId > 0)
try
{
if (appointOPList != null && appointOPList.Any())
#region 新增订单
demodel.CustomerPayType = 2;
demodel.OpEmpId = hotelRepository.GetEntity(demodel?.DetailList?.FirstOrDefault()?.HotelId)?.UpdateBy ?? 0;//2023.04.14 add by:W 下单的时候 先默认 产品的创建人
demodel.OrderNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + new Random().Next(1000, 9999);
demodel.OrderStatus = CustomerOrderStatusEnum.Confirm;
orderId = hotelOrderRepository.Insert(demodel);
if (orderId > 0)
{
foreach (var item in appointOPList)
if (appointOPList != null && appointOPList.Any())
{
item.OrderId = orderId;
foreach (var item in appointOPList)
{
item.OrderId = orderId;
}
appointOPRepository.InsertBatch(appointOPList);//新增op信息
}
appointOPRepository.InsertBatch(appointOPList);//新增op信息
}
foreach (var item in demodel.DetailList)
{
item.OrderId = orderId;
item.GroupId = demodel.GroupId;
item.Status = 0;
item.CreateTime = DateTime.Now;
item.UpdateBy = demodel.UpdateBy;
item.UpdateTime = DateTime.Now;
// item.HotelStatus = 1;
//var priceModel = priceList.Where(x => x.Hotel == item.HotelId && x.Date == item.Date.Value).FirstOrDefault();
//if (priceModel != null)
//{
// item.CurrencyId = priceModel.CurrencyId ?? 0;
// item.CurrentRate = priceModel.CurrentRate ?? 0;
//}
item.Id = hotelOrderDetailRepository.Insert(item);
if (item.Id > 0)
foreach (var item in demodel.DetailList)
{
foreach (var qitem in item.RoomList)
item.OrderId = orderId;
item.GroupId = demodel.GroupId;
item.Status = 0;
item.CreateTime = DateTime.Now;
item.UpdateBy = demodel.UpdateBy;
item.UpdateTime = DateTime.Now;
// item.HotelStatus = 1;
//var priceModel = priceList.Where(x => x.Hotel == item.HotelId && x.Date == item.Date.Value).FirstOrDefault();
//if (priceModel != null)
//{
// item.CurrencyId = priceModel.CurrencyId ?? 0;
// item.CurrentRate = priceModel.CurrentRate ?? 0;
//}
item.Id = hotelOrderDetailRepository.Insert(item);
if (item.Id > 0)
{
qitem.OrderId = orderId;
qitem.DetailId = item.Id;
qitem.Status = 0;
qitem.GroupId = demodel.GroupId;
qitem.CreateTime = DateTime.Now;
qitem.UpdateBy = demodel.UpdateBy;
qitem.UpdateTime = DateTime.Now;
hotelOrderRoomRepository.Insert(qitem);
}
foreach (var qitem in item.RoomList)
{
qitem.OrderId = orderId;
qitem.DetailId = item.Id;
qitem.Status = 0;
qitem.GroupId = demodel.GroupId;
qitem.CreateTime = DateTime.Now;
qitem.UpdateBy = demodel.UpdateBy;
qitem.UpdateTime = DateTime.Now;
hotelOrderRoomRepository.Insert(qitem);
}
}
}
}
#region 推送企微机器人消息
#region 推送企微机器人消息
var dictModel = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.GroupId, DictKey = "Client_OrderPush_Url" }).FirstOrDefault();
if (dictModel != null && userInfo.SimpleEasy == 0)
{
string url = dictModel.Content;
var postdata = new
var dictModel = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.GroupId, DictKey = "Client_OrderPush_Url" }).FirstOrDefault();
if (dictModel != null && userInfo.SimpleEasy == 0)
{
msgtype = "text",
text = new
string url = dictModel.Content;
var postdata = new
{
content = "来新订单了,请注意!",
mentioned_list = dictModel.Mask.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToList(),
msgtype = "text",
text = new
{
content = "来新订单了,请注意!",
mentioned_list = dictModel.Mask.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToList(),
}
};
if (Common.Config.IsOnline && demodel.GroupId == 2)
{
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata), "");//提醒推送
}
};
if (Common.Config.IsOnline && demodel.GroupId == 2)
{
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata), "");//提醒推送
}
string cNmae = "", CTel = "";
if (demodel.CustomerId > 0)
{
if (demodel.OrderSource == 1)
string cNmae = "", CTel = "";
if (demodel.CustomerId > 0)
{
//直客
var customerModel = directCustomerRepository.GetEntity(demodel.CustomerId);
cNmae = customerModel?.Name ?? "";
CTel = (customerModel?.Moblie ?? "") + " -直客";
if (demodel.OrderSource == 1)
{
//直客
var customerModel = directCustomerRepository.GetEntity(demodel.CustomerId);
cNmae = customerModel?.Name ?? "";
CTel = (customerModel?.Moblie ?? "") + " -直客";
}
else
{
var customerModel = customerInfoRepository.GetEntity(demodel.CustomerId);
cNmae = customerModel?.CustomerName ?? "";
CTel = (customerModel?.ContactNumber ?? "") + " -同业";
}
}
else
{
var customerModel = customerInfoRepository.GetEntity(demodel.CustomerId);
cNmae = customerModel?.CustomerName ?? "";
CTel = (customerModel?.ContactNumber ?? "") + " -同业";
cNmae = CacheManager.User.RbUserCache.GetUserLoginInfo(demodel.EnterID.ToString())?.emName ?? "";
CTel = " -销售";
}
}
else
{
cNmae = CacheManager.User.RbUserCache.GetUserLoginInfo(demodel.EnterID.ToString())?.emName ?? "";
CTel = " -销售";
}
string jdName = hotel?.Name;
if (Common.Config.IsOnline && demodel.GroupId == 2)
{
//内容推送
var postdata2 = new
string jdName = hotel?.Name;
if (Common.Config.IsOnline && demodel.GroupId == 2)
{
msgtype = "markdown",
markdown = new
//内容推送
var postdata2 = new
{
content = $"来新订单了。\n> 预定类型:<font color=\"comment\">酒店</font>\n> 订单编号:<font color=\"comment\">{demodel.OrderNo}</font>\n> 订单类型:<font color=\"comment\">{(demodel.OrderType == 1 ? "散客" : "团队")}</font>\n> 酒店名称:<font color=\"comment\">{jdName}</font>\n> 下单信息:<font color=\"comment\">{cNmae + "(" + CTel + ")"}</font>\n> [点击查看详情](http://yx.oytour.com/#/HotelOrderList?OrderId=" + orderId + ")"
}
};
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata2), "");//内容推送
}
msgtype = "markdown",
markdown = new
{
content = $"来新订单了。\n> 预定类型:<font color=\"comment\">酒店</font>\n> 订单编号:<font color=\"comment\">{demodel.OrderNo}</font>\n> 订单类型:<font color=\"comment\">{(demodel.OrderType == 1 ? "散客" : "团队")}</font>\n> 酒店名称:<font color=\"comment\">{jdName}</font>\n> 下单信息:<font color=\"comment\">{cNmae + "(" + CTel + ")"}</font>\n> [点击查看详情](http://yx.oytour.com/#/HotelOrderList?OrderId=" + orderId + ")"
}
};
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata2), "");//内容推送
}
if (demodel.GroupId == 2)
{
Dictionary<string, string> dic = new Dictionary<string, string>
if (demodel.GroupId == 2)
{
Dictionary<string, string> dic = new Dictionary<string, string>
{
{ "订单类型", "酒店产品" },
{ "订单编号", demodel.OrderNo.ToString() },
{ "产品名称", jdName },
{ "销售人员", userInfo.emName }
};
//新增订单,推送消息
Common.Plugin.QYWorkHelper.OrderMessagePush(dic);
//新增订单,推送消息
Common.Plugin.QYWorkHelper.OrderMessagePush(dic);
}
}
#endregion
}
#endregion
if (orderId > 0)
{
customer_OrderLogRepository.Insert(new RB_Customer_OrderLog()
{
LogId = 0,
GroupId = demodel.GroupId,
CreateBy = 0,
CreateTime = DateTime.Now,
LogContent = "客人下单",
OrderId = orderId,
Type = 1
});
}
}
#endregion
if (orderId > 0)
catch (Exception ex)
{
customer_OrderLogRepository.Insert(new RB_Customer_OrderLog()
{
LogId = 0,
GroupId = demodel.GroupId,
CreateBy = 0,
CreateTime = DateTime.Now,
LogContent = "客人下单",
OrderId = orderId,
Type = 1
});
LogHelper.Write(ex);
}
return orderId > 0 ? "" : "出错了,请联系管理员";
}
......
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