using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.ChargeManage.ChargeSituation; using System.Linq.Expressions; using EMIS.Entities; using Bowin.Common.Linq; using EMIS.DataLogic.ChargeManage.ChargeSituation; using Bowin.Common.Linq.Entity; using EMIS.ViewModel; using EMIS.CommonLogic.StudentManage.StudentStatistics; namespace EMIS.CommonLogic.ChargeManage.ChargeSituation { public class ChargeAggregateServices:BaseServices,IChargeAggregateServices { public ChargeAggregateDAL ChargeAggregateDAL { get; set; } public IInSchoolSettingServices InSchoolSettingServices { get; set; } public IChargeDelayServices IChargeDelayServices { get; set; } /// /// 查询费用明细View /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IGridResultSet GetChargeAggregateViewGrid(ConfiguretView configuretView, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus, int pageIndex, int pageSize) { //查询对应的全部流程环节信息(WorkflowStatusView) var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList(); if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0) { throw new Exception("工作流平台中,费用缓交流程未配置,请核查"); } //查询缓交申请工作流程结束环节状态ID(通过) var chargeDelayEndtStatus = IChargeDelayServices.GetCorrectEndStatus(); if (chargeDelayEndtStatus == null) { throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查"); } //应收名单 Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (chargeYearID.HasValue) { expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID); } if (chargeProjectID.HasValue) { expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID); } //缓交信息 Expression> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); //缓交申请(审核通过) expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus); //学生信息 Expression> expStudent = (x => true); if (inSchoolStatus != null && inSchoolStatus > -1) { var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true); if (inSchoolStatus == 1) { //表示在校 expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID)); } if (inSchoolStatus == 0) { //不在校 expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID)); } } var query = ChargeAggregateDAL.GetChargeAggregateView(expStudentCharge, expChargeDelayPass, expStudent); if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (yearID.HasValue) { query = query.Where(x => x.GradeStr == yearID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByDataRangeByCollege(query) .OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ThenBy(x => x.ClassNo.Length).ThenBy(x => x.ClassNo) .ThenBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode) .ToGridResultSet(pageIndex, pageSize); } /// /// 查询费用明细List /// /// /// /// /// /// /// /// /// /// /// /// public List GetChargeAggregateViewList(ConfiguretView configuretView, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem, int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus) { //查询对应的全部流程环节信息(WorkflowStatusView) var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList(); if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0) { throw new Exception("工作流平台中,费用缓交流程未配置,请核查"); } //查询缓交申请工作流程结束环节状态ID(通过) var chargeDelayEndtStatus = IChargeDelayServices.GetCorrectEndStatus(); if (chargeDelayEndtStatus == null) { throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查"); } //应收名单 Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); if (chargeYearID.HasValue) { expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID); } if (chargeProjectID.HasValue) { expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID); } //缓交信息 Expression> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); //缓交申请(审核通过) expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus); //学生信息 Expression> expStudent = (x => true); if (inSchoolStatus != null && inSchoolStatus > -1) { var inschoolStatusList = InSchoolSettingServices.GetInschoolStatusList(true); if (inSchoolStatus == 1) { //表示在校 expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID)); } if (inSchoolStatus == 0) { //不在校 expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID)); } } var query = ChargeAggregateDAL.GetChargeAggregateView(expStudentCharge, expChargeDelayPass, expStudent); if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (yearID.HasValue) { query = query.Where(x => x.GradeStr == yearID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (educationID.HasValue) { query = query.Where(x => x.EducationID == educationID); } if (learningformID.HasValue) { query = query.Where(x => x.LearningformID == learningformID); } if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1") { var LearnSystems = Convert.ToDecimal(learnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } //查询条件 if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } return this.GetQueryByDataRangeByCollege(query) .OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo) .ThenBy(x => x.ClassNo.Length).ThenBy(x => x.ClassNo) .ThenBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode) .ToList(); } } }