ChargeAggregateServices.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ChargeManage.ChargeSituation;
  6. using System.Linq.Expressions;
  7. using EMIS.Entities;
  8. using Bowin.Common.Linq;
  9. using EMIS.DataLogic.ChargeManage.ChargeSituation;
  10. using Bowin.Common.Linq.Entity;
  11. using EMIS.ViewModel;
  12. using EMIS.CommonLogic.StudentManage.StudentStatistics;
  13. namespace EMIS.CommonLogic.ChargeManage.ChargeSituation
  14. {
  15. public class ChargeAggregateServices:BaseServices,IChargeAggregateServices
  16. {
  17. public ChargeAggregateDAL ChargeAggregateDAL { get; set; }
  18. public IInSchoolSettingServices InSchoolSettingServices { get; set; }
  19. public IChargeDelayServices IChargeDelayServices { get; set; }
  20. /// <summary>
  21. /// 查询费用明细View
  22. /// </summary>
  23. /// <param name="configuretView"></param>
  24. /// <param name="collegeID"></param>
  25. /// <param name="yearID"></param>
  26. /// <param name="standardID"></param>
  27. /// <param name="educationID"></param>
  28. /// <param name="learningformID"></param>
  29. /// <param name="learnSystem"></param>
  30. /// <param name="chargeYearID"></param>
  31. /// <param name="chargeProjectID"></param>
  32. /// <param name="inSchoolStatus"></param>
  33. /// <param name="pageIndex"></param>
  34. /// <param name="pageSize"></param>
  35. /// <returns></returns>
  36. public IGridResultSet<ChargeAggregateView> GetChargeAggregateViewGrid(ConfiguretView configuretView, Guid? collegeID,
  37. int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
  38. int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus, int pageIndex, int pageSize)
  39. {
  40. //查询对应的全部流程环节信息(WorkflowStatusView)
  41. var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
  42. if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
  43. {
  44. throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
  45. }
  46. //查询缓交申请工作流程结束环节状态ID(通过)
  47. var chargeDelayEndtStatus = IChargeDelayServices.GetCorrectEndStatus();
  48. if (chargeDelayEndtStatus == null)
  49. {
  50. throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
  51. }
  52. //应收名单
  53. Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  54. if (chargeYearID.HasValue)
  55. {
  56. expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
  57. }
  58. if (chargeProjectID.HasValue)
  59. {
  60. expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
  61. }
  62. //缓交信息
  63. Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  64. //缓交申请(审核通过)
  65. expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus);
  66. //学生信息
  67. Expression<Func<CF_Student, bool>> expStudent = (x => true);
  68. if (inSchoolStatus != null && inSchoolStatus > -1)
  69. {
  70. var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
  71. if (inSchoolStatus == 1)
  72. {
  73. //表示在校
  74. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  75. }
  76. if (inSchoolStatus == 0)
  77. {
  78. //不在校
  79. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  80. }
  81. }
  82. var query = ChargeAggregateDAL.GetChargeAggregateView(expStudentCharge, expChargeDelayPass, expStudent);
  83. if (collegeID.HasValue)
  84. {
  85. query = query.Where(x => x.CollegeID == collegeID);
  86. }
  87. if (yearID.HasValue)
  88. {
  89. query = query.Where(x => x.GradeStr == yearID);
  90. }
  91. if (standardID.HasValue)
  92. {
  93. query = query.Where(x => x.StandardID == standardID);
  94. }
  95. if (educationID.HasValue)
  96. {
  97. query = query.Where(x => x.EducationID == educationID);
  98. }
  99. if (learningformID.HasValue)
  100. {
  101. query = query.Where(x => x.LearningformID == learningformID);
  102. }
  103. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  104. {
  105. var LearnSystems = Convert.ToDecimal(learnSystem);
  106. query = query.Where(x => x.LearnSystem == LearnSystems);
  107. }
  108. //查询条件
  109. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  110. {
  111. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  112. }
  113. return this.GetQueryByDataRangeByCollege(query)
  114. .OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
  115. .ThenBy(x => x.ClassNo.Length).ThenBy(x => x.ClassNo)
  116. .ThenBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode)
  117. .ToGridResultSet<ChargeAggregateView>(pageIndex, pageSize);
  118. }
  119. /// <summary>
  120. /// 查询费用明细List
  121. /// </summary>
  122. /// <param name="configuretView"></param>
  123. /// <param name="collegeID"></param>
  124. /// <param name="yearID"></param>
  125. /// <param name="standardID"></param>
  126. /// <param name="educationID"></param>
  127. /// <param name="learningformID"></param>
  128. /// <param name="learnSystem"></param>
  129. /// <param name="chargeYearID"></param>
  130. /// <param name="chargeProjectID"></param>
  131. /// <param name="inSchoolStatus"></param>
  132. /// <returns></returns>
  133. public List<ChargeAggregateView> GetChargeAggregateViewList(ConfiguretView configuretView, Guid? collegeID,
  134. int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
  135. int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus)
  136. {
  137. //查询对应的全部流程环节信息(WorkflowStatusView)
  138. var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
  139. if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
  140. {
  141. throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
  142. }
  143. //查询缓交申请工作流程结束环节状态ID(通过)
  144. var chargeDelayEndtStatus = IChargeDelayServices.GetCorrectEndStatus();
  145. if (chargeDelayEndtStatus == null)
  146. {
  147. throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
  148. }
  149. //应收名单
  150. Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  151. if (chargeYearID.HasValue)
  152. {
  153. expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
  154. }
  155. if (chargeProjectID.HasValue)
  156. {
  157. expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
  158. }
  159. //缓交信息
  160. Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
  161. //缓交申请(审核通过)
  162. expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus);
  163. //学生信息
  164. Expression<Func<CF_Student, bool>> expStudent = (x => true);
  165. if (inSchoolStatus != null && inSchoolStatus > -1)
  166. {
  167. var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true);
  168. if (inSchoolStatus == 1)
  169. {
  170. //表示在校
  171. expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
  172. }
  173. if (inSchoolStatus == 0)
  174. {
  175. //不在校
  176. expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
  177. }
  178. }
  179. var query = ChargeAggregateDAL.GetChargeAggregateView(expStudentCharge, expChargeDelayPass, expStudent);
  180. if (collegeID.HasValue)
  181. {
  182. query = query.Where(x => x.CollegeID == collegeID);
  183. }
  184. if (yearID.HasValue)
  185. {
  186. query = query.Where(x => x.GradeStr == yearID);
  187. }
  188. if (standardID.HasValue)
  189. {
  190. query = query.Where(x => x.StandardID == standardID);
  191. }
  192. if (educationID.HasValue)
  193. {
  194. query = query.Where(x => x.EducationID == educationID);
  195. }
  196. if (learningformID.HasValue)
  197. {
  198. query = query.Where(x => x.LearningformID == learningformID);
  199. }
  200. if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
  201. {
  202. var LearnSystems = Convert.ToDecimal(learnSystem);
  203. query = query.Where(x => x.LearnSystem == LearnSystems);
  204. }
  205. //查询条件
  206. if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  207. {
  208. query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  209. }
  210. return this.GetQueryByDataRangeByCollege(query)
  211. .OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
  212. .ThenBy(x => x.ClassNo.Length).ThenBy(x => x.ClassNo)
  213. .ThenBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode)
  214. .ToList();
  215. }
  216. }
  217. }