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.
 
 
 
 
 
 

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