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