Commit 8ff638e1 authored by liudong1993's avatar liudong1993

1

parent e821bfbc
......@@ -345,5 +345,86 @@ namespace Edu.Module.Course
})
};
}
/// <summary>
/// 通过我的学生直接转订单客人
/// </summary>
/// <param name="orderId"></param>
/// <param name="stuIds"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetMyStudentToGuest(int orderId, string stuIds, UserInfo userInfo)
{
var orderModel = orderRepository.GetEntity(orderId);
var courseModel = courseRepository.GetEntity(orderModel.CourseId);
//查询学生列表
var StuList = studentRepository.GetStudentListRepository(new RB_Student_ViewModel() { Group_Id = userInfo.Group_Id, StuIds = stuIds, School_Id = -1 });
//根据客人手机号码 验证是否是续费
if (StuList.Select(x => x.CustomerId).Distinct().Count() > 1)
{
return "只能选择同一同行的学生";
}
if (StuList.FirstOrDefault().CustomerId != orderModel.CustomerId)
{
return "同业信息有误";
}
//验证数量
int StuNum = StuList.Count();
var glist = order_GuestRepository.GetSingleListRepository(new RB_Order_Guest_ViewModel() { Group_Id = userInfo.Group_Id, OrderId = orderModel.OrderId, GuestState = GuestStateEnum.Normal });
if (glist.Count() + StuNum > orderModel.GuestNum)
{
return "学生选择超出" + (glist.Count() + StuNum - orderModel.GuestNum) + "位";
}
foreach (var item in StuList) {
if (glist.Where(x => x.Mobile == item.StuTel).Any()) {
return "学生" + item.StuName + "已录入学生名单中,请核实后再试";
}
}
foreach (var item in StuList)
{
var guestModel = new RB_Order_Guest_ViewModel()
{
Id = 0,
OrderId = orderModel.OrderId,
ClassId = orderModel.ClassId,
GuestName = item.StuName,
GuestState = GuestStateEnum.Normal,
Profession = item?.StuProfession ?? "",
Sex = (item?.StuSex ?? 1) + 1,
Age = item.StuBirth.HasValue ? DateTime.Now.Year - item.StuBirth.Value.Year : 18,
Mobile = item?.StuTel ?? "",
Basics = "",
Education = item?.StuEducation ?? GuestEducationEnum.N2,
GuestSource = orderModel.OrderSource,
LearningGoals = item?.StuPurpose ?? GuestLearningGoalsEnum.Love,
Contact = item?.StuContract ?? "",
ContactMobile = item?.StuContractMobile ?? "",
Status = 0,
Group_Id = orderModel.Group_Id,
School_Id = orderModel.School_Id,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
UpdateBy = userInfo.Id,
UpdateTime = DateTime.Now,
DropOutRemark = "",
IDCard = item?.StuIDCard ?? "",
Domicile = item?.StuIDCardAddress ?? "",
ContactAddress = item?.StuAddress ?? "",
SourceId = 0,
GraduatedSchool = "",
GraduatedMajor = "",
VolunteerMajor = "",
Price = 0,
StudyRemark = "",
CompleteHours = 0,
MakeUpHours = 0,
StuIcon = item.StuIcon,
TotalHours = Convert.ToInt32(courseModel.ClassHours),
RenewState = 1
};
SetOrderGuestInfo(guestModel, out string Nmessage);
}
return "";
}
}
}
\ No newline at end of file
......@@ -43,6 +43,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_Extend.CustomerId), query.CustomerId);
}
if (query.CreateBy > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_Extend.CreateBy), query.CreateBy);
}
if (!string.IsNullOrEmpty(query.CustomerName))
{
builder.AppendFormat(" AND A.{0} LIKE @CustomerName ", nameof(RB_Customer_Extend.CustomerName));
......
......@@ -238,6 +238,38 @@ WHERE 1=1 AND A.Status=0
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Order_Guest_ViewModel> GetSingleListRepository(RB_Order_Guest_ViewModel demodel)
{
string where = $@" 1=1 AND Status=0";
if (demodel.Group_Id > 0)
{
where += $@" AND {nameof(RB_Order_Guest_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.OrderId > 0)
{
where += $@" AND {nameof(RB_Order_Guest_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.ClassId > 0)
{
where += $@" AND {nameof(RB_Order_Guest_ViewModel.ClassId)} ={demodel.ClassId}";
}
if (!string.IsNullOrEmpty(demodel.OrderIds))
{
where += $@" AND {nameof(RB_Order_Guest_ViewModel.OrderId)} in({demodel.OrderIds})";
}
if (demodel.GuestState > 0)
{
where += $@" AND {nameof(RB_Order_Guest_ViewModel.GuestState)} ={(int)demodel.GuestState}";
}
string sql = $@" SELECT * FROM RB_Order_Guest WHERE {where}";
return Get<RB_Order_Guest_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
......
......@@ -1268,6 +1268,33 @@ namespace Edu.WebApi.Controllers.Course
}
}
/// <summary>
/// 通过我的学生直接转订单客人
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMyStudentToGuest() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int OrderId = parms.GetInt("OrderId", 0);//订单
string StuIds = parms.GetStringValue("StuIds");//学生Ids
if (OrderId <= 0) {
return ApiResult.ParamIsNull("订单不存在");
}
if (string.IsNullOrEmpty(StuIds)) {
return ApiResult.ParamIsNull("请选择学生");
}
string msg = orderModule.SetMyStudentToGuest(OrderId, StuIds, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
#region 销售中心
......
......@@ -44,7 +44,7 @@ namespace Edu.WebApi.Controllers.Customer
/// <returns></returns>
[HttpPost]
public ApiResult GetCustomerPage()
{
{
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Customer_Extend()
{
......@@ -54,7 +54,7 @@ namespace Edu.WebApi.Controllers.Customer
ContactNumber = base.ParmJObj.GetStringValue("ContactNumber"),
ApproveState = base.ParmJObj.GetInt("ApproveState"),
QCustomerState = base.ParmJObj.GetInt("QCustomerState"),
};
};
var list = customerModule.GetCustomerPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
......@@ -449,6 +449,54 @@ namespace Edu.WebApi.Controllers.Customer
[HttpPost]
public ApiResult GetCustomerPageList_V2()
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Customer_Extend()
{
Group_Id = base.UserInfo.Group_Id,
CustomerId = base.ParmJObj.GetInt("CustomerId"),
CustomerName = base.ParmJObj.GetStringValue("CustomerName"),
ContactNumber = base.ParmJObj.GetStringValue("ContactNumber"),
ApproveState = base.ParmJObj.GetInt("ApproveState"),
QCustomerState = base.ParmJObj.GetInt("QCustomerState"),
};
query.CreateBy = userInfo.Id;
var list = customerModule.GetCustomerPageModule_V2(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
}
pageModel.PageData = list.Select(x => new
{
x.CustomerId,
x.CustomerName,
x.ContactNumber,
x.EnterpriseName,
x.CustomerType,
x.StuNum,
x.OrderNum,
x.OrderSales,
x.ApproveState,
x.ApproveStateStr,
x.CreateBy,
x.CreateByName,
x.CreateTimeStr
});
pageModel.Count = rowsCount;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取同行分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAllCustomerPageList()
{
var userInfo = base.UserInfo;
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Customer_Extend()
{
......@@ -458,6 +506,7 @@ namespace Edu.WebApi.Controllers.Customer
ContactNumber = base.ParmJObj.GetStringValue("ContactNumber"),
ApproveState = base.ParmJObj.GetInt("ApproveState"),
QCustomerState = base.ParmJObj.GetInt("QCustomerState"),
CreateBy = base.ParmJObj.GetInt("CreateBy")
};
var list = customerModule.GetCustomerPageModule_V2(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
......
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