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.
 
 
 
 
 
 

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