Explorar el Código

学生考勤 相关修复

西昌分支
ndbs hace 1 año
padre
commit
9d76672dce
Se han modificado 11 ficheros con 492 adiciones y 36 borrados
  1. +233
    -31
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs
  2. +18
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs
  3. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs
  4. +72
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs
  5. +18
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarBLL.cs
  6. +6
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarIBLL.cs
  7. +23
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarService.cs
  8. +23
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveBLL.cs
  9. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveIBLL.cs
  10. +68
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveService.cs
  11. +27
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs

+ 233
- 31
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs Ver fichero

@@ -6,6 +6,7 @@ using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Helpers;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Util;
@@ -13,7 +14,7 @@ using Nancy;

namespace Learun.Application.WebApi.Modules
{
public class TimeTable : BaseNoLoginApi
public class TimeTable : BaseApi
{
public TimeTable()
: base("/learun/adms/timetable")
@@ -22,11 +23,72 @@ namespace Learun.Application.WebApi.Modules
Get["/StuList"] = GetStuInfo;
Get["/StuLessonInfo"] = GetStuLessonInfo;
Get["/timeTableData"] = GetTimeTableData;
Get["/weeklist"] = GetWeeksData;
Get["/currentweek"] = GetCurrentWeek;
Get["/TenDay"] = GetTenDay;
}
private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL();
private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL();
private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL();
private StuAttendanceIBLL stuAttendanceIBLL = new StuAttendanceBLL();
private EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL();

public class WeekDate
{
public int week { get; set; }
public string startdate { get; set; }
public string enddate { get; set; }
public string textweek { get; set; }
}
public Response GetWeeksData(dynamic _)
{
var weekdatelist = new List<WeekDate>();
var yearsemester = Common.GetSemesterAndYear();
var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate);
if (arrangelessonlist.Any())
{
var firstday = arrangelessonlist.First();
var lastday = arrangelessonlist.Last();
var monday = firstday.LessonDate.Value.AddDays(-Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) + 1);
var sunday = lastday.LessonDate.Value.AddDays(7 - Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek));
//总周数
var weekCount = Math.Ceiling(Convert.ToDouble((sunday - monday).Days + 1) / 7);
for (var i = 0; i < weekCount; i++)
{
var wentity = new WeekDate();
wentity.week = i + 1;
wentity.startdate = monday.AddDays(i * 7).ToString("yyyy-MM-dd");
wentity.enddate = monday.AddDays(i * 7 + 6).ToString("yyyy-MM-dd");
wentity.textweek = "第" + wentity.week + "周 (" + wentity.startdate + "~" + wentity.enddate + ")";
weekdatelist.Add(wentity);
}
return Success(weekdatelist);
}
else
return Success(new { });
}

/// <summary>
/// 获取当前日期是第几周
/// </summary>
/// <returns></returns>
public Response GetCurrentWeek(dynamic _)
{
var yearsemester = Common.GetSemesterAndYear();
var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate);
if (arrangelessonlist.Any())
{
var firstday = arrangelessonlist.First();
var lastday = arrangelessonlist.Last();
var monday = firstday.LessonDate.Value.AddDays(-(Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek)) + 1);
var sunday = lastday.LessonDate.Value.AddDays(7 - (Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek)));
var currentweek = Util.Time.GetWeekOfDay(monday, sunday);
return Success(new { currentweek });
}
return Success(new { currentweek = 1 });
}

/// <summary>
/// 课程表【教师功能、学生功能】
@@ -112,7 +174,7 @@ namespace Learun.Application.WebApi.Modules

}

/// <summary>
/// 全院课程表【按班级分组】
/// </summary>
@@ -170,11 +232,120 @@ namespace Learun.Application.WebApi.Modules
}).OrderBy(x => x.LessonSortNo).ThenBy(x => x.ClassNo).ToList();

result.ClassDataList = dataTemp;
return Success(result);

}

/// <summary>
/// 课程表【教师功能、学生功能】
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
public Response GetTenDay(dynamic _)
{
var param = this.GetReqData<TimeParameter>();
var startdate = DateTime.Today;
var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd");
var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd");

// 获取学年,学期
var strAcademicYear = "";
var strSemester = "";
var AcademicYearShort = "";
if (!param.StartDate.IsEmpty())
{
var NewsemesterAndYear = Common.GetSemesterAndYear(param.StartDate);
strAcademicYear = NewsemesterAndYear.AcademicYearLong;
strSemester = NewsemesterAndYear.Semester;
AcademicYearShort = NewsemesterAndYear.AcademicYearShort;
}
else
{
var semesterAndYear = Common.GetSemesterAndYear(startDate);
strAcademicYear = semesterAndYear.AcademicYearLong;
strSemester = semesterAndYear.Semester;
AcademicYearShort = semesterAndYear.AcademicYearShort;
}


if (param.StartDate.IsEmpty() && param.EndDate.IsEmpty())
{
// 校历
var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(AcademicYearShort, strSemester);
var StartTime = entity.StartTime.Value;
//获取第几周
var curWeek = WeekOfYear(startdate, entity.StartTime.Value, entity.EndTime.Value);
///获取当前周次开始时间
startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).ToString("yyyy-MM-dd");
if (curWeek == 1 && Convert.ToDateTime(startDate) < StartTime)//判断第几周
{
startDate = StartTime.ToString("yyyy-MM-dd");
}
endDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).AddDays(13).ToString("yyyy-MM-dd");
param.StartDate = startDate;
param.EndDate = endDate;
}
var Data = new List<TwoDevelopment.EducationalAdministration.TimeTable>();
if (param.Description == "学生")
{
var Stulist = stuInfoBasicIBLL.GetAllList().Where(x => x.StuNo == param.Account).FirstOrDefault();
if (Stulist != null)
{
Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, Stulist.ClassNo, "", "").ToList();
}
}
else if (param.Description == "教师")
{
//教师
var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == param.Account).FirstOrDefault().EmpNo;
if (empInfo != null)
{
Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, "", param.Account, "").ToList();
}
}
//学生课表请假记录
var leaveList = stuAttendanceLeaveIBLL.GetListByJson("{\"StuNo\":\"" + userInfo.account + "\"}");
var formatData = from d in Data.AsEnumerable()
let tt = d.LessonTime.Split('-')[0]
group d by tt into g
orderby g.Key
select new
{
time = g.Key,
list = from e in Data.AsEnumerable()
let ee = e.LessonTime.Split('-')[0]
where ee == g.Key
select new
{
ALTId = e.ALTId,
day = e.LessonTime.Split('-')[0],
jc = e.LessonTime.Split('-')[1],
curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName,
teacher = e?.EmpName,
classRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(),
academicyear = e.AcademicYear,
semester = e.Semester,
lessonNo = e?.LessonNo,
teachClassNo = e?.TeachClassNo,
empno = e?.EmpNo,
lessonTime = e.LessonTime,
lessonDate = e.LessonDate.ToString("yyyy-MM-dd"),
classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(),
lessonSortNo = e.LessonSortNo,
e?.OLPEId,
className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName,
leaveType = leaveList.Any(c => c.LessonNo == e?.LessonNo && c.LessonDate == e.LessonDate && c.LessonTime == e.LessonTime) ? 1 : 0,
checkType = leaveList.FirstOrDefault(c => c.LessonNo == e?.LessonNo && c.LessonDate == e.LessonDate && c.LessonTime == e.LessonTime)?.IsCheck,

}
}
;
var result = new
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", startDate = param.StartDate, endDate = param.EndDate, weekList = formatData };
return Success(result);

}
/// <summary>
/// 数字转中文
/// </summary>
@@ -219,40 +390,71 @@ namespace Learun.Application.WebApi.Modules
}
return res;
}
}

/// <summary>
/// 换算周次
/// </summary>
/// <param name="curDay"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
private static int WeekOfYear(DateTime curDay, DateTime startTime, DateTime endTime)
{
int firstdayofweek = Convert.ToInt32(startTime.DayOfWeek);
var startDate = DateTime.Parse(Common.CalculateFirstDateOfWeek(startTime).ToString("yyyy-MM-dd"));
int k = Convert.ToInt32(startTime.DayOfWeek);//得到开始时间的第一天是周几
int days = curDay.Subtract(startTime).Days;
//int days = curDay.DayOfYear;
int daysOutOneWeek = days - (14 - firstdayofweek);

if (daysOutOneWeek <= 0)
{
return 1;
}
else
{
int weeks = daysOutOneWeek / 14;
if (daysOutOneWeek % 14 != 0)
weeks++;

return weeks + 1;

}

public class TimeParameter
{
public string StartDate { get; set; }
public string EndDate { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public string ClassNo { get; set; }
/// <summary>
/// 教师编号
/// </summary>
public string EmpNo { get; set; }
}
public class TimeTableData
{
public string AcademicYearNo { get; set; }
public string Semester { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public List<ClassDataList> ClassDataList { get; set; }
}
public class ClassDataList
{
public string ClassNo { get; set; }
public string ClassName { get; set; }
public string LessonSortNo { get; set; }
public List<TwoDevelopment.EducationalAdministration.TimeTable> TimeTableList { get; set; }
}
}

}



public class TimeParameter
{
public string StartDate { get; set; }
public string EndDate { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public string ClassNo { get; set; }
/// <summary>
/// 教师编号
/// </summary>
public string EmpNo { get; set; }
public string Description { get; set; }
public string Account { get; set; }
}
public class TimeTableData
{
public string AcademicYearNo { get; set; }
public string Semester { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public List<ClassDataList> ClassDataList { get; set; }
}
public class ClassDataList
{
public string ClassNo { get; set; }
public string ClassName { get; set; }
public string LessonSortNo { get; set; }
public List<Learun.Application.TwoDevelopment.EducationalAdministration.TimeTable> TimeTableList { get; set; }
}

+ 18
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs Ver fichero

@@ -43,7 +43,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

public IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson)
{
try
{
return arrangeLessonTermService.GetListForTimeTable(queryJson);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
/// <summary>
/// 获取列表分页数据
/// <param name="pagination">分页参数</param>


+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs Ver fichero

@@ -48,6 +48,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <summary>
/// <returns></returns>
IEnumerable<ArrangeLessonTermEntity> GetList(string queryJson);

IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson);
Task<bool> AsyncArrangeLessonData();
Task<bool> AsyncModifyArrangeLessonData();



+ 72
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs Ver fichero

@@ -110,7 +110,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
if (!queryParam["TeachClassNo"].IsEmpty())
{
dp.Add("TeachClassNo", "%"+queryParam["TeachClassNo"].ToString(), DbType.String);
dp.Add("TeachClassNo", "%" + queryParam["TeachClassNo"].ToString(), DbType.String);
strSql.Append(" AND t.TeachClassNo like @TeachClassNo ");
}
if (!queryParam["EmpNo"].IsEmpty())
@@ -124,7 +124,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
strSql.Append(" AND t.ClassroomNo = @ClassroomNo ");
}

return this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(strSql.ToString(),dp);
return this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(strSql.ToString(), dp);
}
catch (Exception ex)
{
@@ -139,6 +139,74 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

public IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson)
{
try
{
//参考写法
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });

var strSql = new StringBuilder();
strSql.Append("SELECT LessonDate,AcademicYearNo,Semester");
strSql.Append(" FROM ArrangeLessonTerm t where 1=1 ");

if (!queryParam["AcademicYearNo"].IsEmpty())
{
dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String);
strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo ");
}
if (!queryParam["Semester"].IsEmpty())
{
dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String);
strSql.Append(" AND t.Semester = @Semester ");
}
if (!queryParam["DeptNo"].IsEmpty())
{
dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
strSql.Append(" AND t.DeptNo = @DeptNo ");
}
if (!queryParam["MajorNo"].IsEmpty())
{
dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
strSql.Append(" AND t.MajorNo = @MajorNo ");
}
if (!queryParam["LessonNo"].IsEmpty())
{
dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String);
strSql.Append(" AND t.LessonNo = @LessonNo ");
}
if (!queryParam["TeachClassNo"].IsEmpty())
{
dp.Add("TeachClassNo", "%" + queryParam["TeachClassNo"].ToString(), DbType.String);
strSql.Append(" AND t.TeachClassNo like @TeachClassNo ");
}
if (!queryParam["EmpNo"].IsEmpty())
{
dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String);
strSql.Append(" AND t.EmpNo = @EmpNo ");
}
if (!queryParam["ClassroomNo"].IsEmpty())
{
dp.Add("ClassroomNo", queryParam["ClassroomNo"].ToString(), DbType.String);
strSql.Append(" AND t.ClassroomNo = @ClassroomNo ");
}

return this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(strSql.ToString(), dp);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
internal IEnumerable<ArrangeLessonTermEntity> GetListByEmpNo(List<string> empNos)
{
try
@@ -2063,6 +2131,8 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les
{
public DateTime LessonDate { get; set; }
public string EnName { get; set; }
public string ALTId { get; set; }

public string AcademicYear { get; set; }
public string LessonNo { get; set; }
public string LessonName { get; set; }


+ 18
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarBLL.cs Ver fichero

@@ -90,7 +90,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

public SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo, string semester)
{
try
{
return schoolCalendarService.GetSchoolCalendarEntityByNo(academicYearNo, semester);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}
#endregion

#region 提交数据


+ 6
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarIBLL.cs Ver fichero

@@ -34,6 +34,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <summary>
/// <returns></returns>
SchoolCalendarEntity GetSchoolCalendarEntity(string keyValue);
/// <summary>
/// 根据学年获取SchoolCalendar表实体数据
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo, string semester);
#endregion

#region 提交数据


+ 23
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SchoolCalendar/SchoolCalendarService.cs Ver fichero

@@ -141,7 +141,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}

/// <summary>
/// 获取SchoolCalendar表实体数据
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
public SchoolCalendarEntity GetSchoolCalendarEntityByNo(string academicYearNo, string semester)
{
try
{
return this.BaseRepository().FindEntity<SchoolCalendarEntity>(x => x.AcademicYearNo == academicYearNo && x.Semester == semester);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion

#region 提交数据


+ 23
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveBLL.cs Ver fichero

@@ -110,6 +110,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
}
/// <summary>
/// 获取页面显示列表数据
/// <summary>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
public IEnumerable<StuAttendanceLeaveEntity> GetListByJson(string queryJson)
{
try
{
return stuAttendanceLeaveService.GetListByJson(queryJson);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

#endregion



+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveIBLL.cs Ver fichero

@@ -36,6 +36,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <summary>
/// <returns></returns>
StuAttendanceLeaveEntity GetStuAttendanceLeaveEntity(string keyValue);
IEnumerable<StuAttendanceLeaveEntity> GetListByJson(string queryJson);

#endregion

#region 提交数据


+ 68
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendanceLeave/StuAttendanceLeaveService.cs Ver fichero

@@ -211,6 +211,74 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

/// <summary>
/// 获取页面显示列表数据
/// <summary>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
public IEnumerable<StuAttendanceLeaveEntity> GetListByJson(string queryJson)
{
try
{
var strSql = new StringBuilder();
strSql.Append("SELECT t.* ");
strSql.Append(" FROM StuAttendanceLeave t");
strSql.Append(" WHERE 1=1 ");
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });
if (!queryParam["LessonName"].IsEmpty())
{
dp.Add("LessonName", "%" + queryParam["LessonName"].ToString() + "%", DbType.String);
strSql.Append(" AND t.LessonName Like @LessonName ");
}
if (!queryParam["Grade"].IsEmpty())
{
dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
strSql.Append(" AND t.Grade = @Grade ");
}
if (!queryParam["StuNo"].IsEmpty())
{
dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
strSql.Append(" AND t.StuNo = @StuNo ");
}
if (!queryParam["StuName"].IsEmpty())
{
dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String);
strSql.Append(" AND t.StuName Like @StuName ");
}
if (!queryParam["EmpNo"].IsEmpty())
{
dp.Add("EmpNo", "%" + queryParam["EmpNo"].ToString() + "%", DbType.String);
strSql.Append(" AND t.EmpNo Like @EmpNo ");
}
if (!queryParam["AcademicYearNo"].IsEmpty())
{
dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String);
strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo ");
}
if (!queryParam["Semester"].IsEmpty())
{
dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String);
strSql.Append(" AND t.Semester = @Semester ");
}
var result = this.BaseRepository("CollegeMIS").FindList<StuAttendanceLeaveEntity>(strSql.ToString(), dp);

return result;
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

#endregion

#region 提交数据


+ 27
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs Ver fichero

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;

namespace Learun.Util
@@ -503,6 +504,32 @@ namespace Learun.Util
return strDate;
}
#endregion

/// <summary>
/// 获取当前日期在指定时间范围内是第几周
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static int GetWeekOfDay(DateTime start, DateTime end)
{
//总周数
var weekCount = Math.Ceiling(Convert.ToDouble((end - start).Days / 7));
//用于存储日期
var weekDic = new Dictionary<DateTime, int>();

var today = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));

for (var i = 0; i < weekCount; i++)
{
for (var j = 0; j < 7; j++)
{
weekDic.Add(start.AddDays(i * 7 + j), i + 1);
}
}

return weekDic.ContainsKey(today) ? weekDic[today] : 1;
}
/// <summary>
/// 获取当前日期是星期几
/// </summary>


Cargando…
Cancelar
Guardar