Commit d9ccbba1 authored by 吴春's avatar 吴春

页面修改

parent c984b64b
......@@ -7,3 +7,4 @@ Edu.WebApi/Properties
Edu.WebApi/SearchIndex
/Properties
*.user
Edu.WebApi/RateLimitConfig.json
......@@ -5,7 +5,7 @@ using Edu.Model.Entity.Grade;
namespace Edu.Model.ViewModel.Grade
{
public class RB_Class_FeedBack_ViewModel: RB_Class_FeedBack
public class RB_Class_FeedBack_ViewModel : RB_Class_FeedBack
{
/// <summary>
/// ids
......@@ -21,5 +21,21 @@ namespace Edu.Model.ViewModel.Grade
/// 老师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 老师头像
/// </summary>
public string TeacherIcon { get; set; }
/// <summary>
/// 头像列表
/// </summary>
public List<string> PhotoList { get; set; }
/// <summary>
/// 学生id
/// </summary>
public int StuId { get; set; }
}
}
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Grade;
using Edu.Model.ViewModel.Grade;
namespace Edu.Repository.Grade
{
public class RB_Class_FeedBackRepository:BaseRepository<RB_Class_FeedBack>
/// <summary>
/// 上课反馈记录表
/// </summary>
public class RB_Class_FeedBackRepository : BaseRepository<RB_Class_FeedBack>
{
/// <summary>
/// 获取班级反馈列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_FeedBack_ViewModel> GetClassFeedBackList(RB_Class_FeedBack_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.*,b.TeacherName,b.TeacherHead as TeacherIcon FROM RB_Class_FeedBack AS A LEFT JOIN rb_teacher as b on a.CreateBy=b.TId WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.Group_Id), query.Group_Id);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.ClassId), query.ClassId);
}
if (query.FeedBackId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.FeedBackId), query.FeedBackId);
}
if (query.OrderGuestId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.OrderGuestId), query.OrderGuestId);
}
if (!string.IsNullOrEmpty(query.Q_ClassIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_FeedBack_ViewModel.ClassId), query.Q_ClassIds);
}
if (!string.IsNullOrEmpty(query.Q_ClassTimeIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_FeedBack_ViewModel.ClassTimeId), query.Q_ClassTimeIds);
}
if (query.ClassTimeId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.ClassTimeId), query.ClassTimeId);
}
if (query.ClassPlanId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.ClassPlanId), query.ClassPlanId);
}
if (!string.IsNullOrWhiteSpace(query.Q_ClassTimeIds))
{
builder.AppendFormat(" AND A.{0} in ({1}) ", nameof(RB_Class_FeedBack_ViewModel.ClassTimeId), query.Q_ClassTimeIds);
}
}
return Get<RB_Class_FeedBack_ViewModel>(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_Class_FeedBack_ViewModel> GetClassFeedBackPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_FeedBack_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.*,b.TeacherName,b.TeacherHead as TeacherIcon FROM RB_Class_FeedBack AS A LEFT JOIN rb_teacher as b on a.TeacherId=b.TId
LEFT JOIN rb_student_orderguest as sog on sog.GuestId=a.OrderGuestId
LEFT JOIN rb_student as s on s.StuId = sog.Student_Id where 1=1 and a.`Status`=0 and sog.`Status`=0 and s.`Status`=0");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.Group_Id), query.Group_Id);
}
if (query.ClassTimeId > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.ClassTimeId), query.ClassTimeId);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.ClassId), query.ClassId);
}
if (query.OrderGuestId > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.OrderGuestId), query.OrderGuestId);
}
if (query.StuId > 0)
{
builder.AppendFormat(" AND s.{0}={1} ", nameof(RB_Class_FeedBack_ViewModel.StuId), query.StuId);
}
}
builder.AppendFormat(" ORDER BY a.CreateTime desc ");
return GetPage<RB_Class_FeedBack_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
}
}
......@@ -131,7 +131,7 @@ namespace Edu.Repository.Sell
}
string sql = $@"
SELECT sog.Student_Id as StudentId,A.*,cs.ClassName,cs.ClassNo,IFNULL(B.JoinType,0) AS JoinType,IFNULL(B.TargetJoinType,0) AS TargetJoinType,IFNULL(B.StartClassHours,0) AS StartClassHours
SELECT sog.Student_Id as StudentId,A.*,cs.ClassName,cs.Teacher_Id,cs.ClassNo,IFNULL(B.JoinType,0) AS JoinType,IFNULL(B.TargetJoinType,0) AS TargetJoinType,IFNULL(B.StartClassHours,0) AS StartClassHours
,IFNULL(C.CourseName,'') AS CourseName,B.EffectStatus,B.EffectTime,B.UpOrderId,B.OrderType,B.CourseId,B.IsRenewOrder,B.RenewOrderId,B.EnterID
,sc.StopClassEffectTime,B.SourceOrderId,B.TargetOrderId,IFNULL(D.FirstClassHours,0)+IFNULL(D.SecondClassHours,0)+IFNULL(D.ThirdClassHours,0) AS ContractTotalHours
FROM RB_Order_Guest AS A LEFT JOIN rb_order AS B ON A.OrderId=B.OrderId
......
......@@ -113,8 +113,8 @@ namespace Edu.WebApi.Controllers.Applet
List<Model.ViewModel.Exam.RB_Examination_Publish_ViewModel> examinationPublishList = new List<Model.ViewModel.Exam.RB_Examination_Publish_ViewModel>();
if (studentModel != null && studentModel.GuestId > 0)
{
examinationPublishList = paperModule.GetGuestExaminationPublishPage(1, 5, out long rowsCount,
new RB_Examination_Publish_ViewModel { QAccountIds= appletUserInfo.Id.ToString(), Group_Id = studentModel.Group_Id });
examinationPublishList = paperModule.GetGuestExaminationPublishPage(1, 5, out long rowsCount,
new RB_Examination_Publish_ViewModel { QAccountIds = appletUserInfo.Id.ToString(), Group_Id = studentModel.Group_Id });
if (examinationPublishList == null)
{
examinationPublishList = new List<Model.ViewModel.Exam.RB_Examination_Publish_ViewModel>();
......@@ -147,6 +147,16 @@ namespace Edu.WebApi.Controllers.Applet
}
#endregion
#region 获取最新一条上课反馈记录
long count = 0;
var feedBackList = classModule.GetClassFeedBackPageListRepository(1, 1, out count, new RB_Class_FeedBack_ViewModel { StuId = appletUserInfo.AccountId, Group_Id = appletUserInfo.Group_Id });
if (feedBackList != null && feedBackList.Any())
{
feedBackList.ForEach(x => x.PhotoList = (!string.IsNullOrWhiteSpace(x.Photo) ? JsonHelper.DeserializeObject<List<string>>(x.Photo) : new List<string>()));
}
#endregion
var result = new
{
studentModel.SName,//学区
......@@ -157,6 +167,7 @@ namespace Edu.WebApi.Controllers.Applet
studentModel.ClassName,
studentModel.CourseId,
studentModel.GuestId,
FeedBackList = feedBackList,//上课反馈最新一条数据
EnterPhone = Cache.User.UserReidsCache.GetUserLoginInfo(studentModel.EnterID).UserMobile,
ContractNum = (((contractList != null && contractList.Any()) ? contractList.Count() : 0) + ((backClassList != null && backClassList.Any()) ? backClassList.Count() : 0)),//合同数
ClassPlan = new //我的课表最新一个数据
......@@ -533,7 +544,7 @@ namespace Edu.WebApi.Controllers.Applet
}
else if (item.ExamStartTime < System.DateTime.Now && item.ExamEndTime > System.DateTime.Now)
{
if (item.ExamStatus != ExamTestStatusEnum.FinishTest &&item.ExamStatus!= ExamTestStatusEnum.FinishScoring )
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
item.ExamStatus = ExamTestStatusEnum.FinishStarted;
}
......@@ -558,7 +569,7 @@ namespace Edu.WebApi.Controllers.Applet
ExamEndTime = Common.ConvertHelper.FormatTime(x.ExamEndTime),
x.ExamTimes,
x.ExamStatus,
ExamStatusStr=x.ExamStatus.ToName()
ExamStatusStr = x.ExamStatus.ToName()
});
pageModel.Count = rowsCount;
return ApiResult.Success(data: pageModel);
......@@ -693,9 +704,11 @@ namespace Edu.WebApi.Controllers.Applet
item.Title,
item.Content,
item.Img,
Ico = "",
item.Digest,
item.LinkUrl,
CreateByName,
item.TypeId,
CreateTime = Common.Plugin.StringHelper.DateFormatToString(item.CreateDate)
});
}
......@@ -731,11 +744,58 @@ namespace Edu.WebApi.Controllers.Applet
extModel.Digest,
extModel.LinkUrl,
CreateByName,
CreateTime = Common.Plugin.StringHelper.DateFormatToString(extModel.CreateDate)
extModel.TypeId,
CreateTime = Common.Plugin.StringHelper.DateFormatToString(extModel.CreateDate),
Ico = UserReidsCache.GetUserLoginInfo(extModel.CreateBy)?.UserIcon ?? ""
};
}
return ApiResult.Success(data: obj);
}
#endregion
#region 上课反馈记录
/// <summary>
/// 获取学习园地分页
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GeClassFeedBackPage()
{
var appletUserInfo = base.AppletUserInfo;
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Class_FeedBack_ViewModel()
{
Group_Id = appletUserInfo.Group_Id,
StuId = appletUserInfo.AccountId,
};
var list = classModule.GetClassFeedBackPageListRepository(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
if (list != null && list.Any())
{
list.ForEach(x => x.PhotoList = (!string.IsNullOrWhiteSpace(x.Photo) ? JsonHelper.DeserializeObject<List<string>>(x.Photo) : new List<string>()));
}
List<object> resultList = new List<object>();
foreach (var item in list)
{
resultList.Add(new
{
item.FeedBackId,
item.TeacherIcon,
item.TeacherName,
item.PhotoList,
item.Comment,
item.Score,
CreateTimeYear = item.CreateTime.ToString("yyyy"),
CreatetimeStr = item.CreateTime.ToString("MM-dd HH:mm:ss")
});
}
pageModel.Count = rowsCount;
pageModel.PageData = resultList;
return ApiResult.Success(data: pageModel);
}
#endregion
}
}
......@@ -16,6 +16,7 @@ using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
namespace Edu.WebApi.Controllers.Course
{
......@@ -325,7 +326,141 @@ namespace Edu.WebApi.Controllers.Course
#region 上课反馈
/// <summary>
/// 获取上课详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetFeedBackDetails()
{
var ID = base.ParmJObj.GetInt("ID", 0);
var timeModel = classModule.GetClassTimeList_V2(new RB_Class_Time_ViewModel { ClassTimeId = ID, Group_Id = base.UserInfo.Group_Id }).FirstOrDefault();
if (timeModel == null || timeModel.ClassTimeId == 0)
{
return ApiResult.Failed("班级上课时间信息不存在");
}
var orderGuestList = classModule.GetOrderGuestListModule(new RB_Order_Guest_ViewModel { Group_Id = base.UserInfo.Group_Id, School_Id = 0, ClassId = timeModel.ClassId });
var tempOrderGuestList = classModule.GetTempInvitationGuest(new Model.ViewModel.EduTask.RB_Temporary_Invitation_ViewModel { ClassTimeId = ID, ClassId = timeModel.ClassId });
var allOrderGuestList = new List<RB_Order_Guest_ViewModel>();
allOrderGuestList.AddRange(orderGuestList.Where(x => x.GuestState == GuestStateEnum.Normal || x.GuestState == GuestStateEnum.StopClassesApplyIng || ((x.GuestState == GuestStateEnum.StopClasses || x.GuestState == GuestStateEnum.Graduate) && x.ChangeEffectTime.HasValue && Convert.ToDateTime(Common.ConvertHelper.FormatDate(x.ChangeEffectTime)) >= Convert.ToDateTime(Common.ConvertHelper.FormatDate(timeModel.NewPlanDateTime)))));
var feedBackList = classModule.GetClassFeedBackList(new RB_Class_FeedBack_ViewModel { ClassTimeId = ID, Group_Id = base.UserInfo.Group_Id, ClassId = timeModel.ClassId });
if (tempOrderGuestList != null && tempOrderGuestList.Any())
{
allOrderGuestList.AddRange(tempOrderGuestList.Where(x => x.GuestState == GuestStateEnum.Normal || x.GuestState == GuestStateEnum.StopClassesApplyIng || ((x.GuestState == GuestStateEnum.StopClasses || x.GuestState == GuestStateEnum.Graduate) && x.ClassTimeId == ID && x.ClassId == timeModel.ClassId && x.ChangeEffectTime.HasValue && Convert.ToDateTime(Common.ConvertHelper.FormatDate(x.ChangeEffectTime)) >= Convert.ToDateTime(Common.ConvertHelper.FormatDate(timeModel.NewPlanDateTime)))));
}
List<object> result = new List<object>();
foreach (var item in allOrderGuestList)
{
var FeedBackModel = feedBackList.Where(y => y.OrderGuestId == item.Id).FirstOrDefault();
if (FeedBackModel != null && FeedBackModel.FeedBackId > 0)
{
if (!string.IsNullOrWhiteSpace(FeedBackModel.Photo))
{
FeedBackModel.PhotoList = JsonHelper.DeserializeObject<List<string>>(FeedBackModel.Photo);
}
else {
FeedBackModel.PhotoList = new List<string>();
}
}
var guest = new
{
timeModel.ClassPlanId,
timeModel.ClassId,
timeModel.ClassTimeId,
item.GuestName,
item.Mobile,
item.Teacher_Id,
item.School_Id,
OrderGuestId = item.Id,
Score = FeedBackModel?.Score ?? 0,
Comment = FeedBackModel?.Comment ?? "",
PhotoList = FeedBackModel?.PhotoList ?? new List<string>(),
FeedBackId = FeedBackModel?.FeedBackId ?? 0,
TeacherName = FeedBackModel?.TeacherName ?? "",
TeacherIcon = FeedBackModel?.TeacherIcon ?? "",
CreateTimeStr = (FeedBackModel != null && FeedBackModel.FeedBackId > 0) ? FeedBackModel.CreateTime.ToString("yyyy-MM-dd HH:mm") : ""
};
result.Add(guest);
}
return ApiResult.Success("", result);
}
/// <summary>
/// 老师上课反馈填写
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetFeedBack()
{
List<RB_Class_FeedBack_ViewModel> list = new List<RB_Class_FeedBack_ViewModel>();
JArray array = JArray.Parse(RequestParm.Msg.ToString());
if (array != null && array.Count > 0)
{
foreach (var jItem in array)
{
JObject obj = JObject.Parse(jItem.ToString());
var nowModel = new RB_Class_FeedBack_ViewModel()
{
OrderGuestId = obj.GetInt("OrderGuestId"),
ClassTimeId = obj.GetInt("ClassTimeId"),
ClassPlanId = obj.GetInt("ClassPlanId"),
School_Id = obj.GetInt("School_Id"),
Score = obj.GetInt("Score"),
TeacherId = obj.GetInt("TeacherId"),
ClassId = obj.GetInt("ClassId"),
Comment = obj.GetStringValue("Comment")
};
List<string> photoList = JsonHelper.DeserializeObject<List<string>>(obj.GetStringValue("PhotoList"));
if (photoList != null && photoList.Any())
{
nowModel.Photo = JsonHelper.Serialize(photoList);
}
else
{
nowModel.Photo = "";
}
list.Add(nowModel);
}
}
if (list == null || !list.Any())
{
return ApiResult.ParamIsNull(message: "请选择上课反馈学员!");
}
//判断当天是否有已签到数据
var classFeedBackList = classModule.GetClassFeedBackList(new RB_Class_FeedBack_ViewModel
{
Group_Id = base.UserInfo.Group_Id,
ClassId = list.FirstOrDefault().ClassId,
ClassTimeId = list.FirstOrDefault().ClassTimeId,
});
foreach (var item in list)
{
var signModel = classFeedBackList?.Where(qitem => qitem.ClassId == item.ClassId && qitem.OrderGuestId == item.OrderGuestId)?.FirstOrDefault();
if (signModel != null && signModel.FeedBackId > 0)
{
item.FeedBackId = signModel.FeedBackId;
item.Group_Id = signModel.Group_Id;
item.CreateTime = signModel.CreateTime;
item.CreateBy = base.UserInfo.Id;
item.Status = 0;
}
else
{
item.Group_Id = base.UserInfo.Group_Id;
item.CreateTime = System.DateTime.Now;
item.CreateBy = base.UserInfo.Id;
item.Status = 0;
}
}
bool result = classModule.SetFeedBack(list);
return result ? ApiResult.Success() : ApiResult.Failed("上课反馈失败");
}
#endregion
}
}
......@@ -143,7 +143,7 @@ namespace Edu.WebApi.Timers
}
/// <summary>
/// 处理值班数据
/// 定时处理考卷过期数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
......
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