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 15 KiB

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