Commit 0583781f authored by 黄奎's avatar 黄奎

页面修改

parent d051f87c
...@@ -45,6 +45,11 @@ namespace Edu.Model.ViewModel.Reserve ...@@ -45,6 +45,11 @@ namespace Edu.Model.ViewModel.Reserve
/// </summary> /// </summary>
public int JoinNum { get; set; } public int JoinNum { get; set; }
/// <summary>
/// 访客预约列表
/// </summary>
public List<RB_Visitor_Reserve_Extend> VisitorList { get; set; }
/// <summary> /// <summary>
/// 预约日期字符串 /// 预约日期字符串
/// </summary> /// </summary>
......
...@@ -358,14 +358,25 @@ namespace Edu.Module.Course ...@@ -358,14 +358,25 @@ namespace Edu.Module.Course
{ {
disMoney = coursePreferentialModel?.SaleCommissionMoney ?? 0; disMoney = coursePreferentialModel?.SaleCommissionMoney ?? 0;
} }
var b2bCommissionType= coursePreferentialModel?.B2BCommissionType ?? 0;
if (b2bCommissionType == 0)
{
var tempMoney = (courseModel?.SellPrice ?? 0) * (coursePreferentialModel?.B2BCommissionMoney ?? 0);
disMoney += tempMoney / Convert.ToDecimal(100);
}
else
{
disMoney = coursePreferentialModel?.B2BCommissionMoney ?? 0;
}
var priceCommissionType = coursePreferentialModel?.PriceType??0; var priceCommissionType = coursePreferentialModel?.PriceType??0;
if (priceCommissionType == 0) if (priceCommissionType == 0)
{ {
coursePrice = coursePrice * (100 - coursePreferentialModel.PriceMoney) / 100; coursePrice = coursePrice * (100 - (coursePreferentialModel?.PriceMoney??0)) / 100;
} }
else else
{ {
coursePrice -= coursePreferentialModel.PriceMoney; coursePrice -= (coursePreferentialModel?.PriceMoney ?? 0);
} }
#region 记录提成信息 #region 记录提成信息
if (coursePreferentialModel == null) { if (coursePreferentialModel == null) {
......
...@@ -93,6 +93,11 @@ namespace Edu.Module.Duty ...@@ -93,6 +93,11 @@ namespace Edu.Module.Duty
} }
model.ReserveClassId = reserveClass.ReserveClassId; model.ReserveClassId = reserveClass.ReserveClassId;
} }
if (visitor_ReserveRepository.ExistsVisitorReserveRepository(model))
{
message = string.Format("已存在此访客的预约试听课信息,请重新选择!");
return false;
}
if (model.Id > 0) if (model.Id > 0)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
...@@ -121,10 +126,6 @@ namespace Edu.Module.Duty ...@@ -121,10 +126,6 @@ namespace Edu.Module.Duty
public RB_Visitor_Reserve_Extend GetVisitorReserveModule(int Id) public RB_Visitor_Reserve_Extend GetVisitorReserveModule(int Id)
{ {
var extModel = visitor_ReserveRepository.GetEntity<RB_Visitor_Reserve_Extend>(Id); var extModel = visitor_ReserveRepository.GetEntity<RB_Visitor_Reserve_Extend>(Id);
if (extModel != null && extModel.Id > 0)
{
}
return extModel; return extModel;
} }
...@@ -183,7 +184,8 @@ namespace Edu.Module.Duty ...@@ -183,7 +184,8 @@ namespace Edu.Module.Duty
}); });
foreach (var item in list) foreach (var item in list)
{ {
item.JoinNum = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId)?.FirstOrDefault()?.JoinNum ?? 0; item.JoinNum = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId)?.Count()??0;
item.VisitorList = visitorList?.Where(qitem => qitem.ReserveClassId == item.ReserveClassId)?.ToList() ?? new List<RB_Visitor_Reserve_Extend>();
} }
} }
return list; return list;
...@@ -252,19 +254,7 @@ namespace Edu.Module.Duty ...@@ -252,19 +254,7 @@ namespace Edu.Module.Duty
/// <returns></returns> /// <returns></returns>
public bool CheckReserveClassExistsModule(RB_Reserve_Class_Extend model) public bool CheckReserveClassExistsModule(RB_Reserve_Class_Extend model)
{ {
List<WhereHelper> whereHelpers = new List<WhereHelper>(); return reserve_ClassRepository.ExistsReserveClassRepository(model);
whereHelpers.Add(new WhereHelper(nameof(RB_Reserve_Class_Extend.ClassDate), model.ClassDate));
whereHelpers.Add(new WhereHelper(nameof(RB_Reserve_Class_Extend.TeacherId), model.TeacherId));
if (model.ReserveClassId > 0)
{
whereHelpers.Add(new WhereHelper()
{
FiledName = nameof(RB_Reserve_Class_Extend.TeacherId),
FiledValue = model.TeacherId,
OperatorEnum = OperatorEnum.NotEqual
});
}
return reserve_ClassRepository.Exists(whereHelpers);
} }
/// <summary> /// <summary>
...@@ -324,8 +314,8 @@ namespace Edu.Module.Duty ...@@ -324,8 +314,8 @@ namespace Edu.Module.Duty
var visitorReserve = visitor_ReserveRepository.GetVisitorReserveStaticsListRepository(new RB_Visitor_Reserve_Extend() var visitorReserve = visitor_ReserveRepository.GetVisitorReserveStaticsListRepository(new RB_Visitor_Reserve_Extend()
{ {
Q_ReserveClassIds = ReserveClassId.ToString() Q_ReserveClassIds = ReserveClassId.ToString()
})?.FirstOrDefault(); });
if ((visitorReserve?.JoinNum ?? 0) > 0) if ((visitorReserve?.Count ?? 0) > 0)
{ {
message = "此试听课存在客户报名信息,不能删除!"; message = "此试听课存在客户报名信息,不能删除!";
return false; return false;
......
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -101,5 +101,38 @@ WHERE 1=1 ...@@ -101,5 +101,38 @@ WHERE 1=1
} }
return Get<RB_Reserve_Class_Extend>(builder.ToString(),parameters).ToList(); return Get<RB_Reserve_Class_Extend>(builder.ToString(),parameters).ToList();
} }
/// <summary>
/// 检查是否存在
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public bool ExistsReserveClassRepository(RB_Reserve_Class_Extend query)
{
int result = 0;
var startTime = query.ClassDateStr + " " + query.ClassTime + ":00";
var endTime= query.ClassDateStr + " " + query.EndTime + ":00";
StringBuilder builder = new StringBuilder();
//CONCAT(substring(C.ClassDate,1,10),' ',C.ClassTime,':00') AS StartTime,CONCAT(substring(C.ClassDate,1,10),' ',C.EndTime,':00') AS EndTime
builder.AppendFormat(@"
SELECT 1
FROM RB_Reserve_Class c
WHERE 1=1 AND c.Status=0 AND NOT(CONCAT(substring(C.ClassDate,1,10),' ',C.ClassTime,':00')> '{0}' or CONCAT(substring(C.ClassDate,1,10),' ',C.EndTime,':00')< '{1}')
", endTime, startTime);
if (query.TeacherId > 0)
{
builder.AppendFormat(" AND C.TeacherId={0} ", query.TeacherId);
}
if (query.ReserveClassId > 0)
{
builder.AppendFormat(" AND C.ReserveClassId<>{0} ", query.ReserveClassId);
}
var obj= base.ExecuteScalar(builder.ToString());
if (obj != null)
{
Int32.TryParse(obj.ToString(), out result);
}
return result>0;
}
} }
} }
...@@ -142,10 +142,10 @@ WHERE 1=1 ...@@ -142,10 +142,10 @@ WHERE 1=1
builder.AppendFormat(@" AND A.{0} IN ({1}) ", nameof(RB_Visitor_Reserve_Extend.ReserveClassId), query.Q_ReserveClassIds); builder.AppendFormat(@" AND A.{0} IN ({1}) ", nameof(RB_Visitor_Reserve_Extend.ReserveClassId), query.Q_ReserveClassIds);
} }
string sql = string.Format(@" string sql = string.Format(@"
SELECT A.ReserveClassId,COUNT(1) AS JoinNum SELECT A.*,IFNULL(B.`Name`,'') AS VisitorName
FROM RB_Visitor_Reserve AS A FROM RB_Visitor_Reserve AS A LEFT JOIN rb_visitor AS B ON A.Visitor_Id=B.Id
WHERE 1=1 {0} WHERE 1=1 {0}
GROUP BY A.ReserveClassId ", builder.ToString()); ", builder.ToString());
return Get<RB_Visitor_Reserve_Extend>(sql, parameters).ToList(); return Get<RB_Visitor_Reserve_Extend>(sql, parameters).ToList();
} }
...@@ -178,5 +178,39 @@ WHERE 1=1 ...@@ -178,5 +178,39 @@ WHERE 1=1
} }
return Get<RB_Visitor_ViewModel>(builder.ToString(), parameters).ToList(); return Get<RB_Visitor_ViewModel>(builder.ToString(), parameters).ToList();
} }
/// <summary>
/// 检查是否存在此访客的约课信息
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public bool ExistsVisitorReserveRepository(RB_Visitor_Reserve_Extend query)
{
int result = 0;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT 1
FROM RB_Visitor_Reserve AS A
WHERE 1=1 AND A.Status=0
");
if (query.Visitor_Id > 0)
{
builder.AppendFormat(" AND A.Visitor_Id={0} ", query.Visitor_Id);
}
if (query.ReserveClassId > 0)
{
builder.AppendFormat(" AND A.ReserveClassId={0} ", query.ReserveClassId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.Id<>{0} ", query.Id);
}
var obj = base.ExecuteScalar(builder.ToString());
if (obj != null)
{
Int32.TryParse(obj.ToString(), out result);
}
return result > 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