Commit af544f53 authored by 吴春's avatar 吴春

解决冲突

parents bf793f53 52362a23
......@@ -12,6 +12,11 @@ namespace Mall.Model.Extend.Point
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserPhoto { get; set; }
/// <summary>
/// 点数商品id
......
......@@ -40,6 +40,11 @@ namespace Mall.Model.Extend.Point
public string Photo { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserPhoto { get; set; }
/// <summary>
/// 开始时间
/// </summary>
......
......@@ -50,7 +50,15 @@ namespace Mall.Model.Extend.Point
/// </summary>
public int IsFree { get; set; }
/// <summary>
/// 确认数量
/// </summary>
public int ConfirmNum { get; set; }
/// <summary>
/// 课程状态 1未上课 2已上课
/// </summary>
public int CourseStudyState { get; set; }
/// <summary>
/// 学习开始时间
......
......@@ -4,9 +4,13 @@ using System.Linq;
using System.Text;
using Mall.Model.Extend.Point;
using Mall.Module.User;
using Mall.Repository.Education;
using Mall.Repository.Point;
using Mall.Repository.User;
using VT.FW.DB;
using Mall.Common;
using Mall.Common.API;
using Mall.Common.Plugin;
namespace Mall.Module.Education
{
......@@ -25,6 +29,10 @@ namespace Mall.Module.Education
private readonly RB_Point_CourseClassRepository pointCourseClassRepository = new RB_Point_CourseClassRepository();
private readonly RB_Point_TeacherCourseRepository pointTeacherCourseRepository = new RB_Point_TeacherCourseRepository();
private readonly RB_Point_TeacherCourseOrderRepository pointTeacherCourseOrderRepository = new RB_Point_TeacherCourseOrderRepository();
/// <summary>
/// 教育老师
/// </summary>
private readonly RB_Education_TeacherRepository education_TeacherRepository = new RB_Education_TeacherRepository();
......@@ -173,9 +181,8 @@ namespace Mall.Module.Education
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_Point_Order_Extend> GetPointGoodsPageList(int pageIndex, int pageSize, out long rowsCount, RB_Point_Order_Extend where)
public List<RB_Point_Order_Extend> GetPointOrderPageList(int pageIndex, int pageSize, out long rowsCount, RB_Point_Order_Extend where)
{
return pointOrderRepository.GetPointOrderPageList(pageIndex, pageSize, out rowsCount, where);
}
......@@ -338,6 +345,89 @@ namespace Mall.Module.Education
}
#endregion
#region 教师列表
/// <summary>
/// 获取教师上课分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Point_TeacherCourse_Extend> GetPointTeacherCoursePageList(int pageIndex, int pageSize, out long count, RB_Point_TeacherCourse_Extend demodel)
{
var list = pointTeacherCourseRepository.GetPointTeacherCoursePageList(pageIndex, pageSize, out count, demodel);
return list;
}
/// <summary>
/// 获取教师课程明细
/// </summary>
/// <param name="courseId"></param>
/// <param name="teacherId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public ApiResult GetPointTeacherCourseDetail(int courseId, int teacherId, AppletUserInfo userInfo)
{
var model = pointTeacherCourseRepository.GetEntity(courseId);
if (model == null) { return ApiResult.Failed("课程不存在"); }
if (model.TeacherId != teacherId) { return ApiResult.Failed("您不是该课程教师,无法查看"); }
var classModel = pointCourseClassRepository.GetEntity(model.CourseClassId);
if (classModel == null) { return ApiResult.Failed("课程分类不存在"); }
//查询该课程下所有的订单
var orderList = pointTeacherCourseOrderRepository.GetNormalPointOrderList(new RB_Point_TeacherCourseOrder_Extend() { TenantId = userInfo.TenantId, CourseId = courseId });
return ApiResult.Success("", new
{
model.ID,
model.CourseClassId,
classModel.CourseClassType,
CourseClassTypeName = classModel.CourseClassType.GetEnumName(),
classModel.StudentNumType,
StudentNumTypeName = classModel.StudentNumType.GetEnumName(),
model.CourseName,
model.TeacherId,
StudyDate = model.StudyDate.ToString("yyyy-MM-dd"),
model.StudyStartDate,
model.StudyEndDate,
model.PointNum,
model.MinDuration,
model.StudyDuration,
DurationUnit = model.DurationUnit.GetEnumName(),
OrderList = orderList.Select(x=>new {
x.ID,
x.UserId,
x.UserName,
x.UserPhoto,
StudyDate = x.StudyDate.ToString("yyyy-MM-dd HH:mm"),
x.StudyDuration,
x.TotalStudyDuration,
DurationUnit = x.DurationUnit.GetEnumName(),
x.OrderStaus,
OrderStausName = x.OrderStaus.GetEnumName(),
x.IsSendRoom,
x.RoomInfo,
x.TotalPointNum,
x.ActualPointNum,
x.BasePointNum,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
})
});
}
/// <summary>
/// 获取教师id
/// </summary>
/// <param name="tid"></param>
/// <param name="userId"></param>
/// <returns></returns>
public int GetUserTeacherId(int tid, int userId)
{
var model = education_TeacherRepository.GetTeacherList(new Model.Extend.Education.RB_Education_Teacher_Extend() { TenantId = tid, UserId = userId, TeacherStatus = 1 }).FirstOrDefault();
return model?.ID ?? 0;
}
#endregion
#region 在线课程分类
/// <summary>
......
......@@ -78,7 +78,7 @@ namespace Mall.Repository.Education
{
builder.Append($" AND a.{nameof(RB_Education_Teacher_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
if (query.MallBaseId > 0)
{
builder.Append($" AND a.{nameof(RB_Education_Teacher_Extend.MallBaseId)}={query.MallBaseId}");
}
......
......@@ -55,7 +55,7 @@ namespace Mall.Repository.Point
public List<RB_Point_Order_Extend> GetPointOrderPageList(int pageIndex, int pageSize, out long rowsCount, RB_Point_Order_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name` as UserName from RB_Point_order as a LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.state=0 ");
sb.Append($@"SELECT a.*,b.`Name` as UserName,b.Photo as UserPhoto from RB_Point_order as a LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.state=0 ");
if (where != null)
{
if (where.TenantId > 0)
......@@ -74,7 +74,16 @@ namespace Mall.Repository.Point
{
sb.AppendFormat(" and a.OrderStatus={0}", where.OrderStatus);
}
if (where.UserId > 0)
{
sb.AppendFormat(" and a.UserId={0}", where.UserId);
}
if (!string.IsNullOrEmpty(where.OrderNo))
{
sb.AppendFormat(" and a.OrderNo like '%{0}%'", where.OrderNo);
}
}
sb.Append(" order by a.ID desc");
return GetPage<RB_Point_Order_Extend>(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
}
......
......@@ -64,7 +64,59 @@ where a.state = 0");
return Get<RB_Point_TeacherCourseOrder_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 获取正常订单列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_Point_TeacherCourseOrder_Extend> GetNormalPointOrderList(RB_Point_TeacherCourseOrder_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name` as UserName,b.Photo as UserPhoto
from RB_Point_TeacherCourseOrder as a
LEFT JOIN rb_member_user as b on a.UserId=b.Id
where a.state=0 and a.OrderStaus in(2,3,4)");
if (where != null)
{
if (where.TenantId > 0)
{
sb.AppendFormat(" and a.TenantId={0}", where.TenantId);
}
if (where.MallBaseId > 0)
{
sb.AppendFormat(" and a.MallBaseId={0}", where.MallBaseId);
}
if (where.ID > 0)
{
sb.AppendFormat(" and a.ID={0}", where.ID);
}
if (where.TeacherId > 0)
{
sb.AppendFormat(" and a.TeacherId={0}", where.TeacherId);
}
if (where.CourseId > 0)
{
sb.AppendFormat(" and a.CourseId={0}", where.CourseId);
}
if (where.UserId > 0)
{
sb.AppendFormat(" and a.UserId={0}", where.UserId);
}
if (!string.IsNullOrEmpty(where.StartTime))
{
sb.AppendFormat(" and a.CreateDate >='{0}'", where.StartTime);
}
if (!string.IsNullOrEmpty(where.EndTime))
{
sb.AppendFormat(" and a.CreateDate <='{0}'", where.EndTime + " 23:59:59");
}
}
sb.AppendFormat(" order by a.ID desc");
return Get<RB_Point_TeacherCourseOrder_Extend>(sb.ToString()).ToList();
}
/// <summary>
......
......@@ -118,5 +118,70 @@ LEFT JOIN rb_education_teacher as et on tc.TeacherId=et.ID
}
return GetPage<RB_Point_TeacherCourse_Extend>(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_Point_TeacherCourse_Extend> GetPointTeacherCoursePageList(int pageIndex, int pageSize, out long count, RB_Point_TeacherCourse_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT tc.*,cc.CourseClassType,cc.StudentNumType,cc.IsPublic,cc.IsFree,o.ConfirmNum,o.OrderNum
from RB_Point_TeacherCourse as tc
LEFT JOIN rb_point_courseclass as cc on tc.CourseClassId=cc.ID
left join (SELECT CourseId,SUM(case when OrderStaus =2 then 1 else 0 end) AS ConfirmNum,COUNT(0) AS OrderNum
FROM rb_point_teachercourseorder WHERE State =0 and OrderStaus in (2,3,4) GROUP BY CourseId) o on tc.ID =o.CourseId
where tc.state=0 and cc.state=0 ");
if (where != null)
{
if (where.TenantId > 0)
{
sb.AppendFormat(" and tc.TenantId={0}", where.TenantId);
}
if (where.MallBaseId > 0)
{
sb.AppendFormat(" and tc.MallBaseId={0}", where.MallBaseId);
}
if (where.MallBaseId > 0)
{
sb.AppendFormat(" and tc.MallBaseId={0}", where.MallBaseId);
}
if (where.CourseClassId > 0)
{
sb.AppendFormat(" and tc.CourseClassId={0}", where.CourseClassId);
}
if (where.TeacherId > 0)
{
sb.AppendFormat(" and tc.TeacherId={0}", where.TeacherId);
}
if (!string.IsNullOrEmpty(where.SelectStartTime))
{
sb.AppendFormat(" AND DATE_FORMAT(tc.{0},'%y-%m-%d')>=DATE_FORMAT('{1}','%y-%m-%d') ", nameof(RB_Point_TeacherCourse_Extend.StudyDate), where.SelectStartTime);
}
if (!string.IsNullOrEmpty(where.SelectEndTime))
{
sb.AppendFormat(" AND DATE_FORMAT(tc.{0},'%y-%m-%d')<=DATE_FORMAT('{1}','%y-%m-%d') ", nameof(RB_Point_TeacherCourse_Extend.StudyDate), where.SelectEndTime);
}
if (where.ID > 0)
{
sb.AppendFormat(" and tc.ID={0}", where.ID);
}
if (where.CourseStudyState > 0) {
if (where.CourseStudyState == 1)
{
sb.AppendFormat(" AND CONCAT(DATE_FORMAT(StudyDate,'%Y-%m-%d'),' ',StudyEndDate) >= '{1}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
else if (where.CourseStudyState == 2)
{
sb.AppendFormat(" AND CONCAT(DATE_FORMAT(StudyDate,'%Y-%m-%d'),' ',StudyEndDate) < '{1}' ", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
}
}
return GetPage<RB_Point_TeacherCourse_Extend>(pageIndex, pageSize, out count, sb.ToString()).ToList();
}
}
}
......@@ -154,68 +154,73 @@ namespace Mall.WebApi.Controllers.Education
#region 个人中心-点数记录
/// <summary>
/// 小程序获取点数记录
/// 后台获取点数记录
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletUserPointDetailPageList()
public ApiResult GetUserPointDetailPageList()
{
var parms = RequestParm;
var userInfo = AppletUserInfo;
var userInfo = UserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Member_PointBalance_Extend demodel = JsonConvert.DeserializeObject<RB_Member_PointBalance_Extend>(RequestParm.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
var list = pointModule.GetUserPointDetailPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
int PointNum = pointModule.GetUserPointBalance(userInfo.UserId);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = new
list.ForEach(x =>
{
PointNum,
List = list.Select(x => new
{
x.Id,
x.Type,
TypeName = x.Type.GetEnumName(),
x.Description,
x.PonitNum,
x.Remarks,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
})
};
var umodel = UserReidsCache.GetAppletUserLoginInfo(x.UserId);
x.UserName = umodel?.Name ?? "";
x.UserPhoto = umodel?.Photo ?? "";
});
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Type,
TypeName = x.Type.GetEnumName(),
x.Description,
x.PonitNum,
x.Remarks,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.UserId,
x.UserName,
x.UserPhoto
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 后台获取点数记录
/// 后台获取充值订单列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetUserPointDetailPageList()
public ApiResult GetUserPointOrderPageList()
{
var parms = RequestParm;
var userInfo = UserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Member_PointBalance_Extend demodel = JsonConvert.DeserializeObject<RB_Member_PointBalance_Extend>(RequestParm.msg.ToString());
RB_Point_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Point_Order_Extend>(RequestParm.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
var list = pointModule.GetUserPointDetailPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
var list = pointModule.GetPointOrderPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
list.ForEach(x =>
{
var umodel = UserReidsCache.GetAppletUserLoginInfo(x.UserId);
x.UserName = umodel?.Name ?? "";
x.UserPhoto = umodel?.Photo ?? "";
});
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Type,
TypeName = x.Type.GetEnumName(),
x.Description,
x.ID,
x.OrderNo,
x.PonitNum,
x.Remarks,
x.OldPonitNum,
x.GivePoint,
x.Income,
PaymentTime = x.PaymentTime.HasValue ? x.PaymentTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.PaymentWay,
PaymentWayName = x.PaymentWay.GetEnumName(),
x.OrderStatus,
x.OrderSource,
OrderSourceName = x.OrderSource.GetEnumName(),
x.PayWay,
PayWayName = x.PayWay.GetEnumName(),
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.UserId,
x.UserName,
......
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