|
|
@@ -911,67 +911,67 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
/// <param name="stuInfoFreshFamilyList"></param> |
|
|
|
private void GenerateAccoutForStuFamily(StuInfoFreshEntity entity, List<StuInfoFreshFamilyEntity> stuInfoFreshFamilyList) |
|
|
|
{ |
|
|
|
UserRelationIBLL userRelationIBLL = new UserRelationBLL(); |
|
|
|
UserIBLL userIBLL = new UserBLL(); |
|
|
|
CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); |
|
|
|
try |
|
|
|
{ |
|
|
|
var stuInfoBasicEntities = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(m => m.CheckMark != "0"); |
|
|
|
var alluserlist = userIBLL.GetAllList().Where(m => m.F_Description == "家长"); |
|
|
|
var roleId = Config.GetValue("GenerateParentsRoleId"); |
|
|
|
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 fEntity in stuInfoFreshFamilyList) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(fEntity.Mobile) || alluserlist.Count(m => m.F_Account == fEntity.Mobile)>0) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
//获取schoolid DeptNo |
|
|
|
var schoolid = cdDeptIBLL.GetSchoolIdByDeptNo(entity.DeptNo); |
|
|
|
if (string.IsNullOrEmpty((schoolid))) |
|
|
|
continue; |
|
|
|
|
|
|
|
UserEntity userbase = new UserEntity(); |
|
|
|
userbase.F_Account = fEntity.Mobile; |
|
|
|
userbase.F_RealName = fEntity.Name; |
|
|
|
userbase.F_EnCode = fEntity.Mobile; |
|
|
|
userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); |
|
|
|
userbase.F_HeadIcon = Config.GetValue("defaultheadimg"); |
|
|
|
userbase.F_Gender = !string.IsNullOrEmpty(fEntity.Sex) ? Convert.ToInt32(fEntity.Sex) : 1; |
|
|
|
userbase.F_DeleteMark = 0; |
|
|
|
userbase.F_EnabledMark = 1; |
|
|
|
userbase.F_Mobile = fEntity.Mobile; |
|
|
|
userbase.F_Description = "家长"; |
|
|
|
userbase.F_CompanyId = schoolid; |
|
|
|
userbase.F_DepartmentId = entity.DeptNo; |
|
|
|
userbase.F_IdentityCardNo = fEntity.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); |
|
|
|
} |
|
|
|
} |
|
|
|
//UserRelationIBLL userRelationIBLL = new UserRelationBLL(); |
|
|
|
//UserIBLL userIBLL = new UserBLL(); |
|
|
|
//CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); |
|
|
|
//try |
|
|
|
//{ |
|
|
|
// var stuInfoBasicEntities = BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(m => m.CheckMark != "0"); |
|
|
|
// var alluserlist = userIBLL.GetAllList().Where(m => m.F_Description == "家长"); |
|
|
|
// var roleId = Config.GetValue("GenerateParentsRoleId"); |
|
|
|
// 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 fEntity in stuInfoFreshFamilyList) |
|
|
|
// { |
|
|
|
// if (string.IsNullOrEmpty(fEntity.Mobile) || alluserlist.Count(m => m.F_Account == fEntity.Mobile)>0) |
|
|
|
// { |
|
|
|
// continue; |
|
|
|
// } |
|
|
|
// //获取schoolid DeptNo |
|
|
|
// var schoolid = cdDeptIBLL.GetSchoolIdByDeptNo(entity.DeptNo); |
|
|
|
// if (string.IsNullOrEmpty((schoolid))) |
|
|
|
// continue; |
|
|
|
|
|
|
|
// UserEntity userbase = new UserEntity(); |
|
|
|
// userbase.F_Account = fEntity.Mobile; |
|
|
|
// userbase.F_RealName = fEntity.Name; |
|
|
|
// userbase.F_EnCode = fEntity.Mobile; |
|
|
|
// userbase.F_Password = Md5Helper.Encrypt(defaultpwd, 32).ToLower(); |
|
|
|
// userbase.F_HeadIcon = Config.GetValue("defaultheadimg"); |
|
|
|
// userbase.F_Gender = !string.IsNullOrEmpty(fEntity.Sex) ? Convert.ToInt32(fEntity.Sex) : 1; |
|
|
|
// userbase.F_DeleteMark = 0; |
|
|
|
// userbase.F_EnabledMark = 1; |
|
|
|
// userbase.F_Mobile = fEntity.Mobile; |
|
|
|
// userbase.F_Description = "家长"; |
|
|
|
// userbase.F_CompanyId = schoolid; |
|
|
|
// userbase.F_DepartmentId = entity.DeptNo; |
|
|
|
// userbase.F_IdentityCardNo = fEntity.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); |
|
|
|
// } |
|
|
|
//} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|