Example #1
0
        /// <summary>
        /// 更新学生联系人至学生联系人表
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-03-06 </para>
        /// </summary>
        /// <param name="passWord">密码</param>
        /// <exception>
        /// 异常ID:3,密码不正确,请重新输入
        /// </exception>
        public static void RunStudentInfoJob(string passWord)
        {
            if (passWord != "86337000")
            {
                throw new BussinessException((byte)ModelType.Customer, 3);
            }

            List <TblCstStudentContact> studentContactList = new List <TblCstStudentContact>();

            // 1、获取所有的学生信息
            var studentList = new TblCstStudentRepository().LoadList(m => true).Select(m => new GuardianOutDto
            {
                StudentId     = m.StudentId,
                Mobile        = m.LinkMobile,
                ContactPerson = m.ContactPerson
            }).ToList();

            foreach (var s in studentList)
            {
                studentContactList.AddRange(GetStudentContact(s.StudentId, s.ContactPerson));
            }

            // 2、批量插入学生至学生联系人表中
            var studentIds = studentList.Select(m => m.StudentId).ToList();

            new TblCstStudentContactRepository().DeleteByStudentId(studentIds);
            new TblCstStudentContactRepository().Add(studentContactList);
        }
Example #2
0
        /// <summary>
        /// 判断电话号码和学生姓名是否存在
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-11-10 </para>
        /// </summary>
        /// <param name="studentId">学生编号</param>
        /// <param name="studentName">学生姓名</param>
        /// <param name="linkMobile">联系电话</param>
        /// <exception>
        /// 异常ID:1,系统中已经存在此学生
        /// </exception>
        private static void Verification(long studentId, string studentName, string linkMobile)
        {
            // 根据学生姓名、学生编号、联系电话查询学生信息
            var list = new TblCstStudentRepository().GetCstStudentList(studentName, linkMobile, studentId);

            if (list.Any())
            {
                throw new BussinessException((byte)ModelType.SignUp, 1);
            }
        }
Example #3
0
        /// <summary>
        /// 更新最新头像
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-12-24 </para>
        /// </summary>
        /// <param name="studentId">学生ID</param>
        /// <param name="newHeadFace">新头像</param>
        /// <exception>
        /// 异常ID:1,系统不存在该学生
        /// </exception>
        public static void ModifyHeadFace(long studentId, string newHeadFace)
        {
            // 根据学生编号查询学生
            TblCstStudent student = new TblCstStudentRepository().GetCstStudentId(studentId);

            if (student == null)
            {
                throw new BussinessException((byte)ModelType.Customer, 1);
            }
            student.HeadFaceUrl = newHeadFace;
            new TblCstStudentRepository().Update(student);
        }
Example #4
0
        /// <summary>
        /// 修改学生手机号或联系人手机号,将手机号信息推送至家校互联账户
        /// <para>作     者:蔡亚康 </para>
        /// <para>创建时间: 2019-03-21 </para>
        /// </summary>
        /// <param name="rawStudent">原学生信息</param>
        /// <param name="newStudent">新学生信息</param>
        /// <param name="rawContacts">原学生联系人信息</param>
        /// <param name="newContacts">新学生联系人信息</param>
        private static void StudentPublish(TblCstStudent rawStudent, TblCstStudent newStudent, List <TblCstStudentContact> rawContacts, List <TblCstStudentContact> newContacts)
        {
            StudentPassportChangeInDto result = new StudentPassportChangeInDto();

            List <string> rawMobiles = new List <string>();   //原手机号
            List <string> newMobiles = new List <string>();   //新手机号


            //原手机号集合
            rawMobiles.Add(rawStudent.LinkMobile);
            rawMobiles.AddRange(rawContacts.Select(t => t.Mobile));
            rawMobiles = rawMobiles.Where(t => !string.IsNullOrEmpty(t))
                         .Distinct()
                         .ToList();


            //新手机号集合
            newMobiles.Add(newStudent.LinkMobile);
            newMobiles.AddRange(newContacts.Select(t => t.Mobile));
            newMobiles = newMobiles.Where(t => !string.IsNullOrEmpty(t))
                         .Distinct()
                         .ToList();


            result.MobileAddList    = newMobiles.Except(rawMobiles).ToList();
            result.MobileDeleteList = rawMobiles.Except(newMobiles).ToList();


            //获取手机号在在其他学生的账户列表
            TblCstStudentRepository        studentRepository = new TblCstStudentRepository();
            TblCstStudentContactRepository contactRepository = new TblCstStudentContactRepository();

            var studentList = studentRepository.SearchByMobiles(result.MobileDeleteList);
            var contactList = contactRepository.SearchByMobiles(result.MobileDeleteList);


            //被删除的号码,在studentList,contactList 还存在,说明还不允许删除
            List <string> existMobiles = new List <string>();

            existMobiles.AddRange(studentList.Select(t => t.LinkMobile));
            existMobiles.AddRange(contactList.Select(t => t.Mobile));
            existMobiles = existMobiles.Distinct().ToList();


            existMobiles.ForEach(item =>
            {
                result.MobileDeleteList.Remove(item);
            });

            // 推送至消息队列
            new StudentFamilyProducerService().Publish(result);
        }
Example #5
0
        /// <summary>
        /// 根据学生电话号码获取学生信息
        /// <para>作    者: Huang GaoLiang </para>
        /// <para>创建时间: 2019-03-08 </para>
        /// </summary>
        /// <param name="mobile">电话号码</param>
        /// <returns>返回学生集合</returns>
        internal static List <TblCstStudent> GetStudentList(string mobile)
        {
            List <TblCstStudent> studentList = new List <TblCstStudent>();

            // 1、从学生表中查询符合条件的学生信息
            studentList = new TblCstStudentRepository().GetStudentList(mobile);

            // 2、从学生联系人表中查询数据
            List <long> studentIds = new TblCstStudentContactRepository().GetStudentList(mobile).Select(m => m.StudentId).ToList();
            var         list       = new TblCstStudentRepository().GetStudentsById(studentIds);

            studentList.AddRange(list);

            studentList = studentList.Where((x, i) => studentList.FindIndex(z => z.StudentId == x.StudentId) == i).ToList();

            return(studentList);
        }
Example #6
0
        /// <summary>
        /// 修改学生信息
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-03-14 </para>
        /// </summary>
        /// <param name="studentId">学生编号</param>
        /// <param name="request">修改输入参数</param>
        /// <returns>返回修改结果受影响的行数</returns>
        /// <exception>
        /// 异常ID:1,系统不存在该学生
        /// </exception>
        public static void Modify(long studentId, StudentRegisterRequest request)
        {
            TblCstStudentContactRepository contactRepository = new TblCstStudentContactRepository();
            TblCstStudentRepository        studentRepository = new TblCstStudentRepository();
            // 1、根据编号查询学生信息
            TblCstStudent rawStudent = studentRepository.GetCstStudentId(studentId);     //原学生信息

            if (rawStudent == null)
            {
                throw new BussinessException((byte)ModelType.Customer, 1);
            }
            List <TblCstStudentContact> rawContacts = contactRepository.GetByStudentId(studentId);              //原学生联系人
            TblCstStudent newStudent = TransExpV2 <TblCstStudent, TblCstStudent> .Trans(rawStudent);            //新学生


            // 2、验证
            Verification(studentId, request.StudentName, request.LinkMobile);

            // 3、学生信息和学生联系人信息
            List <TblCstStudentContact> newContacts = GetStudentContact(newStudent.StudentId, JsonConvert.SerializeObject(request.ContactPerson));

            SetStudentInfo(request, newStudent);


            //4、数据存储操作
            studentRepository.Update(newStudent);                                          //更新学生信息
            contactRepository.DeleteByStudentId(new List <long> {
                newStudent.StudentId
            });                                                                            //删除原来的学生联系人
            contactRepository.Add(newContacts);                                            //添加学生联系人


            // 5、推送学生至档案库
            StudentRequest s = GetStudentToAC(rawStudent);

            new ACService().StudentInfoToArtLibrary(s);


            // 6、记录操作日志
            AddOperationLog(rawStudent, newStudent, request);

            // 7、将手机号信息推送至家校互联账户
            StudentPublish(rawStudent, newStudent, rawContacts, newContacts);
        }