Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

2262 рядки
105 KiB

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