20220325 新增用户接口
This commit is contained in:
		
							parent
							
								
									9dc8a7e05d
								
							
						
					
					
						commit
						844e9f1488
					
				|  | @ -323,5 +323,163 @@ namespace BLL | |||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         #region 保存Meeting | ||||
|         /// <summary> | ||||
|         /// 保存Meeting | ||||
|         /// </summary> | ||||
|         /// <param name="meeting">会议信息</param> | ||||
|         /// <returns></returns> | ||||
|         public static string SaveUserInfo(Model.UserListItem listItem) | ||||
|         { | ||||
|             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | ||||
|             { | ||||
|                 List<Model.UserItem> 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 | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
|             src="./images/login.png" | ||||
|             style="height: 100%; left: 0px; top: 0px; bottom: 0px; position: absolute; display: none;" /> | ||||
|         <img alt=""  | ||||
|             src="res/index/images/iconlogo.png" | ||||
|            <%-- src="res/index/images/iconlogo.png"--%> | ||||
|             style="height: auto;width:400px; left: 100px; top: 65px; position: absolute;" /> | ||||
|         <div class="bi-flex-center-adapt-layout login-area" | ||||
|             style="width: 23%; right: 10%; top: 0px; bottom: 0px; position: absolute;"> | ||||
|  |  | |||
|  | @ -7,10 +7,10 @@ namespace Model | |||
| { | ||||
|     public class UserItem | ||||
|     { | ||||
|        /// <summary> | ||||
|        /// 用户ID | ||||
|        /// </summary> | ||||
|        public string UserId | ||||
|         /// <summary> | ||||
|         /// 用户ID | ||||
|         /// </summary> | ||||
|         public string UserId | ||||
|         { | ||||
|            get; | ||||
|            set; | ||||
|  | @ -80,6 +80,30 @@ namespace Model | |||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 单位代号 | ||||
|         /// </summary> | ||||
|         public string UnitCode | ||||
|         { | ||||
|             get; | ||||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 部门ID | ||||
|         /// </summary> | ||||
|         public string DepartId | ||||
|         { | ||||
|             get; | ||||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 部门名称 | ||||
|         /// </summary> | ||||
|         public string DepartName | ||||
|         { | ||||
|             get; | ||||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 当前项目ID | ||||
|         /// </summary> | ||||
|         public string LoginProjectId | ||||
|  | @ -136,6 +160,14 @@ namespace Model | |||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 是否在岗 | ||||
|         /// </summary> | ||||
|         public string IsPost | ||||
|         { | ||||
|             get; | ||||
|             set; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 是否本部 | ||||
|         /// </summary> | ||||
|         public bool? IsOffice | ||||
|  |  | |||
|  | @ -0,0 +1,19 @@ | |||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| 
 | ||||
| namespace Model | ||||
| { | ||||
|     public class UserListItem | ||||
|     { | ||||
|        /// <summary> | ||||
|        /// 用户信息集合 | ||||
|        /// </summary> | ||||
|        public List<Model.UserItem> list | ||||
|         { | ||||
|            get; | ||||
|            set; | ||||
|        } | ||||
|     } | ||||
| } | ||||
|  | @ -145,6 +145,7 @@ | |||
|     <Compile Include="APIItem\HSSE\TrainingTaskItemItem.cs" /> | ||||
|     <Compile Include="APIItem\HSSE\TrainRecordItem.cs" /> | ||||
|     <Compile Include="APIItem\UnitItem.cs" /> | ||||
|     <Compile Include="APIItem\UserListItem.cs" /> | ||||
|     <Compile Include="APIItem\UserItem.cs" /> | ||||
|     <Compile Include="APIItem\UserReadItem.cs" /> | ||||
|     <Compile Include="BusinessColumn.cs" /> | ||||
|  |  | |||
|  | @ -464,5 +464,29 @@ namespace WebAPI.Controllers | |||
|             return responeData; | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|         #region 保存用户信息         | ||||
|         /// <summary> | ||||
|         /// 保存用户信息 | ||||
|         /// </summary> | ||||
|         /// <param name="list">用户信息</param> | ||||
|         /// <returns></returns> | ||||
|         [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 | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
|     <SiteUrlToLaunchAfterPublish /> | ||||
|     <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> | ||||
|     <ExcludeApp_Data>False</ExcludeApp_Data> | ||||
|     <publishUrl>E:\Package\中国成达\SGGLAPI</publishUrl> | ||||
|     <publishUrl>E:\Package\中化成达\SGGLAPI</publishUrl> | ||||
|     <DeleteExistingFiles>True</DeleteExistingFiles> | ||||
|     <PrecompileBeforePublish>True</PrecompileBeforePublish> | ||||
|     <EnableUpdateable>True</EnableUpdateable> | ||||
|  |  | |||
|  | @ -0,0 +1,84 @@ | |||
| 一 系统要求 | ||||
| 1、服务器操作系统为windows2012及以上版本操作系统, 64位系统。 | ||||
| 2、操作系统安装后需要安装IIS 7;  | ||||
| 3、需安装SQL server 2012企业版及以上版本数据库; | ||||
| 4、需安装Microsoft .NET Framework 4.6.1框架。 | ||||
| 5、站点发布后,站点需要解析域名并认证为HTTPS站点, 至少支持TLS1.2 【用于微信小程序的后台接口】 | ||||
| 二 数据库 | ||||
|   为了操作简单,安装包内包含初始数据为空数据库备份,还原到服务器数据库中即可。 | ||||
|    | ||||
|    | ||||
|    | ||||
| 三 PC端系统安装部署 | ||||
|  在IIS中添加程序池 | ||||
|   打开IIS管理器后,展开左边菜单,找到"应用程序池"。 | ||||
|   在"应用程序池"上右击,点"添加应用程序池" 确定 | ||||
|     | ||||
| 配置程序池,右击程序池中的新增程序池, | ||||
| 
 | ||||
| 点击高级设置:启用32位应用程序【true】,标识中内置帐户下拉选择"LocalSystem",确定 | ||||
| 
 | ||||
|  为网站配置HTTPS证书和对外端口 | ||||
|    | ||||
|    | ||||
|  在IIS中配置应用程序 | ||||
| 在配置好端口的站点,右键选择添加应用程序,输入别名,选择增加的程序池,然后在物理路径选择安装包所在的文件夹,物理路径要点选到程序的PackFile文件夹名称上面,确定。 | ||||
|    | ||||
|    | ||||
|    | ||||
|  配置Web.cofig 文件 | ||||
|   在安装包内容,或者在站点上右键点击浏览打开程序文件夹,找到Web.cofig文件 ,用记事本打开该文件。 | ||||
|  数据库连接字符串,(数据库服务器地址,数据库名,登陆名,密码) | ||||
|  配置站点发布地址SGGLUrl(用于移动端附件上传查看等) | ||||
|  修改版本名SystemVersion (当前安装包/更新包名称) | ||||
|  配置跳转小程序类型:(value="formal")。 | ||||
|     | ||||
|    | ||||
|    | ||||
|  站点测试 | ||||
|   选中站点右键,管理应用程序-》浏览,运行本地站点。本地运行正常后,外网地址(测试域名+端口+站点名)  | ||||
|   【系统管理员账号 sysgly 密码 1111】 | ||||
|    | ||||
|    | ||||
|  站点注册 | ||||
|   浏览器输入【站点地址+ /config/ipmac.aspx [HYPERLINK: interm]】,获取IP地址和mac地址,发给诺必达服务人员注册站点。 | ||||
|   将诺必达按照地址注册的注册页文件放到程序包bin文件夹下。 | ||||
| 
 | ||||
|    | ||||
|    | ||||
| 四 移动端后台接口站点安装部署 | ||||
|  在IIS中添加程序池 | ||||
|   为接口站点新增一个程序池或者与PC端系统同用一个程序池均可,建议新增一个程序池。(新增程序池方法同上 在IIS中添加程序池)。 | ||||
|    | ||||
|  站点下 添加接口应用程序 | ||||
|  在IIS中配置应用程序 | ||||
|  在配置好端口的站点,右键选择添加应用程序,输入别名如(SGGLAPI),选择增加的程序池,然后在物理路径选择安装包所在的文件夹,物理路径要点选到程序的SGGLAPI文件夹名称上面,确定。 | ||||
|    | ||||
|    | ||||
|    | ||||
|  配置Web.cofig 文件 | ||||
|   在安装包内容,或者在站点上右键点击浏览打开程序文件夹,找到Web.cofig文件 ,用记事本打开该文件。 | ||||
|  数据库连接字符串,(数据库服务器地址,数据库名,登陆名,密码) | ||||
|  配置附件上传物理路径localRoot(同服务器PC端站点做在文件夹PackFile地址,用于移动端附件上传查看等。如"E:\SGGLPackFile\PackFile\") | ||||
|  修改版本名SystemVersion (当前安装包/更新包名称) | ||||
|  Pc 站点地址CEMS_IMG_URL:(如:value="http://localhost/SGGL/" 用于附件地址呈现)。 | ||||
|     | ||||
|    | ||||
|    | ||||
|  站点测试 | ||||
|   选中站点右键,管理应用程序-》浏览,运行本地站点。本地运行正常后,外网地址(测试域名+端口+站点名) 如下图页面正常打开即为接口站点部署完成。 | ||||
|    | ||||
|    | ||||
|   注:微信端小程序要求 接口站点地址对外解析为域名的方式且有https 证书TLS1.2 及以上版本。 | ||||
|   站点配置完成 PC端和接口对外站点提供给开发人员,配置小程序发布。 | ||||
| 五 系统更新 | ||||
| 有新版本发布后时,更新系统步骤如下(PC\接口站点基本相同): | ||||
|  备份数据库。 | ||||
|  查看PackFile文件夹下Web.config页面 <add key="SystemVersion" value=" SGGLPackFile(CD)_Vxxxx-xx-xx-xxx"/>中版本号。 | ||||
|    | ||||
|  将版本中版本号与最新包中版本日志比较,找出未执行的脚本按顺序在对于库执行。 | ||||
| 
 | ||||
| 
 | ||||
|  将最新更新中PackFile文件夹覆盖原PackFile文件夹。 | ||||
|  修改PackFile文件夹下Web.config页面 <add key="SystemVersion" value=" SGGLPackFile(CD)_Vxxxx-xx-xx-xxx"/>中版本号为最新更新包版本号。 | ||||
|    | ||||
		Loading…
	
		Reference in New Issue