Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

855 rindas
36 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Net.Http;
  5. using Learun.Application.Base.SystemModule;
  6. using Learun.Cache.Base;
  7. using Learun.Cache.Factory;
  8. using Learun.Util;
  9. using Learun.Util.Operat;
  10. using System.Web.Mvc;
  11. using Learun.Application.Organization;
  12. using Learun.Application.TwoDevelopment.EducationalAdministration;
  13. using Quanjiang.DigitalScholl.WebLicense;
  14. using Learun.Application.TwoDevelopment.LogisticsManagement;
  15. using System.Linq;
  16. using Learun.Application.OA;
  17. using Learun.Application.TwoDevelopment.LR_Desktop;
  18. using Learun.Application.WorkFlow;
  19. namespace Learun.Application.Web.Controllers
  20. {
  21. /// <summary>
  22. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  23. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  24. /// 创建人:陈彬彬
  25. /// 日 期:2017.03.09
  26. /// 描 述:主页控制器
  27. /// </summary>
  28. public class HomeController : MvcControllerBase
  29. {
  30. private EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
  31. private CompanyIBLL companyIbll = new CompanyBLL();
  32. private QingJu_UserAccountIBLL qjAccountIbll = new QingJu_UserAccountBLL();
  33. private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL();
  34. private DatabaseInitIBLL databaseInitIBLL = new DatabaseInitBLL();
  35. private DepartmentIBLL departmentIBLL = new DepartmentBLL();
  36. private DgreeIBLL dgreeIBLL = new DgreeBLL();
  37. private PostIBLL postIBLL = new PostBLL();
  38. private UserIBLL userIBLL = new UserBLL();
  39. private CdDeptIBLL cdDeptIBLL = new CdDeptBLL();
  40. private CdMajorIBLL majorIBLL = new CdMajorBLL();
  41. private LessonInfoIBLL infoIBLL = new LessonInfoBLL();
  42. private ClassroomBuildingIBLL classroomBuildingIBLL = new ClassroomBuildingBLL();
  43. private ClassroomInfoIBLL classroomInfoIBLL = new ClassroomInfoBLL();
  44. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  45. private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL();
  46. private ArrangeExamTermIBLL arrangeExamTermIBLL = new ArrangeExamTermBLL();
  47. private StuScoreIBLL stuScoreIBLL = new StuScoreBLL();
  48. private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL();
  49. private AccommodationIBLL accdormitoryIBLL = new AccommodationBLL();
  50. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  51. private NoticeIBLL newsIBLL = new NoticeBLL();
  52. private SYS_ReceiveMessageIBLL sYS_ReceiveMessageIBLL = new SYS_ReceiveMessageBLL();
  53. private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL();
  54. private Sys_UpdateRecordIBLL sys_UpdateRecordIBLL = new Sys_UpdateRecordBLL();
  55. #region 视图功能
  56. public ActionResult ChangePwd()
  57. {
  58. return View();
  59. }
  60. public ActionResult NeedToDoForm()
  61. {
  62. var userinfo = LoginUserInfo.Get();
  63. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  64. //未读邮件
  65. ViewBag.UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0);
  66. //办公事项
  67. paginationobj.sidx = "F_CreateDate";
  68. ViewBag.UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count();
  69. //公告
  70. List<NewsEntity> outnewslist = new List<NewsEntity>();
  71. var newsList = newsIBLL.GetPageList(paginationobj, "");
  72. foreach (var newsitemEntity in newsList)
  73. {
  74. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  75. {
  76. if (!string.IsNullOrEmpty(userinfo.postIds))
  77. {
  78. if (userinfo.postIds.Contains(","))
  79. {
  80. foreach (var postid in userinfo.postIds.Split(','))
  81. {
  82. if (newsitemEntity.F_SendPostId.Contains(postid))
  83. {
  84. outnewslist.Add(newsitemEntity);
  85. break;
  86. }
  87. }
  88. }
  89. else
  90. {
  91. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  92. {
  93. outnewslist.Add(newsitemEntity);
  94. }
  95. }
  96. }
  97. }
  98. else
  99. {
  100. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  101. {
  102. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  103. {
  104. outnewslist.Add(newsitemEntity);
  105. }
  106. }
  107. else
  108. {
  109. outnewslist.Add(newsitemEntity);
  110. }
  111. }
  112. }
  113. var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId);
  114. ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId));
  115. paginationobj.sidx = "SendTime";
  116. ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Where(a => a.STypeId == 1).Count();
  117. return View();
  118. }
  119. public ActionResult GoTo()
  120. {
  121. var loginUserInfo = LoginUserInfo.Get();
  122. string redi = Request.QueryString["redi"];
  123. if (!string.IsNullOrEmpty(redi))
  124. {
  125. string sysid = Request.QueryString["sysid"];
  126. if (!string.IsNullOrEmpty(sysid))
  127. {
  128. if (sysid == "kaoshi")
  129. {
  130. if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["kaoshisystemurl"]))
  131. {
  132. return Redirect(ConfigurationManager.AppSettings["kaoshisystemurl"] + "?u=" + DESEncrypt.Encrypt(loginUserInfo.account, ConfigurationManager.AppSettings["SSOPublicSecret"]));
  133. }
  134. else
  135. {
  136. return Fail("系统地址未配置");
  137. }
  138. }
  139. if (sysid == "paike")
  140. {
  141. if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["kaoshisystemurl"]))
  142. {
  143. return Redirect(ConfigurationManager.AppSettings["kaoshisystemurl"] + "?u=" + DESEncrypt.Encrypt(loginUserInfo.account, ConfigurationManager.AppSettings["SSOPublicSecret"]));
  144. }
  145. else
  146. {
  147. return Fail("系统地址未配置");
  148. }
  149. }
  150. return Fail("系统id未找到");
  151. }
  152. else
  153. {
  154. return Fail("系统id未设置");
  155. }
  156. }
  157. else
  158. {
  159. return View();
  160. }
  161. }
  162. public ActionResult GoQingJu()
  163. {
  164. string redi = Request.QueryString["redi"];
  165. if (!string.IsNullOrEmpty(redi))
  166. {
  167. HttpClient client = new HttpClient();
  168. try
  169. {
  170. var userinfo = LoginUserInfo.Get();
  171. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  172. string qingJuurl = ConfigurationManager.AppSettings["QingJuurl"];
  173. string qingjuregisterurl = ConfigurationManager.AppSettings["QingJuRegisterurl"];
  174. string defpwd = ConfigurationManager.AppSettings["defaultpwd"];
  175. var qjinfo = qjAccountIbll.GetQingJu_UserAccountEntityByAccount(userinfo.account);
  176. if (qjinfo == null || string.IsNullOrEmpty(qjinfo.UserAccount))
  177. {
  178. if (userinfo.Description == "教师")
  179. {
  180. var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(userinfo.account);
  181. string jsoncontent = "{\"account\":\"" + userinfo.account + "\"," +
  182. "\"realname\":\"" + empinfo.EmpName + "\"," +
  183. "\"mobile\":\"" + empinfo.mobile + "\"," +
  184. "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," +
  185. "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," +
  186. "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_CompanyId) != null ? companyIbll.GetEntity(empinfo.F_CompanyId).F_FullName : "") + "\"," +
  187. "\"isteacher\":\"true\"" +
  188. "}";
  189. HttpContent httpContent = new StringContent(jsoncontent);
  190. httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
  191. string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result;
  192. var result = Convert.ToBoolean(clientData);
  193. if (result)
  194. {
  195. QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity();
  196. qjentity.Create();
  197. qjentity.UserAccount = userinfo.account;
  198. qjentity.QUserName = userinfo.account;
  199. qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey);
  200. qjAccountIbll.SaveEntity(null, qjentity);
  201. return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(userinfo.account, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey));
  202. }
  203. else
  204. {
  205. //注册失败
  206. return Redirect("/Home/QingJuRegister?e=1");
  207. }
  208. }
  209. else
  210. {
  211. var empinfo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userinfo.account);
  212. string jsoncontent = "{\"account\":\"" + userinfo.account + "\"," +
  213. "\"realname\":\"" + empinfo.StuName + "\"," +
  214. "\"mobile\":\"" + empinfo.mobile + "\"," +
  215. "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," +
  216. "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," +
  217. "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_SchoolId) != null ? companyIbll.GetEntity(empinfo.F_SchoolId).F_FullName : "") + "\"," +
  218. "\"isteacher\":\"false\"" +
  219. "}";
  220. HttpContent httpContent = new StringContent(jsoncontent);
  221. httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
  222. string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result;
  223. var result = Convert.ToBoolean(clientData);
  224. if (result)
  225. {
  226. QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity();
  227. qjentity.Create();
  228. qjentity.UserAccount = userinfo.account;
  229. qjentity.QUserName = userinfo.account;
  230. qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey);
  231. qjAccountIbll.SaveEntity(null, qjentity);
  232. return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(userinfo.account, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey));
  233. }
  234. else
  235. {
  236. //注册失败
  237. return Redirect("/Home/QingJuRegister");
  238. }
  239. }
  240. }
  241. else
  242. {
  243. qjinfo.QPass = DESEncrypt.Decrypt(qjinfo.QPass, publickey);
  244. return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(qjinfo.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(qjinfo.QPass, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey));
  245. }
  246. }
  247. catch (Exception e)
  248. {
  249. throw ExceptionEx.ThrowBusinessException(e);
  250. }
  251. }
  252. else
  253. {
  254. return View();
  255. }
  256. }
  257. public ActionResult QingJuRegister(QingJu_UserAccountEntity up)
  258. {
  259. string e = Request.QueryString["e"];
  260. if (!string.IsNullOrEmpty(e))
  261. {
  262. if (e == "1")
  263. {
  264. ViewBag.EMessage = "默认帐号自动注册失败,原因:帐号重复,请更换帐号后注册。";
  265. }
  266. if (e == "2")
  267. {
  268. ViewBag.EMessage = "帐号重复,请更换";
  269. }
  270. }
  271. HttpClient client = new HttpClient();
  272. var userinfo = LoginUserInfo.Get();
  273. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  274. string qingJuurl = ConfigurationManager.AppSettings["QingJuurl"];
  275. string qingjuregisterurl = ConfigurationManager.AppSettings["QingJuRegisterurl"];
  276. string defpwd = ConfigurationManager.AppSettings["defaultpwd"];
  277. if (up != null && !string.IsNullOrEmpty(up.QUserName))
  278. {
  279. if (userinfo.Description == "教师")
  280. {
  281. var empinfo = empInfoIbll.GetEmpInfoEntityByEmpNo(userinfo.account);
  282. string jsoncontent = "{\"account\":\"" + up.QUserName + "\"," +
  283. "\"realname\":\"" + empinfo.EmpName + "\"," +
  284. "\"mobile\":\"" + empinfo.mobile + "\"," +
  285. "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," +
  286. "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," +
  287. "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_CompanyId) != null ? companyIbll.GetEntity(empinfo.F_CompanyId).F_FullName : "") + "\"," +
  288. "\"isteacher\":\"true\"" +
  289. "}";
  290. HttpContent httpContent = new StringContent(jsoncontent);
  291. httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
  292. string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result;
  293. var result = Convert.ToBoolean(clientData);
  294. if (result)
  295. {
  296. QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity();
  297. qjentity.Create();
  298. qjentity.UserAccount = userinfo.account;
  299. qjentity.QUserName = up.QUserName;
  300. qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey);
  301. qjAccountIbll.SaveEntity(null, qjentity);
  302. return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(up.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey));
  303. }
  304. else
  305. {
  306. return Redirect("/Home/QingJuRegister?e=2");
  307. }
  308. }
  309. else
  310. {
  311. var empinfo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userinfo.account);
  312. string jsoncontent = "{\"account\":\"" + up.QUserName + "\"," +
  313. "\"realname\":\"" + empinfo.StuName + "\"," +
  314. "\"mobile\":\"" + empinfo.mobile + "\"," +
  315. "\"idcardno\":\"" + empinfo.IdentityCardNo + "\"," +
  316. "\"genderno\":\"" + (empinfo.GenderNo != null ? empinfo.GenderNo.Value.ToString() : "true") + "\"," +
  317. "\"school\":\"" + (companyIbll.GetEntity(empinfo.F_SchoolId) != null ? companyIbll.GetEntity(empinfo.F_SchoolId).F_FullName : "") + "\"," +
  318. "\"isteacher\":\"false\"" +
  319. "}";
  320. HttpContent httpContent = new StringContent(jsoncontent);
  321. httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
  322. string clientData = client.PostAsync(qingjuregisterurl, httpContent).Result.Content.ReadAsStringAsync().Result;
  323. var result = Convert.ToBoolean(clientData);
  324. if (result)
  325. {
  326. QingJu_UserAccountEntity qjentity = new QingJu_UserAccountEntity();
  327. qjentity.Create();
  328. qjentity.UserAccount = userinfo.account;
  329. qjentity.QUserName = up.QUserName;
  330. qjentity.QPass = DESEncrypt.Encrypt(defpwd, publickey);
  331. qjAccountIbll.SaveEntity(null, qjentity);
  332. return Redirect(qingJuurl + "?u=" + DESEncrypt.Encrypt(up.QUserName, publickey) + "&p=" + DESEncrypt.Encrypt(defpwd, publickey) + "&t=" + DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), publickey));
  333. }
  334. else
  335. {
  336. return Redirect("/Home/QingJuRegister?e=2");
  337. }
  338. }
  339. }
  340. else
  341. {
  342. return View();
  343. }
  344. }
  345. /// <summary>
  346. /// 初始化页面
  347. /// </summary>
  348. /// <returns></returns>
  349. [HttpGet]
  350. public ActionResult Index()
  351. {
  352. //授权验证
  353. var lc = LicenseChecker.CheckLicense();
  354. if (!lc.Result)
  355. {
  356. return Content("<script>alert('" + lc.Message + "');location.href='/ShowRegister/Index';</script>");
  357. }
  358. //return View("AdminTop");
  359. string learn_UItheme = WebHelper.GetCookie("Learn_ADMS_V6.1_UItheme");
  360. #region 待办
  361. var userinfo = LoginUserInfo.Get();
  362. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  363. //未读邮件
  364. ViewBag.UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0);
  365. //办公事项
  366. paginationobj.sidx = "F_CreateDate";
  367. ViewBag.UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count();
  368. //公告
  369. List<NewsEntity> outnewslist = new List<NewsEntity>();
  370. var newsList = newsIBLL.GetPageList(paginationobj, "");
  371. foreach (var newsitemEntity in newsList)
  372. {
  373. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  374. {
  375. if (!string.IsNullOrEmpty(userinfo.postIds))
  376. {
  377. if (userinfo.postIds.Contains(","))
  378. {
  379. foreach (var postid in userinfo.postIds.Split(','))
  380. {
  381. if (newsitemEntity.F_SendPostId.Contains(postid))
  382. {
  383. outnewslist.Add(newsitemEntity);
  384. break;
  385. }
  386. }
  387. }
  388. else
  389. {
  390. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  391. {
  392. outnewslist.Add(newsitemEntity);
  393. }
  394. }
  395. }
  396. }
  397. else
  398. {
  399. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  400. {
  401. if (userinfo.departmentId != null && newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  402. {
  403. outnewslist.Add(newsitemEntity);
  404. }
  405. }
  406. else
  407. {
  408. outnewslist.Add(newsitemEntity);
  409. }
  410. }
  411. }
  412. var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId);
  413. ViewBag.UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId));
  414. paginationobj.sidx = "SendTime";
  415. ViewBag.UnreadFile = sys_ReceiveFileIBLL.GetPageListByUserId(paginationobj, "{}", userinfo.userId).Count();
  416. ViewBag.UnreadNum = ViewBag.UnreadFile + ViewBag.UnreadNews + ViewBag.UnreadTask + ViewBag.UnreadMail;
  417. #endregion
  418. //获取在线用户人数
  419. ViewBag.OnlineUserNum = 0;
  420. var onlineUserResult = sys_UpdateRecordIBLL.GetOnlineUserNum();
  421. if (onlineUserResult != null)
  422. {
  423. ViewBag.OnlineUserNum = onlineUserResult.OnlineUserNum;
  424. }
  425. //获取本机ip
  426. ViewBag.Ip = GetIP();
  427. ViewBag.ACIp = ConfigurationManager.AppSettings["ACIp"] ?? "";
  428. ViewBag.ACIp2 = ConfigurationManager.AppSettings["ACIp2"] ?? "";
  429. switch (learn_UItheme)
  430. {
  431. case "1":
  432. return View("AdminDefault"); // 经典版本
  433. case "2":
  434. return View("AdminAccordion"); // 风尚版
  435. case "3":
  436. return View("AdminWindos"); // 炫动版
  437. case "4":
  438. return View("AdminTop"); // 飞扬版
  439. case "5":
  440. return View("AdminNavigation"); // 导航版
  441. case "6":
  442. return View("AdminTheme5"); // 主题五
  443. default:
  444. return View("AdminDefault"); // 经典版本
  445. }
  446. }
  447. /// <summary>
  448. /// 获取登录人员信息
  449. /// <param name="keyValue">主键</param>
  450. /// <summary>
  451. /// <returns></returns>
  452. [HttpPost]
  453. [AjaxOnly]
  454. public ActionResult GetOnlineUserInfo(string keyValue)
  455. {
  456. return Success(sys_UpdateRecordIBLL.GetOnlineUserInfo());
  457. }
  458. /// <summary>
  459. /// 学生首页
  460. /// </summary>
  461. /// <returns></returns>
  462. [HttpGet]
  463. public ActionResult HomeOfStudent()
  464. {
  465. var userInfo = LoginUserInfo.Get();
  466. var StuInfoFreshEntity = stuInfoFreshIBLL.GetStuInfoFreshEntityByStuNo(userInfo.account);
  467. if (StuInfoFreshEntity != null)
  468. {
  469. StuInfoFreshEntity.DeptName = cdDeptIBLL.GetCdDeptEntityByNo(StuInfoFreshEntity.DeptNo)?.DeptName;
  470. StuInfoFreshEntity.MajorName = majorIBLL.GetCdMajorEntityByMajorNo(StuInfoFreshEntity.MajorNo)?.MajorName;
  471. //是否完善信息
  472. StuInfoFreshEntity.IsStudentEdit = stuInfoFreshIBLL.GetStuInfoFreshFamilyList(StuInfoFreshEntity.ID).Any();
  473. var classInfoEntity = classInfoIBLL.GetClassInfoEntityByClassNo(StuInfoFreshEntity.ClassNo);
  474. if (classInfoEntity != null)
  475. {
  476. StuInfoFreshEntity.ClassName = classInfoEntity.ClassName;
  477. StuInfoFreshEntity.ClassTutorNo = classInfoEntity.ClassTutorNo;
  478. var empInfoEntity = empInfoIbll.GetEmpInfoEntityByEmpNo(classInfoEntity.ClassTutorNo);
  479. if (empInfoEntity != null)
  480. {
  481. StuInfoFreshEntity.ClassTutorName = empInfoEntity.EmpName;
  482. StuInfoFreshEntity.ClassTutorMobile = empInfoEntity.mobile;
  483. }
  484. }
  485. StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID);
  486. }
  487. var now = DateTime.Now;
  488. ViewBag.Year = now.Year;
  489. var companyEntity = companyIbll.GetEntity(userInfo.companyId);
  490. if (companyEntity != null)
  491. {
  492. ViewBag.Company = companyEntity.F_FullName;
  493. }
  494. return View(StuInfoFreshEntity);
  495. }
  496. /// <summary>
  497. /// 使用引导
  498. /// </summary>
  499. /// <returns></returns>
  500. [HttpGet]
  501. public ActionResult Guide()
  502. {
  503. var userInfo = LoginUserInfo.Get();
  504. ViewBag.userId = userInfo.userId;
  505. ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  506. return View();
  507. }
  508. /// <summary>
  509. /// 桌面导航
  510. /// </summary>
  511. /// <returns></returns>
  512. [HttpGet]
  513. public ActionResult DesktopNavigation()
  514. {
  515. //var userInfo = LoginUserInfo.Get();
  516. //ViewBag.userId = userInfo.userId;
  517. //ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  518. return View("DesktopNavigation4");
  519. }
  520. /// <summary>
  521. /// 首页桌面
  522. /// </summary>
  523. /// <returns></returns>
  524. [HttpGet]
  525. public ActionResult AdminDesktop()
  526. {
  527. //学生登录后跳转到“学生首页”
  528. var userInfo = LoginUserInfo.Get();
  529. if (userInfo.Description == "学生" && userInfo.companyId == "207fa1a9-160c-4943-a89b-8fa4db0547ce") //西昌民族幼儿
  530. {
  531. if (stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(userInfo.account) == null) //新生
  532. {
  533. return RedirectToAction("HomeOfStudent");
  534. }
  535. else
  536. {
  537. return Redirect("/UserCenter/Index");
  538. }
  539. }
  540. //return View("AdminDesktopTop");
  541. string learn_UItheme = WebHelper.GetCookie("Learn_ADMS_V6.1_UItheme");
  542. switch (learn_UItheme)
  543. {
  544. case "1":
  545. return View("AdminDesktop"); // 经典版本
  546. case "2":
  547. return View("AdminDesktopAccordion"); // 风尚版
  548. case "3":
  549. return View("AdminDesktopWindos"); // 炫动版
  550. case "4":
  551. return View("AdminDesktopTop"); // 飞扬版
  552. default:
  553. return View("AdminDesktop"); // 经典版本
  554. }
  555. }
  556. /// <summary>
  557. /// 首页模板
  558. /// </summary>
  559. /// <returns></returns>
  560. [HttpGet]
  561. public ActionResult AdminDesktopTemp()
  562. {
  563. return View();
  564. }
  565. #endregion
  566. private ICache cache = CacheFactory.CaChe();
  567. #region 清空缓存
  568. /// <summary>
  569. /// 清空缓存
  570. /// </summary>
  571. /// <returns></returns>
  572. [HttpPost]
  573. [AjaxOnly]
  574. public ActionResult ClearRedis()
  575. {
  576. for (int i = 0; i < 16; i++)
  577. {
  578. cache.RemoveAll(i);
  579. }
  580. return Success("清空成功");
  581. }
  582. #endregion
  583. /// <summary>
  584. /// 访问功能
  585. /// </summary>
  586. /// <param name="moduleId">功能Id</param>
  587. /// <param name="moduleName">功能模块</param>
  588. /// <param name="moduleUrl">访问路径</param>
  589. /// <returns></returns>
  590. [HttpPost]
  591. public ActionResult VisitModule(string moduleName, string moduleUrl)
  592. {
  593. UserInfo userInfo = LoginUserInfo.Get();
  594. LogEntity logEntity = new LogEntity();
  595. logEntity.F_CategoryId = 2;
  596. logEntity.F_OperateTypeId = ((int)OperationType.Visit).ToString();
  597. logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Visit);
  598. logEntity.F_OperateAccount = userInfo.account;
  599. logEntity.F_OperateUserId = userInfo.userId;
  600. logEntity.F_Module = moduleName;
  601. logEntity.F_ExecuteResult = 1;
  602. logEntity.F_ExecuteResultJson = "访问地址:" + moduleUrl;
  603. logEntity.F_Description = "PC端";
  604. logEntity.WriteLog();
  605. return Success("ok");
  606. }
  607. #region 系统数据初始化
  608. public ActionResult DataBaseInit()
  609. {
  610. return View();
  611. }
  612. [HttpPost]
  613. public ActionResult DoDataBaseInit()
  614. {
  615. databaseInitIBLL.InitDatabase();
  616. return Success("初始化成功");
  617. }
  618. #endregion
  619. #region 获取数据
  620. [HttpGet]
  621. public ActionResult GetYearAndSemesteResult()
  622. {
  623. var result = Common.GetSemesterAndYear();
  624. return Success(result);
  625. }
  626. [HttpGet]
  627. public ActionResult GetDgree(string moduleID)
  628. {
  629. var result = dgreeIBLL.GetDgreeEntityByModuleID(moduleID);
  630. return Success(result);
  631. }
  632. [HttpGet]
  633. public ActionResult GetCompanyDgree()
  634. {
  635. var result = companyIbll.GetAny();
  636. return Success(result);
  637. }
  638. [HttpGet]
  639. public ActionResult GetDepartment()
  640. {
  641. var result = departmentIBLL.GetAny();
  642. return Success(result);
  643. }
  644. [HttpGet]
  645. public ActionResult GetPost()
  646. {
  647. var result = postIBLL.GetAny();
  648. return Success(result);
  649. }
  650. [HttpGet]
  651. public ActionResult GetEmpInfo()
  652. {
  653. var result = empInfoIbll.GetAny();
  654. return Success(result);
  655. }
  656. [HttpGet]
  657. public ActionResult GetEmpAccount()
  658. {
  659. var result = userIBLL.GetAny();
  660. return Success(result);
  661. }
  662. [HttpGet]
  663. public ActionResult GetCdDept()
  664. {
  665. var result = cdDeptIBLL.GetAny();
  666. return Success(result);
  667. }
  668. [HttpGet]
  669. public ActionResult GetMajor()
  670. {
  671. var result = majorIBLL.GetAny();
  672. return Success(result);
  673. }
  674. [HttpGet]
  675. public ActionResult GetLesson()
  676. {
  677. var result = infoIBLL.GetAny();
  678. return Success(result);
  679. }
  680. [HttpGet]
  681. public ActionResult GetClassroomBuilding()
  682. {
  683. var result = classroomBuildingIBLL.GetAny();
  684. return Success(result);
  685. }
  686. [HttpGet]
  687. public ActionResult GetClassroomInfo()
  688. {
  689. var result = classroomInfoIBLL.GetAny();
  690. return Success(result);
  691. }
  692. [HttpGet]
  693. public ActionResult GetClassInfo()
  694. {
  695. var result = classInfoIBLL.GetAny();
  696. return Success(result);
  697. }
  698. [HttpGet]
  699. public ActionResult GetStudentInfo()
  700. {
  701. var result = stuInfoBasicIbll.GetAny();
  702. return Success(result);
  703. }
  704. [HttpGet]
  705. public ActionResult GetStuAccount()
  706. {
  707. var result = userIBLL.GetStuAny();
  708. return Success(result);
  709. }
  710. [HttpGet]
  711. public ActionResult GetArrangeLesson()
  712. {
  713. var result = arrangeLessonTermIBLL.GetAny();
  714. return Success(result);
  715. }
  716. [HttpGet]
  717. public ActionResult GetArrangeExam()
  718. {
  719. var result = arrangeExamTermIBLL.GetAny();
  720. return Success(result);
  721. }
  722. [HttpGet]
  723. public ActionResult GetStuScore()
  724. {
  725. var result = stuScoreIBLL.GetAny();
  726. return Success(result);
  727. }
  728. #endregion
  729. private string GetIP()
  730. {
  731. //string ip = string.Empty;
  732. //if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"]))
  733. // ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
  734. //if (string.IsNullOrEmpty(ip))
  735. // ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
  736. //return ip;
  737. string userIP = "未获取用户IP";
  738. try
  739. {
  740. if (System.Web.HttpContext.Current == null
  741. || System.Web.HttpContext.Current.Request == null
  742. || System.Web.HttpContext.Current.Request.ServerVariables == null)
  743. {
  744. return "";
  745. }
  746. string CustomerIP = "";
  747. //CDN加速后取到的IP simone 090805
  748. CustomerIP = System.Web.HttpContext.Current.Request.Headers["Cdn-Src-Ip"];
  749. if (!string.IsNullOrEmpty(CustomerIP))
  750. {
  751. return CustomerIP;
  752. }
  753. CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
  754. if (!String.IsNullOrEmpty(CustomerIP))
  755. {
  756. return CustomerIP;
  757. }
  758. if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
  759. {
  760. CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
  761. if (CustomerIP == null)
  762. {
  763. CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
  764. }
  765. }
  766. else
  767. {
  768. CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
  769. }
  770. if (string.Compare(CustomerIP, "unknown", true) == 0 || String.IsNullOrEmpty(CustomerIP))
  771. {
  772. return System.Web.HttpContext.Current.Request.UserHostAddress;
  773. }
  774. return CustomerIP;
  775. }
  776. catch { }
  777. return userIP;
  778. }
  779. }
  780. }