Commit 24e8e159 authored by 吴春's avatar 吴春

提交代码

parent 5a066757
...@@ -332,5 +332,17 @@ namespace Mall.Model.Extend.Product ...@@ -332,5 +332,17 @@ namespace Mall.Model.Extend.Product
#endregion #endregion
#region 线下服务
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserPhoto { get; set; }
#endregion
} }
} }
...@@ -68,5 +68,75 @@ namespace Mall.Model.Extend.Reserve ...@@ -68,5 +68,75 @@ namespace Mall.Model.Extend.Reserve
/// 商品/分类id /// 商品/分类id
/// </summary> /// </summary>
public List<RB_Reserve_ServicePersonalProduct_Extend> ProductList { get; set; } public List<RB_Reserve_ServicePersonalProduct_Extend> ProductList { get; set; }
/// <summary>
/// 查询时间条件
/// </summary>
public string WorkDate { get; set; }
}
//public class StoreServicePersonalKanBan
//{
// public List<ServicePersonalKanBan> ServicePersonalList { get; set; }
//}
public class ServicePersonalKanBan
{
/// <summary>
/// 服务人员名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 服务人员编号
/// </summary>
public int Id { get; set; }
public List<OrderKanBan> OrderList { get; set; }
} }
public class OrderKanBan
{
/// <summary>
/// 服务人员名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 服务人员编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 服务时间
/// </summary>
public string ServiceTime { get; set; }
/// <summary>
/// 服务时长
/// </summary>
public string ServiceDuration { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserPhoto { get; set; }
/// <summary>
/// 服务内容
/// </summary>
public string GoodsName { get; set; }
}
} }
...@@ -24,6 +24,7 @@ using Mall.Repository.Product; ...@@ -24,6 +24,7 @@ using Mall.Repository.Product;
using Mall.Repository.Reserve; using Mall.Repository.Reserve;
using Mall.Repository.User; using Mall.Repository.User;
using Newtonsoft.Json; using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using VT.FW.DB; using VT.FW.DB;
namespace Mall.Module.Product namespace Mall.Module.Product
...@@ -1214,7 +1215,7 @@ namespace Mall.Module.Product ...@@ -1214,7 +1215,7 @@ namespace Mall.Module.Product
/// </summary> /// </summary>
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Extend> GetServicePersonalGoodsList(int pageIndex, int pageSize, out long count,RB_Goods_Extend demodel,int GoodsClassify) public List<RB_Goods_Extend> GetServicePersonalGoodsList(int pageIndex, int pageSize, out long count, RB_Goods_Extend demodel, int GoodsClassify)
{ {
var list = goodsRepository.GetPageList(pageIndex, pageSize, out count, demodel); var list = goodsRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) if (list.Any())
...@@ -1253,6 +1254,21 @@ namespace Mall.Module.Product ...@@ -1253,6 +1254,21 @@ namespace Mall.Module.Product
} }
/// <summary>
/// 获取线下服务订单详情
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetReserveOrderList(RB_Goods_Order_Extend dmodel)
{
return goods_OrderDetailRepository.GetReserveOrderList(dmodel);
}
#region 评论 #region 评论
/// <summary> /// <summary>
......
...@@ -267,6 +267,8 @@ namespace Mall.Module.Reserve ...@@ -267,6 +267,8 @@ namespace Mall.Module.Reserve
{ {
string Ids = string.Join(",", list.Where(x => x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Category || x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Product).Select(x => x.ID)); string Ids = string.Join(",", list.Where(x => x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Category || x.ServiceType == Common.Enum.Reserve.ServiceTypeEnum.Product).Select(x => x.ID));
if (!string.IsNullOrWhiteSpace(Ids))
{
var listProduct = servicePersonalProductRepository.GetListByServicePersonalProductIds(query, Ids); var listProduct = servicePersonalProductRepository.GetListByServicePersonalProductIds(query, Ids);
foreach (var item in list) foreach (var item in list)
{ {
...@@ -274,9 +276,24 @@ namespace Mall.Module.Reserve ...@@ -274,9 +276,24 @@ namespace Mall.Module.Reserve
item.ProductList = listProduct.Where(x => x.ServiceId == item.ID).ToList(); item.ProductList = listProduct.Where(x => x.ServiceId == item.ID).ToList();
} }
} }
}
return list;
}
/// <summary>
/// 当天排班服务人员列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Reserve_ServicePersonal_Extend> GetKanBanServicePersonalList(RB_Reserve_ServicePersonal_Extend query)
{
var list = servicePersonalRepository.GetKanBanServicePersonalList(query);
return list; return list;
} }
/// <summary> /// <summary>
/// 新增/修改服务人员 /// 新增/修改服务人员
/// </summary> /// </summary>
......
...@@ -723,5 +723,65 @@ LEFT JOIN rb_goods as g on g.ID=a.GoodsId ...@@ -723,5 +723,65 @@ LEFT JOIN rb_goods as g on g.ID=a.GoodsId
where {where} order by a.Id asc"; where {where} order by a.Id asc";
return Get<RB_Goods_OrderDetail_Extend>(sql).ToList(); return Get<RB_Goods_OrderDetail_Extend>(sql).ToList();
} }
/// <summary>
/// 获取线下服务订单详情
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetReserveOrderList(RB_Goods_Order_Extend dmodel)
{
string where = $" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and o.OrderStatus in(2,3,4,5,6) ";
if (dmodel.TenantId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderClassify > -1)
{
where += $@" and o.{nameof(RB_Goods_Order.OrderClassify)}={dmodel.OrderClassify}";
}
if (dmodel.OrderType > 0)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.OrderType)}={dmodel.OrderType}";
}
if (dmodel.StoresId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.StoresId)}={dmodel.StoresId}";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartTime))
{
where += $@" and DATE_FORMAT(od.{nameof(RB_Goods_OrderDetail.ServiceTime)},'%Y-%m-%d' )=DATE_FORMAT('{dmodel.StartTime}','%Y-%m-%d')";
}
if (!string.IsNullOrEmpty(dmodel.OrderNo))
{
where += $@" and o.{nameof(RB_Goods_Order.OrderNo)} like '%{dmodel.OrderNo}%'";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(dmodel.ProductCode))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
}
string sql = $@"SELECT od.*,o.OrderNo,mu.`Name` as UserName,mu.Photo as UserPhoto FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
LEFT JOIN rb_member_user as mu on o.UserId=mu.Id
where {where} order by o.CreateDate desc";
return Get<RB_Goods_OrderDetail_Extend>(sql).ToList();
}
} }
} }
...@@ -175,7 +175,7 @@ LEFT JOIN (SELECT ServicePersonalId,COUNT(*) as CommentNum from rb_goods_commen ...@@ -175,7 +175,7 @@ LEFT JOIN (SELECT ServicePersonalId,COUNT(*) as CommentNum from rb_goods_commen
} }
} }
string sql= $@"SELECT t.ServicepersonalId,t.orderNum, string sql = $@"SELECT t.ServicepersonalId,t.orderNum,
CASE CASE
WHEN @prevRank = t.orderNum THEN @curRank WHEN @prevRank = t.orderNum THEN @curRank
WHEN @prevRank := t.orderNum THEN @curRank := @curRank + 1 WHEN @prevRank := t.orderNum THEN @curRank := @curRank + 1
...@@ -206,6 +206,53 @@ ORDER BY t.orderNum desc "; ...@@ -206,6 +206,53 @@ ORDER BY t.orderNum desc ";
builder.Append($" SELECT a.*,b.`Name` as StoreName,b.Address as StoreAddress FROM {TableName} as A LEFT JOIN rb_stores as b on a.StoreId=b.Id WHERE a.{nameof(RB_Reserve_ServicePersonal_Extend.Status)}=0"); builder.Append($" SELECT a.*,b.`Name` as StoreName,b.Address as StoreAddress FROM {TableName} as A LEFT JOIN rb_stores as b on a.StoreId=b.Id WHERE a.{nameof(RB_Reserve_ServicePersonal_Extend.Status)}=0");
} }
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.MallBaseId)}={query.MallBaseId}");
}
if (query.ServiceStatus > 0)
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.ServiceStatus)}={query.ServiceStatus}");
}
if (query.StoreId > 0)
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.StoreId)}={query.StoreId}");
}
if (query.ID > 0)
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.ID)}={query.ID}");
}
if (!string.IsNullOrWhiteSpace(query.Name))
{
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.Name)} like '%{query.Name}%'");
}
}
builder.Append($" order by a.{nameof(RB_Reserve_ServicePersonal_Extend.ID)} desc");
return Get<RB_Reserve_ServicePersonal_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 当天排班服务人员列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Reserve_ServicePersonal_Extend> GetKanBanServicePersonalList(RB_Reserve_ServicePersonal_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT a.*,b.Date FROM rb_reserve_servicepersonal as A LEFT JOIN rb_reserve_servicetargetdate as b on a.ID=b.ServiceId WHERE a.{nameof(RB_Reserve_ServicePersonal_Extend.Status)}=0");
if (query != null) if (query != null)
{ {
if (query.TenantId > 0) if (query.TenantId > 0)
...@@ -228,12 +275,19 @@ ORDER BY t.orderNum desc "; ...@@ -228,12 +275,19 @@ ORDER BY t.orderNum desc ";
{ {
builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.Name)} like '%{query.Name}%'"); builder.Append($" AND a.{nameof(RB_Reserve_ServicePersonal_Extend.Name)} like '%{query.Name}%'");
} }
if (!string.IsNullOrWhiteSpace(query.WorkDate))
{
builder.Append($" and DATE_FORMAT(b.Date,'%Y-%m-%d' )=DATE_FORMAT('{query.WorkDate}','%Y-%m-%d'");
}
} }
builder.Append($" order by a.{nameof(RB_Reserve_ServicePersonal_Extend.ID)} desc"); builder.Append($" order by a.{nameof(RB_Reserve_ServicePersonal_Extend.ID)} desc");
return Get<RB_Reserve_ServicePersonal_Extend>(builder.ToString()).ToList(); return Get<RB_Reserve_ServicePersonal_Extend>(builder.ToString()).ToList();
} }
/// <summary> /// <summary>
/// 根据门店、商品编号和商品分类编号获取服务人员列表 /// 根据门店、商品编号和商品分类编号获取服务人员列表
/// </summary> /// </summary>
...@@ -241,7 +295,7 @@ ORDER BY t.orderNum desc "; ...@@ -241,7 +295,7 @@ ORDER BY t.orderNum desc ";
/// <param name="productId"></param> /// <param name="productId"></param>
/// <param name="categoryIds"></param> /// <param name="categoryIds"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Reserve_ServicePersonal_Extend> GetServicePersonalListExtRepository(int storeId,int productId,string categoryIds) public List<RB_Reserve_ServicePersonal_Extend> GetServicePersonalListExtRepository(int storeId, int productId, string categoryIds)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
......
...@@ -75,12 +75,12 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -75,12 +75,12 @@ namespace Mall.WebApi.Controllers.Reserve
MallBaseId = parms.MallBaseId MallBaseId = parms.MallBaseId
}, isFirst: true)?.FirstOrDefault(); }, isFirst: true)?.FirstOrDefault();
var consumptionObj = new object(); var consumptionObj = new object();
if (userInfo!=null&&userInfo.UserId > 0) if (userInfo != null && userInfo.UserId > 0)
{ {
var orderModel = orderModule.GetOfflineServiceOrderPageListModule(1, 1, out long rowsCount, new RB_Goods_Order_Extend() var orderModel = orderModule.GetOfflineServiceOrderPageListModule(1, 1, out long rowsCount, new RB_Goods_Order_Extend()
{ {
UserId = userInfo.UserId, UserId = userInfo.UserId,
IsNotSelectCancel=1, IsNotSelectCancel = 1,
})?.FirstOrDefault(); })?.FirstOrDefault();
if (orderModel != null && orderModel.StoresId > 0) if (orderModel != null && orderModel.StoresId > 0)
{ {
...@@ -202,9 +202,9 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -202,9 +202,9 @@ namespace Mall.WebApi.Controllers.Reserve
storeScore = storeModel?.Score, storeScore = storeModel?.Score,
storeCoverImg = storeModel?.CoverImg, storeCoverImg = storeModel?.CoverImg,
storeNavImg = storeModel?.NavImg, storeNavImg = storeModel?.NavImg,
storeIntro= storeModel?.Intro, storeIntro = storeModel?.Intro,
storeProject= storeModel?.ServiceProject, storeProject = storeModel?.ServiceProject,
storeServiceTime= serviceTime, storeServiceTime = serviceTime,
consumptionObj consumptionObj
}, },
}; };
...@@ -225,7 +225,7 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -225,7 +225,7 @@ namespace Mall.WebApi.Controllers.Reserve
{ {
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString()); var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Reserve_ServicePersonal_Extend demodel = JsonConvert.DeserializeObject<RB_Reserve_ServicePersonal_Extend>(RequestParm.msg.ToString()); RB_Reserve_ServicePersonal_Extend demodel = JsonConvert.DeserializeObject<RB_Reserve_ServicePersonal_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
demodel.ServiceStatus = 1; demodel.ServiceStatus = 1;
...@@ -270,7 +270,7 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -270,7 +270,7 @@ namespace Mall.WebApi.Controllers.Reserve
List<RB_Goods_Extend> goodsList = new List<RB_Goods_Extend>(); List<RB_Goods_Extend> goodsList = new List<RB_Goods_Extend>();
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
{ {
oldLogisticsModel = new RB_Reserve_ServicePersonal_Extend(); return ApiResult.Failed("信息不存在");
} }
else else
{ {
...@@ -281,7 +281,10 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -281,7 +281,10 @@ namespace Mall.WebApi.Controllers.Reserve
goodsModel.TeacherId = parms.TenantId; goodsModel.TeacherId = parms.TenantId;
goodsModel.MallBaseId = parms.MallBaseId; goodsModel.MallBaseId = parms.MallBaseId;
goodsModel.GoodsStatus = 1; goodsModel.GoodsStatus = 1;
goodsModel.StoresIds = query.StoreId.ToString(); goodsModel.GoodsClassify = 3;
goodsModel.StoresIds = oldLogisticsModel.StoreId.ToString();
if (oldLogisticsModel.ServiceType != Common.Enum.Reserve.ServiceTypeEnum.All)
{
string ids = string.Join(",", oldLogisticsModel.ProductList.Select(x => x.ProductId)); string ids = string.Join(",", oldLogisticsModel.ProductList.Select(x => x.ProductId));
if (!string.IsNullOrWhiteSpace(ids)) if (!string.IsNullOrWhiteSpace(ids))
{ {
...@@ -293,9 +296,10 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -293,9 +296,10 @@ namespace Mall.WebApi.Controllers.Reserve
{ {
goodsModel.GoodsIds = ids; goodsModel.GoodsIds = ids;
} }
goodsList = offlineGoodsModule.GetServicePersonalGoodsList(1, 3, out totalNum, goodsModel, 3);
} }
} }
goodsList = offlineGoodsModule.GetServicePersonalGoodsList(1, 3, out totalNum, goodsModel, 3);
}
if (!string.IsNullOrWhiteSpace(oldLogisticsModel.LableName)) if (!string.IsNullOrWhiteSpace(oldLogisticsModel.LableName))
{ {
oldLogisticsModel.LableNameList = JsonConvert.DeserializeObject<List<string>>(oldLogisticsModel.LableName); oldLogisticsModel.LableNameList = JsonConvert.DeserializeObject<List<string>>(oldLogisticsModel.LableName);
...@@ -311,11 +315,12 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -311,11 +315,12 @@ namespace Mall.WebApi.Controllers.Reserve
oldLogisticsModel.Gender, oldLogisticsModel.Gender,
oldLogisticsModel.OrderNum, oldLogisticsModel.OrderNum,
oldLogisticsModel.FictitiousReserveNum, oldLogisticsModel.FictitiousReserveNum,
oldLogisticsModel.Major,
oldLogisticsModel.Telephone, oldLogisticsModel.Telephone,
oldLogisticsModel.LableName, oldLogisticsModel.LableNameList,
oldLogisticsModel.StoreAddress, oldLogisticsModel.StoreAddress,
oldLogisticsModel.StoreName, oldLogisticsModel.StoreName,
goodsList = goodsList.Select(x => new { x.Name, x.SellingPrice, x.DepositMoney, x.CoverImage, x.SubName, x.GoodsNumbers }) goodsList = goodsList.Select(x => new { x.Name, x.SellingPrice, x.DepositMoney, x.CoverImage, x.SubName, x.GoodsBuyNum })
}; };
...@@ -372,13 +377,14 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -372,13 +377,14 @@ namespace Mall.WebApi.Controllers.Reserve
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[AllowAnonymous]
public ApiResult GetReserveCouponDetail(object requestMsg) public ApiResult GetReserveCouponDetail()
{ {
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString()); var req = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Reserve_Coupon_Extend>(parms.msg.ToString()); var userInfo = AppletUserInfo;
query.TenantId = parms.TenantId; var query = JsonConvert.DeserializeObject<RB_Reserve_Coupon_Extend>(req.msg.ToString());
query.MallBaseId = parms.MallBaseId; query.TenantId = userInfo.TenantId;
query.MallBaseId = userInfo.MallBaseId;
var oldLogisticsModel = reserveModule.GetDiscountCouponList(query).FirstOrDefault(); var oldLogisticsModel = reserveModule.GetDiscountCouponList(query).FirstOrDefault();
if (oldLogisticsModel == null) if (oldLogisticsModel == null)
{ {
...@@ -393,19 +399,33 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -393,19 +399,33 @@ namespace Mall.WebApi.Controllers.Reserve
{ {
oldLogisticsModel.StoresList = contentModule.GetStoresListModule(new RB_Stores_Extend() oldLogisticsModel.StoresList = contentModule.GetStoresListModule(new RB_Stores_Extend()
{ {
MallBaseId = parms.MallBaseId, MallBaseId = userInfo.MallBaseId,
TenantId = parms.TenantId TenantId = userInfo.TenantId
}); });
} }
else { else
{
oldLogisticsModel.StoresList = contentModule.GetStoresListModule(new RB_Stores_Extend() oldLogisticsModel.StoresList = contentModule.GetStoresListModule(new RB_Stores_Extend()
{ {
MallBaseId = parms.MallBaseId, MallBaseId = userInfo.MallBaseId,
TenantId = parms.TenantId, TenantId = userInfo.TenantId,
QIds= oldLogisticsModel.StoreIds QIds = oldLogisticsModel.StoreIds
}); });
} }
//判断当前人是否领取了改优惠券
//判断套餐卡是否已领取
var receiveList = reserveModule.GetMemberDiscountCouponList(new RB_Reserve_MemberCoupon_Extend
{
CouponId = oldLogisticsModel.ID,
MallBaseId = userInfo.MallBaseId,
TenantId = userInfo.TenantId,
UserId = userInfo.UserId
});
if (receiveList != null && receiveList.Any())
{
oldLogisticsModel.MemberNum = receiveList.Count();
}
} }
return ApiResult.Success("", oldLogisticsModel); return ApiResult.Success("", oldLogisticsModel);
} }
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Mall.AOP;
using Mall.Common.API; using Mall.Common.API;
using Mall.Common.Enum.Reserve; using Mall.Common.Enum.Reserve;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Entity.Product;
using Mall.Model.Entity.Reserve; using Mall.Model.Entity.Reserve;
using Mall.Model.Extend.Reserve; using Mall.Model.Extend.Reserve;
using Mall.Model.Extend.User; using Mall.Model.Extend.User;
...@@ -26,6 +28,14 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -26,6 +28,14 @@ namespace Mall.WebApi.Controllers.Reserve
{ {
private readonly ReserveModule reserveModule = new ReserveModule(); private readonly ReserveModule reserveModule = new ReserveModule();
private Module.User.UserModule UserModule = new Module.User.UserModule(); private Module.User.UserModule UserModule = new Module.User.UserModule();
/// <summary>
/// 门店处理类对象
/// </summary>
private readonly Module.User.ContentModule contentModule = AOPHelper.CreateAOPObject<Module.User.ContentModule>();
/// <summary>
/// 线下服务商品处理类对象
/// </summary>
private readonly Module.Product.OfflineGoodsModule offlineGoodsModule = AOPHelper.CreateAOPObject<Module.Product.OfflineGoodsModule>();
...@@ -90,7 +100,7 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -90,7 +100,7 @@ namespace Mall.WebApi.Controllers.Reserve
{ {
demodel.BusinessHoursJson = JsonConvert.SerializeObject(demodel.BusinessHoursList); demodel.BusinessHoursJson = JsonConvert.SerializeObject(demodel.BusinessHoursList);
} }
if (demodel.PayTypeList==null||!demodel.PayTypeList.Any()) if (demodel.PayTypeList == null || !demodel.PayTypeList.Any())
{ {
return ApiResult.Failed("请选择付款方式"); return ApiResult.Failed("请选择付款方式");
} }
...@@ -896,5 +906,137 @@ namespace Mall.WebApi.Controllers.Reserve ...@@ -896,5 +906,137 @@ namespace Mall.WebApi.Controllers.Reserve
#endregion #endregion
#region 预约看板
/// <summary>
/// 获取详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStoreOrderInfo()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Reserve_ServicePersonal_Extend>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
query.MallBaseId = parms.MallBaseId;
var oldLogisticsModel = contentModule.GetStoresListModule(new Model.Entity.User.RB_Stores_Extend { TenantId = UserInfo.TenantId, MallBaseId = parms.MallBaseId, Id = query.StoreId }).FirstOrDefault();
List<RB_Reserve_ServicePersonal_Extend> servicePersonalList = new List<RB_Reserve_ServicePersonal_Extend>();
List<Model.Extend.Product.RB_Goods_OrderDetail_Extend> orderList = new List<Model.Extend.Product.RB_Goods_OrderDetail_Extend>();
List<ServicePersonalKanBan> KanBanList = new List<ServicePersonalKanBan>();
if (oldLogisticsModel == null)
{
oldLogisticsModel = new Model.Entity.User.RB_Stores_Extend();
}
else
{
//获取门店下面当天需要上班的服务人员
servicePersonalList = reserveModule.GetKanBanServicePersonalList(query);
//获取门店下面当前的订单信息
orderList = offlineGoodsModule.GetReserveOrderList(new Model.Extend.Product.RB_Goods_Order_Extend { TenantId = UserInfo.TenantId, MallBaseId = parms.MallBaseId, OrderClassify = 3, StoresId = query.StoreId, StartTime = query.WorkDate });
foreach (var item in servicePersonalList)//添加到服务人员
{
ServicePersonalKanBan kanBanModel = new ServicePersonalKanBan
{
Name = item.Name,
Id = item.ID,
OrderList = new List<OrderKanBan>()
};
KanBanList.Add(kanBanModel);
}
//看门店营业时间半小时一个节点
try
{
int startTime = Convert.ToInt32(oldLogisticsModel.StartTime.Split(':')[0]);
int endTime = Convert.ToInt32(oldLogisticsModel.EndTime.Split(':')[0]);
DateTime tempStartTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + oldLogisticsModel.StartTime);
DateTime tempEndTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + oldLogisticsModel.EndTime);
if (startTime > endTime)//次日营业
{
tempEndTime = Convert.ToDateTime(System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + oldLogisticsModel.EndTime);
}
DateTime nowStartTime = tempStartTime;
DateTime nowEndTime = tempEndTime;
int startMin = Convert.ToInt32(oldLogisticsModel.StartTime.Split(':')[1]);
if (startMin > 0 && startMin < 30)
{
nowStartTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + startTime + ":00");
}
else
{
nowStartTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + startTime + ":30");
}
int endMin = Convert.ToInt32(oldLogisticsModel.EndTime.Split(':')[1]);
if (endMin > 0 && endMin < 30)
{
nowEndTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + endTime + ":00");
}
else
{
nowEndTime = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd") + " " + endTime + ":30");
}
List<string> allTime = new List<string>();
bool isAddTime = true;
foreach (var item in KanBanList)
{
for (var day = nowStartTime; day <= nowEndTime; day = day.AddMinutes(30))
{
var tempOrderList = orderList.Where(x => x.ServicepersonalId == item.Id && day < Convert.ToDateTime(x.ServiceDate + " " + x.ServiceTime) && Convert.ToDateTime(x.ServiceDate + " " + x.ServiceTime) < day.AddMinutes(30));
foreach (var itemOrder in tempOrderList)
{
OrderKanBan orderModel = new OrderKanBan();
orderModel.Id = item.Id;
orderModel.Name = item.Name;
orderModel.GoodsName = itemOrder.GoodsName;
//orderModel.ServiceDuration = itemOrder.GoodServiceTime;
}
if (day == nowStartTime)
{
if (isAddTime)
{
allTime.Add(oldLogisticsModel.StartTime);
}
//查询订单信息
}
else if (day == nowEndTime)
{
if (isAddTime)
{
allTime.Add(oldLogisticsModel.EndTime);
}
}
else
{
if (isAddTime)
{
allTime.Add(day.ToString("HH:mm"));
}
}
}
isAddTime = false;
}
}
catch (Exception ex)
{
LogHelper.WriteInfo("门店时间转换错误" + ex.ToString());
}
}
return ApiResult.Success("", oldLogisticsModel);
}
#endregion
} }
} }
\ 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