Commit c33946b8 authored by 吴春's avatar 吴春

提交app代码

parent d7065bea
......@@ -23,6 +23,10 @@ namespace Edu.Common.Enum.System
/// </summary>
[EnumField("发送成功")]
Success = 3,
/// <summary>
/// 已读
/// </summary>
[EnumField("已读")]
Read = 4,
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Plugin;
namespace Edu.Common.Enum.System
{
public enum SystemTypeEnum
{
/// <summary>
/// 系统消息
/// </summary>
[EnumField("系统消息")]
SystemMsg = 1,
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.System;
using VT.FW.DB;
namespace Edu.Model.Entity.System
{
/// <summary>
/// 系统消息记录实体表
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_System_Log
{
public int ID { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 学生id
/// </summary>
public int Student_Id { get; set; }
/// <summary>
/// 发送时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 发送状态1:等待回执,2:发送失败,3:发送成功。
/// </summary>
public MsgSendStatusEnum? SendStatus { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 发送内容
/// </summary>
public string SendContent { get; set; }
/// <summary>
/// 发送标题
/// </summary>
public string SendTitle { get; set; }
/// <summary>
/// 发送图片信息
/// </summary>
public string PicUrl { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public SystemTypeEnum SystemType { get; set; }
}
}
......@@ -177,5 +177,15 @@ namespace Edu.Model.Entity.User
/// 基础课时费
/// </summary>
public decimal BaseHourFee { get; set; }
/// <summary>
/// 国籍
/// </summary>
public string Nationality { get; set; }
/// <summary>
/// 国籍图片
/// </summary>
public string ForeignersUrl { get; set; }
}
}
\ No newline at end of file
......@@ -133,5 +133,16 @@ namespace Edu.Model.ViewModel.Course
/// 原班级id
/// </summary>
public int OldClassId { get; set; }
/// <summary>
/// 班级最新计划Id
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 班级最新计划时间
/// </summary>
public DateTime? ClassDate { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.System;
namespace Edu.Model.ViewModel.System
{
public class RB_System_Log_ViewModel : RB_System_Log
{
/// <summary>
/// 发送状态 1-查询成功与与已读的
/// </summary>
public int SelectSendState { get; set; }
}
}
......@@ -1103,12 +1103,24 @@ namespace Edu.Module.Course
}
/// <summary>
/// 获取班级上课计划列表
/// 获取教室列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetClassPlanListRepository(RB_Class_Plan_ViewModel query)
public List<RB_Class_Check_ViewModel> GetClassCheckList(RB_Class_Check_ViewModel query)
{
return classCheckRepository.GetClassCheckList(query);
}
/// <summary>
/// 获取班级上课计划列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetClassPlanListRepository(RB_Class_Plan_ViewModel query)
{
return class_PlanRepository.GetClassPlanListRepository(query);
}
......@@ -1423,5 +1435,32 @@ namespace Edu.Module.Course
}
#endregion
#region 根据学生id获取最近的上课信息
/// <summary>
/// 根据学生id获取教师账户
/// </summary>
/// <param name="teacherIds"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetListByStudentId(int Student_Id, int Group_Id)
{
var list = classRepository.GetListByStudentId(Student_Id, Group_Id);
if (list != null && list.Any())
{
string classPlanIds = string.Join(",", list.Select(x => x.ClassPlanId));
var timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel { QClassPlanIds = classPlanIds, Group_Id = Group_Id });
if (timeList != null && timeList.Any())
{
foreach (var item in list)
{
item.ClassTimeList = new List<RB_Class_Time_ViewModel>();
item.ClassTimeList = timeList.Where(x => x.ClassPlanId == item.ClassPlanId).ToList();
item.ClassTimeList.ForEach(x => x.NewPlanDateTime = item.ClassDate.Value.ToString("yyyy-MM-dd") + " " + x.StartTime);
}
}
}
return list;
}
#endregion
}
}
......@@ -28,6 +28,12 @@ namespace Edu.Module.System
/// </summary>
private readonly RB_Msg_BaseTemplateRepository msgBaseTemplateRepository = new RB_Msg_BaseTemplateRepository();
/// <summary>
/// 系统消息记录仓储层对象
/// </summary>
private readonly RB_System_LogRepository systemLogRepository = new RB_System_LogRepository();
#region 短信记录
/// <summary>
/// 获取发送短信记录信息
......@@ -334,5 +340,28 @@ namespace Edu.Module.System
// ThirdCore.Message.SMSService.SendMsg("13551132417", PhoneMessage, "SMS_201722097", "印象之旅", "dysmsapi.aliyuncs.com", "LTAIwE7l9dImZSa3", "j47Ajn0d0WzUCIX8Biyj3P2r8QDltI", "cn-hangzhou");
}
#endregion
#region 系统消息
/// <summary>
/// 获取发送系统消息记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_System_Log_ViewModel> GetSystemLogListRepository(RB_System_Log_ViewModel query)
{
return systemLogRepository.GetListRepository(query);
}
/// <summary>
/// 获取发送系统消息记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_System_Log_ViewModel> GetSystemLogPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_System_Log_ViewModel query)
{
return systemLogRepository.GetPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
#endregion
}
}
......@@ -532,5 +532,10 @@ namespace Edu.Module.User
{
return teacherRepository.GetListByStudentId(Student_Id, Group_Id);
}
}
}
......@@ -344,5 +344,31 @@ GROUP BY Teacher_Id
",teacherIds);
return Get<TeacherClassStatic_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 根据学生id获取教师账户
/// </summary>
/// <param name="teacherIds"></param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetListByStudentId(int Student_Id, int Group_Id)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"SELECT c.*,cp.ClassPlanId,cp.ClassDate from rb_class as c
LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
LEFT JOIN (SELECT ClassId,MIN(ClassDate) as ClassDate,MIN(ClassPlanId) as ClassPlanId from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%y-%M-%d')>=DATE_FORMAT(now(),'%y-%M-%d') GROUP BY ClassId) as cp
on c.ClassId=cp.ClassId
where c.`Status`=0 and sog.`Status`=0 ");
builder.AppendFormat(" AND sog.Student_Id={0} ", Student_Id);
builder.AppendFormat(" AND c.{0}={1} ", nameof(RB_Class_ViewModel.Group_Id), Group_Id);
return Get<RB_Class_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
namespace Edu.Repository.System
{
public class RB_System_LogRepository : BaseRepository<RB_System_Log>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_System_Log); } }
/// <summary>
/// 获取发送系统消息记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_System_Log_ViewModel> GetListRepository(RB_System_Log_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} where 1=1 ");
if (query != null)
{
if (query.ID > 0)
{
builder.Append($" AND {nameof(RB_System_Log.ID)}={query.ID}");
}
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.Group_Id)}={query.Group_Id}");
}
if (query.School_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.School_Id)}={query.School_Id}");
}
if (query.Student_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.Student_Id)}={query.Student_Id}");
}
if (query.SelectSendState == 1)
{
builder.Append($" AND {nameof(RB_System_Log.SendStatus)}>=3");
}
if (query.SendStatus.HasValue && query.SendStatus > 0)
{
builder.Append($" AND {nameof(RB_System_Log.SendStatus)}={(int)query.SendStatus}");
}
}
return Get<RB_System_Log_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取发送系统消息记录信息
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_System_Log_ViewModel> GetPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_System_Log_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.Append($" SELECT * FROM {TableName} where 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.Group_Id)}={query.Group_Id}");
}
if (query.School_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.School_Id)}={query.School_Id}");
}
if (query.Student_Id > 0)
{
builder.Append($" AND {nameof(RB_System_Log.Student_Id)}={query.Student_Id}");
}
if (query.SelectSendState == 1)
{
builder.Append($" AND {nameof(RB_System_Log.SendStatus)}>=3");
}
if (query.SendStatus.HasValue && query.SendStatus > 0)
{
builder.Append($" AND {nameof(RB_System_Log.SendStatus)}={(int)query.SendStatus}");
}
//if (!string.IsNullOrWhiteSpace(query.StartDate))
//{
// builder.Append($" and DATE_FORMAT({nameof(RB_System_Log.CreateDate)},'%Y-%m-%d' )>=DATE_FORMAT('{query.StartDate}','%Y-%m-%d' ) ");
//}
//if (!string.IsNullOrWhiteSpace(query.EndDate))
//{
// builder.Append($" and DATE_FORMAT({nameof(RB_System_Log.CreateDate)},'%Y-%m-%d' )<= DATE_FORMAT('{query.EndDate}','%Y-%m-%d' ) ");
//}
if (!string.IsNullOrWhiteSpace(query.SendContent))
{
builder.Append($" and {nameof(RB_System_Log.SendContent)} like '%{query.SendContent}%' ");
}
}
return GetPage<RB_System_Log_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
......@@ -182,12 +182,12 @@ WHERE 1=1
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT * from rb_teacher as t
builder.AppendFormat($@"
SELECT t.* from rb_teacher as t
LEFT JOIN (SELECT ClassId,TeacherId from rb_class_plan where `Status`=0 GROUP BY ClassId,TeacherId) as cp on t.TId=cp.TeacherId
LEFT JOIN rb_class as c on cp.ClassId=c.ClassId
LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
where t.`Status`=0 and c.`Status`= and sog.`Status`=0 ");
where t.`Status`=0 and c.`Status`=0 and sog.`Status`=0 AND c.Group_Id={Group_Id}");
builder.AppendFormat(" AND sog.Student_Id={0} ", Student_Id);
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.Group_Id), Group_Id);
return Get<RB_Teacher_ViewModel>(builder.ToString(), parameters).ToList();
......
......@@ -6,6 +6,7 @@ using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.Entity.App;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.System;
using Edu.Module.User;
using Edu.WebApi.Filter;
......@@ -22,7 +23,9 @@ namespace Edu.WebApi.Controllers.APP
public class AppIndexController : AppBaseController
{
private StudentModule StudentModule = new StudentModule();
private StudentModule studentModule = new StudentModule();
private ClassModule classModule = new ClassModule();
private TeacherModule teacherModule = new TeacherModule();
private readonly AppHomePageModule appHomePageModule = AOP.AOPHelper.CreateAOPObject<AppHomePageModule>();
#region 首次登录后填写兴趣爱好
......@@ -43,7 +46,7 @@ namespace Edu.WebApi.Controllers.APP
School_Id = base.AppStudentInfo.School_Id,
StuId = base.AppStudentInfo.AccountId,
};
bool result = StudentModule.SetStudentInterest(query);
bool result = studentModule.SetStudentInterest(query);
if (result)
{
return ApiResult.Success("");
......@@ -64,9 +67,28 @@ namespace Edu.WebApi.Controllers.APP
{
Group_Id = base.AppStudentInfo.Group_Id,
};
var list = appHomePageModule.GetHomePageBannerList(query).OrderBy(x => x.Sort);
return ApiResult.Success("", list);
var list = appHomePageModule.GetHomePageBannerList(query).OrderBy(x => x.Sort);//banner图
var teacherList = teacherModule.GetListByStudentId(base.AppStudentInfo.AccountId, base.AppStudentInfo.Group_Id);//老师
//课程信息
var planList = classModule.GetListByStudentId(base.AppStudentInfo.AccountId, base.AppStudentInfo.Group_Id);
DateTime NextClassTime = System.DateTime.Now;
foreach (var item in planList)
{
DateTime nowTime = item.ClassTimeList.Min(x => Convert.ToDateTime(x.NewPlanDateTime));
if (nowTime < NextClassTime)
{
NextClassTime = nowTime;
}
}
var result = new
{
BannerList = list.Select(x => new { x.BannerId, x.BannerPic, x.BannerUrl }),
TeacherList = teacherList.Select(x => new { x.TeacherName, x.TId, x.TeacherIcon, x.TeachTag, x.Nationality, x.ForeignersUrl }),
ClassName = (planList != null && planList.Any()) ? planList.FirstOrDefault()?.ClassName : "",
CompleteProgress = (planList != null && planList.Any()) ? planList.FirstOrDefault()?.CompleteProgress ?? 0 : 0,
NextClassTime = (planList != null && planList.Any()) ? NextClassTime.ToString("yyyy-MM-dd HH:mm:ss") : ""
};
return ApiResult.Success("", result);
}
#endregion
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.System;
using Edu.Module.System;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.APP
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class SystemLogController : AppBaseController
{
private MsgLogModule msgLogModule = new MsgLogModule();
/// <summary>
/// 获取自己的系统消息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSystemLogPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_System_Log_ViewModel()
{
SelectSendState = 1
};
query.Group_Id = base.AppStudentInfo.Group_Id;
query.Student_Id = base.AppStudentInfo.AccountId;
List<object> result = new List<object>();
var list = msgLogModule.GetSystemLogPageListRepository(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
result.Add(new
{
item.ID,
item.SendTitle,
item.PicUrl,
item.SendStatus
});
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取自己的系统消息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSystemLogModel()
{
var ID = base.ParmJObj.GetInt("ID", 0);
if (ID == 0)
{
return ApiResult.Failed("请传入您要阅读的系统消息id");
}
var model = msgLogModule.GetSystemLogListRepository(new RB_System_Log_ViewModel { ID = ID }).FirstOrDefault();
return ApiResult.Success(data: model);
}
/// <summary>
/// 获取自己的系统消息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSystemLogCount()
{
var query = new RB_System_Log_ViewModel()
{
SelectSendState = 1
};
query.Group_Id = base.AppStudentInfo.Group_Id;
query.Student_Id = base.AppStudentInfo.AccountId;
var msgCount = msgLogModule.GetSystemLogListRepository(query).Count();
return ApiResult.Success(data: new { msgCount });
}
}
}
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