diff --git a/.gitignore b/.gitignore index 15ca4d40..4d55dfb6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ /SGGLPackFile/PackFile/bin /SGGLPackFile /SGGL/FineUIPro.Web/File/Excel/Temp -/SGGL/FineUIPro.Web/common /SGGL/FineUIPro.Web/FileUpload/QRCodeFile diff --git a/DataBase/版本日志/SGGLDB_V2022-04-01-001.sql b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-01-001.sql similarity index 100% rename from DataBase/版本日志/SGGLDB_V2022-04-01-001.sql rename to DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-01-001.sql diff --git a/DataBase/版本日志/SGGLDB_V2022-04-14-001.sql b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-14-001.sql similarity index 100% rename from DataBase/版本日志/SGGLDB_V2022-04-14-001.sql rename to DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-14-001.sql diff --git a/DataBase/版本日志/SGGLDB_V2022-04-23-001.sql b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-23-001.sql similarity index 100% rename from DataBase/版本日志/SGGLDB_V2022-04-23-001.sql rename to DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-23-001.sql diff --git a/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-24-001.sql b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-24-001.sql new file mode 100644 index 00000000..c8fa8f95 --- /dev/null +++ b/DataBase/版本日志/已更新脚本/SGGLDB_V2022-04-24-001.sql @@ -0,0 +1,29 @@ +/****** Object: Index [NonClusteredIndex-20220422-165000] Script Date: 2022/4/22 16:50:59 ******/ +CREATE NONCLUSTERED INDEX [NonClusteredIndex-20220422-165000] ON [dbo].[Training_TestPlan] +( + [TestPlanId] ASC, + [TestStartTime] ASC, + [States] ASC, + [TestEndTime] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +/****** Object: Index [NonClusteredIndex-20220422-165128] Script Date: 2022/4/22 16:52:09 ******/ +CREATE NONCLUSTERED INDEX [NonClusteredIndex-20220422-165128] ON [dbo].[Training_TestRecord] +( + [TestPlanId] ASC, + [TestManId] ASC, + [TestEndTime] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +/****** Object: Index [NonClusteredIndex-20220424-164842] Script Date: 2022/4/24 16:49:20 ******/ +CREATE NONCLUSTERED INDEX [NonClusteredIndex-20220424-164842] ON [dbo].[Training_TestRecordItem] +( + [TestRecordId] ASC, + [TestType] ASC, + [TrainingItemCode] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + + diff --git a/SGGL/BLL/API/APIGetHttpService.cs b/SGGL/BLL/API/APIGetHttpService.cs index 9fbb9cb7..6a40502c 100644 --- a/SGGL/BLL/API/APIGetHttpService.cs +++ b/SGGL/BLL/API/APIGetHttpService.cs @@ -30,6 +30,7 @@ namespace BLL } } request.Headers.Add("token", "AF17168B-87BD-4GLY-1111-F0A0A1158F9B"); + request.Timeout = 20000; /// 设置5秒超时 if (!string.IsNullOrEmpty(data)) { Stream RequestStream = request.GetRequestStream(); @@ -92,7 +93,7 @@ namespace BLL HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = string.IsNullOrEmpty(method) ? "GET" : method; - request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; + request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; if (header != null) { foreach (var i in header.Keys) @@ -161,6 +162,7 @@ namespace BLL HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = string.IsNullOrEmpty(method) ? "GET" : method; request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; + request.Timeout = 20000; /// 设置5秒超时 if (header != null) { foreach (var i in header.Keys) diff --git a/SGGL/BLL/API/HSSE/APITestPlanService.cs b/SGGL/BLL/API/HSSE/APITestPlanService.cs index 291f1f97..3255143e 100644 --- a/SGGL/BLL/API/HSSE/APITestPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITestPlanService.cs @@ -56,35 +56,38 @@ namespace BLL { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var getDataLists = from x in db.Training_TestPlan - where x.TestPlanId == testPlanId - select new Model.TestPlanItem - { - TestPlanId = x.TestPlanId, - ProjectId = x.ProjectId, - TestPlanCode = x.PlanCode, - TestPlanName = x.PlanName, - TestPlanManId = x.PlanManId, - TestPlanManName = db.Sys_User.First(y => y.UserId == x.TestPlanId).UserName, - TestPlanDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.PlanDate), - TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), - TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), - Duration = x.Duration, - SValue = x.SValue, - MValue = x.MValue, - JValue = x.JValue, - TotalScore = x.TotalScore ?? 0, - QuestionCount = x.QuestionCount ?? 0, - TestPalce = x.TestPalce, - UnitIds = x.UnitIds, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), - WorkPostIds = x.WorkPostIds, - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds), - States = x.States, - QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), - TrainingPlanId = x.PlanId, - }; - return getDataLists.FirstOrDefault(); + Model.TestPlanItem returnItem = new Model.TestPlanItem(); + var getTestP = db.Training_TestPlan.FirstOrDefault(x => x.TestPlanId == testPlanId); + if (getTestP != null) + { + returnItem.TestPlanId = getTestP.TestPlanId; + returnItem.ProjectId = getTestP.ProjectId; + returnItem.TestPlanCode = getTestP.PlanCode; + returnItem.TestPlanName = getTestP.PlanName; + returnItem.TestPlanManId = getTestP.PlanManId; + returnItem.TestPlanManName = UserService.GetUserNameByUserId(getTestP.PlanManId); + returnItem.TestPlanDate = getTestP.PlanDate.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.PlanDate) : ""; + returnItem.TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.TestStartTime); + returnItem.TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", getTestP.TestEndTime); + returnItem.Duration = getTestP.Duration; + returnItem.SValue = getTestP.SValue; + returnItem.MValue = getTestP.MValue; + returnItem.JValue = getTestP.JValue; + returnItem.TotalScore = getTestP.TotalScore ?? 0; + returnItem.QuestionCount = getTestP.QuestionCount ?? 0; + returnItem.TestPalce = getTestP.TestPalce; + returnItem.UnitIds = getTestP.UnitIds; + returnItem.UnitNames = UnitService.getUnitNamesUnitIds(getTestP.UnitIds); + returnItem.WorkPostIds = getTestP.WorkPostIds; + returnItem.WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(getTestP.WorkPostIds); + returnItem.States = getTestP.States; + if (!string.IsNullOrEmpty(getTestP.QRCodeUrl)) + { + returnItem.QRCodeUrl = getTestP.QRCodeUrl.Replace('\\', '/'); + } + returnItem.TrainingPlanId = getTestP.PlanId; + } + return returnItem; } } #endregion diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index ca00cf91..f1e5e716 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -21,6 +21,7 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var getDataLists = (from x in db.Training_TestRecord + join y in db.SitePerson_Person on x.TestManId equals y.PersonId where x.TestPlanId == testPlanId orderby x.TestStartTime descending select new Model.TestRecordItem @@ -29,7 +30,7 @@ namespace BLL ProjectId = x.ProjectId, TestPlanId = x.TestPlanId, TestManId = x.TestManId, - TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName, + TestManName = y.PersonName, TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime), TestScores = x.TestScores ?? 0, @@ -39,6 +40,25 @@ namespace BLL return getDataLists; } } + + /// + /// 根据TestPlanId获取考试人员列表 + /// + /// + /// 考试人员 + public static string getTestRecordTestManByTestPlanId(string testPlanId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string name = string.Empty; + var getManList = db.Training_TestRecord.Where(x => x.TestPlanId == testPlanId).Select(x => x.TestManId).Distinct(); + if (getManList.Count() > 0) + { + name = PersonService.getPersonsPersonIds(getManList.ToList()); + } + return name; + } + } #endregion #region 根据试卷ID获取试卷记录详细 @@ -99,14 +119,32 @@ namespace BLL if (item == null) { List getTestTrainingItemList = new List(); + //// 计划考试中单选、多选、判断题总数 + int sumTestType1Count =0; + int sumTestType2Count = 0; + int sumTestType3Count = 0; + var testPlanTrainings = from x in db.Training_TestPlanTraining where x.TestPlanId == getTestPlan.TestPlanId select x; - //// 计划考试中单选、多选、判断题总数 - int sumTestType1Count = testPlanTrainings.Sum(x => x.TestType1Count) ?? 0; - int sumTestType2Count = testPlanTrainings.Sum(x => x.TestType2Count) ?? 0; - int sumTestType3Count = testPlanTrainings.Sum(x => x.TestType3Count) ?? 0; - + if (testPlanTrainings.Count() > 0) + { + //// 计划考试中单选、多选、判断题总数 + sumTestType1Count = testPlanTrainings.Sum(x => x.TestType1Count) ?? 0; + sumTestType2Count = testPlanTrainings.Sum(x => x.TestType2Count) ?? 0; + sumTestType3Count = testPlanTrainings.Sum(x => x.TestType3Count) ?? 0; + } + else + { + var getTestRule = db.Sys_TestRule.FirstOrDefault(); + if (getTestRule != null) + { + sumTestType1Count = getTestRule.SCount; + sumTestType2Count = getTestRule.MCount; + sumTestType3Count = getTestRule.JCount; + } + } + ////获取类型下适合岗位试题集合 var getTestTrainingItemALLs = from x in db.Training_TestTrainingItem where x.TrainingId != null && (x.WorkPostIds == null || (x.WorkPostIds.Contains(person.WorkPostId) && person.WorkPostId != null)) @@ -331,38 +369,64 @@ namespace BLL #region 根据TestRecordId获取试卷题目列表 /// + /// 记录数 + /// + public static int geTestRecordItemCount + { + get; + set; + } + /// /// 根据TestRecordId获取试卷题目列表 /// /// /// 考试人员 - public static List geTestRecordItemListByTestRecordId(string testRecordId) + public static List geTestRecordItemListByTestRecordId(string testRecordId, int pageIndex) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - var getDataLists = (from x in db.Training_TestRecordItem - where x.TestRecordId == testRecordId - orderby x.TestType, x.TrainingItemCode - select new Model.TestRecordItemItem - { - TestRecordItemId = x.TestRecordItemId, - TestRecordId = x.TestRecordId, - TrainingItemCode = x.TrainingItemCode, - TrainingItemName = x.TrainingItemName, - Abstracts = x.Abstracts, - AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "", - TestType = x.TestType, - TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"), - AItem = x.AItem ?? "", - BItem = x.BItem ?? "", - CItem = x.CItem ?? "", - DItem = x.DItem ?? "", - EItem = x.EItem ?? "", - AnswerItems = x.AnswerItems ?? "", - Score = x.Score ?? 0, - SubjectScore = x.SubjectScore ?? 0, - SelectedItem = x.SelectedItem ?? "", - }).ToList(); - return getDataLists; + var getDatas= from x in db.Training_TestRecordItem + where x.TestRecordId == testRecordId + select x; + geTestRecordItemCount = getDatas.Count(); + if (geTestRecordItemCount == 0) + { + return null; + } + else + { + var getDataLists = from x in getDatas + orderby x.TestType, x.TrainingItemCode + select new Model.TestRecordItemItem + { + TestRecordItemId = x.TestRecordItemId, + TestRecordId = x.TestRecordId, + TrainingItemCode = x.TrainingItemCode, + TrainingItemName = x.TrainingItemName, + Abstracts = x.Abstracts, + AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "", + TestType = x.TestType, + TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"), + AItem = x.AItem ?? "", + BItem = x.BItem ?? "", + CItem = x.CItem ?? "", + DItem = x.DItem ?? "", + EItem = x.EItem ?? "", + AnswerItems = x.AnswerItems ?? "", + Score = x.Score ?? 0, + SubjectScore = x.SubjectScore ?? 0, + SelectedItem = x.SelectedItem ?? "", + }; + + if (pageIndex > 0) + { + return getDataLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); + } + else + { + return getDataLists.ToList(); + } + } } } #endregion diff --git a/SGGL/BLL/HSSE/SitePerson/PersonService.cs b/SGGL/BLL/HSSE/SitePerson/PersonService.cs index a5a0b2c1..31e56d0b 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonService.cs @@ -63,7 +63,8 @@ namespace BLL } if (!string.IsNullOrEmpty(workPostIds)) { - getPersonList = getPersonList.Where(x => workPostIds.Contains(x.WorkPostId)); + List wIds = Funs.GetStrListByStr(workPostIds, ','); + getPersonList = getPersonList.Where(x => wIds.Contains(x.WorkPostId)); } if (ckTrain) { @@ -197,6 +198,30 @@ namespace BLL return personId; } + #region 根据多用户ID得到用户名称字符串 + /// + /// 根据多用户ID得到用户名称字符串 + /// + /// + /// + public static string getPersonsPersonIds(List personIds) + { + string personName = string.Empty; + foreach (string id in personIds) + { + var q = GetPersonNameById(id); + if (q != null) + { + personName += q + ","; + } + } + if (!string.IsNullOrEmpty(personName)) + { + personName = personName.Substring(0, personName.Length - 1); ; + } + return personName; + } + #endregion /// /// 根据UserId主键获取人员信息 /// diff --git a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs index 714c5564..4890fcdb 100644 --- a/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs +++ b/SGGL/BLL/ZHGL/RealName/RealNameMonitorService.cs @@ -7,23 +7,19 @@ namespace BLL { public class RealNameMonitorService { - #region 启动监视器 系统启动5分钟 + #region 启动监视器 系统启动5分钟 /// /// 监视组件 /// - private static Timer messageTimer; + // private static Timer messageTimer; /// /// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟 /// - public static void StartMonitor() - { - int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; - //var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(); - //if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue) - //{ - // adTimeJ = getSynchroSet.Intervaltime.Value; - //} + public static void StartMonitor(string jtProCode) + { + int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; + Timer messageTimer = new Timer(); if (messageTimer != null) { messageTimer.Stop(); @@ -36,7 +32,8 @@ namespace BLL { AutoReset = true }; - messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess); + messageTimer.Elapsed += (sender, args) => AdUserInProcess(sender, jtProCode); + //messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess); messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ; messageTimer.Start(); } @@ -47,34 +44,25 @@ namespace BLL /// /// Timer组件 /// 事件参数 - private static void AdUserInProcess(object sender, ElapsedEventArgs e) + public static void AdUserInProcess(object sender, string jtProCode) { try { SynchroSetService.PushCollCompany(); - var getRProjects = from x in Funs.DB.RealName_Project - select x; - if (getRProjects.Count() > 0) + if (!string.IsNullOrEmpty(jtProCode)) { - foreach (var item in getRProjects) - { - var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.JTproCode); - if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode)) - { - SynchroSetService.PushProCollCompany(item.JTproCode); - //SynchroSetService.PushCollTeam(item.ProCode); - //SynchroSetService.getCollTeam(item.ProCode); - SynchroSetService.PushPersons(Const.BtnAdd, item.JTproCode, null); - SynchroSetService.PushPersons(Const.BtnModify, item.JTproCode, null); - SynchroSetService.PushAttendance(item.JTproCode); - SynchroSetService.updatePersonsExitTime(item.JTproCode); - } - } + SynchroSetService.PushProCollCompany(jtProCode); + SynchroSetService.PushCollTeam(jtProCode); + SynchroSetService.getCollTeam(jtProCode); + SynchroSetService.PushPersons(Const.BtnAdd, jtProCode, null); + SynchroSetService.PushPersons(Const.BtnModify, jtProCode, null); + SynchroSetService.PushAttendance(jtProCode); + SynchroSetService.updatePersonsExitTime(jtProCode); } } catch (Exception ex) { - StartMonitor(); + StartMonitor(jtProCode); ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); } } @@ -176,5 +164,196 @@ namespace BLL } } #endregion + + #region 启动监视器 定时清理推送日志 + /// + /// 监视组件 + /// + private static Timer messageTimer1; + + /// + /// 定时清理推送日志 + /// + public static void StartMonitorDeletePushLog() + { + int adTimeJ = 60 * 12; + if (messageTimer1 != null) + { + messageTimer1.Stop(); + messageTimer1.Dispose(); + messageTimer1 = null; + } + if (adTimeJ > 0) + { + messageTimer1 = new Timer + { + AutoReset = true + }; + messageTimer1.Elapsed += new ElapsedEventHandler(DeletePushLog); + messageTimer1.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ; + messageTimer1.Start(); + } + } + + /// + /// 流程确认 定时执行 系统启动5分钟 + /// + /// Timer组件 + /// 事件参数 + private static void DeletePushLog(object sender, ElapsedEventArgs e) + { + try + { + /// 3天推送实名制日志 + var getPushLogs = Funs.DB.RealName_PushLog.Where(x => x.PushTime.Value.AddDays(3) < DateTime.Now); + if (getPushLogs.Count() > 0) + { + Funs.DB.RealName_PushLog.DeleteAllOnSubmit(getPushLogs); + Funs.DB.SubmitChanges(); + } + /// 3个月操作日志 + var getSys_Logs = Funs.DB.Sys_Log.Where(x => x.OperationTime.Value.AddMonths(3) < DateTime.Now); + if (getSys_Logs.Count() > 0) + { + Funs.DB.Sys_Log.DeleteAllOnSubmit(getSys_Logs); + Funs.DB.SubmitChanges(); + } + /// 1个月推送消息日志 + var getSys_HttpLogs = Funs.DB.Sys_HttpLog.Where(x => x.LogTime.Value.AddMonths(1) < DateTime.Now); + if (getSys_HttpLogs.Count() > 0) + { + Funs.DB.Sys_HttpLog.DeleteAllOnSubmit(getSys_HttpLogs); + Funs.DB.SubmitChanges(); + } + } + catch (Exception ex) + { + } + } + #endregion + + #region 启动监视器 定时清理推送日志 + /// + /// 监视组件 + /// + private static Timer messageTimer2; + + /// + /// 定时清理推送日志 + /// + public static void StartMonitorCleanAttendance() + { + int adTimeJ = 60 * 12; + if (messageTimer2 != null) + { + messageTimer2.Stop(); + messageTimer2.Dispose(); + messageTimer2 = null; + } + if (adTimeJ > 0) + { + messageTimer2 = new Timer + { + AutoReset = true + }; + messageTimer2.Elapsed += new ElapsedEventHandler(CleanAttendance); + messageTimer2.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ; + messageTimer2.Start(); + } + } + + /// + /// 流程确认 定时执行 系统启动5分钟 + /// + /// Timer组件 + /// 事件参数 + private static void CleanAttendance(object sender, ElapsedEventArgs e) + { + try + { + /// 清理出入记录 + var getRecords = from x in Funs.DB.T_d_facerecord where x.DateTimeRecord.Value.AddDays(1) < DateTime.Now select x; + if (getRecords.Count() > 0) + { + foreach (var item in getRecords) + { + if (item.InOrOut == "进门") + { + var getDelRecordsIn = from x in Funs.DB.T_d_facerecord + where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut + && x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year + && x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month + && x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day + && x.DateTimeRecord > item.DateTimeRecord + select x; + if (getDelRecordsIn.Count() > 0) + { + Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsIn); + Funs.DB.SubmitChanges(); + } + } + else + { + var getDelRecordsOut = from x in Funs.DB.T_d_facerecord + where x.ProjectId == item.ProjectId && x.EmployNO == item.EmployNO && x.InOrOut == item.InOrOut + && x.DateTimeRecord.Value.Year == item.DateTimeRecord.Value.Year + && x.DateTimeRecord.Value.Month == item.DateTimeRecord.Value.Month + && x.DateTimeRecord.Value.Day == item.DateTimeRecord.Value.Day + && x.DateTimeRecord < item.DateTimeRecord + select x; + if (getDelRecordsOut.Count() > 0) + { + Funs.DB.T_d_facerecord.DeleteAllOnSubmit(getDelRecordsOut); + Funs.DB.SubmitChanges(); + } + } + } + } + + var getVRecords = from x in Funs.DB.T_d_validcardevent + where x.RecordDateTime.Value.AddDays(1) < DateTime.Now + select x; + if (getVRecords.Count() > 0) + { + foreach (var item in getVRecords) + { + if (item.InOrOut == 1) + { + var getDelVRecordsIn = from x in Funs.DB.T_d_validcardevent + where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut + && x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year + && x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month + && x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day + && x.RecordDateTime > item.RecordDateTime + select x; + if (getDelVRecordsIn.Count() > 0) + { + Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsIn); + Funs.DB.SubmitChanges(); + } + } + else + { + var getDelVRecordsOut = from x in Funs.DB.T_d_validcardevent + where x.ProjectId == item.ProjectId && x.IDCardNo == item.IDCardNo && x.InOrOut == item.InOrOut + && x.RecordDateTime.Value.Year == item.RecordDateTime.Value.Year + && x.RecordDateTime.Value.Month == item.RecordDateTime.Value.Month + && x.RecordDateTime.Value.Day == item.RecordDateTime.Value.Day + && x.RecordDateTime < item.RecordDateTime + select x; + if (getDelVRecordsOut.Count() > 0) + { + Funs.DB.T_d_validcardevent.DeleteAllOnSubmit(getDelVRecordsOut); + Funs.DB.SubmitChanges(); + } + } + } + } + } + catch (Exception ex) + { + } + } + #endregion } } diff --git a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs index 9b6d1631..5f566b9f 100644 --- a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs +++ b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs @@ -56,6 +56,11 @@ namespace BLL } #endregion + public static List GetRealNameProject() + { + return (from x in Funs.DB.RealName_Project select x).ToList(); + } + #region 项目基础数据下拉框 /// /// 表下拉框 @@ -1426,7 +1431,14 @@ namespace BLL addTeam(getData.Select(x => x.TeamGroupId).Distinct().ToList(), newToken); getTeam(proCode, newToken); - addPerson(getData.Select(x => x.PersonId).Distinct().ToList(), newToken); + + var getPersonS = getData.Select(x => x.idcardNumber).Distinct().ToList(); + foreach (var pitem in getPersonS) + { + PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem); + PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem); + } + pushContent = JsonConvert.SerializeObject(listObject); var returndata = BLL.APIGetHttpService.OutsideHttp(url, "POST", null, newToken, pushContent); if (!string.IsNullOrEmpty(returndata)) diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110716845.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110716845.jpg deleted file mode 100644 index 1c467220..00000000 Binary files a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110716845.jpg and /dev/null differ diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110726069.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110726069.jpg deleted file mode 100644 index 6361f67d..00000000 Binary files a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110726069.jpg and /dev/null differ diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110734021.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110734021.jpg deleted file mode 100644 index 37df5458..00000000 Binary files a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20220702110734021.jpg and /dev/null differ diff --git a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20221629111627216.jpg b/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20221629111627216.jpg deleted file mode 100644 index 37df5458..00000000 Binary files a/SGGL/FineUIPro.Web/FileUpload/QRCodeFile/20221629111627216.jpg and /dev/null differ diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 999d77a5..799de888 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -58,7 +58,7 @@ False - bin\Apache.NMS.dll + ..\..\..\..\DepCode\reference-bll\Reference BLL\Apache.NMS.dll ..\packages\Apache.NMS.ActiveMQ.1.7.2\lib\net40\Apache.NMS.ActiveMQ.dll diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index b5bc6f9c..2164ab3a 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -1,11 +1,12 @@ namespace FineUIPro.Web { + using BLL; + using Model; using System; using System.Configuration; using System.Globalization; using System.Text; - using BLL; - using Model; + using System.Timers; public class Global : System.Web.HttpApplication { @@ -17,7 +18,6 @@ protected void Application_Start(object sender, EventArgs e) { Application["OnlineUserCount"] = 0; - Model.Sys_User sysUser = new Sys_User(); try { Funs.RootPath = Server.MapPath("~/"); @@ -27,26 +27,34 @@ Funs.SystemName = ConfigurationManager.AppSettings["SystemName"]; Funs.SGGLUrl = ConfigurationManager.AppSettings["SGGLUrl"]; Funs.RealNameApiUrl = ConfigurationManager.AppSettings["RealNameApiUrl"]; - Funs.ControlApiUrl = ConfigurationManager.AppSettings["ControlApiUrl"]; - - sysUser = UserService.GetUserByUserId(Const.sysglyId); + Funs.ControlApiUrl = ConfigurationManager.AppSettings["ControlApiUrl"]; + Funs.SystemVersion = ConfigurationManager.AppSettings["SystemVersion"]; } catch (Exception ex) { ErrLogInfo.WriteLog(string.Empty, ex); //AppDomain.Unload(AppDomain.CurrentDomain); } - - ////实名制同步定时器 + ///实名制出入记录去重 try { BLL.RealNameMonitorService.StartInOutMonitor(); + } + catch (Exception ex) + { + ErrLogInfo.WriteLog("实名制出入记录去重定时器启动失败!", ex); + } + ////实名制同步定时器 + try + { if (ConfigurationManager.AppSettings["EnableRealName"] == "True") { - BLL.RealNameMonitorService.StartMonitor(); + var getProjects = SynchroSetService.GetRealNameProject(); + foreach (var item in getProjects) + { + BLL.RealNameMonitorService.StartMonitor(item.JTproCode); + } } - BLL.RealNameMonitorService.StartInOutMonitor(); - BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "实名制同步定时器启动成功!"); } catch (Exception ex) { @@ -58,27 +66,33 @@ BLL.MonitorService.StartMonitor(); BLL.MonitorService.StartMonitorEve(); BLL.MonitorService.StartPersonQuarterCheck(); - BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "通用定时器启动成功!"); } catch (Exception ex) { ErrLogInfo.WriteLog("通用定时器启动失败!", ex); } - ////员工考核定时器 - //try - //{ - // BLL.MonitorService.StartPersonQuarterCheck(); - // BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "员工考核定时器启动成功!"); - //} - //catch (Exception ex) - //{ - // ErrLogInfo.WriteLog("员工考核定时器启动失败!", ex); - //} + ///实名制日志清理定时器 + try + { + BLL.RealNameMonitorService.StartMonitorDeletePushLog(); + } + catch (Exception ex) + { + ErrLogInfo.WriteLog("实名制日志清理定时器启动失败!", ex); + } + ///考勤记录清理定时器 + try + { + BLL.RealNameMonitorService.StartMonitorCleanAttendance(); + } + catch (Exception ex) + { + ErrLogInfo.WriteLog("实名制日志清理定时器启动失败!", ex); + } ////从集团获取数据定时器 try { BLL.MCSWebService.StartMonitor(); - BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "从材料软件获取数据定时器启动成功!"); } catch (Exception ex) { @@ -88,18 +102,15 @@ try { BLL.CNCECHSSEMonitorService.StartMonitor(); - BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "从集团获取数据定时器启动成功!"); } catch (Exception ex) { ErrLogInfo.WriteLog("从集团获取数据定时器启动失败!", ex); } - ////从博晟获取培训考试数据定时器 try { BLL.BOSHENGMonitorService.StartMonitor(); - BLL.LogService.AddSys_Log(sysUser, string.Empty, string.Empty, string.Empty, "从博晟获取培训考试数据定时器启动成功!"); } catch (Exception ex) { diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs index 8615345a..afa730dc 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonInfoIn.aspx.cs @@ -229,7 +229,7 @@ namespace FineUIPro.Web.HSSE.SitePerson { DateTime inToOutTime = Convert.ToDateTime(col4); } - catch (Exception) + catch (Exception ex) { result += "第" + (i + 2).ToString() + "行," + "时间" + "," + "[" + col4 + "]错误!" + "|"; } @@ -407,26 +407,43 @@ namespace FineUIPro.Web.HSSE.SitePerson { if (string.IsNullOrEmpty(errorInfos)) { - int a = viewCheckings.Count(); - for (int i = 0; i < a; i++) + foreach (var item in viewCheckings) { - Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + var getCheck = Funs.DB.SitePerson_Checking.FirstOrDefault(x => x.CheckingId == item.CheckingId); + if (getCheck == null) { - CheckingId = viewCheckings[i].CheckingId, - ProjectId = viewCheckings[i].ProjectId, - IdentityCard = viewCheckings[i].IdentityCard, - IntoOutTime = viewCheckings[i].IntoOutTime, - IntoOut = viewCheckings[i].IntoOut, - PersonId = viewCheckings[i].PersonId - }; - BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); + Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + { + CheckingId = item.CheckingId, + ProjectId = item.ProjectId, + IdentityCard = item.IdentityCard, + IntoOutTime = item.IntoOutTime, + IntoOut = item.IntoOut, + PersonId = item.PersonId + }; + BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); + } } + //int a = viewCheckings.Count(); + //for (int i = 0; i < a; i++) + //{ + // Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking + // { + // CheckingId = viewCheckings[i].CheckingId, + // ProjectId = viewCheckings[i].ProjectId, + // IdentityCard = viewCheckings[i].IdentityCard, + // IntoOutTime = viewCheckings[i].IntoOutTime, + // IntoOut = viewCheckings[i].IntoOut, + // PersonId = viewCheckings[i].PersonId + // }; + // BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); + //} string rootPath = Server.MapPath("~/"); string initFullPath = rootPath + initPath; string filePath = initFullPath + this.hdFileName.Text; if (filePath != string.Empty && System.IO.File.Exists(filePath)) { - System.IO.File.Delete(filePath);//删除上传的XLS文件 + File.Delete(filePath);//删除上传的XLS文件 } ShowNotify("导入成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); diff --git a/SGGL/FineUIPro.Web/Login.aspx b/SGGL/FineUIPro.Web/Login.aspx index f25e7b17..c099a13a 100644 --- a/SGGL/FineUIPro.Web/Login.aspx +++ b/SGGL/FineUIPro.Web/Login.aspx @@ -10,9 +10,9 @@