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.

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