選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

SSOSystemController.cs 86 KiB

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