Commit b50ccb98 authored by 吴春's avatar 吴春

1

parent f3c7aa8f
...@@ -1101,140 +1101,147 @@ namespace REBORN.Module.SellModule ...@@ -1101,140 +1101,147 @@ namespace REBORN.Module.SellModule
} }
else else
{ {
try
#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)
{ {
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)
}
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 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; foreach (var qitem in item.RoomList)
qitem.DetailId = item.Id; {
qitem.Status = 0; qitem.OrderId = orderId;
qitem.GroupId = demodel.GroupId; qitem.DetailId = item.Id;
qitem.CreateTime = DateTime.Now; qitem.Status = 0;
qitem.UpdateBy = demodel.UpdateBy; qitem.GroupId = demodel.GroupId;
qitem.UpdateTime = DateTime.Now; qitem.CreateTime = DateTime.Now;
hotelOrderRoomRepository.Insert(qitem); 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(); var dictModel = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.GroupId, DictKey = "Client_OrderPush_Url" }).FirstOrDefault();
if (dictModel != null && userInfo.SimpleEasy == 0) if (dictModel != null && userInfo.SimpleEasy == 0)
{
string url = dictModel.Content;
var postdata = new
{ {
msgtype = "text", string url = dictModel.Content;
text = new var postdata = new
{ {
content = "来新订单了,请注意!", msgtype = "text",
mentioned_list = dictModel.Mask.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToList(), 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), "");//提醒推送
} }
}; string cNmae = "", CTel = "";
if (Common.Config.IsOnline && demodel.GroupId == 2) if (demodel.CustomerId > 0)
{
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata), "");//提醒推送
}
string cNmae = "", CTel = "";
if (demodel.CustomerId > 0)
{
if (demodel.OrderSource == 1)
{ {
//直客 if (demodel.OrderSource == 1)
var customerModel = directCustomerRepository.GetEntity(demodel.CustomerId); {
cNmae = customerModel?.Name ?? ""; //直客
CTel = (customerModel?.Moblie ?? "") + " -直客"; 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 else
{ {
var customerModel = customerInfoRepository.GetEntity(demodel.CustomerId); cNmae = CacheManager.User.RbUserCache.GetUserLoginInfo(demodel.EnterID.ToString())?.emName ?? "";
cNmae = customerModel?.CustomerName ?? ""; CTel = " -销售";
CTel = (customerModel?.ContactNumber ?? "") + " -同业";
} }
} string jdName = hotel?.Name;
else if (Common.Config.IsOnline && demodel.GroupId == 2)
{
cNmae = CacheManager.User.RbUserCache.GetUserLoginInfo(demodel.EnterID.ToString())?.emName ?? "";
CTel = " -销售";
}
string jdName = hotel?.Name;
if (Common.Config.IsOnline && demodel.GroupId == 2)
{
//内容推送
var postdata2 = new
{ {
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 + ")" msgtype = "markdown",
} markdown = new
}; {
HttpHelper.HttpPost(url, JsonHelper.Serialize(postdata2), "");//内容推送 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) if (demodel.GroupId == 2)
{ {
Dictionary<string, string> dic = new Dictionary<string, string> Dictionary<string, string> dic = new Dictionary<string, string>
{ {
{ "订单类型", "酒店产品" }, { "订单类型", "酒店产品" },
{ "订单编号", demodel.OrderNo.ToString() }, { "订单编号", demodel.OrderNo.ToString() },
{ "产品名称", jdName }, { "产品名称", jdName },
{ "销售人员", userInfo.emName } { "销售人员", userInfo.emName }
}; };
//新增订单,推送消息 //新增订单,推送消息
Common.Plugin.QYWorkHelper.OrderMessagePush(dic); Common.Plugin.QYWorkHelper.OrderMessagePush(dic);
}
} }
#endregion
} }
#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 catch (Exception ex)
if (orderId > 0)
{ {
customer_OrderLogRepository.Insert(new RB_Customer_OrderLog() LogHelper.Write(ex);
{
LogId = 0,
GroupId = demodel.GroupId,
CreateBy = 0,
CreateTime = DateTime.Now,
LogContent = "客人下单",
OrderId = orderId,
Type = 1
});
} }
return orderId > 0 ? "" : "出错了,请联系管理员"; 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