Commit f4a9173a authored by 黄奎's avatar 黄奎

页面修改

parent c3e0fd6c
......@@ -69,5 +69,10 @@ namespace Edu.Model.ViewModel.Customer
/// 操作时间字符串
/// </summary>
public string UpdateTimeStr { get { return Common.ConvertHelper.FormatTime(this.UpdateTime); } }
/// <summary>
/// 订单编号
/// </summary>
public string QOrderIds { get; set; }
}
}
......@@ -2373,7 +2373,7 @@ namespace Edu.Module.Course
StudentId = guestModel.Id,
CustomerId = 1,
Title = "欠费预警",
Content = "学员" + guestModel.GuestName + " 即将欠费,剩余课时"+ shenyuHours + ",关联单号:"+ guestModel.OrderId + "!",
Content = "学员" + guestModel.GuestName + " 即将欠费,剩余课时" + shenyuHours + ",关联单号:" + guestModel.OrderId + "!",
IsLook = 2,
Status = 0,
CreateBy = item.CreateBy,
......@@ -4803,23 +4803,65 @@ namespace Edu.Module.Course
/// <returns></returns>
public object AppCustomerGetClassPlan(int student_stuId)
{
decimal SurplusClassHours = 0;
List<object> list = new List<object>();
GetStudentCurrentOrderModule(student_stuId, out int newClassStatus, out string classStatusName, out int classId, out decimal SurplusClassHours);
if (classId > 0)
{
var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel()
{
ClassId = classId,
StartTime = Common.ConvertHelper.FormatDate(DateTime.Now)
});
var disList = planList.GroupBy(qitem => new { qitem.ClassId, qitem.ClassDate }).Select(qitem => new { qitem.Key.ClassId, qitem.Key.ClassDate }).Take(10);
foreach (var item in disList)
{
var tempModel = planList.Where(qitem => qitem.ClassId == item.ClassId && qitem.ClassDate == item.ClassDate)?.OrderBy(qitem => qitem.StartTime)?.FirstOrDefault();
list.Add(new
{
tempModel?.CourseName,
tempModel?.RoomName,
tempModel?.TeacherName,
TeacherIcon = tempModel?.UserIcon,
ClassTime = Common.ConvertHelper.FormatDate2(tempModel?.ClassDate) + " " + tempModel?.StartTime
});
}
}
var result = new
{
classStatus = newClassStatus,
classStatusName,
SurplusClassHours,
PlanList = list
};
return result;
}
/// <summary>
/// 获取学员当前订单
/// </summary>
/// <param name="student_stuId"></param>
public void GetStudentCurrentOrderModule(int student_stuId, out int newClassStatus, out string classStatusName, out int classId, out decimal SurplusClassHours)
{
newClassStatus = 1;
classStatusName = "学习中";
SurplusClassHours = 0;
classId = 0;
ClassStatusEnum classStatus = 0;
GuestStateEnum StuGuestState = 0;
List<object> list = new List<object>();
var stuOrderList= student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
var stuOrderList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
{
Student_Id = student_stuId
});
if (stuOrderList != null && stuOrderList.Count > 0)
{
var firstModel= stuOrderList.Where(qitem =>
qitem.OrderState == OrderStateEnum.Normal
&& qitem.ClassStatus != ClassStatusEnum.EndClass
&& (qitem.TotalHours - qitem.CompleteHours) > 0)
?.OrderBy(qitem => qitem.OrderId)
?.FirstOrDefault();
int classId = firstModel?.ClassId??0;
var firstModel = stuOrderList.Where(qitem =>
qitem.OrderState == OrderStateEnum.Normal
&& qitem.ClassStatus != ClassStatusEnum.EndClass
&& (qitem.TotalHours - qitem.CompleteHours) > 0)
?.OrderBy(qitem => qitem.OrderId)
?.FirstOrDefault();
classId = firstModel?.ClassId ?? 0;
classStatus = firstModel?.ClassStatus ?? 0;
StuGuestState = firstModel?.StuGuestState ?? 0;
SurplusClassHours = (firstModel?.TotalHours ?? 0) - (firstModel?.CompleteHours ?? 0);
......@@ -4827,38 +4869,35 @@ namespace Edu.Module.Course
{
SurplusClassHours = 0;
}
if (classId > 0)
}
if (classStatus == ClassStatusEnum.NonOpenClass)
{
newClassStatus = 0;
classStatusName = "未开班";
}
else
{
switch (StuGuestState)
{
var planList = class_PlanRepository.GetClassPlanListExtRepository(new RB_Class_Plan_ViewModel()
{
ClassId = classId,
StartTime = Common.ConvertHelper.FormatDate(DateTime.Now)
});
var disList = planList.GroupBy(qitem => new { qitem.ClassId, qitem.ClassDate }).Select(qitem => new { qitem.Key.ClassId, qitem.Key.ClassDate }).Take(10);
foreach (var item in disList)
{
var tempModel = planList.Where(qitem => qitem.ClassId == item.ClassId && qitem.ClassDate == item.ClassDate)?.OrderBy(qitem => qitem.StartTime)?.FirstOrDefault();
list.Add(new
{
tempModel?.CourseName,
tempModel?.RoomName,
tempModel?.TeacherName,
TeacherIcon=tempModel?.UserIcon,
ClassTime= Common.ConvertHelper.FormatDate2(tempModel?.ClassDate) +" "+tempModel?.StartTime
});
}
case GuestStateEnum.Normal:
newClassStatus = 1;
classStatusName = "学习中";
break;
case GuestStateEnum.DropOut:
newClassStatus = 2;
classStatusName = "已休学";
break;
case GuestStateEnum.StopClasses:
newClassStatus = 3;
classStatusName = "欠费";
break;
case GuestStateEnum.Graduate:
newClassStatus = 4;
classStatusName = "已结束";
break;
}
}
var result = new
{
classStatus,
classStatusName = classStatus.ToName(),
StuGuestState,
StuGuestStateName = StuGuestState.ToName(),
SurplusClassHours,
PlanList = list
};
return result;
}
}
}
}
\ No newline at end of file
......@@ -30,5 +30,16 @@ namespace Edu.Module.Customer
return list;
}
/// <summary>
/// 获取客户返佣或幸福存折列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Customer_BalanceDetail_ViewModel> GetCustomerBalanceDetailListModule(RB_Customer_BalanceDetail_ViewModel query)
{
var list = customer_BalanceDetailRepository.GetCustomerBalanceDetailListRepository(query);
return list;
}
}
}
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Customer
{
......@@ -13,7 +14,7 @@ namespace Edu.Repository.Customer
public class RB_Customer_BalanceDetailRepository : BaseRepository<RB_Customer_BalanceDetail>
{
/// <summary>
/// 获取客户幸福存折分页列表
/// 获取客户返佣或幸福存折分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
......@@ -22,6 +23,7 @@ namespace Edu.Repository.Customer
/// <returns></returns>
public List<RB_Customer_BalanceDetail_ViewModel> GetCustomerBalanceDetailPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Customer_BalanceDetail_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(b.ClassName,'') AS ClassName,IFNULL(B.ClassNo,'') AS ClassNo,IFNULL(C.CustomerName,'') AS CustomerName
......@@ -51,10 +53,69 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.OrderId), query.OrderId);
}
if (!string.IsNullOrEmpty(query.Description))
{
builder.AppendFormat(" AND A.{0} LIKE @Description ", nameof(RB_Customer_BalanceDetail_ViewModel.Description));
parameters.Add("Description", "%" + query.Description.Trim() + "%");
}
}
return GetPage<RB_Customer_BalanceDetail_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取客户返佣或幸福存折列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Customer_BalanceDetail_ViewModel> GetCustomerBalanceDetailListRepository( RB_Customer_BalanceDetail_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(b.ClassName,'') AS ClassName,IFNULL(B.ClassNo,'') AS ClassNo,IFNULL(C.CustomerName,'') AS CustomerName
FROM RB_Customer_BalanceDetail AS A LEFT JOIN rb_class AS B ON A.ClassId=B.ClassId
LEFT JOIN rb_customer AS C ON A.CustomerId=C.CustomerId
WHERE 1=1
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.Group_Id), query.Group_Id);
}
if (query.CustomerId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.CustomerId), query.CustomerId);
}
if (query.RebateType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.RebateType), query.RebateType);
}
if (query.BalanceType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.BalanceType), query.BalanceType);
}
if (query.OrderId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Customer_BalanceDetail_ViewModel.OrderId), query.OrderId);
}
if (!string.IsNullOrEmpty(query.Description))
{
builder.AppendFormat(" AND A.{0} LIKE @Description ", nameof(RB_Customer_BalanceDetail_ViewModel.Description));
parameters.Add("Description", "%" + query.Description.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.QOrderIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Customer_BalanceDetail_ViewModel.OrderId), query.QOrderIds);
}
}
return Get<RB_Customer_BalanceDetail_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取可发放返佣的列表
/// </summary>
......
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Customer;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Sell;
using Edu.Module.Course;
using Edu.Module.Customer;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
......@@ -33,6 +35,11 @@ namespace Edu.WebApi.Controllers.B2BApp
/// </summary>
private readonly ClassModule classModule = new ClassModule();
/// <summary>
/// 客户返佣和幸福存折处理类对象
/// </summary>
private readonly CustomerBalanceDetailModule customerBalanceDetailModule = new CustomerBalanceDetailModule();
/// <summary>
/// 同行获取学员订单分页列表
/// </summary>
......@@ -51,15 +58,22 @@ namespace Edu.WebApi.Controllers.B2BApp
};
var list = orderModule.GetMyOrderPageList(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
List<RB_Class_Time_ViewModel> timeList = new List<RB_Class_Time_ViewModel>();
List<RB_Customer_BalanceDetail_ViewModel> balanceList = new List<RB_Customer_BalanceDetail_ViewModel>();
if (list != null && list.Count > 0)
{
string classIds = string.Join(",", list.Select(qitem => qitem.ClassId));
timeList= orderModule.GetClassOpenTimeListModule(classIds);
string orderIds = string.Join(",", list.Select(qitem => qitem.OrderId));
balanceList= customerBalanceDetailModule.GetCustomerBalanceDetailListModule(new RB_Customer_BalanceDetail_ViewModel()
{
QOrderIds = orderIds
});
}
List<object> result = new List<object>();
foreach (var item in list)
{
var timeModel = timeList.Where(qitem => qitem.ClassId == item.ClassId)?.FirstOrDefault();
var timeModel = timeList.Where(qitem => qitem.ClassId == item.ClassId)?.FirstOrDefault();
var tempBalanceList = balanceList?.Where(qitem => qitem.OrderId == item.OrderId)?.ToList();
result.Add(new
{
item.CourseId,
......@@ -79,8 +93,8 @@ namespace Edu.WebApi.Controllers.B2BApp
item.Income,
item.ClassStatus,
ClassStatusName = item.ClassStatus.ToName(),
RebateMoney = 0,
DepositbookMoney = 0,
RebateMoney = tempBalanceList?.Where(qitem=>qitem.RebateType==1)?.Sum(qitem=>qitem.Money)??0,
DepositbookMoney = tempBalanceList?.Where(qitem => qitem.RebateType == 2)?.Sum(qitem => qitem.Money) ?? 0,
item.B2BBackground,
item.B2BIcon,
});
......
......@@ -348,6 +348,7 @@ namespace Edu.WebApi.Controllers.Customer
BalanceType = base.ParmJObj.GetInt("BalanceType"),
CustomerId=base.ParmJObj.GetInt("CustomerId"),
OrderId=base.ParmJObj.GetInt("OrderId"),
Description=base.ParmJObj.GetStringValue("Description"),
};
var list = balanceDetailModule.GetCustomerBalanceDetailPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
......
......@@ -11,6 +11,7 @@ using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Log;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.Log;
using Edu.Module.User;
using Edu.WebApi.Filter;
......@@ -89,6 +90,11 @@ namespace Edu.WebApi.Controllers.User
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 班级处理类对象
/// </summary>
private readonly ClassModule classModule = new ClassModule();
#region 用户账户管理
/// <summary>
......@@ -793,6 +799,7 @@ namespace Edu.WebApi.Controllers.User
{
var StuId = base.ParmJObj.GetInt("StuId", 0);
var extModel = studentModule.GetStudentModule(StuId);
classModule.GetStudentCurrentOrderModule(StuId, out int newClassStatus, out string classStatusName, out _, out _);
var obj = new
{
extModel.StuId,
......@@ -824,6 +831,8 @@ namespace Edu.WebApi.Controllers.User
extModel.StuIDCard,
extModel.StuIDCardAddress,
CreateTimeStr=Common.ConvertHelper.FormatDate(extModel.CreateTime),
newClassStatus,
classStatusName
};
return ApiResult.Success(data: obj);
}
......
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