Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

1819 рядки
85 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.OA;
  3. using Learun.Application.Organization;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using Learun.Application.TwoDevelopment.Permission;
  6. using Learun.Application.WorkFlow;
  7. using Learun.Util;
  8. using Learun.Util.Operat;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Configuration;
  12. using System.Linq;
  13. using System.Web;
  14. using System.Web.Mvc;
  15. using Learun.Cache.Base;
  16. using Learun.Cache.Factory;
  17. using Newtonsoft.Json;
  18. using Learun.Application.TwoDevelopment.LR_Desktop;
  19. using Learun.Application.TwoDevelopment.PersonnelManagement;
  20. namespace Learun.Application.Web.Controllers
  21. {
  22. [HandlerLogin(FilterMode.Ignore)]
  23. public class SSOSystemController : MvcControllerBase
  24. {
  25. private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL();
  26. Perm_UserPermissionIBLL permUserPermissionIbll = new Perm_UserPermissionBLL();
  27. private ModuleIBLL moduleIBLL = new ModuleBLL();
  28. private SYS_ReceiveMessageIBLL sYS_ReceiveMessageIBLL = new SYS_ReceiveMessageBLL();
  29. private UserIBLL userBll = new UserBLL();
  30. private WfTaskIBLL wfTaskIBLL = new WfTaskBLL();
  31. private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
  32. private NoticeIBLL newsIBLL = new NoticeBLL();
  33. private Perm_FunctionTypeIBLL perm_FunctionTypeIBLL = new Perm_FunctionTypeBLL();
  34. private DataItemIBLL dataItemIBLL = new DataItemBLL();
  35. private WfSchemeIBLL wfSchemeIBLL = new WfSchemeBLL();
  36. AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
  37. private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL();
  38. private Perm_FunctionVisitIBLL functionVisitIbll = new Perm_FunctionVisitBLL();
  39. private ICache redisCache = CacheFactory.CaChe();
  40. private SSO_Drag_DesktopManageIBLL sSO_Drag_DesktopManageIBLL = new SSO_Drag_DesktopManageBLL();
  41. private SYS_SendMessageIBLL sYS_SendMessageIBLL = new SYS_SendMessageBLL();
  42. private CdMajorIBLL cdMajorIBLL = new CdMajorBLL();
  43. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  44. private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
  45. private ClassroomInfoIBLL classroomInfoIBLL = new ClassroomInfoBLL();
  46. private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
  47. private SSO_Drag_CardSortManageIBLL sSO_Drag_CardSortManageIBLL = new SSO_Drag_CardSortManageBLL();
  48. private LessonInfoIBLL lessonInfoIBLL = new LessonInfoBLL();
  49. private CdLessonSortIBLL cdLessonSortIBLL = new CdLessonSortBLL();
  50. private CdLessonTypeIBLL cdLessonTypeIBLL = new CdLessonTypeBLL();
  51. private BCdCultureDegreeIBLL bCdCultureDegreeIBLL = new BCdCultureDegreeBLL();
  52. private StuScoreNotPassIBLL stuScoreNotPassIBLL = new StuScoreNotPassBLL();
  53. private Sys_QRCodeInLoginIBLL sys_QRCodeInLoginIBLL = new Sys_QRCodeInLoginBLL();
  54. private TeachSwitchIBLL teachSwitchIBLL = new TeachSwitchBLL();
  55. private StuSaverecordIBLL stuSaverecordIBLL = new StuSaverecordBLL();
  56. private StuConsumptionIBLL stuConsumptionIBLL = new StuConsumptionBLL();
  57. #region 统一身份认证2.0
  58. /// <summary>
  59. /// 获取统一认证用户信息
  60. /// </summary>
  61. /// <returns></returns>
  62. public ActionResult authorize()
  63. {
  64. string appid = Request.QueryString["appid"];
  65. string secret = Request.QueryString["secret"];
  66. string appkey = Request.QueryString["appkey"];
  67. if (string.IsNullOrEmpty(appid))
  68. {
  69. return Fail("参数:appid不能为空");
  70. }
  71. if (string.IsNullOrEmpty(secret))
  72. {
  73. return Fail("参数:secret不能为空");
  74. }
  75. if (string.IsNullOrEmpty(appkey))
  76. {
  77. return Fail("参数:appkey不能为空");
  78. }
  79. var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid);
  80. if (application != null)
  81. {
  82. if (Util.DESEncrypt.Decrypt(application.FSecret,
  83. ConfigurationManager.AppSettings["SSOPublicSecret"]).Equals(secret))
  84. {
  85. try
  86. {
  87. var code = DESEncrypt.Decrypt(appkey, "bjqjsso");
  88. if (!string.IsNullOrEmpty(redisCache.Read<string>(code)))
  89. {
  90. return Success(new { useraccount = redisCache.Read<string>(code) });
  91. }
  92. else
  93. {
  94. return Fail("appkey已过期");
  95. }
  96. }
  97. catch (Exception e)
  98. {
  99. return Fail("appkey错误");
  100. }
  101. }
  102. else
  103. {
  104. return Fail("secret错误");
  105. }
  106. }
  107. else
  108. return Fail("未授权的appid");
  109. }
  110. #endregion
  111. public ActionResult Index()
  112. {
  113. string account = "";
  114. if (!Request.Headers["account"].IsEmpty())
  115. {
  116. account = Request.Headers["account"].ToString();
  117. }
  118. OperatorHelper helper = new OperatorHelper();
  119. var result = helper.IsOnLine(account);
  120. if (result.stateCode != 1)
  121. {
  122. return Redirect("NoLogin");
  123. }
  124. var userinfo = LoginUserInfo.Get();
  125. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  126. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  127. var allCount = 0;
  128. foreach (var flow in flowType)
  129. {
  130. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  131. flow.FlowCount = count;
  132. allCount += count;
  133. }
  134. ViewBag.AllCount = allCount;
  135. ViewBag.FlowType = flowType;
  136. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  137. List<ModuleEntity> list = new List<ModuleEntity>();
  138. List<string> offenused = LogBLL.GetGroupLog(userinfo.userId).Select(m => m.F_Module).Take(20).ToList();
  139. var data = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress));
  140. foreach (var oitem in offenused)
  141. {
  142. ModuleEntity fod = data.FirstOrDefault(m => m.F_FullName == oitem);
  143. if (fod != null)
  144. {
  145. list.Add(fod);
  146. }
  147. }
  148. //常用服务
  149. ViewBag.Offenused = list.Take(12);
  150. //内部邮件
  151. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  152. var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}");
  153. ViewBag.LanMail = maildata;
  154. ViewBag.LanMailUnRead = maildata.Count(m => m.READFLAG == 0);
  155. //办公事项
  156. paginationobj.sidx = "F_CreateDate";
  157. //ViewBag.TaskList = wfTaskIBLL.GetActiveList(userinfo, paginationobj, "{}");
  158. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}");
  159. //公告
  160. List<NewsEntity> outnewslist = new List<NewsEntity>();
  161. paginationobj.rows = 100;
  162. var newsList = newsIBLL.GetList("", userinfo.userId);
  163. foreach (var newsitemEntity in newsList)
  164. {
  165. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  166. {
  167. if (!string.IsNullOrEmpty(userinfo.postIds))
  168. {
  169. if (userinfo.postIds.Contains(","))
  170. {
  171. foreach (var postid in userinfo.postIds.Split(','))
  172. {
  173. if (newsitemEntity.F_SendPostId.Contains(postid))
  174. {
  175. outnewslist.Add(newsitemEntity);
  176. break;
  177. }
  178. }
  179. }
  180. else
  181. {
  182. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  183. {
  184. outnewslist.Add(newsitemEntity);
  185. }
  186. }
  187. }
  188. }
  189. else
  190. {
  191. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  192. {
  193. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  194. {
  195. outnewslist.Add(newsitemEntity);
  196. }
  197. }
  198. else
  199. {
  200. outnewslist.Add(newsitemEntity);
  201. }
  202. }
  203. }
  204. //公文
  205. paginationobj.sidx = "SendTime";
  206. paginationobj.rows = 5;
  207. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userinfo.userId + "\"}");
  208. ViewBag.NewsList = outnewslist;
  209. //底部办公事项
  210. ViewBag.FunctionTypeList = perm_FunctionTypeIBLL.GetListByUserId(userinfo.userId).OrderBy(m => m.FTOrder).Take(7);
  211. var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userinfo.userId);
  212. foreach (var ufitem in userfunctionlist)
  213. {
  214. if (!string.IsNullOrEmpty(ufitem.FImage))
  215. {
  216. var imagePath = annexesFileIBLL.GetEntityByFolderId(ufitem.FImage)?.F_FilePath;
  217. if (!string.IsNullOrEmpty(imagePath))
  218. {
  219. ufitem.FImage = imagePath.Substring(imagePath.IndexOf("Resource") - 1);
  220. }
  221. }
  222. }
  223. ViewBag.FunctionList = userfunctionlist;
  224. ViewBag.PublicKey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  225. return View();
  226. }
  227. //public ActionResult NoLogin()
  228. //{
  229. // var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  230. // var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  231. // var allCount = 0;
  232. // foreach (var flow in flowType)
  233. // {
  234. // var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  235. // flow.FlowCount = count;
  236. // allCount += count;
  237. // }
  238. // ViewBag.AllCount = allCount;
  239. // ViewBag.FlowType = flowType;
  240. // ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  241. // return View();
  242. //}
  243. private UserService userService = new UserService();
  244. public ActionResult ResetPWD(string password)
  245. {
  246. password = Md5Helper.Encrypt(password, 32);
  247. userService.RevisePassword("System", password);
  248. return Success("修改成功");
  249. }
  250. [HandlerLogin(FilterMode.Enforce)]
  251. public ActionResult Work()
  252. {
  253. ViewBag.FlowType = dataItemIBLL.GetDetailList("FlowSort", "");
  254. ViewBag.FlowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  255. return View();
  256. }
  257. //[HandlerLogin(FilterMode.Enforce)]
  258. public ActionResult workTwo()
  259. {
  260. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  261. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  262. var allCount = 0;
  263. foreach (var flow in flowType)
  264. {
  265. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  266. flow.FlowCount = count;
  267. allCount += count;
  268. }
  269. ViewBag.AllCount = allCount;
  270. ViewBag.FlowType = flowType;
  271. ViewBag.FlowList = flowList;
  272. return View();
  273. }
  274. [HandlerLogin(FilterMode.Enforce)]
  275. public ActionResult UserService()
  276. {
  277. ViewBag.FlowType = dataItemIBLL.GetDetailList("FlowSort", "");
  278. ViewBag.FlowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  279. return View();
  280. }
  281. [HandlerLogin(FilterMode.Enforce)]
  282. public ActionResult NewsList()
  283. {
  284. var userinfo = LoginUserInfo.Get();
  285. int page = 1;
  286. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  287. {
  288. page = Convert.ToInt32(Request.QueryString["page"]);
  289. }
  290. //公告
  291. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "F_CreateDate", sord = "desc" };
  292. paginationobj.rows = 100;
  293. var newsList = newsIBLL.GetList("", userinfo.userId);
  294. //用户可以看到的通知公告
  295. var newsListSelf = new List<NewsEntity>();
  296. foreach (var newsitemEntity in newsList)
  297. {
  298. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  299. {
  300. if (!string.IsNullOrEmpty(userinfo.postIds))
  301. {
  302. if (userinfo.postIds.Contains(","))
  303. {
  304. foreach (var postid in userinfo.postIds.Split(','))
  305. {
  306. if (newsitemEntity.F_SendPostId.Contains(postid))
  307. {
  308. newsListSelf.Add(newsitemEntity);
  309. break;
  310. }
  311. }
  312. }
  313. else
  314. {
  315. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  316. {
  317. newsListSelf.Add(newsitemEntity);
  318. }
  319. }
  320. }
  321. }
  322. else
  323. {
  324. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  325. {
  326. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  327. {
  328. newsListSelf.Add(newsitemEntity);
  329. }
  330. }
  331. else
  332. {
  333. newsListSelf.Add(newsitemEntity);
  334. }
  335. }
  336. }
  337. foreach (var ufitem in newsListSelf)
  338. {
  339. if (!string.IsNullOrEmpty(ufitem.F_NewsImage))
  340. {
  341. if (annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage) != null)
  342. {
  343. var imagePath = annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage).F_FilePath;
  344. if (!string.IsNullOrEmpty(imagePath))
  345. {
  346. ufitem.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource") - 1);
  347. }
  348. else
  349. {
  350. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  351. }
  352. }
  353. else
  354. {
  355. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  356. }
  357. }
  358. else
  359. {
  360. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  361. }
  362. }
  363. ViewBag.NewsList = newsListSelf;
  364. return View(paginationobj);
  365. }
  366. [HandlerLogin(FilterMode.Enforce)]
  367. public ActionResult newsTwo()
  368. {
  369. var userinfo = LoginUserInfo.Get();
  370. int page = 1;
  371. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  372. {
  373. page = Convert.ToInt32(Request.QueryString["page"]);
  374. }
  375. //公告
  376. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "F_CreateDate", sord = "desc" };
  377. var newsList = newsIBLL.GetList("", userinfo.userId);
  378. //用户可以看到的通知公告
  379. var newsListSelf = new List<NewsEntity>();
  380. foreach (var newsitemEntity in newsList)
  381. {
  382. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  383. {
  384. if (!string.IsNullOrEmpty(userinfo.postIds))
  385. {
  386. if (userinfo.postIds.Contains(","))
  387. {
  388. foreach (var postid in userinfo.postIds.Split(','))
  389. {
  390. if (newsitemEntity.F_SendPostId.Contains(postid))
  391. {
  392. newsListSelf.Add(newsitemEntity);
  393. break;
  394. }
  395. }
  396. }
  397. else
  398. {
  399. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  400. {
  401. newsListSelf.Add(newsitemEntity);
  402. }
  403. }
  404. }
  405. }
  406. else
  407. {
  408. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  409. {
  410. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  411. {
  412. newsListSelf.Add(newsitemEntity);
  413. }
  414. }
  415. else
  416. {
  417. newsListSelf.Add(newsitemEntity);
  418. }
  419. }
  420. }
  421. foreach (var ufitem in newsListSelf)
  422. {
  423. if (!string.IsNullOrEmpty(ufitem.F_NewsImage))
  424. {
  425. if (annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage) != null)
  426. {
  427. var imagePath = annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage).F_FilePath;
  428. if (!string.IsNullOrEmpty(imagePath))
  429. {
  430. ufitem.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource") - 1);
  431. }
  432. else
  433. {
  434. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  435. }
  436. }
  437. else
  438. {
  439. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  440. }
  441. }
  442. else
  443. {
  444. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  445. }
  446. }
  447. //公告
  448. ViewBag.NewsList = newsListSelf;
  449. //内部邮件
  450. paginationobj.sidx = "readflag asc,SENDTIME desc ";
  451. ViewBag.LanMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}");
  452. //办公事项
  453. paginationobj.sidx = "F_CreateDate";
  454. //ViewBag.TaskList = wfTaskIBLL.GetActiveList(userinfo, paginationobj, "{}");
  455. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}");
  456. //学校公文
  457. paginationobj.sidx = "SendTime";
  458. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userinfo.userId + "\"}");
  459. return View();
  460. }
  461. public PartialViewResult LanMail()
  462. {
  463. var userinfo = LoginUserInfo.Get();
  464. int page = 1;
  465. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  466. {
  467. page = Convert.ToInt32(Request.QueryString["page"]);
  468. }
  469. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "readflag asc,SENDTIME desc", sord = "desc" };
  470. ViewBag.LanMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}");
  471. return PartialView(paginationobj);
  472. }
  473. public PartialViewResult TaskList()
  474. {
  475. var userinfo = LoginUserInfo.Get();
  476. int page = 1;
  477. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  478. {
  479. page = Convert.ToInt32(Request.QueryString["page"]);
  480. }
  481. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "F_CreateDate", sord = "desc" };
  482. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}");
  483. //ViewBag.TaskList = wfTaskIBLL.GetActiveList(userinfo, paginationobj, "{}");
  484. return PartialView(paginationobj);
  485. }
  486. public PartialViewResult ReceiveFileList()
  487. {
  488. var userinfo = LoginUserInfo.Get();
  489. int page = 1;
  490. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  491. {
  492. page = Convert.ToInt32(Request.QueryString["page"]);
  493. }
  494. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "SendTime", sord = "desc" };
  495. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userinfo.userId + "\"}");
  496. return PartialView(paginationobj);
  497. }
  498. public PartialViewResult NewList()
  499. {
  500. var userinfo = LoginUserInfo.Get();
  501. int page = 1;
  502. if (!string.IsNullOrEmpty(Request.QueryString["page"]))
  503. {
  504. page = Convert.ToInt32(Request.QueryString["page"]);
  505. }
  506. //公告
  507. Pagination paginationobj = new Pagination() { rows = 10, page = page, sidx = "F_CreateDate", sord = "desc" };
  508. var newsList = newsIBLL.GetList("", userinfo.userId);
  509. //用户可以看到的通知公告
  510. var newsListSelf = new List<NewsEntity>();
  511. foreach (var newsitemEntity in newsList)
  512. {
  513. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  514. {
  515. if (!string.IsNullOrEmpty(userinfo.postIds))
  516. {
  517. if (userinfo.postIds.Contains(","))
  518. {
  519. foreach (var postid in userinfo.postIds.Split(','))
  520. {
  521. if (newsitemEntity.F_SendPostId.Contains(postid))
  522. {
  523. newsListSelf.Add(newsitemEntity);
  524. break;
  525. }
  526. }
  527. }
  528. else
  529. {
  530. if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
  531. {
  532. newsListSelf.Add(newsitemEntity);
  533. }
  534. }
  535. }
  536. }
  537. else
  538. {
  539. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  540. {
  541. if (newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
  542. {
  543. newsListSelf.Add(newsitemEntity);
  544. }
  545. }
  546. else
  547. {
  548. newsListSelf.Add(newsitemEntity);
  549. }
  550. }
  551. }
  552. foreach (var ufitem in newsListSelf)
  553. {
  554. if (!string.IsNullOrEmpty(ufitem.F_NewsImage))
  555. {
  556. if (annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage) != null)
  557. {
  558. var imagePath = annexesFileIBLL.GetEntityByFolderId(ufitem.F_NewsImage).F_FilePath;
  559. if (!string.IsNullOrEmpty(imagePath))
  560. {
  561. ufitem.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource") - 1);
  562. }
  563. else
  564. {
  565. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  566. }
  567. }
  568. else
  569. {
  570. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  571. }
  572. }
  573. else
  574. {
  575. ufitem.F_NewsImage = "/Resource/NewsDefault.jpg";
  576. }
  577. }
  578. //公告
  579. ViewBag.NewsList = newsListSelf;
  580. return PartialView(paginationobj);
  581. }
  582. [HandlerLogin(FilterMode.Enforce)]
  583. public ActionResult NewsDetail()
  584. {
  585. return View();
  586. }
  587. public ActionResult Check()
  588. {
  589. try
  590. {
  591. string redi = Request.QueryString["redi"];
  592. if (!string.IsNullOrEmpty(redi))
  593. {
  594. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  595. string uid = Request.QueryString["u"];
  596. string pwd = Request.QueryString["p"];
  597. string logintime = Request.QueryString["t"];
  598. string n = Request.QueryString["n"];
  599. string mail = Request.QueryString["mail"];
  600. string sendfile = Request.QueryString["sendfile"];
  601. string task = Request.QueryString["task"];
  602. string gotomain = Request.QueryString["gotomain"];
  603. string nk = Request.QueryString["nk"];
  604. string jx = Request.QueryString["jx"];
  605. string zl = Request.QueryString["zl"];
  606. if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(logintime))
  607. {
  608. decimal decodelogintime = Convert.ToDecimal(DESEncrypt.Decrypt(logintime, publickey));
  609. decimal datetimenow = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMddHHmmss"));
  610. if (datetimenow - 300 <= decodelogintime && datetimenow + 300 >= decodelogintime)
  611. {
  612. string username = DESEncrypt.Decrypt(uid, publickey);
  613. string password = DESEncrypt.Decrypt(pwd, publickey);
  614. UserEntity userEntity = userBll.CheckLogin(username, Md5Helper.Encrypt(password, 32));
  615. LogEntity logEntity = new LogEntity();
  616. logEntity.F_CategoryId = 1;
  617. logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString();
  618. logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login);
  619. logEntity.F_OperateAccount = username + "(" + userEntity.F_RealName + ")";
  620. logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : username;
  621. logEntity.F_Module = Config.GetValue("SoftName");
  622. logEntity.F_Description = "PC端";
  623. if (!userEntity.LoginOk)//登录失败
  624. {
  625. //写入日志
  626. logEntity.F_ExecuteResult = 0;
  627. logEntity.F_ExecuteResultJson = "sso登录失败:" + userEntity.LoginMsg;
  628. logEntity.WriteLog();
  629. return Fail(userEntity.LoginMsg);
  630. }
  631. else
  632. {
  633. OperatorHelper.Instance.AddLoginUser(userEntity.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息
  634. //写入日志
  635. logEntity.F_ExecuteResult = 1;
  636. logEntity.F_ExecuteResultJson = "sso登录成功";
  637. logEntity.WriteLog();
  638. var DigitalschoolMisLoginurl = ConfigurationManager.AppSettings["DigitalschoolMisLoginurl"];
  639. var Returnurl = "http://" + Request.Url.Host + ":" + Request.Url.Port;
  640. if (!string.IsNullOrEmpty(n))
  641. {
  642. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=6252983c-52f5-402c-991b-ad19a9cb1f94&keyValue=" + n));
  643. }
  644. else if (!string.IsNullOrEmpty(mail))
  645. {
  646. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=252878d7-d807-497f-b01e-839bb1b869c6"));
  647. }
  648. else if (!string.IsNullOrEmpty(sendfile))
  649. {
  650. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=19637c39-624d-4be6-b680-04250f8df71f"));
  651. }
  652. else if (!string.IsNullOrEmpty(task))
  653. {
  654. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=56ce34c2-882e-47d1-b12d-5036e3b79fcf"));
  655. }
  656. else if (!string.IsNullOrEmpty(gotomain))
  657. {
  658. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index"));
  659. }
  660. else if (!string.IsNullOrEmpty(nk))
  661. {
  662. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=07ceccd0-cf74-42ec-9b7d-3b36af0be451"));
  663. }
  664. else if (!string.IsNullOrEmpty(jx))
  665. {
  666. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=5f2e3e9b-b0da-421a-b370-671dcae4fc17"));
  667. }
  668. else if (!string.IsNullOrEmpty(zl))
  669. {
  670. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + HttpUtility.UrlEncode(Returnurl + "/Home/Index?autoopen=8dfd9f38-8cab-49ff-b4d1-8b899b1ecbca"));
  671. }
  672. else
  673. {
  674. return Redirect(DigitalschoolMisLoginurl + "?F_Account=" + username + "&returnurl=" + Returnurl + "/SSOSystem/Index");
  675. }
  676. }
  677. }
  678. else
  679. {
  680. return Fail("时间戳验证失败");
  681. }
  682. }
  683. else
  684. {
  685. return Fail("参数错误");
  686. }
  687. }
  688. else
  689. {
  690. return View();
  691. }
  692. }
  693. catch (Exception e)
  694. {
  695. return Fail("参数错误");
  696. }
  697. }
  698. public ActionResult FirstLogin(Perm_FunctionEntity up)
  699. {
  700. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  701. if (up != null && !string.IsNullOrEmpty(up.UPId))
  702. {
  703. perm_FunctionIBLL.SaveEntityByUPId(up.UPId, up);
  704. return Redirect("/SSOSystem/GoTo?sysid=" + DESEncrypt.Encrypt(up.FId, publickey) + "&openid=" + DESEncrypt.Encrypt(up.UserId, publickey));
  705. }
  706. string sysid = Request.QueryString["sysid"];
  707. string strsysid = DESEncrypt.Decrypt(sysid, publickey);
  708. string openid = Request.QueryString["openid"];
  709. string userid = DESEncrypt.Decrypt(openid, publickey);
  710. var uplist = permUserPermissionIbll.GetPerm_UserPermissionEntityByFIdAndUid(strsysid, userid);
  711. if (uplist == null)
  712. {
  713. return Fail("用户未授权。");
  714. }
  715. var perfun = perm_FunctionIBLL.GetPerm_FunctionEntityByUPId(uplist.UPId);
  716. return View(perfun);
  717. }
  718. public ActionResult GoTo()
  719. {
  720. try
  721. {
  722. string redi = Request.QueryString["redi"];
  723. if (!string.IsNullOrEmpty(redi))
  724. {
  725. string publickey = ConfigurationManager.AppSettings["SSOPublicSecret"];
  726. string sysid = Request.QueryString["sysid"];
  727. string strsysid = DESEncrypt.Decrypt(sysid, publickey);
  728. string openid = Request.QueryString["openid"];
  729. string userid = DESEncrypt.Decrypt(openid, publickey);
  730. var uplist = permUserPermissionIbll.GetPerm_UserPermissionEntityByFIdAndUid(strsysid, userid);
  731. Perm_FunctionVisitEntity functionVisitEntity = new Perm_FunctionVisitEntity();
  732. functionVisitEntity.Create();
  733. functionVisitEntity.Fid = strsysid;
  734. functionVisitEntity.PDate = DateTime.Now;
  735. functionVisitEntity.PUId = userid;
  736. var userinfo = userBll.GetEntityByUserId(userid);
  737. functionVisitEntity.PUName = userinfo.F_RealName;
  738. if (uplist == null)
  739. {
  740. functionVisitEntity.PIsLoginSuccess = false;
  741. functionVisitEntity.PContent = "用户未授权";
  742. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  743. return Fail("用户未授权。");
  744. }
  745. var perfun = perm_FunctionIBLL.GetPerm_FunctionEntityByUPId(uplist.UPId);
  746. string secretkey = DESEncrypt.Decrypt(perfun.FSecret, publickey);
  747. if (perfun.FIsManagePage == true)
  748. {
  749. if (!string.IsNullOrEmpty(perfun.FInterfaceUrl))
  750. {
  751. if (!string.IsNullOrEmpty(perfun.UPUserName) && !string.IsNullOrEmpty(perfun.UPPass))
  752. {
  753. functionVisitEntity.PIsLoginSuccess = true;
  754. functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl;
  755. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  756. return Redirect(perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), publickey) + "&t=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey));
  757. }
  758. else
  759. {
  760. functionVisitEntity.PIsLoginSuccess = false;
  761. functionVisitEntity.PContent = "用户未配置转到用户名密码配置页面";
  762. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  763. //用户未配置转到用户名密码配置页面
  764. return Redirect("/SSOSystem/FirstLogin?sysid=" + sysid + "&openid=" + openid);
  765. }
  766. }
  767. else
  768. {
  769. functionVisitEntity.PIsLoginSuccess = false;
  770. functionVisitEntity.PContent = "未配置登录接口地址";
  771. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  772. return Fail("未配置登录接口地址。");
  773. }
  774. }
  775. else
  776. {
  777. if (!string.IsNullOrEmpty(perfun.FUrl))
  778. {
  779. functionVisitEntity.PIsLoginSuccess = true;
  780. functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl;
  781. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  782. return Redirect(perfun.FUrl);
  783. }
  784. else
  785. {
  786. functionVisitEntity.PIsLoginSuccess = false;
  787. functionVisitEntity.PContent = "未配置地址";
  788. functionVisitIbll.SaveEntity(null, functionVisitEntity);
  789. return Fail("未配置地址。");
  790. }
  791. }
  792. }
  793. else
  794. {
  795. return View();
  796. }
  797. }
  798. catch (Exception e)
  799. {
  800. return Fail("参数错误。");
  801. }
  802. }
  803. /// <summary>
  804. /// 获取IP
  805. /// </summary>
  806. /// <returns></returns>
  807. private string GetIP()
  808. {
  809. string ip = string.Empty;
  810. if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"]))
  811. ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
  812. if (string.IsNullOrEmpty(ip))
  813. ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
  814. return ip;
  815. }
  816. /// <summary>
  817. /// 网上办事大厅拖拽版-未登录页面
  818. /// </summary>
  819. /// <returns></returns>
  820. public ActionResult NoLogin()
  821. {
  822. //获取错误次数
  823. ViewBag.errornum = OperatorHelper.Instance.GetCurrentErrorNum();
  824. //获取高职版跳转地址
  825. ViewBag.DigitalschoolMisLoginurl = ConfigurationManager.AppSettings["DigitalschoolMisLoginurl"];
  826. ViewBag.Returnurl = "http://" + Request.Url.Host + ":" + Request.Url.Port;
  827. //获取登录页二维码配置信息
  828. ViewBag.HasQRCode = false;
  829. var qrcodelist = sys_QRCodeInLoginIBLL.GetList().ToList().Where(x => x.EnabledMark == 1).OrderByDescending(x => x.CreateTime);
  830. if (qrcodelist.Any())
  831. {
  832. ViewBag.HasQRCode = true;
  833. ViewBag.QRCodeUrl = qrcodelist.FirstOrDefault().QRCodeUrl;
  834. ViewBag.QRCodeText = qrcodelist.FirstOrDefault().Title;
  835. }
  836. //微信快捷登录
  837. var result4 = teachSwitchIBLL.FindFirst("wxloginforpc");
  838. ViewBag.WeixinLoginSwitch = result4;
  839. return View("DragNoLogin");
  840. }
  841. /// <summary>
  842. /// 网上办事大厅拖拽版-未登录页面-微信登录
  843. /// </summary>
  844. /// <returns></returns>
  845. public ActionResult DragNoWxLogin()
  846. {
  847. string QQOpenId = Request.QueryString["QQOpenId"];
  848. string WeixinOpenId = Request.QueryString["WeixinOpenId"];
  849. ViewBag.WeixinOpenId = WeixinOpenId;
  850. ViewBag.QQOpenId = QQOpenId;
  851. //获取错误次数
  852. ViewBag.errornum = OperatorHelper.Instance.GetCurrentErrorNum();
  853. //获取高职版跳转地址
  854. ViewBag.DigitalschoolMisLoginurl = ConfigurationManager.AppSettings["DigitalschoolMisLoginurl"];
  855. ViewBag.Returnurl = "http://" + Request.Url.Host + ":" + Request.Url.Port;
  856. //获取登录页二维码配置信息
  857. ViewBag.HasQRCode = false;
  858. var qrcodelist = sys_QRCodeInLoginIBLL.GetList().ToList().Where(x => x.EnabledMark == 1).OrderByDescending(x => x.CreateTime);
  859. if (qrcodelist.Any())
  860. {
  861. ViewBag.HasQRCode = true;
  862. ViewBag.QRCodeUrl = qrcodelist.FirstOrDefault().QRCodeUrl;
  863. ViewBag.QRCodeText = qrcodelist.FirstOrDefault().Title;
  864. }
  865. return View();
  866. }
  867. /// <summary>
  868. /// 网上办事大厅拖拽版-办事大厅模式
  869. /// </summary>
  870. /// <returns></returns>
  871. public ActionResult DragModelOne()
  872. {
  873. //判断登录状态码
  874. string account = "";
  875. if (!Request.Headers["account"].IsEmpty())
  876. {
  877. account = Request.Headers["account"].ToString();
  878. }
  879. OperatorHelper helper = new OperatorHelper();
  880. var result = helper.IsOnLine(account);
  881. if (result.stateCode != 1)
  882. {
  883. return Redirect("NoLogin");
  884. }
  885. //登录用户
  886. var userInfo = LoginUserInfo.Get();
  887. ViewBag.UserId = userInfo.userId;
  888. //桌面管理表、卡片块排序管理表增加默认数据
  889. sSO_Drag_DesktopManageIBLL.AddDefaultData(userInfo.userId, "one");
  890. //获取桌面、卡片块排序列表
  891. ViewBag.DesktopList = sSO_Drag_DesktopManageIBLL.GetListByModelCode(userInfo.userId, "one").OrderByDescending(x => x.DefaultFlag).ThenBy(x => x.Sort).ThenBy(x => x.CreateDate);
  892. ViewBag.DesktopListStr = JsonConvert.SerializeObject(ViewBag.DesktopList);
  893. //分页查询条件设置
  894. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  895. //邮件-收件箱
  896. var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  897. var maildataAll = sYS_ReceiveMessageIBLL.GetList("{\"userId\":\"" + userInfo.userId + "\"}");
  898. ViewBag.LanMail = maildata;
  899. ViewBag.LanMailStr = JsonConvert.SerializeObject(ViewBag.LanMail);
  900. ViewBag.LanMailUnReadCount = maildataAll.Count(m => m.READFLAG == 0);
  901. //邮件-已发送
  902. paginationobj.sidx = "SENDTIME desc";
  903. var mailsenddata = sYS_SendMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  904. var mailsenddataAll = sYS_SendMessageIBLL.GetList2("{\"userId\":\"" + userInfo.userId + "\"}");
  905. ViewBag.LanMailSend = mailsenddata;
  906. ViewBag.LanMailSendStr = JsonConvert.SerializeObject(ViewBag.LanMailSend);
  907. //来往邮件数量
  908. ViewBag.LanMailTotalNum = maildataAll.Count() + mailsenddataAll.Count();
  909. //公文
  910. paginationobj.sidx = "SendTime";
  911. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userInfo.userId + "\"}");
  912. ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList);
  913. //公告
  914. List<NewsEntity> outnewslist = new List<NewsEntity>();
  915. var newsList = newsIBLL.GetList("", userInfo.userId);
  916. foreach (var newsitemEntity in newsList)
  917. {
  918. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  919. {
  920. if (!string.IsNullOrEmpty(userInfo.postIds))
  921. {
  922. if (userInfo.postIds.Contains(","))
  923. {
  924. foreach (var postid in userInfo.postIds.Split(','))
  925. {
  926. if (newsitemEntity.F_SendPostId.Contains(postid))
  927. {
  928. outnewslist.Add(newsitemEntity);
  929. break;
  930. }
  931. }
  932. }
  933. else
  934. {
  935. if (newsitemEntity.F_SendPostId.Contains(userInfo.postIds))
  936. {
  937. outnewslist.Add(newsitemEntity);
  938. }
  939. }
  940. }
  941. }
  942. else
  943. {
  944. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  945. {
  946. if (newsitemEntity.F_SendDeptId.Contains(userInfo.departmentId))
  947. {
  948. outnewslist.Add(newsitemEntity);
  949. }
  950. }
  951. else
  952. {
  953. outnewslist.Add(newsitemEntity);
  954. }
  955. }
  956. }
  957. ViewBag.NewsList = outnewslist.Take(5);
  958. ViewBag.NewsListStr = JsonConvert.SerializeObject(ViewBag.NewsList);
  959. //宣传报道
  960. var newsListOfxuanchuan = outnewslist.Where(x => x.F_CategoryId == "15").Take(4);
  961. foreach (var item in newsListOfxuanchuan)
  962. {
  963. if (!string.IsNullOrEmpty(item.F_NewsImage))
  964. {
  965. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  966. if (!string.IsNullOrEmpty(imagePath))
  967. {
  968. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  969. }
  970. else
  971. {
  972. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  973. }
  974. }
  975. }
  976. ViewBag.NewsListOfxuanchuan = newsListOfxuanchuan;
  977. ViewBag.NewsListOfxuanchuanStr = JsonConvert.SerializeObject(ViewBag.NewsListOfxuanchuan);
  978. //智慧教育
  979. ViewBag.NewsListOfzhihui = outnewslist.Where(x => x.F_CategoryId == "16").Take(6);
  980. ViewBag.NewsListOfzhihuiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhihui);
  981. //专题推荐
  982. var newsListOfzhuanti = outnewslist.Where(x => x.F_CategoryId == "17").Take(7);
  983. foreach (var item in newsListOfzhuanti)
  984. {
  985. if (!string.IsNullOrEmpty(item.F_NewsImage))
  986. {
  987. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  988. if (!string.IsNullOrEmpty(imagePath))
  989. {
  990. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  991. }
  992. else
  993. {
  994. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  995. }
  996. }
  997. }
  998. ViewBag.NewsListOfzhuanti = newsListOfzhuanti;
  999. ViewBag.NewsListOfzhuantiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhuanti);
  1000. //办公事项-待办任务
  1001. paginationobj.sidx = "F_CreateDate";
  1002. paginationobj.rows = 4;
  1003. var taskListAll = nWFProcessIBLL.GetMyTaskPageList(userInfo, "{}");
  1004. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userInfo, paginationobj, "{}");
  1005. ViewBag.TaskListStr = JsonConvert.SerializeObject(ViewBag.TaskList);
  1006. ViewBag.TaskTotalNum = taskListAll.Count();
  1007. //办公事项-已办任务
  1008. var finishTaskListAll = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, "{}");
  1009. ViewBag.FinishTaskList = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, paginationobj, "{}");
  1010. ViewBag.FinishTaskListStr = JsonConvert.SerializeObject(ViewBag.FinishTaskList);
  1011. ViewBag.FinishTaskTotalNum = finishTaskListAll.Count();
  1012. //办公事项-我发起的
  1013. var myListAll = nWFProcessIBLL.GetMyPageList(userInfo.userId, "{}");
  1014. ViewBag.MyList = nWFProcessIBLL.GetMyPageList(userInfo.userId, paginationobj, "{}");
  1015. ViewBag.MyListStr = JsonConvert.SerializeObject(ViewBag.MyList);
  1016. ViewBag.MyListTotalNum = myListAll.Count();
  1017. //常用服务
  1018. List<ModuleEntity> modulelist = new List<ModuleEntity>();
  1019. List<string> offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList();
  1020. var moduledata = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress) && m.F_IsMenu == 1 && m.F_Target == "iframe" && !string.IsNullOrEmpty(m.F_ParentId));
  1021. foreach (var oitem in offenused)
  1022. {
  1023. ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem);
  1024. if (fod != null)
  1025. {
  1026. //找父级
  1027. if (fod.F_ParentId == "0")
  1028. {
  1029. fod.ParentName = fod.F_FullName;
  1030. fod.F_ParentId = fod.F_ModuleId;
  1031. }
  1032. else
  1033. {
  1034. var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId);
  1035. if (parent1 != null)
  1036. {
  1037. if (parent1.F_ParentId == "0")
  1038. {
  1039. fod.ParentName = parent1.F_FullName;
  1040. fod.F_ParentId = parent1.F_ModuleId;
  1041. }
  1042. else
  1043. {
  1044. //下一级
  1045. var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId);
  1046. if (parent2 != null)
  1047. {
  1048. if (parent2.F_ParentId == "0")
  1049. {
  1050. fod.ParentName = parent2.F_FullName;
  1051. fod.F_ParentId = parent2.F_ModuleId;
  1052. }
  1053. else
  1054. {
  1055. //下一级
  1056. var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId);
  1057. if (parent3 != null)
  1058. {
  1059. if (parent3.F_ParentId == "0")
  1060. {
  1061. fod.ParentName = parent3.F_FullName;
  1062. fod.F_ParentId = parent3.F_ModuleId;
  1063. }
  1064. else
  1065. {
  1066. //下一级
  1067. var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId);
  1068. if (parent4 != null)
  1069. {
  1070. if (parent4.F_ParentId == "0")
  1071. {
  1072. fod.ParentName = parent4.F_FullName;
  1073. fod.F_ParentId = parent4.F_ModuleId;
  1074. }
  1075. }
  1076. }
  1077. }
  1078. }
  1079. }
  1080. }
  1081. }
  1082. }
  1083. modulelist.Add(fod);
  1084. }
  1085. }
  1086. ViewBag.OffenusedAll = modulelist;
  1087. var mm = modulelist.GroupBy(x => x.F_ParentId).Select(x => new ModuleEntity()
  1088. {
  1089. F_ParentId = x.Key,
  1090. ParentName = x.FirstOrDefault().ParentName,
  1091. ChildrenList = x.Select(y => new ModuleEntity()
  1092. {
  1093. F_ModuleId = y.F_ModuleId,
  1094. F_FullName = y.F_FullName
  1095. }).ToList()
  1096. }).ToList();
  1097. ViewBag.OffenusedGroup = mm;
  1098. ViewBag.OffenusedGroupStr = JsonConvert.SerializeObject(ViewBag.OffenusedGroup);
  1099. //查找服务
  1100. List<ModuleEntity> searchmodulelist = new List<ModuleEntity>();
  1101. foreach (var item in moduledata)
  1102. {
  1103. if (moduleIBLL.GetColumnList(item.F_ModuleId).Any())
  1104. {
  1105. item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1);
  1106. searchmodulelist.Add(item);
  1107. }
  1108. }
  1109. ViewBag.SearchModule = searchmodulelist;
  1110. //校园总览
  1111. //专业
  1112. var majorData = cdMajorIBLL.GetAllList();
  1113. ViewBag.MajorTotalNum = majorData.Count();
  1114. //班级
  1115. var classInfoData = classInfoIBLL.GetAllClass();
  1116. ViewBag.ClassInfoTotalNum = classInfoData.Count();
  1117. //学生
  1118. var stuInfoData = stuInfoBasicIBLL.GetAllList();
  1119. ViewBag.StuInfoTotalNum = stuInfoData.Count();
  1120. //教师
  1121. var teacherData = empInfoIBLL.GetAllList();
  1122. ViewBag.TeacherTotalNum = teacherData.Count();
  1123. //教室
  1124. var classRoomData = classroomInfoIBLL.GetAllList();
  1125. ViewBag.ClassRoomTotalNum = classRoomData.Count();
  1126. //课程
  1127. var lessonData = lessonInfoIBLL.GetAllList();
  1128. ViewBag.LessonTotalNum = lessonData.Count();
  1129. //专业总览
  1130. //专业学生
  1131. var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new
  1132. {
  1133. value = x.Select(y => y.StuId).Count(),
  1134. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1135. });
  1136. ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor);
  1137. //流程
  1138. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  1139. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  1140. var allCount = 0;
  1141. foreach (var flow in flowType)
  1142. {
  1143. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1144. flow.FlowCount = count;
  1145. allCount += count;
  1146. }
  1147. ViewBag.AllCount = allCount;
  1148. ViewBag.FlowType = flowType;
  1149. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1150. //校园一卡通余额
  1151. ViewBag.StuSaveRecordTotalNum = 0;
  1152. var stuSaveRecordList = stuSaverecordIBLL.GetListByAccount(userInfo.account).OrderByDescending(x => x.UPLOADDATE);
  1153. if (stuSaveRecordList.Any())
  1154. {
  1155. ViewBag.StuSaveRecordTotalNum = stuSaveRecordList.FirstOrDefault().ODDFARE;
  1156. }
  1157. //红湖付款码余额
  1158. ViewBag.StuConsumptionTotalNum = 0;
  1159. var stuConsumptionList = stuConsumptionIBLL.GetListByAccount(userInfo.account);
  1160. if (stuConsumptionList.Any())
  1161. {
  1162. ViewBag.StuConsumptionTotalNum = stuConsumptionList.Select(x => x.OPFARE.ToDecimal()).Sum();
  1163. }
  1164. //常用链接
  1165. var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userInfo.userId);
  1166. var ff = userfunctionlist.GroupBy(x => x.FTName).Select(x => new Perm_FunctionEntity()
  1167. {
  1168. FTName = x.Key,
  1169. PFunctionList = x.Select(y => new Perm_FunctionEntity()
  1170. {
  1171. FId = y.FId,
  1172. FTId = y.FTId,
  1173. FName = y.FName,
  1174. UPId = DESEncrypt.Encrypt(y.FId, ConfigurationManager.AppSettings["SSOPublicSecret"]),//sysid
  1175. UserId = DESEncrypt.Encrypt(userInfo.userId, ConfigurationManager.AppSettings["SSOPublicSecret"])//openid
  1176. }).Take(8).ToList()
  1177. });
  1178. ViewBag.FunctionList = ff;
  1179. ViewBag.FunctionListStr = JsonConvert.SerializeObject(ViewBag.FunctionList);
  1180. return View();
  1181. }
  1182. /// <summary>
  1183. /// 网上办事大厅拖拽版-效率优先模式
  1184. /// </summary>
  1185. /// <returns></returns>
  1186. public ActionResult DragModelTwo()
  1187. {
  1188. //判断登录状态码
  1189. string account = "";
  1190. if (!Request.Headers["account"].IsEmpty())
  1191. {
  1192. account = Request.Headers["account"].ToString();
  1193. }
  1194. OperatorHelper helper = new OperatorHelper();
  1195. var result = helper.IsOnLine(account);
  1196. if (result.stateCode != 1)
  1197. {
  1198. return Redirect("NoLogin");
  1199. }
  1200. //登录用户
  1201. var userInfo = LoginUserInfo.Get();
  1202. ViewBag.UserId = userInfo.userId;
  1203. //桌面管理表、卡片块排序管理表增加默认数据
  1204. sSO_Drag_DesktopManageIBLL.AddDefaultData(userInfo.userId, "two");
  1205. //获取桌面、卡片块排序列表
  1206. ViewBag.DesktopList = sSO_Drag_DesktopManageIBLL.GetListByModelCode(userInfo.userId, "two").OrderByDescending(x => x.DefaultFlag).ThenBy(x => x.Sort).ThenBy(x => x.CreateDate);
  1207. ViewBag.DesktopListStr = JsonConvert.SerializeObject(ViewBag.DesktopList);
  1208. //分页查询条件设置
  1209. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  1210. //邮件-收件箱
  1211. var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  1212. var maildataAll = sYS_ReceiveMessageIBLL.GetList("{\"userId\":\"" + userInfo.userId + "\"}");
  1213. ViewBag.LanMail = maildata;
  1214. ViewBag.LanMailStr = JsonConvert.SerializeObject(ViewBag.LanMail);
  1215. ViewBag.LanMailUnReadCount = maildataAll.Count(m => m.READFLAG == 0);
  1216. //邮件-已发送
  1217. paginationobj.sidx = "SENDTIME desc";
  1218. var mailsenddata = sYS_SendMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  1219. var mailsenddataAll = sYS_SendMessageIBLL.GetList2("{\"userId\":\"" + userInfo.userId + "\"}");
  1220. ViewBag.LanMailSend = mailsenddata;
  1221. ViewBag.LanMailSendStr = JsonConvert.SerializeObject(ViewBag.LanMailSend);
  1222. //来往邮件数量
  1223. ViewBag.LanMailTotalNum = maildataAll.Count() + mailsenddataAll.Count();
  1224. //公文
  1225. paginationobj.sidx = "SendTime";
  1226. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userInfo.userId + "\"}");
  1227. ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList);
  1228. //公告
  1229. List<NewsEntity> outnewslist = new List<NewsEntity>();
  1230. var newsList = newsIBLL.GetList("", userInfo.userId);
  1231. foreach (var newsitemEntity in newsList)
  1232. {
  1233. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  1234. {
  1235. if (!string.IsNullOrEmpty(userInfo.postIds))
  1236. {
  1237. if (userInfo.postIds.Contains(","))
  1238. {
  1239. foreach (var postid in userInfo.postIds.Split(','))
  1240. {
  1241. if (newsitemEntity.F_SendPostId.Contains(postid))
  1242. {
  1243. outnewslist.Add(newsitemEntity);
  1244. break;
  1245. }
  1246. }
  1247. }
  1248. else
  1249. {
  1250. if (newsitemEntity.F_SendPostId.Contains(userInfo.postIds))
  1251. {
  1252. outnewslist.Add(newsitemEntity);
  1253. }
  1254. }
  1255. }
  1256. }
  1257. else
  1258. {
  1259. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  1260. {
  1261. if (newsitemEntity.F_SendDeptId.Contains(userInfo.departmentId))
  1262. {
  1263. outnewslist.Add(newsitemEntity);
  1264. }
  1265. }
  1266. else
  1267. {
  1268. outnewslist.Add(newsitemEntity);
  1269. }
  1270. }
  1271. }
  1272. ViewBag.NewsList = outnewslist.Take(5);
  1273. ViewBag.NewsListStr = JsonConvert.SerializeObject(ViewBag.NewsList);
  1274. //宣传报道
  1275. var newsListOfxuanchuan = outnewslist.Where(x => x.F_CategoryId == "15").Take(4);
  1276. foreach (var item in newsListOfxuanchuan)
  1277. {
  1278. if (!string.IsNullOrEmpty(item.F_NewsImage))
  1279. {
  1280. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  1281. if (!string.IsNullOrEmpty(imagePath))
  1282. {
  1283. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  1284. }
  1285. else
  1286. {
  1287. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  1288. }
  1289. }
  1290. }
  1291. ViewBag.NewsListOfxuanchuan = newsListOfxuanchuan;
  1292. ViewBag.NewsListOfxuanchuanStr = JsonConvert.SerializeObject(ViewBag.NewsListOfxuanchuan);
  1293. //智慧教育
  1294. ViewBag.NewsListOfzhihui = outnewslist.Where(x => x.F_CategoryId == "16").Take(6);
  1295. ViewBag.NewsListOfzhihuiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhihui);
  1296. //专题推荐
  1297. var newsListOfzhuanti = outnewslist.Where(x => x.F_CategoryId == "17").Take(7);
  1298. foreach (var item in newsListOfzhuanti)
  1299. {
  1300. if (!string.IsNullOrEmpty(item.F_NewsImage))
  1301. {
  1302. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  1303. if (!string.IsNullOrEmpty(imagePath))
  1304. {
  1305. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  1306. }
  1307. else
  1308. {
  1309. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  1310. }
  1311. }
  1312. }
  1313. ViewBag.NewsListOfzhuanti = newsListOfzhuanti;
  1314. ViewBag.NewsListOfzhuantiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhuanti);
  1315. //办公事项-待办任务
  1316. paginationobj.sidx = "F_CreateDate";
  1317. paginationobj.rows = 4;
  1318. var taskListAll = nWFProcessIBLL.GetMyTaskPageList(userInfo, "{}");
  1319. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userInfo, paginationobj, "{}");
  1320. ViewBag.TaskListStr = JsonConvert.SerializeObject(ViewBag.TaskList);
  1321. ViewBag.TaskTotalNum = taskListAll.Count();
  1322. //办公事项-已办任务
  1323. var finishTaskListAll = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, "{}");
  1324. ViewBag.FinishTaskList = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, paginationobj, "{}");
  1325. ViewBag.FinishTaskListStr = JsonConvert.SerializeObject(ViewBag.FinishTaskList);
  1326. ViewBag.FinishTaskTotalNum = finishTaskListAll.Count();
  1327. //办公事项-我发起的
  1328. var myListAll = nWFProcessIBLL.GetMyPageList(userInfo.userId, "{}");
  1329. ViewBag.MyList = nWFProcessIBLL.GetMyPageList(userInfo.userId, paginationobj, "{}");
  1330. ViewBag.MyListStr = JsonConvert.SerializeObject(ViewBag.MyList);
  1331. ViewBag.MyListTotalNum = myListAll.Count();
  1332. //常用服务
  1333. List<ModuleEntity> modulelist = new List<ModuleEntity>();
  1334. List<string> offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList();
  1335. var moduledata = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress) && m.F_IsMenu == 1 && m.F_Target == "iframe" && !string.IsNullOrEmpty(m.F_ParentId));
  1336. foreach (var oitem in offenused)
  1337. {
  1338. ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem);
  1339. if (fod != null)
  1340. {
  1341. //找父级
  1342. if (fod.F_ParentId == "0")
  1343. {
  1344. fod.ParentName = fod.F_FullName;
  1345. fod.F_ParentId = fod.F_ModuleId;
  1346. }
  1347. else
  1348. {
  1349. var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId);
  1350. if (parent1 != null)
  1351. {
  1352. if (parent1.F_ParentId == "0")
  1353. {
  1354. fod.ParentName = parent1.F_FullName;
  1355. fod.F_ParentId = parent1.F_ModuleId;
  1356. }
  1357. else
  1358. {
  1359. //下一级
  1360. var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId);
  1361. if (parent2 != null)
  1362. {
  1363. if (parent2.F_ParentId == "0")
  1364. {
  1365. fod.ParentName = parent2.F_FullName;
  1366. fod.F_ParentId = parent2.F_ModuleId;
  1367. }
  1368. else
  1369. {
  1370. //下一级
  1371. var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId);
  1372. if (parent3 != null)
  1373. {
  1374. if (parent3.F_ParentId == "0")
  1375. {
  1376. fod.ParentName = parent3.F_FullName;
  1377. fod.F_ParentId = parent3.F_ModuleId;
  1378. }
  1379. else
  1380. {
  1381. //下一级
  1382. var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId);
  1383. if (parent4 != null)
  1384. {
  1385. if (parent4.F_ParentId == "0")
  1386. {
  1387. fod.ParentName = parent4.F_FullName;
  1388. fod.F_ParentId = parent4.F_ModuleId;
  1389. }
  1390. }
  1391. }
  1392. }
  1393. }
  1394. }
  1395. }
  1396. }
  1397. }
  1398. modulelist.Add(fod);
  1399. }
  1400. }
  1401. ViewBag.OffenusedAll = modulelist;
  1402. var mm = modulelist.GroupBy(x => x.F_ParentId).Select(x => new ModuleEntity()
  1403. {
  1404. F_ParentId = x.Key,
  1405. ParentName = x.FirstOrDefault().ParentName,
  1406. ChildrenList = x.Select(y => new ModuleEntity()
  1407. {
  1408. F_ModuleId = y.F_ModuleId,
  1409. F_FullName = y.F_FullName
  1410. }).ToList()
  1411. }).ToList();
  1412. ViewBag.OffenusedGroup = mm;
  1413. ViewBag.OffenusedGroupStr = JsonConvert.SerializeObject(ViewBag.OffenusedGroup);
  1414. //todo:
  1415. //删begin
  1416. ViewBag.OffenusedJiao = modulelist.Where(x => x.F_FullName.Contains("教"));
  1417. ViewBag.OffenusedGuan = modulelist.Where(x => x.F_FullName.Contains("管理"));
  1418. ViewBag.Offenused = modulelist.Except(modulelist.Where(x => x.F_FullName.Contains("教") || x.F_FullName.Contains("管理"))).Take(6);
  1419. ViewBag.OffenusedJiaoStr = JsonConvert.SerializeObject(ViewBag.OffenusedJiao);
  1420. ViewBag.OffenusedGuanStr = JsonConvert.SerializeObject(ViewBag.OffenusedGuan);
  1421. ViewBag.OffenusedStr = JsonConvert.SerializeObject(ViewBag.Offenused);
  1422. //删end
  1423. //查找服务
  1424. List<ModuleEntity> searchmodulelist = new List<ModuleEntity>();
  1425. foreach (var item in moduledata)
  1426. {
  1427. if (moduleIBLL.GetColumnList(item.F_ModuleId).Any())
  1428. {
  1429. item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1);
  1430. searchmodulelist.Add(item);
  1431. }
  1432. }
  1433. ViewBag.SearchModule = searchmodulelist;
  1434. //校园总览
  1435. //专业
  1436. var majorData = cdMajorIBLL.GetAllList();
  1437. ViewBag.MajorTotalNum = majorData.Count();
  1438. //班级
  1439. var classInfoData = classInfoIBLL.GetAllClass();
  1440. ViewBag.ClassInfoTotalNum = classInfoData.Count();
  1441. //学生
  1442. var stuInfoData = stuInfoBasicIBLL.GetAllList();
  1443. ViewBag.StuInfoTotalNum = stuInfoData.Count();
  1444. //教师
  1445. var teacherData = empInfoIBLL.GetAllList();
  1446. ViewBag.TeacherTotalNum = teacherData.Count();
  1447. //教室
  1448. var classRoomData = classroomInfoIBLL.GetAllList();
  1449. ViewBag.ClassRoomTotalNum = classRoomData.Count();
  1450. //课程
  1451. var lessonData = lessonInfoIBLL.GetAllList();
  1452. ViewBag.LessonTotalNum = lessonData.Count();
  1453. //专业总览
  1454. //专业学生
  1455. var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new
  1456. {
  1457. value = x.Select(y => y.StuId).Count(),
  1458. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1459. });
  1460. ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor);
  1461. //流程
  1462. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  1463. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  1464. var allCount = 0;
  1465. foreach (var flow in flowType)
  1466. {
  1467. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1468. flow.FlowCount = count;
  1469. allCount += count;
  1470. }
  1471. ViewBag.AllCount = allCount;
  1472. ViewBag.FlowType = flowType;
  1473. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1474. //校园一卡通余额
  1475. ViewBag.StuSaveRecordTotalNum = 0;
  1476. var stuSaveRecordList = stuSaverecordIBLL.GetListByAccount(userInfo.account).OrderByDescending(x => x.UPLOADDATE);
  1477. if (stuSaveRecordList.Any())
  1478. {
  1479. ViewBag.StuSaveRecordTotalNum = stuSaveRecordList.FirstOrDefault().ODDFARE;
  1480. }
  1481. //红湖付款码余额
  1482. ViewBag.StuConsumptionTotalNum = 0;
  1483. var stuConsumptionList = stuConsumptionIBLL.GetListByAccount(userInfo.account);
  1484. if (stuConsumptionList.Any())
  1485. {
  1486. ViewBag.StuConsumptionTotalNum = stuConsumptionList.Select(x => x.OPFARE.ToDecimal()).Sum();
  1487. }
  1488. //常用链接
  1489. var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userInfo.userId);
  1490. var ff = userfunctionlist.GroupBy(x => x.FTName).Select(x => new Perm_FunctionEntity()
  1491. {
  1492. FTName = x.Key,
  1493. PFunctionList = x.Select(y => new Perm_FunctionEntity()
  1494. {
  1495. FId = y.FId,
  1496. FTId = y.FTId,
  1497. FName = y.FName,
  1498. UPId = DESEncrypt.Encrypt(y.FId, ConfigurationManager.AppSettings["SSOPublicSecret"]),//sysid
  1499. UserId = DESEncrypt.Encrypt(userInfo.userId, ConfigurationManager.AppSettings["SSOPublicSecret"])//openid
  1500. }).Take(8).ToList()
  1501. });
  1502. ViewBag.FunctionList = ff;
  1503. ViewBag.FunctionListStr = JsonConvert.SerializeObject(ViewBag.FunctionList);
  1504. return View();
  1505. }
  1506. /// <summary>
  1507. /// 网上办事大厅拖拽版-管理驾驶舱模式
  1508. /// </summary>
  1509. /// <returns></returns>
  1510. public ActionResult DragModelThree()
  1511. {
  1512. //判断登录状态码
  1513. string account = "";
  1514. if (!Request.Headers["account"].IsEmpty())
  1515. {
  1516. account = Request.Headers["account"].ToString();
  1517. }
  1518. OperatorHelper helper = new OperatorHelper();
  1519. var result = helper.IsOnLine(account);
  1520. if (result.stateCode != 1)
  1521. {
  1522. return Redirect("NoLogin");
  1523. }
  1524. //登录用户
  1525. var userInfo = LoginUserInfo.Get();
  1526. ViewBag.UserId = userInfo.userId;
  1527. //校园总览
  1528. //专业
  1529. var majorData = cdMajorIBLL.GetAllList();
  1530. ViewBag.MajorTotalNum = majorData.Count();
  1531. //班级
  1532. var classInfoData = classInfoIBLL.GetAllClass();
  1533. ViewBag.ClassInfoTotalNum = classInfoData.Count();
  1534. //学生
  1535. var stuInfoData = stuInfoBasicIBLL.GetAllList();
  1536. ViewBag.StuInfoTotalNum = stuInfoData.Count();
  1537. ViewBag.StuInfoTotalNumOfMan = stuInfoData.Where(x => x.GenderNo == true).Count();
  1538. //教师
  1539. var teacherData = empInfoIBLL.GetAllList();
  1540. ViewBag.TeacherTotalNum = teacherData.Count();
  1541. ViewBag.TeacherTotalNumOfMan = teacherData.Where(x => x.GenderNo == true).Count();
  1542. ViewBag.TeacherTotalNumOfBianNei = teacherData.Where(x => x.CompilationCategory == "01").Count();
  1543. //教室
  1544. var classRoomData = classroomInfoIBLL.GetAllList();
  1545. ViewBag.ClassRoomTotalNum = classRoomData.Count();
  1546. //专业总览
  1547. //专业学生
  1548. var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new
  1549. {
  1550. value = x.Select(y => y.StuId).Count(),
  1551. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1552. });
  1553. ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor);
  1554. //流程
  1555. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  1556. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  1557. var allCount = 0;
  1558. foreach (var flow in flowType)
  1559. {
  1560. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1561. flow.FlowCount = count;
  1562. allCount += count;
  1563. }
  1564. ViewBag.AllCount = allCount;
  1565. ViewBag.FlowType = flowType;
  1566. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1567. //课程总览
  1568. var lessonInfoData = lessonInfoIBLL.GetAllList();
  1569. ViewBag.LessonTotalNum = lessonInfoData.Count();
  1570. ViewBag.OpenLessonTotalNum = lessonInfoData.Where(x => x.CheckMark == true).Count();
  1571. //课程分类下的课程
  1572. var lessonBySort = lessonInfoData.GroupBy(x => x.LessonSortNo).Select(x => new
  1573. {
  1574. value = x.Select(y => y.LessonId).Count(),
  1575. name = cdLessonSortIBLL.GetCdLessonSortEntityByNo(x.Key)?.LessonSortName
  1576. });
  1577. ViewBag.LessonBySortStr = JsonConvert.SerializeObject(lessonBySort);
  1578. //课程类型下的课程
  1579. var lessonByType = lessonInfoData.GroupBy(x => x.LessonTypeId).Select(x => new
  1580. {
  1581. value = x.Select(y => y.LessonId).Count(),
  1582. name = cdLessonTypeIBLL.GetCdLessonTypeEntity(x.Key)?.LessonTypeName
  1583. });
  1584. ViewBag.LessonByTypeStr = JsonConvert.SerializeObject(lessonByType);
  1585. //教师总览
  1586. //教师学历比例
  1587. var teacherByHighestRecord = teacherData.Where(x => !string.IsNullOrEmpty(x.HighestRecord)).GroupBy(x => x.HighestRecord).Select(x => new
  1588. {
  1589. value = x.Select(y => y.EmpId).Count(),
  1590. name = bCdCultureDegreeIBLL.GetEntity(x.Key)?.CultureDegree
  1591. }).OrderByDescending(x => x.value);
  1592. ViewBag.TeacherByHighestRecordStr = JsonConvert.SerializeObject(teacherByHighestRecord);
  1593. //教师年龄比例
  1594. var empInfoAgeRate = empInfoIBLL.GetEmpInfoAgeRate();
  1595. var teacherByAge = new List<object>() {
  1596. new { value = empInfoAgeRate.age1, name = "60岁以上" },
  1597. new { value = empInfoAgeRate.age2, name = "50~60岁" },
  1598. new { value = empInfoAgeRate.age3, name = "40~50岁" },
  1599. new { value = empInfoAgeRate.age4, name = "30~40岁" },
  1600. new { value = empInfoAgeRate.age5, name = "20~30岁" },
  1601. };
  1602. ViewBag.TeacherByAgeStr = JsonConvert.SerializeObject(teacherByAge);
  1603. //学生总览
  1604. //学生成绩预警
  1605. var stuScoreData = stuScoreNotPassIBLL.GetList("{}").Where(x => x.Score == 0).Select(x => new { x.StuNo, x.MajorNo }).Distinct();
  1606. ViewBag.StuScoreWarnTotalNum = stuScoreData.Count();
  1607. var stuScoreByMajor = stuScoreData.GroupBy(x => x.MajorNo).Select(x => new
  1608. {
  1609. value = x.Select(y => y.StuNo).Count(),
  1610. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1611. });
  1612. ViewBag.StuScoreByMajorStr = JsonConvert.SerializeObject(stuScoreByMajor);
  1613. //常用服务
  1614. List<ModuleEntity> modulelist = new List<ModuleEntity>();
  1615. List<string> offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList();
  1616. var moduledata = moduleIBLL.GetModuleList().Where(m => m.F_EnabledMark == 1 && m.F_DeleteMark == 0 && !string.IsNullOrEmpty(m.F_UrlAddress) && m.F_IsMenu == 1 && m.F_Target == "iframe" && !string.IsNullOrEmpty(m.F_ParentId));
  1617. foreach (var oitem in offenused)
  1618. {
  1619. ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem);
  1620. if (fod != null)
  1621. {
  1622. //找父级
  1623. if (fod.F_ParentId == "0")
  1624. {
  1625. fod.ParentName = fod.F_FullName;
  1626. fod.F_ParentId = fod.F_ModuleId;
  1627. }
  1628. else
  1629. {
  1630. var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId);
  1631. if (parent1 != null)
  1632. {
  1633. if (parent1.F_ParentId == "0")
  1634. {
  1635. fod.ParentName = parent1.F_FullName;
  1636. fod.F_ParentId = parent1.F_ModuleId;
  1637. }
  1638. else
  1639. {
  1640. //下一级
  1641. var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId);
  1642. if (parent2 != null)
  1643. {
  1644. if (parent2.F_ParentId == "0")
  1645. {
  1646. fod.ParentName = parent2.F_FullName;
  1647. fod.F_ParentId = parent2.F_ModuleId;
  1648. }
  1649. else
  1650. {
  1651. //下一级
  1652. var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId);
  1653. if (parent3 != null)
  1654. {
  1655. if (parent3.F_ParentId == "0")
  1656. {
  1657. fod.ParentName = parent3.F_FullName;
  1658. fod.F_ParentId = parent3.F_ModuleId;
  1659. }
  1660. else
  1661. {
  1662. //下一级
  1663. var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId);
  1664. if (parent4 != null)
  1665. {
  1666. if (parent4.F_ParentId == "0")
  1667. {
  1668. fod.ParentName = parent4.F_FullName;
  1669. fod.F_ParentId = parent4.F_ModuleId;
  1670. }
  1671. }
  1672. }
  1673. }
  1674. }
  1675. }
  1676. }
  1677. }
  1678. }
  1679. modulelist.Add(fod);
  1680. }
  1681. }
  1682. ViewBag.OffenusedAll = modulelist;
  1683. //查找服务
  1684. List<ModuleEntity> searchmodulelist = new List<ModuleEntity>();
  1685. foreach (var item in moduledata)
  1686. {
  1687. if (moduleIBLL.GetColumnList(item.F_ModuleId).Any())
  1688. {
  1689. item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1);
  1690. searchmodulelist.Add(item);
  1691. }
  1692. }
  1693. ViewBag.SearchModule = searchmodulelist;
  1694. return View();
  1695. }
  1696. /// <summary>
  1697. /// 网上办事大厅拖拽版-保存卡片块排序
  1698. /// </summary>
  1699. /// <returns></returns>
  1700. public ActionResult SaveCardSort(string userId, string modelCode, string desktopId, string cardSort)
  1701. {
  1702. sSO_Drag_CardSortManageIBLL.SaveCardSort(userId, modelCode, desktopId, cardSort);
  1703. return Success("操作成功");
  1704. }
  1705. /// <summary>
  1706. /// 网上办事大厅拖拽版-新增桌面
  1707. /// </summary>
  1708. /// <returns></returns>
  1709. public ActionResult AddDesktop(string userId, string modelCode, string desktopName, string desktopCode)
  1710. {
  1711. sSO_Drag_DesktopManageIBLL.AddDesktop(userId, modelCode, desktopName, desktopCode);
  1712. var data = sSO_Drag_DesktopManageIBLL.GetEntityByDesktopCode(userId, modelCode, desktopCode);
  1713. return Success("操作成功", data);
  1714. }
  1715. /// <summary>
  1716. /// 网上办事大厅拖拽版-删除桌面
  1717. /// </summary>
  1718. /// <returns></returns>
  1719. public ActionResult DeleteDesktop(string desktopId)
  1720. {
  1721. sSO_Drag_DesktopManageIBLL.DeleteEntity(desktopId);
  1722. return Success("操作成功");
  1723. }
  1724. /// <summary>
  1725. /// 网上办事大厅拖拽版-修改桌面
  1726. /// </summary>
  1727. /// <returns></returns>
  1728. public ActionResult ModifyDesktop(string desktopId, string desktopName)
  1729. {
  1730. var entity = new SSO_Drag_DesktopManageEntity()
  1731. {
  1732. DesktopName = desktopName
  1733. };
  1734. sSO_Drag_DesktopManageIBLL.SaveEntity(desktopId, entity);
  1735. return Success("操作成功");
  1736. }
  1737. /// <summary>
  1738. /// 网上办事大厅拖拽版-默认桌面恢复默认设置
  1739. /// </summary>
  1740. /// <returns></returns>
  1741. public ActionResult RestoreDefaultDesktop(string desktopId)
  1742. {
  1743. sSO_Drag_DesktopManageIBLL.RestoreDefaultDesktop(desktopId);
  1744. return Success("操作成功");
  1745. }
  1746. }
  1747. }