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

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