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.

EmpInfoController.cs 14 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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. empInfo.NationalityNo = dataItemIBLL.GetDetailList("National").FirstOrDefault(x => x.F_ItemValue == empInfo.NationalityNo)?.F_ItemName;
  116. //var nationality = dataSourceIBLL.GetDataTable("BCdNationality", "t.NationalityNo='" + empInfo.NationalityNo + "'");
  117. //if (nationality != null && nationality.Rows.Count > 0)
  118. //{
  119. // empInfo.NationalityNo = nationality.Rows[0][1].ToString();
  120. //}
  121. //政治面貌
  122. empInfo.PartyFaceNo = dataItemIBLL.GetDetailList("BCdPartyFace").FirstOrDefault(x => x.F_ItemValue == empInfo.PartyFaceNo)?.F_ItemName;
  123. //最高学历
  124. var highestRecord = dataSourceIBLL.GetDataTable("BCdCultureDegree", "t.CultureDegreeNo='" + empInfo.HighestRecord + "'");
  125. if (highestRecord != null && highestRecord.Rows.Count > 0)
  126. {
  127. empInfo.HighestRecord = highestRecord.Rows[0][1].ToString();
  128. }
  129. //头像
  130. empInfo.Photo = annexesFileIBLL.GetEntityByFolderId(empInfo.Photo)?.F_FilePath;
  131. if (!string.IsNullOrEmpty(empInfo.Photo))
  132. {
  133. empInfo.Photo = empInfo.Photo.Substring(empInfo.Photo.IndexOf("Resource") - 1);
  134. }
  135. //本人简历
  136. empInfo.PM_ResumeList = pM_ResumeIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.RTime).ToList();
  137. //教育经历
  138. empInfo.PM_EducationExperienceList = pM_EducationExperienceIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.ETime).ToList();
  139. //家庭主要成员及重要社会关系
  140. empInfo.PM_FamilySituationList = pM_FamilySituationIBLL.GetListByEmpId(empInfo.EmpId).ToList();
  141. foreach (var item in empInfo.PM_FamilySituationList)
  142. {
  143. item.Application = dataItemIBLL.GetDetailList("FamilyRelation").FirstOrDefault(x => x.F_ItemValue == item.Application)?.F_ItemName;
  144. }
  145. //培训进修
  146. empInfo.TeacherTrainList = teacherTrainIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.TTStartTime).ToList();
  147. //奖罚情况
  148. empInfo.TeacherEncourgementList = teacherEncourgementIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.EncourgeDate).ToList();
  149. empInfo.TeacherPunishmentList = teacherPunishmentIBLL.GetListByEmpId(empInfo.EmpId).OrderByDescending(x => x.StartTime).ToList();
  150. }
  151. return View(empInfo);
  152. }
  153. #endregion
  154. #region 获取数据
  155. /// <summary>
  156. /// 获取页面显示列表数据
  157. /// <summary>
  158. /// <param name="queryJson">查询参数</param>
  159. /// <returns></returns>
  160. [HttpGet]
  161. [AjaxOnly]
  162. public ActionResult GetPageList(string pagination, string queryJson)
  163. {
  164. Pagination paginationobj = pagination.ToObject<Pagination>();
  165. var data = empInfoIBLL.GetPageList(paginationobj, queryJson);
  166. var jsonData = new
  167. {
  168. rows = data,
  169. total = paginationobj.total,
  170. page = paginationobj.page,
  171. records = paginationobj.records
  172. };
  173. return Success(jsonData);
  174. }
  175. /// <summary>
  176. /// 获取表单数据
  177. /// <summary>
  178. /// <returns></returns>
  179. [HttpGet]
  180. [AjaxOnly]
  181. public ActionResult GetFormData(string keyValue)
  182. {
  183. var EmpInfoData = empInfoIBLL.GetEmpInfoEntity(keyValue);
  184. if (EmpInfoData != null)
  185. {
  186. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  187. }
  188. var jsonData = new
  189. {
  190. EmpInfo = EmpInfoData,
  191. };
  192. return Success(jsonData);
  193. }
  194. /// <summary>
  195. /// 获取表单数据
  196. /// <summary>
  197. /// <returns></returns>
  198. [HttpGet]
  199. [AjaxOnly]
  200. public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
  201. {
  202. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
  203. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  204. return Success(EmpInfoData);
  205. }
  206. /// <summary>
  207. /// 根据部门获取人员
  208. /// <summary>
  209. /// <returns></returns>
  210. [HttpGet]
  211. [AjaxOnly]
  212. public ActionResult GetEmpInfoEntityByDepartment(string departmentId)
  213. {
  214. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByDepartment(departmentId);
  215. return Success(EmpInfoData);
  216. }
  217. /// <summary>
  218. /// 获取表单数据
  219. /// <summary>
  220. /// <returns></returns>
  221. [HttpGet]
  222. [AjaxOnly]
  223. public ActionResult GetEmpInfoEntitiesByEmpName(string empName)
  224. {
  225. var EmpInfoList = empInfoIBLL.GetEmpInfoEntitiesByName(empName);
  226. return Success(EmpInfoList);
  227. }
  228. #endregion
  229. #region 提交数据
  230. /// <summary>
  231. /// 生成帐号
  232. /// </summary>
  233. /// <returns></returns>
  234. [HttpPost]
  235. [AjaxOnly]
  236. public ActionResult Generate()
  237. {
  238. empInfoIBLL.GenerateAccout();
  239. return Success("生成成功!");
  240. }
  241. [HttpPost]
  242. [AjaxOnly]
  243. public ActionResult UpdateAccount()
  244. {
  245. empInfoIBLL.UpdateAccount();
  246. return Success("生成成功!");
  247. }
  248. [HttpPost]
  249. [AjaxOnly]
  250. public ActionResult Lock(string keyValue)
  251. {
  252. empInfoIBLL.Lock(keyValue);
  253. empInfoIBLL.GenerateAccout(keyValue);
  254. empInfoIBLL.UpdateAccount(keyValue);
  255. return Success("审核成功!");
  256. }
  257. [HttpPost]
  258. [AjaxOnly]
  259. public ActionResult UnLock(string keyValue)
  260. {
  261. empInfoIBLL.UnLock(keyValue);
  262. return Success("去审成功!");
  263. }
  264. /// <summary>
  265. /// 删除实体数据
  266. /// <param name="keyValue">主键</param>
  267. /// <summary>
  268. /// <returns></returns>
  269. [HttpPost]
  270. [AjaxOnly]
  271. public ActionResult DeleteForm(string keyValue)
  272. {
  273. empInfoIBLL.DeleteEntity(keyValue);
  274. return Success("删除成功!");
  275. }
  276. /// <summary>
  277. /// 保存实体数据(新增、修改)
  278. /// <param name="keyValue">主键</param>
  279. /// <summary>
  280. /// <returns></returns>
  281. [HttpPost]
  282. [ValidateAntiForgeryToken]
  283. [AjaxOnly]
  284. [ValidateInput(false)]
  285. public ActionResult SaveForm(string keyValue, string strEntity)
  286. {
  287. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  288. entity.resume = WebHelper.HtmlEncode(entity.resume);
  289. entity.SyncFlag = false;
  290. var model = empInfoIBLL.GetEmpInfoEntityByEmpNo(entity.EmpNo);
  291. if (string.IsNullOrEmpty(keyValue))
  292. {
  293. if (model != null)
  294. {
  295. return Fail("职工编号已存在!");
  296. }
  297. //员工状态时间
  298. if (!string.IsNullOrEmpty(entity.IsInActiveStatus))
  299. {
  300. entity.IsInActiveTime = DateTime.Now;
  301. }
  302. }
  303. else
  304. {
  305. if (model != null && model.EmpId != keyValue)
  306. {
  307. return Fail("职工编号已存在!");
  308. }
  309. entity.SyncFlag = true;
  310. //判断排课同步数据是否存在:若存在,清除同步数据;
  311. var arrangeLessonSyncList = arrangeLessonSyncIBLL.GetArrangeLessonSyncListByTableId(keyValue);
  312. if (arrangeLessonSyncList.Any())
  313. {
  314. arrangeLessonSyncIBLL.DeleteEntityByTableId(keyValue);
  315. }
  316. else
  317. {
  318. entity.SyncFlag = false;
  319. }
  320. //员工状态时间
  321. var preEntity = empInfoIBLL.GetEmpInfoEntity(keyValue);
  322. if (preEntity != null)
  323. {
  324. if (entity.IsInActiveStatus != preEntity.IsInActiveStatus)
  325. {
  326. entity.IsInActiveTime = DateTime.Now;
  327. }
  328. }
  329. }
  330. empInfoIBLL.SaveEntity(keyValue, entity);
  331. return Success("保存成功!");
  332. }
  333. [HttpPost]
  334. [AjaxOnly]
  335. public ActionResult CheckAll()
  336. {
  337. empInfoIBLL.CheckAll();
  338. empInfoIBLL.GenerateAccout();
  339. empInfoIBLL.UpdateAccount();
  340. return Success("全部审核成功!");
  341. }
  342. /// <summary>
  343. /// 保存实体数据(新增、修改)
  344. /// <param name="keyValue">主键</param>
  345. /// <summary>
  346. /// <returns></returns>
  347. [HttpPost]
  348. [ValidateAntiForgeryToken]
  349. [AjaxOnly]
  350. [ValidateInput(false)]
  351. public ActionResult SaveFormEdit(string keyValue, string strEntity)
  352. {
  353. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  354. empInfoIBLL.SaveEditEntity(keyValue, entity);
  355. return Success("保存成功!");
  356. }
  357. /// <summary>
  358. /// 保存实体数据(新增、修改)
  359. /// <param name="keyValue">主键</param>
  360. /// <summary>
  361. /// <returns></returns>
  362. [HttpPost]
  363. [ValidateAntiForgeryToken]
  364. [AjaxOnly]
  365. [ValidateInput(false)]
  366. public ActionResult SaveFormModify(string keyValue, string strEntity)
  367. {
  368. if (string.IsNullOrEmpty(keyValue))
  369. {
  370. return Fail("主键不存在!");
  371. }
  372. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  373. entity.resume = WebHelper.HtmlEncode(entity.resume);
  374. empInfoIBLL.SaveEntity(keyValue, entity);
  375. return Success("保存成功!");
  376. }
  377. #endregion
  378. }
  379. }