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.
 
 
 
 
 
 

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