Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

SSOSystemController.cs 86 KiB

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