diff --git a/SGGL/BLL/API/APIUserService.cs b/SGGL/BLL/API/APIUserService.cs index 476b7ffb..0f500921 100644 --- a/SGGL/BLL/API/APIUserService.cs +++ b/SGGL/BLL/API/APIUserService.cs @@ -323,5 +323,163 @@ namespace BLL } } } + + #region 保存Meeting + /// + /// 保存Meeting + /// + /// 会议信息 + /// + public static string SaveUserInfo(Model.UserListItem listItem) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List userInfo = listItem.list; + string returnInfos = string.Empty; + int i = 0; + int rowNum = 0; + foreach (var item in userInfo) + { + i++; + string info = string.Empty; + if (string.IsNullOrEmpty(item.UnitName)) + { + info += "单位名称为空。"; + } + if (string.IsNullOrEmpty(item.UserName)) + { + info += "用户名称为空。"; + } + if (string.IsNullOrEmpty(item.Account)) + { + info += "用户账号为空。"; + } + if (string.IsNullOrEmpty(info)) + { + Model.Sys_User newUser = new Model.Sys_User + { + UserId = item.UserId, + UserCode = item.UserCode, + UserName = item.UserName, + Account = item.Account, + Password = item.Password, + IdentityCard = item.IdentityCard, + Telephone = item.Telephone, + IsPost = item.IsPost == "1" ? true : false, + IsOffice = true, + }; + #region 用户单位 + newUser.UnitId = Const.UnitId_CD; + if (!string.IsNullOrEmpty(item.UnitName) || !string.IsNullOrEmpty(item.UnitCode)) + { + var getUnit = db.Base_Unit.FirstOrDefault(x => x.UnitName == item.UnitName || x.UnitName == item.UnitName); + if (getUnit != null) + { + newUser.UnitId = getUnit.UnitId; + } + else + { + Model.Base_Unit newUnit = new Model.Base_Unit + { + UnitId = SQLHelper.GetNewID(), + UnitName = item.UnitName, + UnitCode = item.UnitCode, + }; + db.Base_Unit.InsertOnSubmit(newUnit); + db.SubmitChanges(); + newUser.UnitId = newUnit.UnitId; + } + } + #endregion + #region 用户部门 + if (!string.IsNullOrEmpty(item.DepartName)) + { + var getDepart = db.Base_Depart.FirstOrDefault(x => x.DepartName == item.DepartName); + if (getDepart != null) + { + newUser.DepartId = getDepart.DepartId; + } + else + { + Model.Base_Depart newDepart = new Model.Base_Depart + { + DepartId = SQLHelper.GetNewID(), + DepartName = item.DepartName, + }; + db.Base_Depart.InsertOnSubmit(newDepart); + db.SubmitChanges(); + newUser.DepartId = newDepart.DepartId; + } + } + #endregion + #region 用户角色 + if (!string.IsNullOrEmpty(item.RoleName)) + { + var getRole = db.Sys_Role.FirstOrDefault(x => x.RoleName == item.RoleName); + if (getRole != null) + { + newUser.RoleId = getRole.RoleId; + } + else + { + Model.Sys_Role newRole = new Model.Sys_Role + { + RoleId = SQLHelper.GetNewID(), + RoleName = item.RoleName, + }; + db.Sys_Role.InsertOnSubmit(newRole); + db.SubmitChanges(); + newUser.RoleId = newRole.RoleId; + } + } + #endregion + if (!string.IsNullOrEmpty(item.Password)) + { + newUser.Password = item.Password; + } + else + { + newUser.Password = Funs.EncryptionPassword(Const.Password); + } + var geUser = db.Sys_User.FirstOrDefault(x => (x.Account == item.Account && item.Account != null) || (x.IdentityCard == item.IdentityCard && item.IdentityCard != null)); + if (geUser != null) + { + geUser.UserCode = newUser.UserCode; + geUser.UserName = newUser.UserName; + geUser.Account = newUser.Account; + geUser.Password = newUser.Password; + geUser.IdentityCard = newUser.IdentityCard; + geUser.Telephone = newUser.Telephone; + geUser.UnitId = newUser.UnitId; + geUser.DepartId = newUser.DepartId; + geUser.RoleId = newUser.RoleId; + geUser.IsPost = newUser.IsPost; + db.SubmitChanges(); + } + else + { + newUser.UserId = SQLHelper.GetNewID(); + db.Sys_User.InsertOnSubmit(newUser); + db.SubmitChanges(); + } + rowNum++; + } + else + { + returnInfos += "第" + i.ToString() + "行," + info; + } + } + if (!string.IsNullOrEmpty(returnInfos)) + { + returnInfos = "同步成功" + rowNum.ToString() + "条记录。" + returnInfos; + } + else + { + returnInfos = "同步成功" + rowNum.ToString() + "条记录。"; + } + return returnInfos; + } + } + #endregion } } diff --git a/SGGL/FineUIPro.Web/Login.aspx b/SGGL/FineUIPro.Web/Login.aspx index de706aef..989f2368 100644 --- a/SGGL/FineUIPro.Web/Login.aspx +++ b/SGGL/FineUIPro.Web/Login.aspx @@ -14,7 +14,7 @@ src="./images/login.png" style="height: 100%; left: 0px; top: 0px; bottom: 0px; position: absolute; display: none;" /> style="height: auto;width:400px; left: 100px; top: 65px; position: absolute;" />
diff --git a/SGGL/Model/APIItem/UserItem.cs b/SGGL/Model/APIItem/UserItem.cs index 429f40db..b11403b8 100644 --- a/SGGL/Model/APIItem/UserItem.cs +++ b/SGGL/Model/APIItem/UserItem.cs @@ -7,10 +7,10 @@ namespace Model { public class UserItem { - /// - /// 用户ID - /// - public string UserId + /// + /// 用户ID + /// + public string UserId { get; set; @@ -80,6 +80,30 @@ namespace Model set; } /// + /// 单位代号 + /// + public string UnitCode + { + get; + set; + } + /// + /// 部门ID + /// + public string DepartId + { + get; + set; + } + /// + /// 部门名称 + /// + public string DepartName + { + get; + set; + } + /// /// 当前项目ID /// public string LoginProjectId @@ -136,6 +160,14 @@ namespace Model set; } /// + /// 是否在岗 + /// + public string IsPost + { + get; + set; + } + /// /// 是否本部 /// public bool? IsOffice diff --git a/SGGL/Model/APIItem/UserListItem.cs b/SGGL/Model/APIItem/UserListItem.cs new file mode 100644 index 00000000..1648255b --- /dev/null +++ b/SGGL/Model/APIItem/UserListItem.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Model +{ + public class UserListItem + { + /// + /// 用户信息集合 + /// + public List list + { + get; + set; + } + } +} diff --git a/SGGL/Model/Model.csproj b/SGGL/Model/Model.csproj index 82cfb785..ff810224 100644 --- a/SGGL/Model/Model.csproj +++ b/SGGL/Model/Model.csproj @@ -145,6 +145,7 @@ + diff --git a/SGGL/WebAPI/Controllers/UserController.cs b/SGGL/WebAPI/Controllers/UserController.cs index 6476a8cd..3ac453de 100644 --- a/SGGL/WebAPI/Controllers/UserController.cs +++ b/SGGL/WebAPI/Controllers/UserController.cs @@ -464,5 +464,29 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 保存用户信息 + /// + /// 保存用户信息 + /// + /// 用户信息 + /// + [HttpPost] + public Model.ResponeData postUserInfo([FromBody] Model.UserListItem list) + { + var responeData = new Model.ResponeData(); + try + { + responeData.message= APIUserService.SaveUserInfo(list); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + + return responeData; + } + #endregion } } diff --git a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml index ec9e975a..da9bb69f 100644 --- a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml +++ b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml @@ -12,7 +12,7 @@ True False - E:\Package\中国成达\SGGLAPI + E:\Package\中化成达\SGGLAPI True True True diff --git a/需求说明/诺必达施工平台系统部署说明(新)20220322.docx b/需求说明/诺必达施工平台系统部署说明(新)20220322.docx new file mode 100644 index 00000000..2886bdae Binary files /dev/null and b/需求说明/诺必达施工平台系统部署说明(新)20220322.docx differ