Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

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