You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

730 lines
28 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.TwoDevelopment.EducationalAdministration;
  3. using Learun.Util;
  4. using Nancy;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Net;
  9. using System.Net.Http;
  10. using System.Web.Http;
  11. namespace Learun.Application.WebApi.Modules.Echarts
  12. {
  13. public class StudentEchartsApi : BaseNoAuthentication
  14. {
  15. private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
  16. private DataItemIBLL dataItemIBLL = new DataItemBLL();
  17. private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL();
  18. private DIC_PROVINCEIBLL dIC_PROVINCEIBLL = new DIC_PROVINCEBLL();
  19. private DIC_CITYIBLL dIC_CITYIBLL = new DIC_CITYBLL();
  20. private StuEncourgementIBLL stuEncourgementIBLL = new StuEncourgementBLL();
  21. private StuTransferInfoIBLL stuTransferInfoIBLL = new StuTransferInfoBLL();
  22. private StuGraduateStatisticIBLL stuGraduateStatisticIBLL = new StuGraduateStatisticBLL();
  23. private CdMajorIBLL cdMajorIBLL = new CdMajorBLL();
  24. private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
  25. public StudentEchartsApi() : base("/api/studentEcharts/")
  26. {
  27. Get["/stuTotalNum"] = stuTotalNum;
  28. Get["/stuManNum"] = stuManNum;
  29. Get["/stuWomanNum"] = stuWomanNum;
  30. Get["/stuSexEchart"] = stuSexEchart;
  31. Get["/stuAgeEchart"] = stuAgeEchart;
  32. Get["/stuNationalityEchart"] = stuNationalityEchart;
  33. Get["/stuPartyFaceEchart"] = stuPartyFaceEchart;
  34. Get["/stuClassPartyFaceEchart"] = stuClassPartyFaceEchart;
  35. Get["/stuProvinceEchart"] = stuProvinceEchart;
  36. Get["/stuEncourgementNum"] = stuEncourgementNum;
  37. Get["/stuEncourgementEchart"] = stuEncourgementEchart;
  38. Get["/stuTransferNum"] = stuTransferNum;
  39. Get["/stuGraduateEchart"] = stuGraduateEchart;
  40. Get["/stuMapEchart"] = stuMapEchart;
  41. Get["/stuGradeSelect"] = stuGradeSelect;
  42. Get["/stuClassSelect"] = stuClassSelect;
  43. Get["/majorSelect"] = majorSelect;
  44. Get["/stuClassEchart"] = stuClassEchart;
  45. Get["/teacherNumOfZZMM"] = teacherNumOfZZMM;
  46. Get["/teacherNumOfBZQK"] = teacherNumOfBZQK;
  47. Get["/teacherAgeEchart"] = teacherAgeEchart;
  48. Get["/teacherSexEchart"] = teacherSexEchart;
  49. Get["/teacherCollegeEchart"] = teacherCollegeEchart;
  50. Get["/teacherNationalEchart"] = teacherNationalEchart;
  51. }
  52. #region 学生信息分析
  53. /// <summary>
  54. /// 在校学生人数
  55. /// </summary>
  56. /// <param name="_"></param>
  57. /// <returns></returns>
  58. public Response stuTotalNum(dynamic _)
  59. {
  60. var sum = stuInfoBasicIBLL.GetAllList().Count();
  61. var res = new { value = sum };
  62. return Res(res);
  63. }
  64. /// <summary>
  65. /// 在校学生人数-男
  66. /// </summary>
  67. /// <param name="_"></param>
  68. /// <returns></returns>
  69. public Response stuManNum(dynamic _)
  70. {
  71. var sum = stuInfoBasicIBLL.GetAllList().Where(x => x.GenderNo == true).Count();
  72. var res = new { value = sum };
  73. return Res(res);
  74. }
  75. /// <summary>
  76. /// 在校学生人数-女
  77. /// </summary>
  78. /// <param name="_"></param>
  79. /// <returns></returns>
  80. public Response stuWomanNum(dynamic _)
  81. {
  82. var sum = stuInfoBasicIBLL.GetAllList().Where(x => x.GenderNo == false).Count();
  83. var res = new { value = sum };
  84. return Res(res);
  85. }
  86. /// <summary>
  87. /// 在校学生人数-性别图表
  88. /// </summary>
  89. /// <param name="_"></param>
  90. /// <returns></returns>
  91. public Response stuSexEchart(dynamic _)
  92. {
  93. var stuList = stuInfoBasicIBLL.GetAllList();
  94. var stuManNum = stuList.Where(x => x.GenderNo == true).Count();
  95. var stuWomanNum = stuList.Where(x => x.GenderNo == false).Count();
  96. var res = new BarModel()
  97. {
  98. categories = new List<string>(),
  99. series = new List<seriesModel>()
  100. };
  101. res.categories.Add("性别");
  102. var s1data = new List<int>();
  103. s1data.Add(stuManNum);
  104. res.series.Add(new seriesModel { name = "男", data = s1data });
  105. var s2data = new List<int>();
  106. s2data.Add(stuWomanNum);
  107. res.series.Add(new seriesModel { name = "女", data = s2data });
  108. return Res(res);
  109. }
  110. /// <summary>
  111. /// 学生年龄分布
  112. /// </summary>
  113. /// <param name="_"></param>
  114. /// <returns></returns>
  115. public Response stuAgeEchart(dynamic _)
  116. {
  117. var param = this.GetReqData();
  118. var res = new List<PieModel>();
  119. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.Birthday.HasValue);
  120. if (!string.IsNullOrEmpty(param))
  121. {
  122. stuList = stuList.Where(x => x.Grade == param);
  123. }
  124. var num1820 = stuList.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 18 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 20).Count();
  125. res.Add(new PieModel() { name = "18-20", value = num1820 });
  126. var num2123 = stuList.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 21 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 23).Count();
  127. res.Add(new PieModel() { name = "21-23", value = num2123 });
  128. var num2426 = stuList.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 24 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 26).Count();
  129. res.Add(new PieModel() { name = "24-26", value = num2426 });
  130. return Res(res);
  131. }
  132. /// <summary>
  133. /// 学生民族分布
  134. /// </summary>
  135. /// <param name="_"></param>
  136. /// <returns></returns>
  137. public Response stuNationalityEchart(dynamic _)
  138. {
  139. var param = this.GetReqData();
  140. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.NationalityNo != null && x.NationalityNo.Length > 0);
  141. if (!string.IsNullOrEmpty(param))
  142. {
  143. stuList = stuList.Where(x => x.Grade == param);
  144. }
  145. var stuListGroup = stuList.GroupBy(x => x.NationalityNo).Select(x => new
  146. {
  147. NationalityNo = x.Key,
  148. manNum = x.Where(y => y.GenderNo == true).Count(),
  149. womanNum = x.Where(y => y.GenderNo == false).Count()
  150. }).OrderBy(x => x.NationalityNo);
  151. var nationalityList = dataItemIBLL.GetDetailList2("National", null);
  152. var res = new BarModel()
  153. {
  154. categories = new List<string>(),
  155. series = new List<seriesModel>()
  156. };
  157. var s1data = new List<int>();
  158. var s2data = new List<int>();
  159. foreach (var item in stuListGroup)
  160. {
  161. res.categories.Add(nationalityList.FirstOrDefault(x => x.F_ItemValue == item.NationalityNo)?.F_ItemName);
  162. s1data.Add(item.manNum);
  163. s2data.Add(item.womanNum);
  164. }
  165. res.series.Add(new seriesModel { name = "男", data = s1data });
  166. res.series.Add(new seriesModel { name = "女", data = s2data });
  167. return Res(res);
  168. }
  169. /// <summary>
  170. /// 学生政治面貌
  171. /// </summary>
  172. /// <param name="_"></param>
  173. /// <returns></returns>
  174. public Response stuPartyFaceEchart(dynamic _)
  175. {
  176. var param = this.GetReqData();
  177. var res = new List<PieModel>();
  178. var stuList = stuInfoBasicIBLL.GetAllList();
  179. if (!string.IsNullOrEmpty(param))
  180. {
  181. stuList = stuList.Where(x => x.Grade == param);
  182. }
  183. //中共党员03 共青团员01 群众02 不限
  184. var num1 = stuList.Where(x => x.PartyFaceNo == "03").Count();
  185. res.Add(new PieModel() { name = "中共党员", value = num1 });
  186. var num2 = stuList.Where(x => x.PartyFaceNo == "01").Count();
  187. res.Add(new PieModel() { name = "共青团员", value = num2 });
  188. var num3 = stuList.Where(x => x.PartyFaceNo == "02").Count();
  189. res.Add(new PieModel() { name = "群众", value = num3 });
  190. var num4 = stuList.Where(x => x.PartyFaceNo != "03" && x.PartyFaceNo != "01" && x.PartyFaceNo != "02").Count();
  191. res.Add(new PieModel() { name = "不限", value = num4 });
  192. return Res(res);
  193. }
  194. /// <summary>
  195. /// 学生政治面貌-按班级统计
  196. /// </summary>
  197. /// <param name="_"></param>
  198. /// <returns></returns>
  199. public Response stuClassPartyFaceEchart(dynamic _)
  200. {
  201. var res = new List<TableModel>();
  202. //按班级统计
  203. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.ClassNo != null && x.ClassNo.Length > 0).GroupBy(x => x.ClassNo).Select(x => new
  204. {
  205. classNo = x.Key,
  206. stuList = x
  207. }).OrderBy(x => x.classNo);
  208. //中共党员03 共青团员01 群众02 不限
  209. foreach (var item in stuList)
  210. {
  211. var model = new TableModel()
  212. {
  213. type1 = classInfoIBLL.GetClassInfoEntityByClassNo(item.classNo)?.ClassName,
  214. type2 = item.stuList.Where(x => x.PartyFaceNo == "03").Count().ToString(),
  215. type3 = item.stuList.Where(x => x.PartyFaceNo == "01").Count().ToString(),
  216. type4 = item.stuList.Where(x => x.PartyFaceNo == "02").Count().ToString(),
  217. type5 = item.stuList.Where(x => x.PartyFaceNo != "03" && x.PartyFaceNo != "01" && x.PartyFaceNo != "02").Count().ToString(),
  218. };
  219. res.Add(model);
  220. }
  221. return Res(res);
  222. }
  223. /// <summary>
  224. /// 学生籍贯地区
  225. /// </summary>
  226. /// <param name="_"></param>
  227. /// <returns></returns>
  228. public Response stuProvinceEchart(dynamic _)
  229. {
  230. var param = this.GetReqData();
  231. var res = new List<PieModel>();
  232. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.F_ProvinceId != null && x.F_ProvinceId.Length > 0);
  233. if (!string.IsNullOrEmpty(param))
  234. {
  235. stuList = stuList.Where(x => x.Grade == param);
  236. }
  237. var stuListGroup = stuList.GroupBy(x => x.F_ProvinceId).Select(x => new
  238. {
  239. provinceCode = x.Key,
  240. num = x.Count()
  241. }).OrderBy(x => x.provinceCode);
  242. foreach (var item in stuListGroup)
  243. {
  244. var model = new PieModel()
  245. {
  246. name = dIC_PROVINCEIBLL.GetDIC_PROVINCEEntityByCode(item.provinceCode)?.PNAME,
  247. value = item.num
  248. };
  249. res.Add(model);
  250. }
  251. return Res(res);
  252. }
  253. /// <summary>
  254. /// 学生奖励人数
  255. /// </summary>
  256. /// <param name="_"></param>
  257. /// <returns></returns>
  258. public Response stuEncourgementNum(dynamic _)
  259. {
  260. var sum = stuEncourgementIBLL.GetAllList().Count();
  261. var res = new { value = sum };
  262. return Res(res);
  263. }
  264. /// <summary>
  265. /// 学生奖励
  266. /// </summary>
  267. /// <param name="_"></param>
  268. /// <returns></returns>
  269. public Response stuEncourgementEchart(dynamic _)
  270. {
  271. var res = stuEncourgementIBLL.GetPageList(null).GroupBy(x => x.GenderNo).Select(x => new PieModel()
  272. {
  273. name = x.Key.Value ? "男" : "女",
  274. value = x.Count()
  275. });
  276. return Res(res);
  277. }
  278. /// <summary>
  279. /// 异动人数
  280. /// </summary>
  281. /// <param name="_"></param>
  282. /// <returns></returns>
  283. public Response stuTransferNum(dynamic _)
  284. {
  285. var param = this.GetReq<TransferParam>();
  286. var res = new RingModel();
  287. var list = stuTransferInfoIBLL.GetList(null).Where(x => x.F_EnabledMark == 1);
  288. if (!string.IsNullOrEmpty(param.ClassNo))
  289. {
  290. list = list.Where(x => x.ClassNo == param.ClassNo);
  291. }
  292. if (!string.IsNullOrEmpty(param.AnomalousType))
  293. {
  294. res.value = list.Where(x => x.AnomalousType == param.AnomalousType).Count();
  295. if (list.Count() > 0)
  296. {
  297. res.data = ((res.value.ToDecimal() / list.Count().ToDecimal()) * 100).ToDecimal(2);
  298. }
  299. }
  300. return Res(res);
  301. }
  302. /// <summary>
  303. /// 学生毕业统计
  304. /// </summary>
  305. /// <param name="_"></param>
  306. /// <returns></returns>
  307. public Response stuGraduateEchart(dynamic _)
  308. {
  309. var stuList = stuGraduateStatisticIBLL.GetList().Where(x => x.UniversityLevel != null && x.UniversityLevel.Length > 0).GroupBy(x => x.UniversityLevel).Select(x => new
  310. {
  311. UniversityLevel = x.Key,
  312. Num = x.Count()
  313. });
  314. var GraduateLevelList = dataItemIBLL.GetDetailList2("GraduateLevel", null);
  315. var res = new List<PieModel>();
  316. foreach (var item in stuList)
  317. {
  318. var model = new PieModel()
  319. {
  320. name = GraduateLevelList.FirstOrDefault(x => x.F_ItemValue == item.UniversityLevel)?.F_ItemName + "毕业",
  321. value = item.Num
  322. };
  323. res.Add(model);
  324. }
  325. return Res(res);
  326. }
  327. /// <summary>
  328. /// 招生情况
  329. /// </summary>
  330. /// <param name="_"></param>
  331. /// <returns></returns>
  332. public Response stuMapEchart(dynamic _)
  333. {
  334. var res = new List<MapModel>();
  335. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.F_ProvinceId != null && x.F_ProvinceId.Length > 0 && x.F_ProvinceId == "420000").GroupBy(x => x.F_CityId).Select(x => new
  336. {
  337. F_CityId = x.Key,
  338. num = x.Count()
  339. }).OrderBy(x => x.F_CityId);
  340. foreach (var item in stuList)
  341. {
  342. var model = new MapModel()
  343. {
  344. code = item.F_CityId,
  345. area = dIC_CITYIBLL.GetDIC_CITYEntityByCode(item.F_CityId)?.CNAME,
  346. number = item.num
  347. };
  348. res.Add(model);
  349. }
  350. return Res(res);
  351. }
  352. /// <summary>
  353. /// 年级下拉框
  354. /// </summary>
  355. /// <param name="_"></param>
  356. /// <returns></returns>
  357. public Response stuGradeSelect(dynamic _)
  358. {
  359. var res = new List<SelectModel>();
  360. var stuList = stuInfoBasicIBLL.GetAllList().Where(x => x.Grade != null && x.Grade.Length > 0).GroupBy(x => x.Grade).Select(x => new SelectModel()
  361. {
  362. value = x.Key,
  363. label = x.Key + "级"
  364. }).OrderBy(x => x.value);
  365. res.Add(new SelectModel() { value = "", label = "全年级" });
  366. res.AddRange(stuList);
  367. return Res(res.OrderBy(x => x.value));
  368. }
  369. /// <summary>
  370. /// 异动-班级下拉框
  371. /// </summary>
  372. /// <param name="_"></param>
  373. /// <returns></returns>
  374. public Response stuClassSelect(dynamic _)
  375. {
  376. var res = new List<SelectModel>();
  377. var stuList = stuTransferInfoIBLL.GetList(null).Where(x => x.F_EnabledMark == 1 && x.ClassNo != null && x.ClassNo.Length > 0).GroupBy(x => x.ClassNo).Select(x => new SelectModel()
  378. {
  379. value = x.Key,
  380. label = classInfoIBLL.GetClassInfoEntityByClassNo(x.Key)?.ClassName
  381. }).OrderBy(x => x.value);
  382. res.Add(new SelectModel() { value = "", label = "全校" });
  383. res.AddRange(stuList);
  384. return Res(res.OrderBy(x => x.value));
  385. }
  386. #endregion
  387. /// <summary>
  388. /// 专业下拉框
  389. /// </summary>
  390. /// <param name="_"></param>
  391. /// <returns></returns>
  392. public Response majorSelect(dynamic _)
  393. {
  394. var res = new List<SelectModel>();
  395. var stuList = cdMajorIBLL.GetAllList().Where(x => x.MajorNo != null && x.MajorNo.Length > 0).GroupBy(x => x.MajorNo).Select(x => new SelectModel()
  396. {
  397. value = x.Key,
  398. label = x.FirstOrDefault().MajorName
  399. }).OrderBy(x => x.value);
  400. res.Add(new SelectModel() { value = "", label = "全校" });
  401. res.AddRange(stuList);
  402. return Res(res.OrderBy(x => x.value));
  403. }
  404. /// <summary>
  405. /// 学生班级信息统计
  406. /// </summary>
  407. /// <param name="_"></param>
  408. /// <returns></returns>
  409. public Response stuClassEchart(dynamic _)
  410. {
  411. var param = this.GetReq<ClassParam>();
  412. var res = new List<TableModelOfClass>();
  413. var stuList = classInfoIBLL.GetAllClass().Where(x => x.ClassNo != null && x.ClassNo.Length > 0);
  414. if (!string.IsNullOrEmpty(param.MajorNo))
  415. {
  416. stuList = stuList.Where(x => x.MajorNo == param.MajorNo);
  417. }
  418. var groupList = stuList.GroupBy(x => x.ClassNo).Select(x => new TableModelOfClass()
  419. {
  420. classno = x.Key,
  421. classname = x.FirstOrDefault().ClassName,
  422. man = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Where(y => y.GenderNo == true).Count(),
  423. woman = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Where(y => y.GenderNo == false).Count(),
  424. total = stuInfoBasicIBLL.GetStuInfoByClassNo(x.Key).Count()
  425. }).OrderBy(x => x.classno);
  426. res.AddRange(groupList);
  427. return Res(res);
  428. }
  429. #region 教师信息分析
  430. /// <summary>
  431. /// 教师人数-政治面貌
  432. /// </summary>
  433. /// <param name="_"></param>
  434. /// <returns></returns>
  435. public Response teacherNumOfZZMM(dynamic _)
  436. {
  437. var param = this.GetReqData();
  438. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true);
  439. if (!string.IsNullOrEmpty(param))
  440. {
  441. list = list.Where(x => x.PartyFaceNo == param);
  442. }
  443. return Res(new { value = list.Count() });
  444. }
  445. /// <summary>
  446. /// 教师人数-编制情况
  447. /// </summary>
  448. /// <param name="_"></param>
  449. /// <returns></returns>
  450. public Response teacherNumOfBZQK(dynamic _)
  451. {
  452. var param = this.GetReqData();
  453. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true);
  454. if (!string.IsNullOrEmpty(param))
  455. {
  456. list = list.Where(x => x.CompilationCategory == param);
  457. }
  458. return Res(new { value = list.Count() });
  459. }
  460. /// <summary>
  461. /// 教师年龄分布
  462. /// </summary>
  463. /// <param name="_"></param>
  464. /// <returns></returns>
  465. public Response teacherAgeEchart(dynamic _)
  466. {
  467. var res = new BarModel()
  468. {
  469. categories = new List<string>(),
  470. series = new List<seriesModel>()
  471. };
  472. res.categories.Add("20-30");
  473. res.categories.Add("31-35");
  474. res.categories.Add("36-40");
  475. res.categories.Add("41-45");
  476. res.categories.Add("46-50");
  477. res.categories.Add("51-55");
  478. res.categories.Add("56-70");
  479. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true);
  480. var seriesModel = new seriesModel()
  481. {
  482. name = "年龄段",
  483. data = new List<int>()
  484. };
  485. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 20 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 30).Count());
  486. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 31 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 35).Count());
  487. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 36 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 40).Count());
  488. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 41 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 45).Count());
  489. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 46 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 50).Count());
  490. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 51 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 55).Count());
  491. seriesModel.data.Add(list.Where(x => Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) >= 56 && Math.Abs(x.Birthday.Value.Year - DateTime.Now.Year) <= 70).Count());
  492. res.series.Add(seriesModel);
  493. return Res(res);
  494. }
  495. /// <summary>
  496. /// 教师性别比例
  497. /// </summary>
  498. /// <param name="_"></param>
  499. /// <returns></returns>
  500. public Response teacherSexEchart(dynamic _)
  501. {
  502. var res = new List<PieModel>();
  503. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true);
  504. var man = new PieModel()
  505. {
  506. name = "男",
  507. value = list.Where(x => x.GenderNo == true).Count(),
  508. };
  509. man.rate = list.Count() > 0 ? (man.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  510. res.Add(man);
  511. var woman = new PieModel()
  512. {
  513. name = "女",
  514. value = list.Where(x => x.GenderNo == false).Count(),
  515. };
  516. woman.rate = list.Count() > 0 ? (woman.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  517. res.Add(woman);
  518. return Res(res);
  519. }
  520. /// <summary>
  521. /// 教师学历比例
  522. /// </summary>
  523. /// <param name="_"></param>
  524. /// <returns></returns>
  525. public Response teacherCollegeEchart(dynamic _)
  526. {
  527. var res = new List<PieModel>();
  528. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true);
  529. var college1 = new PieModel()
  530. {
  531. name = "本科",
  532. value = list.Where(x => x.HighestRecord == "1" || x.HighestRecord == "20" || x.HighestRecord == "21" || x.HighestRecord == "7").Count(),
  533. };
  534. college1.rate = list.Count() > 0 ? (college1.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  535. res.Add(college1);
  536. var college2 = new PieModel()
  537. {
  538. name = "研究生",
  539. value = list.Where(x => x.HighestRecord == "13" || x.HighestRecord == "18" || x.HighestRecord == "19" || x.HighestRecord == "4").Count(),
  540. };
  541. college2.rate = list.Count() > 0 ? (college2.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  542. res.Add(college2);
  543. var college3 = new PieModel()
  544. {
  545. name = "硕士",
  546. value = list.Where(x => x.HighestRecord == "17" || x.HighestRecord == "3" || x.HighestRecord == "5").Count(),
  547. };
  548. college3.rate = list.Count() > 0 ? (college3.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  549. res.Add(college3);
  550. var college4 = new PieModel()
  551. {
  552. name = "博士",
  553. value = list.Where(x => x.HighestRecord == "14" || x.HighestRecord == "15" || x.HighestRecord == "16").Count(),
  554. };
  555. college4.rate = list.Count() > 0 ? (college4.value.ToDecimal() / list.Count().ToDecimal() * 100).ToDecimal(2) : 0;
  556. res.Add(college4);
  557. return Res(res);
  558. }
  559. /// <summary>
  560. /// 教师民族分布
  561. /// </summary>
  562. /// <param name="_"></param>
  563. /// <returns></returns>
  564. public Response teacherNationalEchart(dynamic _)
  565. {
  566. var res = new BarModel()
  567. {
  568. categories = new List<string>(),
  569. series = new List<seriesModel>()
  570. };
  571. var seriesModel = new seriesModel()
  572. {
  573. name = "教师人数",
  574. data = new List<int>()
  575. };
  576. var list = empInfoIBLL.GetAllList().Where(x => x.CheckMark == true && x.NationalityNo != null && x.NationalityNo.Length > 0).GroupBy(x => x.NationalityNo).Select(x => new
  577. {
  578. nationalityNo = x.Key,
  579. num = x.Select(y => y.EmpId).Count()
  580. });
  581. var nationalityData = dataItemIBLL.GetDetailList2("National", null);
  582. foreach (var item in list)
  583. {
  584. res.categories.Add(nationalityData.First(x => x.F_ItemValue == item.nationalityNo)?.F_ItemName);
  585. seriesModel.data.Add(item.num);
  586. }
  587. res.series.Add(seriesModel);
  588. return Res(res);
  589. }
  590. #endregion
  591. /// <summary>
  592. /// 柱状图数据
  593. /// </summary>
  594. public class BarModel
  595. {
  596. public List<string> categories { get; set; }
  597. public List<seriesModel> series { get; set; }
  598. }
  599. public class seriesModel
  600. {
  601. public string name { get; set; }
  602. public List<int> data { get; set; }
  603. }
  604. /// <summary>
  605. /// 饼图数据
  606. /// </summary>
  607. public class PieModel
  608. {
  609. public string name { get; set; }
  610. public int value { get; set; }
  611. /// <summary>
  612. /// 百分比
  613. /// </summary>
  614. public decimal rate { get; set; }
  615. }
  616. /// <summary>
  617. /// 表格数据
  618. /// </summary>
  619. public class TableModel
  620. {
  621. public string type1 { get; set; }
  622. public string type2 { get; set; }
  623. public string type3 { get; set; }
  624. public string type4 { get; set; }
  625. public string type5 { get; set; }
  626. }
  627. /// <summary>
  628. /// 环形图数据
  629. /// </summary>
  630. public class RingModel
  631. {
  632. /// <summary>
  633. /// 环文字名称
  634. /// </summary>
  635. public string label { get; set; }
  636. public int value { get; set; }
  637. /// <summary>
  638. /// 百分比
  639. /// </summary>
  640. public decimal data { get; set; }
  641. }
  642. /// <summary>
  643. /// 地图数据
  644. /// </summary>
  645. public class MapModel
  646. {
  647. public string code { get; set; }
  648. public string area { get; set; }
  649. public int number { get; set; }
  650. }
  651. /// <summary>
  652. /// 下拉框数据
  653. /// </summary>
  654. public class SelectModel
  655. {
  656. public string label { get; set; }
  657. public string value { get; set; }
  658. }
  659. /// <summary>
  660. /// 异动人数的传参
  661. /// </summary>
  662. public class TransferParam
  663. {
  664. public string AnomalousType { get; set; }
  665. public string ClassNo { get; set; }
  666. }
  667. /// <summary>
  668. /// 班级信息统计数据
  669. /// </summary>
  670. public class TableModelOfClass
  671. {
  672. public string classno { get; set; }
  673. public string classname { get; set; }
  674. public int man { get; set; }
  675. public int woman { get; set; }
  676. public int total { get; set; }
  677. }
  678. /// <summary>
  679. /// 班级信息统计的传参
  680. /// </summary>
  681. public class ClassParam
  682. {
  683. public string MajorNo { get; set; }
  684. }
  685. }
  686. }