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.
 
 
 
 
 
 

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