Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

381 rader
13 KiB

  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System;
  8. using Learun.Application.Base.SystemModule;
  9. using Learun.Application.Organization;
  10. using Learun.Application.TwoDevelopment.PersonnelManagement;
  11. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  12. {
  13. /// <summary>
  14. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  15. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  16. /// 创 建:超级管理员
  17. /// 日 期:2019-01-29 17:31
  18. /// 描 述:教师信息管理
  19. /// </summary>
  20. public class EmpInfoController : MvcControllerBase
  21. {
  22. private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
  23. private ArrangeLessonSyncIBLL arrangeLessonSyncIBLL = new ArrangeLessonSyncBLL();
  24. private DataItemIBLL dataItemIBLL = new DataItemBLL();
  25. private DepartmentIBLL departmentIBLL = new DepartmentBLL();
  26. private DataSourceIBLL dataSourceIBLL = new DataSourceBLL();
  27. private PM_ResumeIBLL pM_ResumeIBLL = new PM_ResumeBLL();
  28. private PM_EducationExperienceIBLL pM_EducationExperienceIBLL = new PM_EducationExperienceBLL();
  29. private PM_FamilySituationIBLL pM_FamilySituationIBLL = new PM_FamilySituationBLL();
  30. private TeacherTrainIBLL teacherTrainIBLL = new TeacherTrainBLL();
  31. private TeacherEncourgementIBLL teacherEncourgementIBLL = new TeacherEncourgementBLL();
  32. private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
  33. private TeacherPunishmentIBLL teacherPunishmentIBLL = new TeacherPunishmentBLL();
  34. #region 视图功能
  35. /// <summary>
  36. /// 主页面
  37. /// <summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. public ActionResult Index()
  41. {
  42. return View();
  43. }
  44. /// <summary>
  45. /// 主页面【大厂】
  46. /// <summary>
  47. /// <returns></returns>
  48. [HttpGet]
  49. public ActionResult IndexOfDC()
  50. {
  51. return View();
  52. }
  53. /// <summary>
  54. /// 表单页
  55. /// <summary>
  56. /// <returns></returns>
  57. [HttpGet]
  58. public ActionResult Form()
  59. {
  60. ViewBag.NewEmpId = Guid.NewGuid().ToString();
  61. return View();
  62. }
  63. /// <summary>
  64. /// 导入页
  65. /// <summary>
  66. /// <returns></returns>
  67. [HttpGet]
  68. public ActionResult ImportForm()
  69. {
  70. return View();
  71. }
  72. [HttpGet]
  73. public ActionResult FormView()
  74. {
  75. return View();
  76. }
  77. public ActionResult FormAdd()
  78. {
  79. return View();
  80. }
  81. /// <summary>
  82. /// 表单页【修改部门、系部】
  83. /// <summary>
  84. /// <returns></returns>
  85. [HttpGet]
  86. public ActionResult FormEdit()
  87. {
  88. return View();
  89. }
  90. /// <summary>
  91. /// 表单页【编辑部分内容】
  92. /// </summary>
  93. /// <returns></returns>
  94. [HttpGet]
  95. public ActionResult FormModify()
  96. {
  97. return View();
  98. }
  99. /// <summary>
  100. /// 打印
  101. /// <summary>
  102. /// <returns></returns>
  103. [HttpGet]
  104. public ActionResult Print(string keyValue)
  105. {
  106. var empInfo = empInfoIBLL.GetEmpInfoEntity(keyValue);
  107. if (empInfo != null)
  108. {
  109. //性别
  110. var genderNo = empInfo.GenderNo.ToString().ToLower();
  111. empInfo.GenderNoName = dataItemIBLL.GetDetailList("usersexbit").FirstOrDefault(x => x.F_ItemValue == genderNo)?.F_ItemName;
  112. //部门
  113. empInfo.DepartmentName = departmentIBLL.GetEntity(empInfo.F_DepartmentId)?.F_FullName;
  114. //民族
  115. var nationality = dataSourceIBLL.GetDataTable("BCdNationality", "t.NationalityNo='" + empInfo.NationalityNo + "'");
  116. if (nationality != null && nationality.Rows.Count > 0)
  117. {
  118. empInfo.NationalityNo = nationality.Rows[0][1].ToString();
  119. }
  120. //政治面貌
  121. var partyFace = dataSourceIBLL.GetDataTable("BCdPartyFace", "t.PartyFaceNo='" + empInfo.PartyFaceNo + "'");
  122. if (partyFace != null && partyFace.Rows.Count > 0)
  123. {
  124. empInfo.PartyFaceNo = partyFace.Rows[0][1].ToString();
  125. }
  126. //最高学历
  127. var highestRecord = dataSourceIBLL.GetDataTable("BCdCultureDegree", "t.CultureDegreeNo='" + empInfo.HighestRecord + "'");
  128. if (highestRecord != null && highestRecord.Rows.Count > 0)
  129. {
  130. empInfo.HighestRecord = highestRecord.Rows[0][1].ToString();
  131. }
  132. //头像
  133. empInfo.Photo = annexesFileIBLL.GetEntityByFolderId(empInfo.Photo)?.F_FilePath;
  134. if (!string.IsNullOrEmpty(empInfo.Photo))
  135. {
  136. empInfo.Photo = empInfo.Photo.Substring(empInfo.Photo.IndexOf("Resource") - 1);
  137. }
  138. //本人简历
  139. empInfo.PM_ResumeList = pM_ResumeIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.RTime).ToList();
  140. //教育经历
  141. empInfo.PM_EducationExperienceList = pM_EducationExperienceIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.ETime).ToList();
  142. //家庭主要成员及重要社会关系
  143. empInfo.PM_FamilySituationList = pM_FamilySituationIBLL.GetListByEmpId(empInfo.EmpId).ToList();
  144. foreach (var item in empInfo.PM_FamilySituationList)
  145. {
  146. item.Application = dataItemIBLL.GetDetailList("FamilyRelation").FirstOrDefault(x => x.F_ItemValue == item.Application)?.F_ItemName;
  147. }
  148. //培训进修
  149. empInfo.TeacherTrainList = teacherTrainIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.TTStartTime).ToList();
  150. //奖罚情况
  151. empInfo.TeacherEncourgementList = teacherEncourgementIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.EncourgeDate).ToList();
  152. empInfo.TeacherPunishmentList = teacherPunishmentIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.StartTime).ToList();
  153. }
  154. return View(empInfo);
  155. }
  156. #endregion
  157. #region 获取数据
  158. /// <summary>
  159. /// 获取页面显示列表数据
  160. /// <summary>
  161. /// <param name="queryJson">查询参数</param>
  162. /// <returns></returns>
  163. [HttpGet]
  164. [AjaxOnly]
  165. public ActionResult GetPageList(string pagination, string queryJson)
  166. {
  167. Pagination paginationobj = pagination.ToObject<Pagination>();
  168. var data = empInfoIBLL.GetPageList(paginationobj, queryJson);
  169. var jsonData = new
  170. {
  171. rows = data,
  172. total = paginationobj.total,
  173. page = paginationobj.page,
  174. records = paginationobj.records
  175. };
  176. return Success(jsonData);
  177. }
  178. /// <summary>
  179. /// 获取表单数据
  180. /// <summary>
  181. /// <returns></returns>
  182. [HttpGet]
  183. [AjaxOnly]
  184. public ActionResult GetFormData(string keyValue)
  185. {
  186. var EmpInfoData = empInfoIBLL.GetEmpInfoEntity(keyValue);
  187. if (EmpInfoData != null)
  188. {
  189. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  190. }
  191. var jsonData = new
  192. {
  193. EmpInfo = EmpInfoData,
  194. };
  195. return Success(jsonData);
  196. }
  197. /// <summary>
  198. /// 获取表单数据
  199. /// <summary>
  200. /// <returns></returns>
  201. [HttpGet]
  202. [AjaxOnly]
  203. public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
  204. {
  205. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
  206. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  207. return Success(EmpInfoData);
  208. }
  209. /// <summary>
  210. /// 根据部门获取人员
  211. /// <summary>
  212. /// <returns></returns>
  213. [HttpGet]
  214. [AjaxOnly]
  215. public ActionResult GetEmpInfoEntityByDepartment(string departmentId)
  216. {
  217. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByDepartment(departmentId);
  218. return Success(EmpInfoData);
  219. }
  220. /// <summary>
  221. /// 获取表单数据
  222. /// <summary>
  223. /// <returns></returns>
  224. [HttpGet]
  225. [AjaxOnly]
  226. public ActionResult GetEmpInfoEntitiesByEmpName(string empName)
  227. {
  228. var EmpInfoList = empInfoIBLL.GetEmpInfoEntitiesByName(empName);
  229. return Success(EmpInfoList);
  230. }
  231. #endregion
  232. #region 提交数据
  233. /// <summary>
  234. /// 生成帐号
  235. /// </summary>
  236. /// <returns></returns>
  237. [HttpPost]
  238. [AjaxOnly]
  239. public ActionResult Generate()
  240. {
  241. empInfoIBLL.GenerateAccout();
  242. return Success("生成成功!");
  243. }
  244. [HttpPost]
  245. [AjaxOnly]
  246. public ActionResult UpdateAccount()
  247. {
  248. empInfoIBLL.UpdateAccount();
  249. return Success("生成成功!");
  250. }
  251. [HttpPost]
  252. [AjaxOnly]
  253. public ActionResult Lock(string keyValue)
  254. {
  255. empInfoIBLL.Lock(keyValue);
  256. empInfoIBLL.GenerateAccout(keyValue);
  257. empInfoIBLL.UpdateAccount(keyValue);
  258. return Success("审核成功!");
  259. }
  260. [HttpPost]
  261. [AjaxOnly]
  262. public ActionResult UnLock(string keyValue)
  263. {
  264. empInfoIBLL.UnLock(keyValue);
  265. return Success("去审成功!");
  266. }
  267. /// <summary>
  268. /// 删除实体数据
  269. /// <param name="keyValue">主键</param>
  270. /// <summary>
  271. /// <returns></returns>
  272. [HttpPost]
  273. [AjaxOnly]
  274. public ActionResult DeleteForm(string keyValue)
  275. {
  276. empInfoIBLL.DeleteEntity(keyValue);
  277. return Success("删除成功!");
  278. }
  279. /// <summary>
  280. /// 保存实体数据(新增、修改)
  281. /// <param name="keyValue">主键</param>
  282. /// <summary>
  283. /// <returns></returns>
  284. [HttpPost]
  285. [ValidateAntiForgeryToken]
  286. [AjaxOnly]
  287. [ValidateInput(false)]
  288. public ActionResult SaveForm(string keyValue, string strEntity)
  289. {
  290. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  291. entity.resume = WebHelper.HtmlEncode(entity.resume);
  292. entity.SyncFlag = false;
  293. var model = empInfoIBLL.GetEmpInfoEntityByEmpNo(entity.EmpNo);
  294. if (string.IsNullOrEmpty(keyValue))
  295. {
  296. if (model != null)
  297. {
  298. return Fail("职工编号已存在!");
  299. }
  300. }
  301. else
  302. {
  303. if (model != null && model.EmpId != keyValue)
  304. {
  305. return Fail("职工编号已存在!");
  306. }
  307. entity.SyncFlag = true;
  308. //判断排课同步数据是否存在:若存在,清除同步数据;
  309. var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
  310. if (arrangeLessonSyncList.Any())
  311. {
  312. arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
  313. }
  314. else
  315. {
  316. entity.SyncFlag = false;
  317. }
  318. }
  319. empInfoIBLL.SaveEntity(keyValue, entity);
  320. return Success("保存成功!");
  321. }
  322. [HttpPost]
  323. [AjaxOnly]
  324. public ActionResult CheckAll()
  325. {
  326. empInfoIBLL.CheckAll();
  327. empInfoIBLL.GenerateAccout();
  328. empInfoIBLL.UpdateAccount();
  329. return Success("全部审核成功!");
  330. }
  331. /// <summary>
  332. /// 保存实体数据(新增、修改)
  333. /// <param name="keyValue">主键</param>
  334. /// <summary>
  335. /// <returns></returns>
  336. [HttpPost]
  337. [ValidateAntiForgeryToken]
  338. [AjaxOnly]
  339. [ValidateInput(false)]
  340. public ActionResult SaveFormEdit(string keyValue, string strEntity)
  341. {
  342. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  343. empInfoIBLL.SaveEditEntity(keyValue, entity);
  344. return Success("保存成功!");
  345. }
  346. /// <summary>
  347. /// 保存实体数据(新增、修改)
  348. /// <param name="keyValue">主键</param>
  349. /// <summary>
  350. /// <returns></returns>
  351. [HttpPost]
  352. [ValidateAntiForgeryToken]
  353. [AjaxOnly]
  354. [ValidateInput(false)]
  355. public ActionResult SaveFormModify(string keyValue, string strEntity)
  356. {
  357. if (string.IsNullOrEmpty(keyValue))
  358. {
  359. return Fail("主键不存在!");
  360. }
  361. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  362. entity.resume = WebHelper.HtmlEncode(entity.resume);
  363. empInfoIBLL.SaveEntity(keyValue, entity);
  364. return Success("保存成功!");
  365. }
  366. #endregion
  367. }
  368. }