You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

391 lines
14 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. item.PoliticalAffiliation = dataItemIBLL.GetDetailList("PolityStatus").FirstOrDefault(x => x.F_ItemValue == item.PoliticalAffiliation)?.F_ItemName;
  148. }
  149. //培训进修
  150. empInfo.TeacherTrainList = teacherTrainIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.TTStartTime).ToList();
  151. //奖罚情况
  152. empInfo.TeacherEncourgementList = teacherEncourgementIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.EncourgeDate).ToList();
  153. empInfo.TeacherPunishmentList = teacherPunishmentIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.StartTime).ToList();
  154. }
  155. return View(empInfo);
  156. }
  157. #endregion
  158. #region 获取数据
  159. /// <summary>
  160. /// 获取页面显示列表数据
  161. /// <summary>
  162. /// <param name="queryJson">查询参数</param>
  163. /// <returns></returns>
  164. [HttpGet]
  165. [AjaxOnly]
  166. public ActionResult GetPageList(string pagination, string queryJson)
  167. {
  168. Pagination paginationobj = pagination.ToObject<Pagination>();
  169. var data = empInfoIBLL.GetPageList(paginationobj, queryJson);
  170. var jsonData = new
  171. {
  172. rows = data,
  173. total = paginationobj.total,
  174. page = paginationobj.page,
  175. records = paginationobj.records
  176. };
  177. return Success(jsonData);
  178. }
  179. /// <summary>
  180. /// 获取表单数据
  181. /// <summary>
  182. /// <returns></returns>
  183. [HttpGet]
  184. [AjaxOnly]
  185. public ActionResult GetFormData(string keyValue)
  186. {
  187. var EmpInfoData = empInfoIBLL.GetEmpInfoEntity(keyValue);
  188. if (EmpInfoData != null)
  189. {
  190. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  191. }
  192. var jsonData = new
  193. {
  194. EmpInfo = EmpInfoData,
  195. };
  196. return Success(jsonData);
  197. }
  198. /// <summary>
  199. /// 获取表单数据
  200. /// <summary>
  201. /// <returns></returns>
  202. [HttpGet]
  203. [AjaxOnly]
  204. public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
  205. {
  206. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
  207. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  208. return Success(EmpInfoData);
  209. }
  210. /// <summary>
  211. /// 根据部门获取人员
  212. /// <summary>
  213. /// <returns></returns>
  214. [HttpGet]
  215. [AjaxOnly]
  216. public ActionResult GetEmpInfoEntityByDepartment(string departmentId)
  217. {
  218. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByDepartment(departmentId);
  219. return Success(EmpInfoData);
  220. }
  221. /// <summary>
  222. /// 获取表单数据
  223. /// <summary>
  224. /// <returns></returns>
  225. [HttpGet]
  226. [AjaxOnly]
  227. public ActionResult GetEmpInfoEntitiesByEmpName(string empName)
  228. {
  229. var EmpInfoList = empInfoIBLL.GetEmpInfoEntitiesByName(empName);
  230. return Success(EmpInfoList);
  231. }
  232. #endregion
  233. #region 提交数据
  234. /// <summary>
  235. /// 生成帐号
  236. /// </summary>
  237. /// <returns></returns>
  238. [HttpPost]
  239. [AjaxOnly]
  240. public ActionResult Generate()
  241. {
  242. empInfoIBLL.GenerateAccout();
  243. return Success("生成成功!");
  244. }
  245. [HttpPost]
  246. [AjaxOnly]
  247. public ActionResult UpdateAccount()
  248. {
  249. empInfoIBLL.UpdateAccount();
  250. return Success("生成成功!");
  251. }
  252. [HttpPost]
  253. [AjaxOnly]
  254. public ActionResult Lock(string keyValue)
  255. {
  256. empInfoIBLL.Lock(keyValue);
  257. empInfoIBLL.GenerateAccout(keyValue);
  258. empInfoIBLL.UpdateAccount(keyValue);
  259. return Success("审核成功!");
  260. }
  261. [HttpPost]
  262. [AjaxOnly]
  263. public ActionResult UnLock(string keyValue)
  264. {
  265. empInfoIBLL.UnLock(keyValue);
  266. return Success("去审成功!");
  267. }
  268. /// <summary>
  269. /// 删除实体数据
  270. /// <param name="keyValue">主键</param>
  271. /// <summary>
  272. /// <returns></returns>
  273. [HttpPost]
  274. [AjaxOnly]
  275. public ActionResult DeleteForm(string keyValue)
  276. {
  277. empInfoIBLL.DeleteEntity(keyValue);
  278. return Success("删除成功!");
  279. }
  280. /// <summary>
  281. /// 保存实体数据(新增、修改)
  282. /// <param name="keyValue">主键</param>
  283. /// <summary>
  284. /// <returns></returns>
  285. [HttpPost]
  286. [ValidateAntiForgeryToken]
  287. [AjaxOnly]
  288. [ValidateInput(false)]
  289. public ActionResult SaveForm(string keyValue, string strEntity)
  290. {
  291. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  292. entity.resume = WebHelper.HtmlEncode(entity.resume);
  293. entity.SyncFlag = false;
  294. var model = empInfoIBLL.GetEmpInfoEntityByEmpNo(entity.EmpNo);
  295. var model_mobile = empInfoIBLL.GetEmpInfoEntityByMobile(entity.mobile);
  296. if (string.IsNullOrEmpty(keyValue))
  297. {
  298. if (model != null)
  299. {
  300. return Fail("职工编号已存在!");
  301. }
  302. if (model_mobile != null)
  303. {
  304. return Fail("手机号已存在!");
  305. }
  306. }
  307. else
  308. {
  309. if (model != null && model.EmpId != keyValue)
  310. {
  311. return Fail("职工编号已存在!");
  312. }
  313. if (model_mobile != null && model_mobile.EmpId != keyValue)
  314. {
  315. return Fail("手机号已存在!");
  316. }
  317. entity.SyncFlag = true;
  318. //判断排课同步数据是否存在:若存在,清除同步数据;
  319. var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
  320. if (arrangeLessonSyncList.Any())
  321. {
  322. arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
  323. }
  324. else
  325. {
  326. entity.SyncFlag = false;
  327. }
  328. }
  329. empInfoIBLL.SaveEntity(keyValue, entity);
  330. return Success("保存成功!");
  331. }
  332. [HttpPost]
  333. [AjaxOnly]
  334. public ActionResult CheckAll()
  335. {
  336. empInfoIBLL.CheckAll();
  337. empInfoIBLL.GenerateAccout();
  338. empInfoIBLL.UpdateAccount();
  339. return Success("全部审核成功!");
  340. }
  341. /// <summary>
  342. /// 保存实体数据(新增、修改)
  343. /// <param name="keyValue">主键</param>
  344. /// <summary>
  345. /// <returns></returns>
  346. [HttpPost]
  347. [ValidateAntiForgeryToken]
  348. [AjaxOnly]
  349. [ValidateInput(false)]
  350. public ActionResult SaveFormEdit(string keyValue, string strEntity)
  351. {
  352. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  353. empInfoIBLL.SaveEditEntity(keyValue, entity);
  354. return Success("保存成功!");
  355. }
  356. /// <summary>
  357. /// 保存实体数据(新增、修改)
  358. /// <param name="keyValue">主键</param>
  359. /// <summary>
  360. /// <returns></returns>
  361. [HttpPost]
  362. [ValidateAntiForgeryToken]
  363. [AjaxOnly]
  364. [ValidateInput(false)]
  365. public ActionResult SaveFormModify(string keyValue, string strEntity)
  366. {
  367. if (string.IsNullOrEmpty(keyValue))
  368. {
  369. return Fail("主键不存在!");
  370. }
  371. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  372. entity.resume = WebHelper.HtmlEncode(entity.resume);
  373. empInfoIBLL.SaveEntity(keyValue, entity);
  374. return Success("保存成功!");
  375. }
  376. #endregion
  377. }
  378. }