|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- using Learun.Util;
- using System.Data;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using System.Web.Mvc;
- using System.Collections.Generic;
- using System.Linq;
- using System;
- using Learun.Application.Base.SystemModule;
- using Learun.Application.Organization;
- using Learun.Application.TwoDevelopment.PersonnelManagement;
-
- namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-01-29 17:31
- /// 描 述:教师信息管理
- /// </summary>
- public class EmpInfoController : MvcControllerBase
- {
- private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
- private ArrangeLessonSyncIBLL arrangeLessonSyncIBLL = new ArrangeLessonSyncBLL();
- private DataItemIBLL dataItemIBLL = new DataItemBLL();
- private DepartmentIBLL departmentIBLL = new DepartmentBLL();
- private DataSourceIBLL dataSourceIBLL = new DataSourceBLL();
- private PM_ResumeIBLL pM_ResumeIBLL = new PM_ResumeBLL();
- private PM_EducationExperienceIBLL pM_EducationExperienceIBLL = new PM_EducationExperienceBLL();
- private PM_FamilySituationIBLL pM_FamilySituationIBLL = new PM_FamilySituationBLL();
- private TeacherTrainIBLL teacherTrainIBLL = new TeacherTrainBLL();
- private TeacherEncourgementIBLL teacherEncourgementIBLL = new TeacherEncourgementBLL();
- private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
- private TeacherPunishmentIBLL teacherPunishmentIBLL = new TeacherPunishmentBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 主页面【大厂】
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IndexOfDC()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- ViewBag.NewEmpId = Guid.NewGuid().ToString();
- return View();
- }
- /// <summary>
- /// 导入页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ImportForm()
- {
- return View();
- }
- [HttpGet]
- public ActionResult FormView()
- {
- return View();
- }
-
- public ActionResult FormAdd()
- {
- return View();
- }
- /// <summary>
- /// 表单页【修改部门、系部】
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormEdit()
- {
- return View();
- }
- /// <summary>
- /// 表单页【编辑部分内容】
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult FormModify()
- {
- return View();
- }
- /// <summary>
- /// 打印
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Print(string keyValue)
- {
- var empInfo = empInfoIBLL.GetEmpInfoEntity(keyValue);
- if (empInfo != null)
- {
- //性别
- var genderNo = empInfo.GenderNo.ToString().ToLower();
- empInfo.GenderNoName = dataItemIBLL.GetDetailList("usersexbit").FirstOrDefault(x => x.F_ItemValue == genderNo)?.F_ItemName;
- //部门
- empInfo.DepartmentName = departmentIBLL.GetEntity(empInfo.F_DepartmentId)?.F_FullName;
- //民族
- empInfo.NationalityNo = dataItemIBLL.GetDetailList("National").FirstOrDefault(x => x.F_ItemValue == empInfo.NationalityNo)?.F_ItemName;
-
- //var nationality = dataSourceIBLL.GetDataTable("BCdNationality", "t.NationalityNo='" + empInfo.NationalityNo + "'");
- //if (nationality != null && nationality.Rows.Count > 0)
- //{
- // empInfo.NationalityNo = nationality.Rows[0][1].ToString();
- //}
- //政治面貌
- empInfo.PartyFaceNo = dataItemIBLL.GetDetailList("BCdPartyFace").FirstOrDefault(x => x.F_ItemValue == empInfo.PartyFaceNo)?.F_ItemName;
-
- //最高学历
- var highestRecord = dataSourceIBLL.GetDataTable("BCdCultureDegree", "t.CultureDegreeNo='" + empInfo.HighestRecord + "'");
- if (highestRecord != null && highestRecord.Rows.Count > 0)
- {
- empInfo.HighestRecord = highestRecord.Rows[0][1].ToString();
- }
- //头像
- empInfo.Photo = annexesFileIBLL.GetEntityByFolderId(empInfo.Photo)?.F_FilePath;
- if (!string.IsNullOrEmpty(empInfo.Photo))
- {
- empInfo.Photo = empInfo.Photo.Substring(empInfo.Photo.IndexOf("Resource") - 1);
- }
- //本人简历
- empInfo.PM_ResumeList = pM_ResumeIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.RTime).ToList();
- //教育经历
- empInfo.PM_EducationExperienceList = pM_EducationExperienceIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.ETime).ToList();
- //家庭主要成员及重要社会关系
- empInfo.PM_FamilySituationList = pM_FamilySituationIBLL.GetListByEmpId(empInfo.EmpId).ToList();
- foreach (var item in empInfo.PM_FamilySituationList)
- {
- item.Application = dataItemIBLL.GetDetailList("FamilyRelation").FirstOrDefault(x => x.F_ItemValue == item.Application)?.F_ItemName;
- item.PoliticalAffiliation = dataItemIBLL.GetDetailList("PolityStatus").FirstOrDefault(x => x.F_ItemValue == item.PoliticalAffiliation)?.F_ItemName;
- }
- //培训进修
- empInfo.TeacherTrainList = teacherTrainIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.TTStartTime).ToList();
- //奖罚情况
- empInfo.TeacherEncourgementList = teacherEncourgementIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.EncourgeDate).ToList();
- empInfo.TeacherPunishmentList = teacherPunishmentIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.StartTime).ToList();
-
- }
-
- return View(empInfo);
- }
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = empInfoIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetFormData(string keyValue)
- {
- var EmpInfoData = empInfoIBLL.GetEmpInfoEntity(keyValue);
- if (EmpInfoData != null)
- {
- EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
- }
- var jsonData = new
- {
- EmpInfo = EmpInfoData,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
- {
- var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
- EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
- return Success(EmpInfoData);
- }
- /// <summary>
- /// 根据部门获取人员
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEmpInfoEntityByDepartment(string departmentId)
- {
- var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByDepartment(departmentId);
- return Success(EmpInfoData);
- }
-
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetEmpInfoEntitiesByEmpName(string empName)
- {
- var EmpInfoList = empInfoIBLL.GetEmpInfoEntitiesByName(empName);
- return Success(EmpInfoList);
- }
- #endregion
-
- #region 提交数据
- /// <summary>
- /// 生成帐号
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult Generate()
- {
- empInfoIBLL.GenerateAccout();
- return Success("生成成功!");
- }
-
- [HttpPost]
- [AjaxOnly]
- public ActionResult UpdateAccount()
- {
- empInfoIBLL.UpdateAccount();
- return Success("生成成功!");
- }
- [HttpPost]
- [AjaxOnly]
- public ActionResult Lock(string keyValue)
- {
- empInfoIBLL.Lock(keyValue);
- empInfoIBLL.GenerateAccout(keyValue);
- empInfoIBLL.UpdateAccount(keyValue);
- return Success("审核成功!");
- }
- [HttpPost]
- [AjaxOnly]
- public ActionResult UnLock(string keyValue)
- {
- empInfoIBLL.UnLock(keyValue);
- return Success("去审成功!");
- }
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- empInfoIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- [ValidateInput(false)]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
- entity.resume = WebHelper.HtmlEncode(entity.resume);
- entity.SyncFlag = false;
- var model = empInfoIBLL.GetEmpInfoEntityByEmpNo(entity.EmpNo);
- var model_mobile = empInfoIBLL.GetEmpInfoEntityByMobile(entity.mobile);
- if (string.IsNullOrEmpty(keyValue))
- {
- if (model != null)
- {
- return Fail("职工编号已存在!");
- }
- if (model_mobile != null)
- {
- return Fail("手机号已存在!");
- }
- }
- else
- {
- if (model != null && model.EmpId != keyValue)
- {
- return Fail("职工编号已存在!");
- }
- if (model_mobile != null && model_mobile.EmpId != keyValue)
- {
- return Fail("手机号已存在!");
- }
- entity.SyncFlag = true;
- //判断排课同步数据是否存在:若存在,清除同步数据;
- var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
- if (arrangeLessonSyncList.Any())
- {
- arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
- }
- else
- {
- entity.SyncFlag = false;
- }
- }
- empInfoIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
- [HttpPost]
- [AjaxOnly]
- public ActionResult CheckAll()
- {
- empInfoIBLL.CheckAll();
- empInfoIBLL.GenerateAccout();
- empInfoIBLL.UpdateAccount();
- return Success("全部审核成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- [ValidateInput(false)]
- public ActionResult SaveFormEdit(string keyValue, string strEntity)
- {
- EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
- empInfoIBLL.SaveEditEntity(keyValue, entity);
- return Success("保存成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- [ValidateInput(false)]
- public ActionResult SaveFormModify(string keyValue, string strEntity)
- {
- if (string.IsNullOrEmpty(keyValue))
- {
- return Fail("主键不存在!");
- }
- EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
- entity.resume = WebHelper.HtmlEncode(entity.resume);
- empInfoIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
- #endregion
-
- }
- }
|