Commit c2b8a9d2 authored by liudong1993's avatar liudong1993

1

parent a9c5dcb0
......@@ -81,5 +81,22 @@ namespace Edu.Model.ViewModel.User
/// 合同编号
/// </summary>
public string ContractNo { get; set; }
/// <summary>
/// 订单数量
/// </summary>
public int OrderNum { get; set; }
/// <summary>
/// 留学数量
/// </summary>
public int StudyAbroadNum { get; set; }
/// <summary>
/// 合同数量
/// </summary>
public int ContractNum { get; set; }
/// <summary>
/// 课程ID
/// </summary>
public int CourseId { get; set; }
}
}
......@@ -231,7 +231,7 @@ namespace Edu.Module.Course
flag = backClass_ProtocolRepository.Insert(model) > 0;
}
return flag;
}
}
/// <summary>
/// 处理订单生效状态
......@@ -463,5 +463,21 @@ namespace Edu.Module.Course
}
return "";
}
#region 小程序个人中心
/// <summary>
/// 获取学生的课时 缺课 请假信息
/// </summary>
/// <param name="guestId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Order_Guest_Extend GetOrderGusetHoursInfo(int guestId, int group_Id)
{
var gmodel = order_GuestRepository.GetOrderGusetHoursInfo(guestId, group_Id);
return gmodel;
}
#endregion
}
}
\ No newline at end of file
......@@ -18,6 +18,16 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取账户信息
/// </summary>
/// <param name="empId"></param>
/// <returns></returns>
public Employee_ViewModel GetEmployeeInfo(int empId) {
return accountRepository.GetEmployeeInfo(empId);
}
/// <summary>
/// 获取账号列表
/// </summary>
......
......@@ -744,5 +744,32 @@ namespace Edu.Module.User
};
return obj;
}
#region 小程序个人中心
/// <summary>
/// 获取学生订单/留学/合同数量
/// </summary>
/// <param name="accountId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Student_OrderGuest_ViewModel GetStuendOrderNum(int accountId, int group_Id)
{
return student_OrderGuestRepository.GetStuendOrderNum(accountId, group_Id);
}
/// <summary>
/// 获取学生正在学习的课程 信息
/// </summary>
/// <param name="accountId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id)
{
//获取正在学习的课程
return student_OrderGuestRepository.GetLearningCourseInfo(accountId, group_Id);
}
#endregion
}
}
......@@ -467,7 +467,6 @@ WHERE 1=1 and A.Status=0 and class.Status=0 and b.OrderState<>3 ");
}
/// <summary>
/// 获取分页列表
/// </summary>
......@@ -797,5 +796,26 @@ WHERE g.`Status` =0 and g.Group_Id ={groupId} and o.OrderState <>3 and o.OrderTy
return Get<RB_Order_Guest_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取学生课时 请假 缺席
/// </summary>
/// <param name="guestId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Order_Guest_Extend GetOrderGusetHoursInfo(int guestId, int classId)
{
string sql = $@"select A.* ,gc.AbsenceNum,gc.LeaveNum
FROM RB_Order_Guest AS A
inner JOIN (
SELECT OrderGuestId,SUM(CASE CheckStatus WHEN 1 THEN 1 ELSE 0 END) AS AbsenceNum,SUM(CASE CheckStatus WHEN 2 THEN 1 ELSE 0 END) AS LeaveNum
FROM rb_class_check
WHERE `Status`=0 and CheckStatus <>0 and ClassId ={classId} GROUP BY OrderGuestId
) AS gc on gc.OrderGuestId=a.Id
where A.Id ={guestId}
";
return Get<RB_Order_Guest_ViewModel>(sql).FirstOrDefault();
}
}
}
......@@ -180,5 +180,44 @@ WHERE 1=1
return Get<RB_Student_OrderGuest_ViewModel>(sql, parameters).FirstOrDefault();
}
/// <summary>
/// 获取学生订单/留学/合同数量
/// </summary>
/// <param name="accountId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Student_OrderGuest_ViewModel GetStuendOrderNum(int accountId, int group_Id)
{
string sql = $@" select
(select count(0) from RB_Student_OrderGuest og
inner join rb_order o on og.OrderId = o.OrderId
where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId}) as OrderNum,";
sql += $@"(select count(0) from RB_Student_OrderGuest og
inner join rb_order o on og.OrderId = o.OrderId
where og.Status =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =2 and og.Student_Id ={accountId}) as StudyAbroadNum,";
sql += $@"(select count(0) from RB_Student_OrderGuest og
inner join rb_education_contract ec on ec.GuestId = o.GuestId
inner join rb_order o on og.OrderId = o.OrderId
where og.Status =0 and ec.Group_Id ={group_Id} and ec.Status <>4 and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId}) as ContractNum";
return Get<RB_Student_OrderGuest_ViewModel>(sql).FirstOrDefault();
}
/// <summary>
/// 获取正在学习的课程
/// </summary>
/// <param name="accountId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Student_OrderGuest_ViewModel GetLearningCourseInfo(int accountId, int group_Id)
{
string sql = $@"SELECT og.*,o.CourseId FROM rb_student_orderguest og
INNER JOIN rb_order_guest g on og.GuestId = g.Id
INNER JOIN rb_order o on og.OrderId = o.OrderId
INNER JOIN rb_class c on o.ClassId = c.ClassId
WHERE og.Status =0 and g.`Status` =0 and o.Group_Id ={group_Id} and o.OrderState <>3 and o.OrderType =1 and og.Student_Id ={accountId}
ORDER BY c.OpenTime ASC LIMIT 1";
return Get<RB_Student_OrderGuest_ViewModel>(sql).FirstOrDefault();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.LearningGarden;
using Edu.Model.ViewModel.User;
using Edu.Module.Course;
using Edu.Module.EduTask;
using Edu.Module.Public;
using Edu.Module.User;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
namespace Edu.WebApi.Controllers.Applet
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletCenterController : AppletBaseController
{
/// <summary>
/// 账号处理类
/// </summary>
private readonly AccountModule accountModule = new AccountModule();
/// <summary>
/// 学生管理处理类
/// </summary>
private readonly StudentModule studentModule = new StudentModule();
/// <summary>
/// 订单处理类
/// </summary>
private readonly OrderModule orderModule = new OrderModule();
/// <summary>
/// 班级管理处理类
/// </summary>
private readonly ClassModule classModule = new ClassModule();
/// <summary>
/// 课程处理类对象
/// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary>
/// 学习园地处理类对象
/// </summary>
private readonly LearningGardenModule learningGardenModule = AOP.AOPHelper.CreateAOPObject<LearningGardenModule>();
#region 获取个人中心数据
/// <summary>
/// 获取我的个人中心
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMyCenterInfo() {
var userInfo = base.AppletUserInfo;
var accountModel = accountModule.GetAccountListModule(new RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Id = userInfo.Id, AccountType = Common.Enum.User.AccountTypeEnum.Student }).FirstOrDefault();
if (accountModel == null) { return ApiResult.Failed("账号不存在"); }
//获取学生信息
var stuModel = studentModule.GetStudentListModule(new RB_Student_ViewModel() { Group_Id = userInfo.Group_Id, StuId = accountModel.AccountId }).FirstOrDefault();
if (stuModel == null) { return ApiResult.Failed("账号不存在"); }
//获取协助人员
List<object> RAssistList = new List<object>();
var assistList = studentModule.GetStuAssistListModule(accountModel.AccountId);
foreach (var item in assistList) {
var empModel = accountModule.GetEmployeeInfo(item.AssistId);
RAssistList.Add(new
{
item.AssistId,
AssistTypeName = item.AssistType.ToName(),
EmployeeName = empModel?.EmployeeName??"",
UserIcon = empModel?.UserIcon??"",
Mobile = empModel?.Account??""
});
}
//获取课程信息(正在学习中的)
object CourseInfo = new object();
var LearningInfo = studentModule.GetLearningCourseInfo(accountModel.AccountId, userInfo.Group_Id);
if (LearningInfo != null)
{
//获取课程
var courseModel = courseModule.GetCourseModule(LearningInfo.CourseId);
//获取课时信息
var guestModel = orderModule.GetOrderGusetHoursInfo(LearningInfo.GuestId, userInfo.Group_Id);
CourseInfo = new
{
State = 1,
TotalHours = guestModel?.TotalHours??0,
CompleteHours = guestModel?.CompleteHours??0,
AbsenceNum = guestModel?.AbsenceNum??0,
LeaveNum = guestModel?.LeaveNum??0,
};
}
else {
CourseInfo = new
{
State = 2//没有课程信息
};
}
//获取订单合同
var orderModel = studentModule.GetStuendOrderNum(accountModel.AccountId, userInfo.Group_Id);
return ApiResult.Success("", new
{
AccountId = userInfo.Id,
StuId = accountModel.AccountId,
stuModel.StuName,
stuModel.StuIcon,
stuModel.StuSex,
orderModel.OrderNum,
orderModel.StudyAbroadNum,
orderModel.ContractNum,
AssistList = assistList
});
}
#endregion
}
}
......@@ -70,7 +70,8 @@ namespace Edu.WebApi
"https://edu.kookaku.com",
"https://eduapi.oytour.com",
"http://eduapi.oytour.com",
"http://mobile.kookaku.com"
"http://mobile.kookaku.com",
"http://m.kookaku.com",
};
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
services.Configure<IISServerOptions>(options => options.AllowSynchronousIO = true);
......
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