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

1842 rindas
86 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 MealCardRunTabIBLL mealCardRunTabIBLL = new MealCardRunTabBLL();
  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 NoLogin()
  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("DragNoLogin");
  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("NoLogin");
  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();
  1141. var allCount = 0;
  1142. foreach (var flow in flowType)
  1143. {
  1144. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1145. flow.FlowCount = count;
  1146. allCount += count;
  1147. }
  1148. ViewBag.AllCount = allCount;
  1149. ViewBag.FlowType = flowType;
  1150. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1151. var card = "";
  1152. if (userInfo.Description == "学生")
  1153. {
  1154. card = stuInfoData.Where(x => x.StuNo == userInfo.account).Select(x => x.IdentityCardNo).FirstOrDefault();
  1155. }
  1156. else if (userInfo.Description == "教师")
  1157. {
  1158. card = teacherData.Where(x => x.EmpNo == userInfo.account).Select(x => x.IdentityCardNo).FirstOrDefault();
  1159. }
  1160. //校园一卡通余额
  1161. ViewBag.StuSaveRecordTotalNum = 0;
  1162. //红湖付款码余额
  1163. ViewBag.StuConsumptionTotalNum = 0;
  1164. if (!string.IsNullOrEmpty(card))
  1165. {
  1166. var mealCardRunTabList = mealCardRunTabIBLL.GetListByAccount(card).OrderByDescending(x => x.centralTm);
  1167. if (mealCardRunTabList.Any())
  1168. {
  1169. ViewBag.StuSaveRecordTotalNum = mealCardRunTabList.FirstOrDefault().balance;
  1170. }
  1171. var mealCardRunTabListJY = mealCardRunTabIBLL.GetListByAccount(card);
  1172. if (mealCardRunTabListJY.Any())
  1173. {
  1174. ViewBag.StuConsumptionTotalNum = Math.Abs(mealCardRunTabListJY.Select(x => x.flowamount).Sum());
  1175. }
  1176. }
  1177. //常用链接
  1178. var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userInfo.userId);
  1179. var ff = userfunctionlist.GroupBy(x => x.FTName).Select(x => new Perm_FunctionEntity()
  1180. {
  1181. FTName = x.Key,
  1182. PFunctionList = x.Select(y => new Perm_FunctionEntity()
  1183. {
  1184. FId = y.FId,
  1185. FTId = y.FTId,
  1186. FName = y.FName,
  1187. UPId = DESEncrypt.Encrypt(y.FId, ConfigurationManager.AppSettings["SSOPublicSecret"]),//sysid
  1188. UserId = DESEncrypt.Encrypt(userInfo.userId, ConfigurationManager.AppSettings["SSOPublicSecret"])//openid
  1189. }).Take(8).ToList()
  1190. });
  1191. ViewBag.FunctionList = ff;
  1192. ViewBag.FunctionListStr = JsonConvert.SerializeObject(ViewBag.FunctionList);
  1193. return View();
  1194. }
  1195. /// <summary>
  1196. /// 网上办事大厅拖拽版-效率优先模式
  1197. /// </summary>
  1198. /// <returns></returns>
  1199. public ActionResult DragModelTwo()
  1200. {
  1201. //判断登录状态码
  1202. string account = "";
  1203. if (!Request.Headers["account"].IsEmpty())
  1204. {
  1205. account = Request.Headers["account"].ToString();
  1206. }
  1207. OperatorHelper helper = new OperatorHelper();
  1208. var result = helper.IsOnLine(account);
  1209. if (result.stateCode != 1)
  1210. {
  1211. return Redirect("NoLogin");
  1212. }
  1213. //登录用户
  1214. var userInfo = LoginUserInfo.Get();
  1215. ViewBag.UserId = userInfo.userId;
  1216. //桌面管理表、卡片块排序管理表增加默认数据
  1217. sSO_Drag_DesktopManageIBLL.AddDefaultData(userInfo.userId, "two");
  1218. //获取桌面、卡片块排序列表
  1219. ViewBag.DesktopList = sSO_Drag_DesktopManageIBLL.GetListByModelCode(userInfo.userId, "two").OrderByDescending(x => x.DefaultFlag).ThenBy(x => x.Sort).ThenBy(x => x.CreateDate);
  1220. ViewBag.DesktopListStr = JsonConvert.SerializeObject(ViewBag.DesktopList);
  1221. //分页查询条件设置
  1222. Pagination paginationobj = new Pagination() { rows = 5, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
  1223. //邮件-收件箱
  1224. var maildata = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  1225. var maildataAll = sYS_ReceiveMessageIBLL.GetList("{\"userId\":\"" + userInfo.userId + "\"}");
  1226. ViewBag.LanMail = maildata;
  1227. ViewBag.LanMailStr = JsonConvert.SerializeObject(ViewBag.LanMail);
  1228. ViewBag.LanMailUnReadCount = maildataAll.Count(m => m.READFLAG == 0);
  1229. //邮件-已发送
  1230. paginationobj.sidx = "SENDTIME desc";
  1231. var mailsenddata = sYS_SendMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userInfo.userId + "\"}");
  1232. var mailsenddataAll = sYS_SendMessageIBLL.GetList2("{\"userId\":\"" + userInfo.userId + "\"}");
  1233. ViewBag.LanMailSend = mailsenddata;
  1234. ViewBag.LanMailSendStr = JsonConvert.SerializeObject(ViewBag.LanMailSend);
  1235. //来往邮件数量
  1236. ViewBag.LanMailTotalNum = maildataAll.Count() + mailsenddataAll.Count();
  1237. //公文
  1238. paginationobj.sidx = "SendTime";
  1239. ViewBag.ReceiveFileList = sys_ReceiveFileIBLL.GetPageList(paginationobj, "{\"ReceiverId\":\"" + userInfo.userId + "\"}");
  1240. ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList);
  1241. //公告
  1242. List<NewsEntity> outnewslist = new List<NewsEntity>();
  1243. var newsList = newsIBLL.GetList("", userInfo.userId);
  1244. foreach (var newsitemEntity in newsList)
  1245. {
  1246. if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
  1247. {
  1248. if (!string.IsNullOrEmpty(userInfo.postIds))
  1249. {
  1250. if (userInfo.postIds.Contains(","))
  1251. {
  1252. foreach (var postid in userInfo.postIds.Split(','))
  1253. {
  1254. if (newsitemEntity.F_SendPostId.Contains(postid))
  1255. {
  1256. outnewslist.Add(newsitemEntity);
  1257. break;
  1258. }
  1259. }
  1260. }
  1261. else
  1262. {
  1263. if (newsitemEntity.F_SendPostId.Contains(userInfo.postIds))
  1264. {
  1265. outnewslist.Add(newsitemEntity);
  1266. }
  1267. }
  1268. }
  1269. }
  1270. else
  1271. {
  1272. if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
  1273. {
  1274. if (newsitemEntity.F_SendDeptId.Contains(userInfo.departmentId))
  1275. {
  1276. outnewslist.Add(newsitemEntity);
  1277. }
  1278. }
  1279. else
  1280. {
  1281. outnewslist.Add(newsitemEntity);
  1282. }
  1283. }
  1284. }
  1285. ViewBag.NewsList = outnewslist.Take(5);
  1286. ViewBag.NewsListStr = JsonConvert.SerializeObject(ViewBag.NewsList);
  1287. //宣传报道
  1288. var newsListOfxuanchuan = outnewslist.Where(x => x.F_CategoryId == "15").Take(4);
  1289. foreach (var item in newsListOfxuanchuan)
  1290. {
  1291. if (!string.IsNullOrEmpty(item.F_NewsImage))
  1292. {
  1293. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  1294. if (!string.IsNullOrEmpty(imagePath))
  1295. {
  1296. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  1297. }
  1298. else
  1299. {
  1300. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  1301. }
  1302. }
  1303. }
  1304. ViewBag.NewsListOfxuanchuan = newsListOfxuanchuan;
  1305. ViewBag.NewsListOfxuanchuanStr = JsonConvert.SerializeObject(ViewBag.NewsListOfxuanchuan);
  1306. //智慧教育
  1307. ViewBag.NewsListOfzhihui = outnewslist.Where(x => x.F_CategoryId == "16").Take(6);
  1308. ViewBag.NewsListOfzhihuiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhihui);
  1309. //专题推荐
  1310. var newsListOfzhuanti = outnewslist.Where(x => x.F_CategoryId == "17").Take(7);
  1311. foreach (var item in newsListOfzhuanti)
  1312. {
  1313. if (!string.IsNullOrEmpty(item.F_NewsImage))
  1314. {
  1315. var imagePath = annexesFileIBLL.GetEntityByFolderId(item.F_NewsImage)?.F_FilePath;
  1316. if (!string.IsNullOrEmpty(imagePath))
  1317. {
  1318. item.F_NewsImage = imagePath.Substring(imagePath.IndexOf("Resource"));
  1319. }
  1320. else
  1321. {
  1322. item.F_NewsImage = "/Content/images/DragSSO/noLogin.png";
  1323. }
  1324. }
  1325. }
  1326. ViewBag.NewsListOfzhuanti = newsListOfzhuanti;
  1327. ViewBag.NewsListOfzhuantiStr = JsonConvert.SerializeObject(ViewBag.NewsListOfzhuanti);
  1328. //办公事项-待办任务
  1329. paginationobj.sidx = "F_CreateDate";
  1330. paginationobj.rows = 4;
  1331. var taskListAll = nWFProcessIBLL.GetMyTaskPageList(userInfo, "{}");
  1332. ViewBag.TaskList = nWFProcessIBLL.GetMyTaskPageList(userInfo, paginationobj, "{}");
  1333. ViewBag.TaskListStr = JsonConvert.SerializeObject(ViewBag.TaskList);
  1334. ViewBag.TaskTotalNum = taskListAll.Count();
  1335. //办公事项-已办任务
  1336. var finishTaskListAll = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, "{}");
  1337. ViewBag.FinishTaskList = nWFProcessIBLL.GetMyFinishTaskPageList(userInfo, paginationobj, "{}");
  1338. ViewBag.FinishTaskListStr = JsonConvert.SerializeObject(ViewBag.FinishTaskList);
  1339. ViewBag.FinishTaskTotalNum = finishTaskListAll.Count();
  1340. //办公事项-我发起的
  1341. var myListAll = nWFProcessIBLL.GetMyPageList(userInfo.userId, "{}");
  1342. ViewBag.MyList = nWFProcessIBLL.GetMyPageList(userInfo.userId, paginationobj, "{}");
  1343. ViewBag.MyListStr = JsonConvert.SerializeObject(ViewBag.MyList);
  1344. ViewBag.MyListTotalNum = myListAll.Count();
  1345. //常用服务
  1346. List<ModuleEntity> modulelist = new List<ModuleEntity>();
  1347. List<string> offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList();
  1348. 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));
  1349. foreach (var oitem in offenused)
  1350. {
  1351. ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem);
  1352. if (fod != null)
  1353. {
  1354. //找父级
  1355. if (fod.F_ParentId == "0")
  1356. {
  1357. fod.ParentName = fod.F_FullName;
  1358. fod.F_ParentId = fod.F_ModuleId;
  1359. }
  1360. else
  1361. {
  1362. var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId);
  1363. if (parent1 != null)
  1364. {
  1365. if (parent1.F_ParentId == "0")
  1366. {
  1367. fod.ParentName = parent1.F_FullName;
  1368. fod.F_ParentId = parent1.F_ModuleId;
  1369. }
  1370. else
  1371. {
  1372. //下一级
  1373. var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId);
  1374. if (parent2 != null)
  1375. {
  1376. if (parent2.F_ParentId == "0")
  1377. {
  1378. fod.ParentName = parent2.F_FullName;
  1379. fod.F_ParentId = parent2.F_ModuleId;
  1380. }
  1381. else
  1382. {
  1383. //下一级
  1384. var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId);
  1385. if (parent3 != null)
  1386. {
  1387. if (parent3.F_ParentId == "0")
  1388. {
  1389. fod.ParentName = parent3.F_FullName;
  1390. fod.F_ParentId = parent3.F_ModuleId;
  1391. }
  1392. else
  1393. {
  1394. //下一级
  1395. var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId);
  1396. if (parent4 != null)
  1397. {
  1398. if (parent4.F_ParentId == "0")
  1399. {
  1400. fod.ParentName = parent4.F_FullName;
  1401. fod.F_ParentId = parent4.F_ModuleId;
  1402. }
  1403. }
  1404. }
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. }
  1411. modulelist.Add(fod);
  1412. }
  1413. }
  1414. ViewBag.OffenusedAll = modulelist;
  1415. var mm = modulelist.GroupBy(x => x.F_ParentId).Select(x => new ModuleEntity()
  1416. {
  1417. F_ParentId = x.Key,
  1418. ParentName = x.FirstOrDefault().ParentName,
  1419. ChildrenList = x.Select(y => new ModuleEntity()
  1420. {
  1421. F_ModuleId = y.F_ModuleId,
  1422. F_FullName = y.F_FullName
  1423. }).ToList()
  1424. }).ToList();
  1425. ViewBag.OffenusedGroup = mm;
  1426. ViewBag.OffenusedGroupStr = JsonConvert.SerializeObject(ViewBag.OffenusedGroup);
  1427. //todo:
  1428. //删begin
  1429. ViewBag.OffenusedJiao = modulelist.Where(x => x.F_FullName.Contains("教"));
  1430. ViewBag.OffenusedGuan = modulelist.Where(x => x.F_FullName.Contains("管理"));
  1431. ViewBag.Offenused = modulelist.Except(modulelist.Where(x => x.F_FullName.Contains("教") || x.F_FullName.Contains("管理"))).Take(6);
  1432. ViewBag.OffenusedJiaoStr = JsonConvert.SerializeObject(ViewBag.OffenusedJiao);
  1433. ViewBag.OffenusedGuanStr = JsonConvert.SerializeObject(ViewBag.OffenusedGuan);
  1434. ViewBag.OffenusedStr = JsonConvert.SerializeObject(ViewBag.Offenused);
  1435. //删end
  1436. //查找服务
  1437. List<ModuleEntity> searchmodulelist = new List<ModuleEntity>();
  1438. foreach (var item in moduledata)
  1439. {
  1440. if (moduleIBLL.GetColumnList(item.F_ModuleId).Any())
  1441. {
  1442. item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1);
  1443. searchmodulelist.Add(item);
  1444. }
  1445. }
  1446. ViewBag.SearchModule = searchmodulelist;
  1447. //校园总览
  1448. //专业
  1449. var majorData = cdMajorIBLL.GetAllList();
  1450. ViewBag.MajorTotalNum = majorData.Count();
  1451. //班级
  1452. var classInfoData = classInfoIBLL.GetAllClass();
  1453. ViewBag.ClassInfoTotalNum = classInfoData.Count();
  1454. //学生
  1455. var stuInfoData = stuInfoBasicIBLL.GetAllList();
  1456. ViewBag.StuInfoTotalNum = stuInfoData.Count();
  1457. //教师
  1458. var teacherData = empInfoIBLL.GetAllList();
  1459. ViewBag.TeacherTotalNum = teacherData.Count();
  1460. //教室
  1461. var classRoomData = classroomInfoIBLL.GetAllList();
  1462. ViewBag.ClassRoomTotalNum = classRoomData.Count();
  1463. //课程
  1464. var lessonData = lessonInfoIBLL.GetAllList();
  1465. ViewBag.LessonTotalNum = lessonData.Count();
  1466. //专业总览
  1467. //专业学生
  1468. var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new
  1469. {
  1470. value = x.Select(y => y.StuId).Count(),
  1471. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1472. });
  1473. ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor);
  1474. //流程
  1475. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  1476. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  1477. var allCount = 0;
  1478. foreach (var flow in flowType)
  1479. {
  1480. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1481. flow.FlowCount = count;
  1482. allCount += count;
  1483. }
  1484. ViewBag.AllCount = allCount;
  1485. ViewBag.FlowType = flowType;
  1486. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1487. var card = "";
  1488. if (userInfo.Description == "学生")
  1489. {
  1490. card = stuInfoData.Where(x => x.StuNo == userInfo.account).Select(x => x.IdentityCardNo).FirstOrDefault();
  1491. }
  1492. else if (userInfo.Description == "教师")
  1493. {
  1494. card = teacherData.Where(x => x.EmpNo == userInfo.account).Select(x => x.IdentityCardNo).FirstOrDefault();
  1495. }
  1496. //校园一卡通余额
  1497. ViewBag.StuSaveRecordTotalNum = 0;
  1498. var mealCardRunTabList = mealCardRunTabIBLL.GetListByAccount(card).OrderByDescending(x => x.centralTm);
  1499. if (mealCardRunTabList.Any())
  1500. {
  1501. ViewBag.StuSaveRecordTotalNum = mealCardRunTabList.FirstOrDefault().balance;
  1502. }
  1503. //红湖付款码余额
  1504. ViewBag.StuConsumptionTotalNum = 0;
  1505. var mealCardRunTabListJY = mealCardRunTabIBLL.GetListByAccount(userInfo.IdentityCardNo);
  1506. if (mealCardRunTabListJY.Any())
  1507. {
  1508. ViewBag.StuConsumptionTotalNum = Math.Abs(mealCardRunTabListJY.Select(x => x.flowamount).Sum());
  1509. }
  1510. //常用链接
  1511. var userfunctionlist = perm_FunctionIBLL.GetListByUserId(userInfo.userId);
  1512. var ff = userfunctionlist.GroupBy(x => x.FTName).Select(x => new Perm_FunctionEntity()
  1513. {
  1514. FTName = x.Key,
  1515. PFunctionList = x.Select(y => new Perm_FunctionEntity()
  1516. {
  1517. FId = y.FId,
  1518. FTId = y.FTId,
  1519. FName = y.FName,
  1520. UPId = DESEncrypt.Encrypt(y.FId, ConfigurationManager.AppSettings["SSOPublicSecret"]),//sysid
  1521. UserId = DESEncrypt.Encrypt(userInfo.userId, ConfigurationManager.AppSettings["SSOPublicSecret"])//openid
  1522. }).Take(8).ToList()
  1523. });
  1524. ViewBag.FunctionList = ff;
  1525. ViewBag.FunctionListStr = JsonConvert.SerializeObject(ViewBag.FunctionList);
  1526. return View();
  1527. }
  1528. /// <summary>
  1529. /// 网上办事大厅拖拽版-管理驾驶舱模式
  1530. /// </summary>
  1531. /// <returns></returns>
  1532. public ActionResult DragModelThree()
  1533. {
  1534. //判断登录状态码
  1535. string account = "";
  1536. if (!Request.Headers["account"].IsEmpty())
  1537. {
  1538. account = Request.Headers["account"].ToString();
  1539. }
  1540. OperatorHelper helper = new OperatorHelper();
  1541. var result = helper.IsOnLine(account);
  1542. if (result.stateCode != 1)
  1543. {
  1544. return Redirect("NoLogin");
  1545. }
  1546. //登录用户
  1547. var userInfo = LoginUserInfo.Get();
  1548. ViewBag.UserId = userInfo.userId;
  1549. //校园总览
  1550. //专业
  1551. var majorData = cdMajorIBLL.GetAllList();
  1552. ViewBag.MajorTotalNum = majorData.Count();
  1553. //班级
  1554. var classInfoData = classInfoIBLL.GetAllClass();
  1555. ViewBag.ClassInfoTotalNum = classInfoData.Count();
  1556. //学生
  1557. var stuInfoData = stuInfoBasicIBLL.GetAllList();
  1558. ViewBag.StuInfoTotalNum = stuInfoData.Count();
  1559. ViewBag.StuInfoTotalNumOfMan = stuInfoData.Where(x => x.GenderNo == true).Count();
  1560. //教师
  1561. var teacherData = empInfoIBLL.GetAllList();
  1562. ViewBag.TeacherTotalNum = teacherData.Count();
  1563. ViewBag.TeacherTotalNumOfMan = teacherData.Where(x => x.GenderNo == true).Count();
  1564. ViewBag.TeacherTotalNumOfBianNei = teacherData.Where(x => x.CompilationCategory == "01").Count();
  1565. //教室
  1566. var classRoomData = classroomInfoIBLL.GetAllList();
  1567. ViewBag.ClassRoomTotalNum = classRoomData.Count();
  1568. //专业总览
  1569. //专业学生
  1570. var stuByMajor = stuInfoData.GroupBy(x => x.MajorNo).Select(x => new
  1571. {
  1572. value = x.Select(y => y.StuId).Count(),
  1573. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1574. });
  1575. ViewBag.StuByMajorStr = JsonConvert.SerializeObject(stuByMajor);
  1576. //流程
  1577. var flowType = dataItemIBLL.GetDetailList("FlowSort", "");
  1578. var flowList = wfSchemeIBLL.GetWfSchemeStart().ToList();
  1579. var allCount = 0;
  1580. foreach (var flow in flowType)
  1581. {
  1582. var count = flowList.Count(a => a.F_Category == flow.F_ItemName);
  1583. flow.FlowCount = count;
  1584. allCount += count;
  1585. }
  1586. ViewBag.AllCount = allCount;
  1587. ViewBag.FlowType = flowType;
  1588. ViewBag.FlowList = JsonConvert.SerializeObject(flowList);
  1589. //课程总览
  1590. var lessonInfoData = lessonInfoIBLL.GetAllList();
  1591. ViewBag.LessonTotalNum = lessonInfoData.Count();
  1592. ViewBag.OpenLessonTotalNum = lessonInfoData.Where(x => x.CheckMark == true).Count();
  1593. //课程分类下的课程
  1594. var lessonBySort = lessonInfoData.GroupBy(x => x.LessonSortNo).Select(x => new
  1595. {
  1596. value = x.Select(y => y.LessonId).Count(),
  1597. name = cdLessonSortIBLL.GetCdLessonSortEntityByNo(x.Key)?.LessonSortName
  1598. });
  1599. ViewBag.LessonBySortStr = JsonConvert.SerializeObject(lessonBySort);
  1600. //课程类型下的课程
  1601. var lessonByType = lessonInfoData.GroupBy(x => x.LessonTypeId).Select(x => new
  1602. {
  1603. value = x.Select(y => y.LessonId).Count(),
  1604. name = cdLessonTypeIBLL.GetCdLessonTypeEntity(x.Key)?.LessonTypeName
  1605. });
  1606. ViewBag.LessonByTypeStr = JsonConvert.SerializeObject(lessonByType);
  1607. //教师总览
  1608. //教师学历比例
  1609. var teacherByHighestRecord = teacherData.Where(x => !string.IsNullOrEmpty(x.HighestRecord)).GroupBy(x => x.HighestRecord).Select(x => new
  1610. {
  1611. value = x.Select(y => y.EmpId).Count(),
  1612. name = bCdCultureDegreeIBLL.GetEntity(x.Key)?.CultureDegree
  1613. }).OrderByDescending(x => x.value);
  1614. ViewBag.TeacherByHighestRecordStr = JsonConvert.SerializeObject(teacherByHighestRecord);
  1615. //教师年龄比例
  1616. var empInfoAgeRate = empInfoIBLL.GetEmpInfoAgeRate();
  1617. var teacherByAge = new List<object>() {
  1618. new { value = empInfoAgeRate.age1, name = "60岁以上" },
  1619. new { value = empInfoAgeRate.age2, name = "50~60岁" },
  1620. new { value = empInfoAgeRate.age3, name = "40~50岁" },
  1621. new { value = empInfoAgeRate.age4, name = "30~40岁" },
  1622. new { value = empInfoAgeRate.age5, name = "20~30岁" },
  1623. };
  1624. ViewBag.TeacherByAgeStr = JsonConvert.SerializeObject(teacherByAge);
  1625. //学生总览
  1626. //学生成绩预警
  1627. var stuScoreData = stuScoreNotPassIBLL.GetList("{}").Where(x => x.Score == 0).Select(x => new { x.StuNo, x.MajorNo }).Distinct();
  1628. ViewBag.StuScoreWarnTotalNum = stuScoreData.Count();
  1629. var stuScoreByMajor = stuScoreData.GroupBy(x => x.MajorNo).Select(x => new
  1630. {
  1631. value = x.Select(y => y.StuNo).Count(),
  1632. name = cdMajorIBLL.GetCdMajorEntityByMajorNo(x.Key)?.MajorName
  1633. });
  1634. ViewBag.StuScoreByMajorStr = JsonConvert.SerializeObject(stuScoreByMajor);
  1635. //常用服务
  1636. List<ModuleEntity> modulelist = new List<ModuleEntity>();
  1637. List<string> offenused = LogBLL.GetGroupLog(userInfo.userId).Select(m => m.F_Module).Take(20).ToList();
  1638. 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));
  1639. foreach (var oitem in offenused)
  1640. {
  1641. ModuleEntity fod = moduledata.FirstOrDefault(m => m.F_FullName == oitem);
  1642. if (fod != null)
  1643. {
  1644. //找父级
  1645. if (fod.F_ParentId == "0")
  1646. {
  1647. fod.ParentName = fod.F_FullName;
  1648. fod.F_ParentId = fod.F_ModuleId;
  1649. }
  1650. else
  1651. {
  1652. var parent1 = moduleIBLL.GetModuleEntity(fod.F_ParentId);
  1653. if (parent1 != null)
  1654. {
  1655. if (parent1.F_ParentId == "0")
  1656. {
  1657. fod.ParentName = parent1.F_FullName;
  1658. fod.F_ParentId = parent1.F_ModuleId;
  1659. }
  1660. else
  1661. {
  1662. //下一级
  1663. var parent2 = moduleIBLL.GetModuleEntity(parent1.F_ParentId);
  1664. if (parent2 != null)
  1665. {
  1666. if (parent2.F_ParentId == "0")
  1667. {
  1668. fod.ParentName = parent2.F_FullName;
  1669. fod.F_ParentId = parent2.F_ModuleId;
  1670. }
  1671. else
  1672. {
  1673. //下一级
  1674. var parent3 = moduleIBLL.GetModuleEntity(parent2.F_ParentId);
  1675. if (parent3 != null)
  1676. {
  1677. if (parent3.F_ParentId == "0")
  1678. {
  1679. fod.ParentName = parent3.F_FullName;
  1680. fod.F_ParentId = parent3.F_ModuleId;
  1681. }
  1682. else
  1683. {
  1684. //下一级
  1685. var parent4 = moduleIBLL.GetModuleEntity(parent3.F_ParentId);
  1686. if (parent4 != null)
  1687. {
  1688. if (parent4.F_ParentId == "0")
  1689. {
  1690. fod.ParentName = parent4.F_FullName;
  1691. fod.F_ParentId = parent4.F_ModuleId;
  1692. }
  1693. }
  1694. }
  1695. }
  1696. }
  1697. }
  1698. }
  1699. }
  1700. }
  1701. modulelist.Add(fod);
  1702. }
  1703. }
  1704. ViewBag.OffenusedAll = modulelist;
  1705. //查找服务
  1706. List<ModuleEntity> searchmodulelist = new List<ModuleEntity>();
  1707. foreach (var item in moduledata)
  1708. {
  1709. if (moduleIBLL.GetColumnList(item.F_ModuleId).Any())
  1710. {
  1711. item.FirstLetter = Str.PinYin(item.F_FullName).Substring(0, 1);
  1712. searchmodulelist.Add(item);
  1713. }
  1714. }
  1715. ViewBag.SearchModule = searchmodulelist;
  1716. return View();
  1717. }
  1718. /// <summary>
  1719. /// 网上办事大厅拖拽版-保存卡片块排序
  1720. /// </summary>
  1721. /// <returns></returns>
  1722. public ActionResult SaveCardSort(string userId, string modelCode, string desktopId, string cardSort)
  1723. {
  1724. sSO_Drag_CardSortManageIBLL.SaveCardSort(userId, modelCode, desktopId, cardSort);
  1725. return Success("操作成功");
  1726. }
  1727. /// <summary>
  1728. /// 网上办事大厅拖拽版-新增桌面
  1729. /// </summary>
  1730. /// <returns></returns>
  1731. public ActionResult AddDesktop(string userId, string modelCode, string desktopName, string desktopCode)
  1732. {
  1733. sSO_Drag_DesktopManageIBLL.AddDesktop(userId, modelCode, desktopName, desktopCode);
  1734. var data = sSO_Drag_DesktopManageIBLL.GetEntityByDesktopCode(userId, modelCode, desktopCode);
  1735. return Success("操作成功", data);
  1736. }
  1737. /// <summary>
  1738. /// 网上办事大厅拖拽版-删除桌面
  1739. /// </summary>
  1740. /// <returns></returns>
  1741. public ActionResult DeleteDesktop(string desktopId)
  1742. {
  1743. sSO_Drag_DesktopManageIBLL.DeleteEntity(desktopId);
  1744. return Success("操作成功");
  1745. }
  1746. /// <summary>
  1747. /// 网上办事大厅拖拽版-修改桌面
  1748. /// </summary>
  1749. /// <returns></returns>
  1750. public ActionResult ModifyDesktop(string desktopId, string desktopName)
  1751. {
  1752. var entity = new SSO_Drag_DesktopManageEntity()
  1753. {
  1754. DesktopName = desktopName
  1755. };
  1756. sSO_Drag_DesktopManageIBLL.SaveEntity(desktopId, entity);
  1757. return Success("操作成功");
  1758. }
  1759. /// <summary>
  1760. /// 网上办事大厅拖拽版-默认桌面恢复默认设置
  1761. /// </summary>
  1762. /// <returns></returns>
  1763. public ActionResult RestoreDefaultDesktop(string desktopId)
  1764. {
  1765. sSO_Drag_DesktopManageIBLL.RestoreDefaultDesktop(desktopId);
  1766. return Success("操作成功");
  1767. }
  1768. }
  1769. }