Commit 3af710a4 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents f91611c6 032c14de
......@@ -1907,10 +1907,21 @@ namespace Edu.Module.Course
dmodel.Age = Common.ConvertHelper.GetAgeByBirthdate(dmodel.BirthDate);
}
message = "";
//订单实体
var ordermodel = orderRepository.GetEntity(dmodel.OrderId);
if (ordermodel == null)
{
message = "订单不存在";
return flag;
}
//班级实体
var classmodel = classRepository.GetEntity(ordermodel.ClassId);
string LogContent = "";
//修改学员信息
if (dmodel.Id > 0)
{
var gModel = order_GuestRepository.GetEntity(dmodel.Id);
string LogContent = "修改学生名单【" + dmodel.Id + "】";
LogContent = "修改学生名单【" + dmodel.Id + "】";
if (gModel.Age != dmodel.Age)
{
LogContent += ",年龄由【" + gModel.Age + "】修改为【" + dmodel.Age + "】";
......@@ -2040,50 +2051,17 @@ namespace Edu.Module.Course
LogContent += ",学生头像由【" + gModel.StuIcon + "】修改为【" + dmodel.StuIcon + "】";
}
gModel.StuIcon = dmodel.StuIcon;
gModel.TotalHours = dmodel.TotalHours;
gModel.GuestContractNo = dmodel.GuestContractNo;
gModel.ContractType = dmodel.ContractType;
gModel.ContractUrl = dmodel.ContractUrl;
gModel.UpdateTime = dmodel.UpdateTime;
flag = order_GuestRepository.Update(gModel);
if (flag)
{
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
Type = 2,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
Group_Id = dmodel.Group_Id,
LogContent = LogContent,
School_Id = dmodel.School_Id,
SourceId = gModel.OrderId
});
if (!string.IsNullOrWhiteSpace(dmodel.StuIcon))//更新学生表中的头像
{
var orderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel { ClassId = gModel.ClassId, OrderId = gModel.OrderId, GuestId = gModel.Id }).FirstOrDefault();
if (orderGuestModel != null && orderGuestModel.Student_Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuIcon),dmodel.StuIcon},
};
studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), orderGuestModel.Student_Id));
}
}
}
}
//新增学员信息
else
{
var ordermodel = orderRepository.GetEntity(dmodel.OrderId);
if (ordermodel == null)
{
message = "订单不存在";
return flag;
}
dmodel.ClassId = ordermodel.ClassId;
dmodel.SourceId = ordermodel.SourceId;
int GuestNum = order_GuestRepository.GetOrderGuestNumRepository(new RB_Order_Guest_ViewModel() { OrderId = dmodel.OrderId, GuestState = GuestStateEnum.Normal });
......@@ -2095,16 +2073,43 @@ namespace Edu.Module.Course
int Id = order_GuestRepository.Insert(dmodel);
dmodel.Id = Id;
flag = Id > 0;
}
#region 新增修改学员账号
if (flag)
{
var classmodel = classRepository.GetEntity(ordermodel.ClassId);
//验证账号是否存在
//检查【学员表(rb_order_guest)和学生表(rb_student)】关联信息
var stuOrderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel { ClassId = ordermodel.ClassId, OrderId = ordermodel.OrderId, GuestId = dmodel.Id }).FirstOrDefault();
//学员账号信息
var accmodel = accountRepository.GetAccountListRepository(new RB_Account_ViewModel() { Group_Id = dmodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Student, Account = dmodel.Mobile }).FirstOrDefault();
string LogContent = "新增学生名单【" + Id + "】";
if (dmodel.ClassId > 0)
//【学员表、学生表、账号表】关联表和账号信息都存在
if (stuOrderGuestModel != null && accmodel != null)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuIcon),dmodel.StuIcon},
{nameof(RB_Student_ViewModel.StuTel),dmodel.Mobile},
{nameof(RB_Student_ViewModel.StuName),dmodel.GuestName},
{nameof(RB_Student_ViewModel.StuSex), dmodel.Sex - 1},
{nameof(RB_Student_ViewModel.StuBirth),dmodel.BirthDate},
};
studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), stuOrderGuestModel.Student_Id));
}
//有【学员表、学生表、账号表】关联信息,没有账号信息【需要修改账号表中的账号】
else if (stuOrderGuestModel != null && accmodel == null)
{
if (accmodel != null)
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{nameof(RB_Account_ViewModel.Account),dmodel.Mobile }
};
accountRepository.Update(accountFileds, new WhereHelper(nameof(RB_Account_ViewModel.Id), stuOrderGuestModel.Account_Id));
}
//有【账号】信息,没有关联信息
else if (stuOrderGuestModel == null && accmodel != null)
{
//创建学员表、学生表、账号表关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{
Id = 0,
......@@ -2112,16 +2117,17 @@ namespace Edu.Module.Course
ClassId = ordermodel.ClassId,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
GuestId = Id,
GuestId = dmodel.Id,
OrderId = dmodel.OrderId,
Status = DateStateEnum.Normal,
Student_Id = accmodel.AccountId
});
LogContent += ",添加学生账号关联【" + accmodel.Id + "】";
}
//关联信息和账号都不存在
else
{
//创建学生账号
//创建学生表信息
int StudentId = studentRepository.Insert(new Model.Entity.User.RB_Student()
{
StuId = 0,
......@@ -2141,8 +2147,8 @@ namespace Edu.Module.Course
StuTel = dmodel.Mobile,
UpdateBy = dmodel.CreateBy,
UpdateTime = DateTime.Now,
});
//创建学生账号
int AccountId = accountRepository.Insert(new Model.Entity.User.RB_Account()
{
Id = 0,
......@@ -2159,6 +2165,7 @@ namespace Edu.Module.Course
UpdateTime = DateTime.Now,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd)
});
//创建【学员表、学生表、账号表】关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{
Id = 0,
......@@ -2166,7 +2173,7 @@ namespace Edu.Module.Course
ClassId = ordermodel.ClassId,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
GuestId = Id,
GuestId = dmodel.Id,
OrderId = dmodel.OrderId,
Status = DateStateEnum.Normal,
Student_Id = StudentId
......@@ -2174,6 +2181,13 @@ namespace Edu.Module.Course
LogContent += ",自动创建学生账号【" + AccountId + "】";
}
}
#endregion
#region 添加日志
if (flag && !string.IsNullOrEmpty(LogContent))
{
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
......@@ -2183,10 +2197,11 @@ namespace Edu.Module.Course
Group_Id = dmodel.Group_Id,
LogContent = LogContent,
School_Id = dmodel.School_Id,
SourceId = dmodel.OrderId,
SourceId = dmodel.OrderId
});
}
}
#endregion
return flag;
}
......
......@@ -636,6 +636,7 @@ namespace Edu.Module.Exam
return flag;
}
/// <summary>
/// 根据试卷编号获取试卷实体
/// </summary>
......@@ -1253,10 +1254,33 @@ namespace Edu.Module.Exam
foreach (var sItem in stuTempList)
{
var questionModel = gItem.DetailsList.Where(qitem => qitem.Id == sItem.DetailsId)?.FirstOrDefault();
var QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent,isEdit:true);
var QuestionContentObj = new object();
if (isShowAnswer)
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, questionModel.QuestionContent, isEdit: true);
}
else
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent, isEdit: true);
}
List<object> answerList = new List<object>();
//填空题、分录题、资料题
if (questionModel.QuestionTypeKey == "fill-in" || questionModel.QuestionTypeKey == "entry-problem" || questionModel.QuestionTypeKey == "data-question")
{
var tempList = sItem.StundetAnswer.Split('★');
if (tempList != null && tempList.Count() > 0)
{
foreach (var tItem in tempList)
{
answerList.Add(tItem);
}
}
}
var qObj = new
{
PaperDetailsId= sItem.DetailsId,//试卷问题编号
PaperDetailsId = sItem.DetailsId,//试卷问题编号
StundetDetailsId = sItem.Id,//考生答题编号
sItem.PaperId,
questionModel.Title,
......@@ -1266,10 +1290,12 @@ namespace Edu.Module.Exam
questionModel.QuestionTypeKey,
questionModel.DifficultyType,
questionModel.Score,
Answer =sItem.StundetAnswer,
Answer = isShowAnswer ? questionModel.Answer : sItem.StundetAnswer,
sItem.StundetAnswer,
AnswerParse = "",
StundetScore = 0,
AnswerList = isShowAnswer ? answerList : new List<object> (),
AnswerParse = questionModel.AnswerParse,
StundetScore = sItem.StundetScore,
sItem.IsMarking
};
questionList.Add(qObj);
}
......@@ -1306,6 +1332,7 @@ namespace Edu.Module.Exam
StundetAnswer = "",
AnswerParse = "",
StundetScore = 0,
IsMarking=0,
};
questionList.Add(qObj);
}
......@@ -1313,6 +1340,8 @@ namespace Edu.Module.Exam
paperTypeList.Add(new
{
gItem.GId,
gItem.QuestionTypeKey,
gItem.QuestionTypeId,
gItem.GroupName,
gItem.GScore,
DetailsList = questionList
......
......@@ -160,7 +160,7 @@ namespace Edu.Module.Question
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.Select(qitem => new
{
DifficultyType = qitem.DifficultyType,
qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount,
ChooseNum = 0
......
......@@ -60,14 +60,6 @@ WHERE 1=1
{
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.AreaId), query.AreaId);
}
//if (query.StuStatus > 0)
//{
// builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.StuStatus), query.StuStatus);
//}
//else
//{
// builder.AppendFormat(" AND t.{0} in({1}) ", nameof(RB_Student_ViewModel.StuStatus), "1,2");
//}
}
return Get<RB_Student_ViewModel>(builder.ToString(),parameters).ToList();
}
......@@ -142,7 +134,9 @@ WHERE 1=1
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT c.*,rbc.ClassName from rb_student as c
builder.AppendFormat($@"
SELECT c.*,rbc.ClassName
FROM rb_student as c
LEFT JOIN rb_student_orderguest as sog on sog.Student_Id=c.StuId
LEFT JOIN rb_class as rbc on rbc.ClassId=sog.ClassId
where sog.ClassId in(SELECT a.ClassId from rb_student_orderguest as a LEFT JOIN rb_class as b on a.ClassId=b.ClassId
......@@ -164,14 +158,16 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours from rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_order as o on og.OrderId=o.OrderId
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId
LEFT JOIN rb_class as c on c.ClassId=o.ClassId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
where o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");
builder.AppendFormat($@"
SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours
FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_order as o on og.OrderId=o.OrderId
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId
LEFT JOIN rb_class as c on c.ClassId=o.ClassId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");
return Get<RB_Student_ViewModel>(builder.ToString(), parameters).ToList();
}
}
......
......@@ -554,7 +554,16 @@ namespace Edu.WebApi.Controllers.Applet
var PaperId = base.ParmJObj.GetInt("PaperId");
var Id = base.ParmJObj.GetInt("Id");
var GuestId = base.ParmJObj.GetInt("GuestId", 0);
var data = paperModule.AppGetExamPaperInfoModule(PaperId, isShowAnswer: false, GuestId: GuestId, PublishId: Id);
var isShowAnswer = base.ParmJObj.GetBoolValue("isShowAnswer");
if (Id <= 0)
{
return ApiResult.ParamIsNull(message: "请传递考试编号!");
}
if (GuestId <= 0)
{
return ApiResult.ParamIsNull(message: "请传递学员编号!");
}
var data = paperModule.AppGetExamPaperInfoModule(PaperId, isShowAnswer: isShowAnswer, GuestId: GuestId, PublishId: Id);
return ApiResult.Success(data: data);
}
......
......@@ -87,7 +87,7 @@ namespace Edu.WebApi.Controllers.Course
x.ClassStyle,
ClassStyleName = x.ClassStyle.ToName(),
OpenTime = x.OpenTime.ToString("yyyy年MM月dd日"),
EndOrderTime = x.EndOrderTime.HasValue ? x.EndOrderTime.Value.ToString("yyyy年MM月dd日") : "",
EndOrderTime =Common.ConvertHelper.FormatDate2(x.EndOrderTime),
IsCanApply = x.EndOrderTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")) && x.ClassPersion > x.OrderStudentCount ? 1 : 0,
OriginalPrice = x.CourseOriginalPrice,
SellPrice = x.CourseSellPrice,
......
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