@@ -629,7 +629,17 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 生成帐号 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult Generate() | |||||
{ | |||||
stuEnrollIBLL.GenerateAccout(); | |||||
return Success("生成成功!"); | |||||
} | |||||
[HttpPost] | [HttpPost] | ||||
[AjaxOnly] | [AjaxOnly] | ||||
@@ -57,7 +57,7 @@ | |||||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | <a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | ||||
</div> | </div> | ||||
<div class=" btn-group btn-group-sm"> | <div class=" btn-group btn-group-sm"> | ||||
<a id="lr_gen" class="btn btn-default"><i class="fa fa-plug"></i> 生成帐号</a> | |||||
<a id="lr_generate" class="btn btn-default"><i class="fa fa-plug"></i> 生成帐号</a> | |||||
</div> | </div> | ||||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | <div class=" btn-group btn-group-sm" learun-authorize="yes"> | ||||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 录入</a> | <a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 录入</a> | ||||
@@ -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 () { | initGird: function () { | ||||
@@ -162,12 +162,13 @@ | |||||
success: function (res) { | success: function (res) { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
if (source == "noLogin") { | 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") { | } 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 { | } 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) { | else if (res.code == 400) { | ||||
@@ -132,6 +132,28 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取学校Id (根据班级编号) | |||||
/// </summary> | |||||
/// <param name="classNo"></param> | |||||
/// <returns></returns> | |||||
public string GetSchoolIdByClassNo(string classNo) { | |||||
try | |||||
{ | |||||
return classInfoService.GetSchoolIdByClassNo(classNo); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -40,6 +40,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
ClassInfoEntity GetClassInfoEntityByClassName(string className); | ClassInfoEntity GetClassInfoEntityByClassName(string className); | ||||
/// <summary> | |||||
/// 根据班级编号获取schoolid | |||||
/// </summary> | |||||
/// <param name="classNo"></param> | |||||
/// <returns></returns> | |||||
string GetSchoolIdByClassNo(string classNo); | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -151,6 +151,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取ClassInfo表实体数据 | |||||
/// <param name="classNo">班级编号</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
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<ClassInfoEntity>(sql); | |||||
if (obj != null) | |||||
return obj.ToString(); | |||||
else | |||||
return ""; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取ClassInfo表实体数据 | /// 获取ClassInfo表实体数据 | ||||
/// <param name="className">班级名称</param> | /// <param name="className">班级名称</param> | ||||
@@ -623,6 +623,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 生成帐号 | |||||
/// </summary> | |||||
public void GenerateAccout() | |||||
{ | |||||
try | |||||
{ | |||||
stuEnrollService.GenerateAccout(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
public void AllReport() | public void AllReport() | ||||
{ | { | ||||
try | try | ||||
@@ -65,6 +65,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
(bool, string) Military(string stuId, bool status, bool payAfter); | (bool, string) Military(string stuId, bool status, bool payAfter); | ||||
void AllMilitary(); | void AllMilitary(); | ||||
void GenerateAccout(); | |||||
void AllReport(); | void AllReport(); | ||||
void AllPhoto(); | void AllPhoto(); | ||||
void AllGetCloth(); | void AllGetCloth(); | ||||
@@ -128,7 +128,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
if (!queryParam["Admissions"].IsEmpty()) | 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 "); | strSql.Append(" AND t.Admissions = @Admissions "); | ||||
} | } | ||||
if (!queryParam["DeptNo"].IsEmpty()) | if (!queryParam["DeptNo"].IsEmpty()) | ||||
@@ -2048,8 +2048,82 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 生成账号 | |||||
/// </summary> | |||||
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<StuEnrollEntity>(m => m.Grade == "20" && m.IsReport == true); | |||||
var roleId = Config.GetValue("GenerateStudentsRoleId"); | |||||
var defaultpwd = Config.GetValue("defaultpwd"); | |||||
//读取默认密码配置中已启用的密码 | |||||
var Sys_DefaultPwdConfigEntity = this.BaseRepository().FindEntity<Sys_DefaultPwdConfigEntity>(x => x.IsEnabled == true); | |||||
if (Sys_DefaultPwdConfigEntity != null) | |||||
{ | |||||
defaultpwd = Sys_DefaultPwdConfigEntity.Pwd; | |||||
} | |||||
var studentList = new List<UserEntity>(); | |||||
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<AnnexesFileEntity>(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() | public void SyncDept() | ||||
{ | { | ||||