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.
 
 
 
 
 
 

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