@@ -3,6 +3,7 @@ using System.Data; | |||||
using Learun.Application.TwoDevelopment.EducationalAdministration; | using Learun.Application.TwoDevelopment.EducationalAdministration; | ||||
using System.Web.Mvc; | using System.Web.Mvc; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||||
namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | ||||
{ | { | ||||
@@ -16,6 +17,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
public class TeachAttendanceController : MvcControllerBase | public class TeachAttendanceController : MvcControllerBase | ||||
{ | { | ||||
private TeachAttendanceIBLL teachAttendanceIBLL = new TeachAttendanceBLL(); | private TeachAttendanceIBLL teachAttendanceIBLL = new TeachAttendanceBLL(); | ||||
private ADR_RestrictionIBLL aDR_RestrictionIBLL = new ADR_RestrictionBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
@@ -148,6 +150,18 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
teachAttendanceIBLL.SaveEntity(keyValue,entity); | teachAttendanceIBLL.SaveEntity(keyValue,entity); | ||||
return Success("保存成功!"); | return Success("保存成功!"); | ||||
} | } | ||||
/// <summary> | |||||
/// 授课时间变动后异常处理 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult DoHandleError() | |||||
{ | |||||
aDR_RestrictionIBLL.DoHandleError(); | |||||
return Success("成功!"); | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -44,6 +44,9 @@ | |||||
<div class=" btn-group btn-group-sm"> | <div class=" btn-group btn-group-sm"> | ||||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | <a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | ||||
</div> | </div> | ||||
<div class=" btn-group btn-group-sm"> | |||||
@*<a id="lr_handleError" class="btn btn-default">授课时间变动后异常处理</a>*@ | |||||
</div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="lr-layout-body" id="gridtable"></div> | <div class="lr-layout-body" id="gridtable"></div> | ||||
@@ -63,6 +63,16 @@ var bootstrap = function ($, learun) { | |||||
}); | }); | ||||
//考勤状态 | //考勤状态 | ||||
$('#ClockStatus').lrDataItemSelect({ code: 'ADStatus' }); | $('#ClockStatus').lrDataItemSelect({ code: 'ADStatus' }); | ||||
// 授课时间变动后异常处理 | |||||
$('#lr_handleError').on('click', function () { | |||||
learun.layerConfirm('是否确认处理!', function (res) { | |||||
if (res) { | |||||
learun.postForm(top.$.rootUrl + '/EducationalAdministration/TeachAttendance/DoHandleError', {}, function () { | |||||
refreshGirdData(); | |||||
}); | |||||
} | |||||
}); | |||||
}); | |||||
}, | }, | ||||
// 初始化列表 | // 初始化列表 | ||||
initGird: function () { | initGird: function () { | ||||
@@ -180,5 +180,8 @@ | |||||
<add key="ChannelId" value="49"/> | <add key="ChannelId" value="49"/> | ||||
<add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/> | <add key="ApiKey" value="fafc361a-40c1-4060-8eee-ea796640c39c"/> | ||||
<add key="Ports" value="192.168.50.127:8007"/> | <add key="Ports" value="192.168.50.127:8007"/> | ||||
<add key="clockTime1" value="2024-10-10"/> | |||||
<add key="clockTime2" value="2024-10-15"/> | |||||
</appSettings> | </appSettings> |
@@ -338,6 +338,30 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 授课时间变动后异常处理 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public void DoHandleError() | |||||
{ | |||||
try | |||||
{ | |||||
aDR_RestrictionService.DoHandleError(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -84,5 +84,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
/// <returns></returns> | /// <returns></returns> | ||||
bool ClockInTeacher(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string LessonSortNo, string ALTId, string AlTOEId,string Img); | bool ClockInTeacher(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string LessonSortNo, string ALTId, string AlTOEId,string Img); | ||||
/// <summary> | |||||
/// 授课时间变动后异常处理 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
void DoHandleError(); | |||||
} | } | ||||
} | } |
@@ -2302,6 +2302,66 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 授课时间变动后异常处理 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public void DoHandleError() | |||||
{ | |||||
var clockTime1 = Config.GetValue("clockTime1"); | |||||
var clockTime2 = Config.GetValue("clockTime2"); | |||||
try | |||||
{ | |||||
var list = this.BaseRepository("CollegeMIS").FindList<HandleErrorModel>($@"select * from | |||||
( | |||||
select t.EmpNo,t.EmpName,CONVERT(date,t.ClockTime) as clockdate,count(t.ID) as total, | |||||
sum(case when t.ADType=1 then 1 else 0 end) as total1,sum(case when t.ADType=2 then 1 else 0 end) as total2, | |||||
(select count(al.ALTId) from ArrangeLessonTerm al where al.AcademicYearNo='24-25' and al.Semester='1' and al.LessonDate=CONVERT(date,t.ClockTime) and al.EmpNo=t.EmpNo)*2 as arrangetotal | |||||
from Teach_Attendance t | |||||
left join ArrangeLessonTerm a on t.ALTId=a.ALTId | |||||
where a.AcademicYearNo='24-25' and a.Semester='1' and CONVERT(date,a.InsertDate)='2024-10-05' | |||||
and CONVERT(date,t.ADTime)>='{clockTime1}' and CONVERT(date,t.ADTime)<='{clockTime2}' | |||||
group by CONVERT(date,t.ClockTime),t.EmpNo,t.EmpName | |||||
)as bb | |||||
where bb.total1!=bb.total2 or bb.total!=bb.arrangetotal | |||||
order by bb.clockdate,bb.EmpNo"); | |||||
foreach (var item in list) | |||||
{ | |||||
var day = item.clockdate.Day < 10 ? "0" + item.clockdate.Day.ToString() : item.clockdate.Day.ToString(); | |||||
var adr_recordEntity = this.BaseRepository("CollegeMIS").FindEntity<ADR_RecordEntity>(x => x.ADType == "2" && x.UserNo == item.EmpNo && x.ADYear == item.clockdate.Year.ToString() && x.ADMonth == item.clockdate.Month.ToString() && x.ADDay == day); | |||||
if (adr_recordEntity != null) | |||||
{ | |||||
adr_recordEntity.UserName = item.EmpName; | |||||
ClockInModifyTeachAttendance(adr_recordEntity); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
public class HandleErrorModel | |||||
{ | |||||
public string EmpNo { get; set; } | |||||
public string EmpName { get; set; } | |||||
public DateTime clockdate { get; set; } | |||||
public int total { get; set; } | |||||
public int total1 { get; set; } | |||||
public int total2 { get; set; } | |||||
public int arrangetotal { get; set; } | |||||
} | |||||
} | } | ||||
} | } |