diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 7fb52841..deaae098 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -1,4 +1,6 @@ using Microsoft.SqlServer.Dts.Runtime; +using Model; +using NPOI.SS.Formula.PTG; using System; using System.Collections.Generic; using System.Configuration; @@ -572,7 +574,16 @@ namespace BLL if (!string.IsNullOrEmpty(newProjectPerson.SitePersonId)) { - SitePerson_PersonService.UpdateSitePerson(newProjectPerson); + Model.Sys_Log newlog = new Sys_Log + { + UserId = newPerson.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "APP修改人员", + OperationLog = "修改人员"+newPerson.PersonName, + DataId = newPerson.PersonId, + ProjectId = person.ProjectId, + }; + SitePerson_PersonService.UpdateSitePerson(newProjectPerson, newlog); } else { diff --git a/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs b/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs index e90de5b6..0bffb795 100644 --- a/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs +++ b/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs @@ -150,144 +150,6 @@ namespace BLL } } - public static void AddProjectUser(string ProjectCode, string UserID) - { - Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString); - Base_Project base_Project = new Base_Project(); - SitePerson_Person sitePerson = new SitePerson_Person(); - base_Project = BLL.ProjectService.GetProjectByProjectCode(ProjectCode); - if (base_Project == null) - { - return; - } - var ProUser = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(base_Project.ProjectId, UserID); - if (ProUser == null) - { - sitePerson.SitePersonId = SQLHelper.GetNewID(); - sitePerson.ProjectId = base_Project.ProjectId; - sitePerson.PersonId = UserID; - sitePerson.UnitId = Const.UnitId_SEDIN; - sitePerson.States = Const.State_1; - SitePerson_PersonService.AddSitePerson(ProUser); - } - else - { - ProUser.ProjectId = base_Project.ProjectId; - ProUser.PersonId = UserID; - ProUser.UnitId = Const.UnitId_SEDIN; - ProUser.States = Const.State_1; - SitePerson_PersonService.UpdateSitePerson(ProUser); - - } - } - - - public static Pro_Person SavePro_Person(Pro_Person PersonjsonData) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - Pro_Person rb = PersonjsonData; - - Pro_Person _Person = new Pro_Person - { - data = new List() - }; - foreach (Pro_PersonDataItem item in rb.data) - { - try - { - if (CheckDataIsNull(item)) //判断参数是否有空值 - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--参数有误存在null值|"; - continue; - } - - - if (item.UserCode == null || item.UserCode == "") - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--身份证信息有误|"; - continue; - } - - if (item.ProjectCode == null || item.ProjectCode == "") - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--项目代号不能为空|"; - continue; - } - - var getPerson = Person_PersonsService.GetPerson_PersonsByJobNum(item.UserCode); - if (getPerson != null) - { - getPerson.JobNum = item.UserCode; - getPerson.PersonName = item.UserName; - getPerson.DataFrom = "API"; - db.SubmitChanges(); - APIHTGLPersonService.AddProjectUser(item.ProjectCode, getPerson.PersonId); - } - else - { - string newKeyID = SQLHelper.GetNewID(); - Model.Person_Persons newUser = new Model.Person_Persons - { - PersonId = newKeyID, - Account = item.UserCode, - JobNum = item.UserCode, - PersonName = item.UserName, - IdentityCard = item.IdentityCard, - UnitId = Const.UnitId_SEDIN, - Password = Funs.EncryptionPassword(Const.Password), - DataFrom = "API", - }; - db.Person_Persons.InsertOnSubmit(newUser); - db.SubmitChanges(); - AddProjectUser(item.ProjectCode, newKeyID); - } - } - catch (Exception ex) - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += ex.Message; - } - } - return _Person; - } - } - private static bool CheckDataIsNull(object t) { bool Isok = false; diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs index d7433eef..19fcd73e 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs @@ -1,6 +1,7 @@ using FineUIPro; using Microsoft.Office.Interop.Excel; using Microsoft.SqlServer.Dts.Runtime; +using Model; using System; using System.Collections; using System.Linq; @@ -115,7 +116,7 @@ namespace BLL /// 设置人员进出场 /// /// - public static void SetPersonItemInOut(Model.SitePerson_Person sitePerson) + public static void SetPersonItemInOut(Model.SitePerson_Person sitePerson, Model.Sys_Log log) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -144,7 +145,7 @@ namespace BLL InTime = sitePerson.InTime, }; - AddPersonItem(newPersonItem); + AddPersonItem(newPersonItem, log); if (!getPersons.MultiProject.HasValue || getPersons.MultiProject == false) { var getOtherPersons = db.SitePerson_Person.Where(x => x.IdentityCard == sitePerson.IdentityCard && x.ProjectId != sitePerson.ProjectId && x.States == Const.ProjectPersonStates_1); @@ -182,7 +183,7 @@ namespace BLL /// 增加 人员进场 /// /// 实体 - public static void AddPersonItem(Model.SitePerson_PersonItem newitem) + public static void AddPersonItem(Model.SitePerson_PersonItem newitem, Model.Sys_Log log) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -271,6 +272,11 @@ namespace BLL db.SitePerson_PersonItem.InsertOnSubmit(newPersonItem); db.SubmitChanges(); } + ///更新人员出入记录日志 + if (log != null) + { + LogService.AddSys_Log(log); + } } } } diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs index 9f8481e8..1c4a3268 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs @@ -1,5 +1,7 @@ using FineUIPro; +using Microsoft.SqlServer.Dts.Runtime; using Model; +using NPOI.SS.Formula.PTG; using System; using System.Collections; using System.Collections.Generic; @@ -697,9 +699,9 @@ namespace BLL Isprint = "0", States = person.States, }; - ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(newPerson); + ////现场人员项目出入场记录 + SitePerson_PersonItemService.SetPersonItemInOut(newPerson, null); db.SitePerson_Person.InsertOnSubmit(newPerson); db.SubmitChanges(); } @@ -709,7 +711,7 @@ namespace BLL /// 修改人员信息 /// /// 人员实体 - public static void UpdateSitePerson(Model.SitePerson_Person person) + public static void UpdateSitePerson(Model.SitePerson_Person person, Model.Sys_Log newlog) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -790,9 +792,9 @@ namespace BLL } } if (setPersonItemInOut) - { + { ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(newPerson); + SitePerson_PersonItemService.SetPersonItemInOut(newPerson,newlog); } } } @@ -850,7 +852,7 @@ namespace BLL { ////现场人员项目出入场记录 person.States = Const.ProjectPersonStates_2; - SitePerson_PersonItemService.SetPersonItemInOut(person); + SitePerson_PersonItemService.SetPersonItemInOut(person, null); Funs.DB.SitePerson_Person.DeleteOnSubmit(person); Funs.DB.SubmitChanges(); @@ -980,8 +982,18 @@ namespace BLL } Funs.DB.SubmitChanges(); + Model.Sys_Log newlog = new Sys_Log + { + UserId = getSitePerson.AuditorId, + MenuId = Const.PersonListMenuId, + OperationName = "现场人员审核", + OperationLog = "现场人员审核" + getSitePerson.PersonName, + DataId = getSitePerson.PersonId, + ProjectId = getSitePerson.ProjectId, + }; + ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(getSitePerson); + SitePerson_PersonItemService.SetPersonItemInOut(getSitePerson, newlog); } } } diff --git a/SGGL/BLL/Person/Person_PersonsService.cs b/SGGL/BLL/Person/Person_PersonsService.cs index 3f866072..9b42a026 100644 --- a/SGGL/BLL/Person/Person_PersonsService.cs +++ b/SGGL/BLL/Person/Person_PersonsService.cs @@ -776,7 +776,10 @@ namespace BLL newPerson.IdcardEndDate = person.IdcardEndDate; newPerson.IdcardForever = person.IdcardForever; newPerson.IdcardAddress = person.IdcardAddress; - newPerson.Telephone = person.Telephone; + if (!string.IsNullOrEmpty(person.Telephone) && newPerson.Telephone != person.Telephone) + { + newPerson.Telephone = person.Telephone; + } newPerson.Birthday = person.Birthday; newPerson.Sex = person.Sex; newPerson.Address = person.Address; diff --git a/SGGL/BLL/SysManage/LogService.cs b/SGGL/BLL/SysManage/LogService.cs index 1df5bb90..551618ac 100644 --- a/SGGL/BLL/SysManage/LogService.cs +++ b/SGGL/BLL/SysManage/LogService.cs @@ -1,5 +1,6 @@ namespace BLL { + using NPOI.SS.Formula.PTG; using System; using System.Linq; using System.Net; @@ -73,6 +74,70 @@ namespace BLL } } + /// + /// Ӳ־ + /// + /// + /// + /// ID + /// ˵ID + /// + public static void AddSys_Log(Model.Sys_Log newsyslog) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (newsyslog != null) + { + Model.Sys_Log syslog = new Model.Sys_Log + { + LogId = SQLHelper.GetNewID(), + HostName = Dns.GetHostName(), + OperationTime = DateTime.Now, + UserId = newsyslog.UserId, + MenuId = newsyslog.MenuId, + OperationName = newsyslog.OperationName, + DataId = newsyslog.DataId, + LogSource = 1, + }; + + IPAddress[] ips = Dns.GetHostAddresses(syslog.HostName); + if (ips.Length > 0) + { + foreach (IPAddress ip in ips) + { + if (ip.ToString().IndexOf('.') != -1) + { + syslog.Ip = ip.ToString(); + } + } + } + string opLog = string.Empty; + var menu = db.Sys_Menu.FirstOrDefault(x => x.MenuId == newsyslog.MenuId); + if (menu != null) + { + opLog = menu.MenuName + ":"; + } + + if (!string.IsNullOrEmpty(newsyslog.OperationName)) + { + opLog += newsyslog.OperationName; + } + + if (!string.IsNullOrEmpty(newsyslog.OperationLog)) + { + syslog.OperationLog = opLog + "" + newsyslog.OperationLog + ""; + } + + if (!string.IsNullOrEmpty(newsyslog.ProjectId) && newsyslog.ProjectId != "null") + { + syslog.ProjectId = newsyslog.ProjectId; + } + + db.Sys_Log.InsertOnSubmit(syslog); + db.SubmitChanges(); + } + } + } /// /// ĿIdɾ־Ϣ /// diff --git a/SGGL/FineUIPro.Web/CQMS/PersonManage/TestRecordEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/PersonManage/TestRecordEdit.aspx.cs index 02d17db5..9ad3367f 100644 --- a/SGGL/FineUIPro.Web/CQMS/PersonManage/TestRecordEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/PersonManage/TestRecordEdit.aspx.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Linq; using System.Web.UI.WebControls; using AspNet = System.Web.UI.WebControls; +using Model; namespace FineUIPro.Web.CQMS.PersonManage { @@ -165,7 +166,7 @@ namespace FineUIPro.Web.CQMS.PersonManage if (welder != null) { welder.States = Const.ProjectPersonStates_2; - BLL.SitePerson_PersonService.UpdateSitePerson(welder); + Funs.DB.SubmitChanges(); } } } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonOut.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonOut.aspx.cs index 18d39d59..4055d554 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonOut.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonOut.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Model; using System; using System.Collections.Generic; using System.Data; @@ -85,7 +86,17 @@ namespace FineUIPro.Web.HSSE.SitePerson { person.OutTime = Funs.GetNewDateTime(this.txtChangeTime.Text); person.States = Const.State_2; - BLL.SitePerson_PersonService.UpdateSitePerson(person); + Model.Sys_Log newlog = new Sys_Log + { + UserId = this.CurrUser.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "现场人员出场", + OperationLog = "现场人员出场" + person.PersonName, + DataId = person.PersonId, + ProjectId = person.ProjectId, + }; + + BLL.SitePerson_PersonService.UpdateSitePerson(person, newlog); } } diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonUnitRefresh.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonUnitRefresh.aspx.cs index 26b3c80d..44427b9f 100644 --- a/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonUnitRefresh.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/PersonUnitRefresh.aspx.cs @@ -117,13 +117,13 @@ namespace FineUIPro.Web.HSSE.SitePerson { person.TeamGroupId = null; } - BLL.SitePerson_PersonService.UpdateSitePerson(person); + Funs.DB.SubmitChanges(); var getPerson = Person_PersonsService.GetPerson_PersonsById(person.PersonId); if (getPerson != null) { getPerson.UnitId = person.UnitId; - Person_PersonsService.UpdatePerson(getPerson); + Funs.DB.SubmitChanges(); } } } diff --git a/SGGL/FineUIPro.Web/Person/DepartPersonShunt.aspx.cs b/SGGL/FineUIPro.Web/Person/DepartPersonShunt.aspx.cs index 80715aa1..fb0fffea 100644 --- a/SGGL/FineUIPro.Web/Person/DepartPersonShunt.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/DepartPersonShunt.aspx.cs @@ -1,5 +1,6 @@ using BLL; using FastReport.DevComponents.Editors; +using Model; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -380,7 +381,16 @@ namespace FineUIPro.Web.Person if (!string.IsNullOrEmpty(newProjectPerson.SitePersonId)) { - SitePerson_PersonService.UpdateSitePerson(newProjectPerson); + Model.Sys_Log newlog = new Sys_Log + { + UserId = this.CurrUser.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "部门人员", + OperationLog = "部门人员修改" + newProjectPerson.PersonName, + DataId = newProjectPerson.PersonId, + ProjectId = newProjectPerson.ProjectId, + }; + SitePerson_PersonService.UpdateSitePerson(newProjectPerson,newlog); LogService.AddSys_Log(this.CurrUser, newProjectPerson.IdentityCard, newProjectPerson.SitePersonId, BLL.Const.ProjectPersonMenuId, BLL.Const.BtnModify); } else diff --git a/SGGL/FineUIPro.Web/Person/PersonItemEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/PersonItemEdit.aspx.cs index ab490bff..36f9a595 100644 --- a/SGGL/FineUIPro.Web/Person/PersonItemEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/PersonItemEdit.aspx.cs @@ -165,7 +165,7 @@ namespace FineUIPro.Web.Person { this.PersonItemId = SQLHelper.GetNewID(); newData.PersonItemId = this.PersonItemId; - BLL.SitePerson_PersonItemService.AddPersonItem(newData); + BLL.SitePerson_PersonItemService.AddPersonItem(newData,null); BLL.LogService.AddSys_Log(this.CurrUser, newData.PersonName, newData.PersonItemId, BLL.Const.ProjectPersonMenuId, BLL.Const.BtnAdd); } diff --git a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.cs b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.cs index 3881b7b4..699f074f 100644 --- a/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Person/ProjectPersonEdit.aspx.cs @@ -708,7 +708,17 @@ namespace FineUIPro.Web.Person if (!string.IsNullOrEmpty(newProjectPerson.SitePersonId)) { newProjectPerson.PersonId = this.PersonId; - SitePerson_PersonService.UpdateSitePerson(newProjectPerson); + + Model.Sys_Log newlog = new Sys_Log + { + UserId = this.CurrUser.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "劳务人员", + OperationLog = "劳务人员修改" + newProjectPerson.PersonName, + DataId = newProjectPerson.PersonId, + ProjectId = newProjectPerson.ProjectId, + }; + SitePerson_PersonService.UpdateSitePerson(newProjectPerson, newlog); LogService.AddSys_Log(this.CurrUser, newPerson.IdentityCard, newProjectPerson.SitePersonId, BLL.Const.ProjectPersonMenuId, BLL.Const.BtnModify); } else diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectUser.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectUser.aspx.cs index e673dc2e..1067868e 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectUser.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectUser.aspx.cs @@ -1,6 +1,7 @@ namespace FineUIPro.Web.ProjectData { using BLL; + using Model; using System; using System.Collections.Generic; using System.Data; @@ -122,7 +123,17 @@ { BLL.RoleItemService.DeleteRoleItem(roleItem.RoleItemId); } - SitePerson_PersonService.UpdateSitePerson(projectUser); + + Model.Sys_Log newlog = new Sys_Log + { + UserId = this.CurrUser.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "项目用户", + OperationLog = "项目用户删除" + projectUser.PersonName, + DataId = projectUser.PersonId, + ProjectId = projectUser.ProjectId, + }; + SitePerson_PersonService.UpdateSitePerson(projectUser, newlog); } } diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectUserSave.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectUserSave.aspx.cs index a1717164..e098ae9f 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectUserSave.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectUserSave.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Model; using System; using System.Linq; @@ -114,7 +115,17 @@ namespace FineUIPro.Web.ProjectData { newProjectUser.WorkAreaId = string.Join(",", txtUnitWork.Values); } - BLL.SitePerson_PersonService.UpdateSitePerson(newProjectUser); + + Model.Sys_Log newlog = new Sys_Log + { + UserId = this.CurrUser.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "项目用户", + OperationLog = "项目用户修改" + newProjectUser.PersonName, + DataId = newProjectUser.PersonId, + ProjectId = newProjectUser.ProjectId, + }; + BLL.SitePerson_PersonService.UpdateSitePerson(newProjectUser, newlog); ///离岗 -todo Model.Sys_RoleItem roleItem = BLL.RoleItemService.GeRoleItemByUserIdAndProjectId(newProjectUser.PersonId, newProjectUser.ProjectId); diff --git a/SGGL/WebAPI/Controllers/HTGL/HTGLPersonController.cs b/SGGL/WebAPI/Controllers/HTGL/HTGLPersonController.cs index de6a021b..1541d776 100644 --- a/SGGL/WebAPI/Controllers/HTGL/HTGLPersonController.cs +++ b/SGGL/WebAPI/Controllers/HTGL/HTGLPersonController.cs @@ -53,8 +53,7 @@ namespace WebAPI.Controllers public Model.ResponeData AddHTGLPerson_Pro([FromBody] Model.Pro_Person PersonjsonData) { var responeData = new Model.ResponeData(); - APICommonService.SaveSysHttpLog("API", JsonConvert.SerializeObject(PersonjsonData), ""); - + try { //var Data = APIHTGLPersonService.SavePro_Person(PersonjsonData);