From 4d2a1487e40b18218fba19b34c4dca62240405d2 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 7 May 2021 14:28:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=94=9F=E6=8A=A5=E5=88=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=20=E7=94=9F=E6=88=90=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StuEnrollController.cs | 12 ++- .../Views/StuEnroll/Report.cshtml | 2 +- .../Views/StuEnroll/Report.js | 11 ++- .../Views/Login/PageSix/Index.js | 9 ++- .../ClassInfo/ClassInfoBLL.cs | 22 ++++++ .../ClassInfo/ClassInfoIBLL.cs | 7 ++ .../ClassInfo/ClassInfoService.cs | 32 ++++++++ .../StuEnroll/StuEnrollBLL.cs | 23 ++++++ .../StuEnroll/StuEnrollIBLL.cs | 1 + .../StuEnroll/StuEnrollService.cs | 78 ++++++++++++++++++- 10 files changed, 188 insertions(+), 9 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuEnrollController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuEnrollController.cs index 68591a54d..aca79df42 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuEnrollController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuEnrollController.cs @@ -629,7 +629,17 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers } } - + /// + /// 生成帐号 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult Generate() + { + stuEnrollIBLL.GenerateAccout(); + return Success("生成成功!"); + } [HttpPost] [AjaxOnly] diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.cshtml index eb2c39b14..1cc583b92 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.cshtml @@ -57,7 +57,7 @@
-  生成帐号 +  生成帐号
 录入 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.js index 5bbd99863..4a33e7adb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuEnroll/Report.js @@ -201,7 +201,16 @@ var bootstrap = function ($, learun) { } }); - + //生成帐号 + $('#lr_generate').on('click', function () { + learun.layerConfirm('是否确认生成帐号?', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuEnroll/Generate', {}, function () { + refreshGirdData(); + }); + } + }); + }); }, // 初始化列表 initGird: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix/Index.js index feb2330c7..57a076fd0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix/Index.js @@ -162,12 +162,13 @@ success: function (res) { if (res.code == 200) { if (source == "noLogin") { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index"; } else if (source == "DragNoLogin") { - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; + window.location.href = "/Home/Index"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/DragModelOne"; } else { - - window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; + window.location.href = "/Home/Index"; + //window.location.href = DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/Home/Index"; } } else if (res.code == 400) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs index d23fd75a4..5e3e494d8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoBLL.cs @@ -132,6 +132,28 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取学校Id (根据班级编号) + /// + /// + /// + public string GetSchoolIdByClassNo(string classNo) { + try + { + return classInfoService.GetSchoolIdByClassNo(classNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs index d6972f2bf..3f17f0292 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoIBLL.cs @@ -40,6 +40,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// ClassInfoEntity GetClassInfoEntityByClassName(string className); + + /// + /// 根据班级编号获取schoolid + /// + /// + /// + string GetSchoolIdByClassNo(string classNo); #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs index 1075e48cd..156a27e93 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ClassInfo/ClassInfoService.cs @@ -151,6 +151,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取ClassInfo表实体数据 + /// 班级编号 + /// + /// + public string GetSchoolIdByClassNo(string classNo) + { + try + { + var sql = $@"select F_SchoolId from CdDept where DeptNo= +(select DeptNo from ClassInfo where ClassNo = '{classNo}') +"; + var obj= this.BaseRepository("CollegeMIS").FindObject(sql);//.FindList(sql); + if (obj != null) + return obj.ToString(); + else + return ""; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// /// 获取ClassInfo表实体数据 /// 班级名称 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollBLL.cs index b4b9898e7..b3804b800 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollBLL.cs @@ -623,6 +623,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + + /// + /// 生成帐号 + /// + public void GenerateAccout() + { + try + { + stuEnrollService.GenerateAccout(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public void AllReport() { try diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollIBLL.cs index 3313c1ab3..42af973d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollIBLL.cs @@ -65,6 +65,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration (bool, string) Military(string stuId, bool status, bool payAfter); void AllMilitary(); + void GenerateAccout(); void AllReport(); void AllPhoto(); void AllGetCloth(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollService.cs index 95bc560b0..94c5ef896 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuEnroll/StuEnrollService.cs @@ -128,7 +128,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } if (!queryParam["Admissions"].IsEmpty()) { - dp.Add("Admissions", queryParam["Admissions"].ToString() , DbType.String); + dp.Add("Admissions", queryParam["Admissions"].ToString(), DbType.String); strSql.Append(" AND t.Admissions = @Admissions "); } if (!queryParam["DeptNo"].IsEmpty()) @@ -2048,8 +2048,82 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 生成账号 + /// + public void GenerateAccout() + { + Base.AuthorizeModule.UserRelationIBLL userRelationIBLL = new Base.AuthorizeModule.UserRelationBLL(); + UserIBLL userIBLL = new UserBLL(); + ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); + try + { + var alluserlist = userIBLL.GetAllList().Where(m => m.F_Description == "学生"); + //新生报到管理 + var stuEnrolllist = BaseRepository("CollegeMIS").FindList(m => m.Grade == "20" && m.IsReport == true); + var roleId = Config.GetValue("GenerateStudentsRoleId"); + var defaultpwd = Config.GetValue("defaultpwd"); + //读取默认密码配置中已启用的密码 + var Sys_DefaultPwdConfigEntity = this.BaseRepository().FindEntity(x => x.IsEnabled == true); + if (Sys_DefaultPwdConfigEntity != null) + { + defaultpwd = Sys_DefaultPwdConfigEntity.Pwd; + } + var studentList = new List(); + foreach (var tEntity in stuEnrolllist) + { + if (alluserlist.Count(m => m.F_Account == tEntity.IDCard) > 0 || string.IsNullOrEmpty(tEntity.IDCard) || string.IsNullOrEmpty(tEntity.ClassNo)) + { + continue; + } + //查询班级Id + var schoolId = classInfoIBLL.GetSchoolIdByClassNo(tEntity.ClassNo); + if (string.IsNullOrEmpty(schoolId)) + continue; + + var annexesFileEntity = this.BaseRepository().FindEntity(a => a.F_FolderId == tEntity.Photo); + var url = ""; + if (annexesFileEntity != null) + { + url = annexesFileEntity.F_FilePath; + url = "/" + url.Substring(url.IndexOf("Resource")); + } - + UserEntity userbase = new UserEntity(); + userbase.F_Account = tEntity.IDCard; + userbase.F_RealName = tEntity.StuName; + userbase.F_EnCode = tEntity.IDCard; + userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); + userbase.F_HeadIcon = string.IsNullOrEmpty(url) ? Config.GetValue("defaultheadimg") : url; + userbase.F_Gender = tEntity.Gender.HasValue ? Convert.ToInt32(tEntity.Gender.Value) : 1; + userbase.F_DeleteMark = 0; + userbase.F_EnabledMark = 1; + userbase.F_Mobile = tEntity.FirstMobile; + userbase.F_Description = "学生"; + userbase.F_CompanyId = schoolId; + userbase.F_DepartmentId = tEntity.DeptNo; + userbase.F_IdentityCardNo = tEntity.IDCard; + userIBLL.SaveEntity(null, userbase); + studentList.Add(userbase); + } + if (studentList.Any()) + { + string s = studentList.Select(m => m.F_UserId).Aggregate((current, userEntity) => current + "," + userEntity); + userRelationIBLL.SaveEntityList2(roleId, 1, s); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } public void SyncDept() {