123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using EMIS.ViewModel;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.ChargeManage.ArrearsSituation;
- using EMIS.DataLogic.ChargeManage.ArrearsSituation;
- using System.Text.RegularExpressions;
- using EMIS.CommonLogic.ChargeManage.ChargeSituation;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.ChargeManage.ArrearsSituation
- {
- public class ArrearsListServices : BaseServices, IArrearsListServices
- {
- public ArrearsListDAL ArrearsListDAL { get; set; }
- public IInSchoolSettingServices InSchoolSettingServices { get; set; }
- public IChargeDelayServices IChargeDelayServices { get; set; }
- /// <summary>
- /// 查询欠费名单信息View(左连对应的缴费控制信息表)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="isArrear"></param>
- /// <param name="isControl"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ArrearsListView> GetArrearListViewGrid(ConfiguretView configuretView, Guid? collegeID, int? yearID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, int? isArrear,
- int? isControl, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //查询对应的全部流程环节信息(WorkflowStatusView)
- var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
- if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
- {
- throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
- }
- //查询缓交申请工作流程结束环节状态ID(通过)
- var chargeDelayEndStatus = IChargeDelayServices.GetCorrectEndStatus();
- if (chargeDelayEndStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交信息
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交申请(审核通过)
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndStatus);
- //学生信息
- Expression<Func<CF_Student, bool>> 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 = ArrearsListDAL.GetArrearListView(expStudentCharge, expChargeDelayPass, expStudent);
- //欠费状态
- if (isArrear.HasValue)
- {
- if (isArrear.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsYes);
- }
- if (isArrear.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsNo);
- }
- }
- //登录控制
- if (isControl.HasValue)
- {
- if (isControl.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsYes);
- }
- if (isControl.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsNo);
- }
- }
- 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<ArrearsListView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询欠费名单信息View(左连对应的缴费控制信息表)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="isArrear"></param>
- /// <param name="isControl"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ArrearsListView> GetArrearListViewGridForAdult(ConfiguretView configuretView, Guid? collegeID, int? yearID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, int? isArrear,
- int? isControl, int? inSchoolStatus, int pageIndex, int pageSize)
- {
- //查询对应的全部流程环节信息(WorkflowStatusView)
- var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
- if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
- {
- throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
- }
- //查询缓交申请工作流程结束环节状态ID(通过)
- var chargeDelayEndStatus = IChargeDelayServices.GetCorrectEndStatus();
- if (chargeDelayEndStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交信息
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交申请(审核通过)
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndStatus);
- //学生信息
- Expression<Func<CF_Student, bool>> 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 = ArrearsListDAL.GetArrearListView(expStudentCharge, expChargeDelayPass, expStudent);
- //欠费状态
- if (isArrear.HasValue)
- {
- if (isArrear.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsYes);
- }
- if (isArrear.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsNo);
- }
- }
- //登录控制
- if (isControl.HasValue)
- {
- if (isControl.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsYes);
- }
- if (isControl.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsNo);
- }
- }
- 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());
- }
- query = query.Where(x => x.AmountSum > 0);
- 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<ArrearsListView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询欠费名单信息List(左连对应的缴费控制信息表)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="isArrear"></param>
- /// <param name="isControl"></param>
- /// <param name="inSchoolStatus"></param>
- /// <returns></returns>
- public List<ArrearsListView> GetArrearsListViewList(ConfiguretView configuretView, Guid? collegeID, int? yearID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, int? isArrear,
- int? isControl, int? inSchoolStatus)
- {
- //查询对应的全部流程环节信息(WorkflowStatusView)
- var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
- if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
- {
- throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
- }
- //查询缓交申请工作流程结束环节状态ID(通过)
- var chargeDelayEndStatus = IChargeDelayServices.GetCorrectEndStatus();
- if (chargeDelayEndStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交信息
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交申请(审核通过)
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndStatus);
- //学生信息
- Expression<Func<CF_Student, bool>> 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 = ArrearsListDAL.GetArrearListView(expStudentCharge, expChargeDelayPass, expStudent);
- //欠费状态
- if (isArrear.HasValue)
- {
- if (isArrear.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsYes);
- }
- if (isArrear.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsNo);
- }
- }
- //登录控制
- if (isControl.HasValue)
- {
- if (isControl.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsYes);
- }
- if (isControl.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsControl == (int)CF_GeneralPurpose.IsNo);
- }
- }
- 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();
- }
- /// <summary>
- /// 查询对应的欠费信息ArrearsListView(根据用户信息ID)
- /// </summary>
- /// <param name="userID"></param>
- /// <returns></returns>
- public ArrearsListView GetArrearListView(Guid? userID)
- {
- try
- {
- //查询缓交申请工作流程结束环节状态ID(通过)
- var chargeDelayEndStatus = IChargeDelayServices.GetCorrectEndStatus();
- if (chargeDelayEndStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //userID
- expStudentCharge = expStudentCharge.And(x => x.UserID == userID);
- //缓交信息
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //缓交申请(审核通过)
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndStatus);
- var arrearsListView = ArrearsListDAL.GetArrearListViewAble(expStudentCharge, expChargeDelayPass)
- .SingleOrDefault();
- return arrearsListView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 放行(个性化控制登录)
- /// </summary>
- /// <param name="userIDList"></param>
- public void Pass(List<Guid?> userIDList)
- {
- try
- {
- //控制放行信息
- Expression<Func<EC_PassStudent, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => userIDList.Contains(x.UserID));
- //查询控制放行信息
- var passStudentViewList = ArrearsListDAL.GetPassStudentView(exp);
- List<EC_PassStudent> passStudentInList = new List<EC_PassStudent>();
- foreach (var userID in userIDList)
- {
- //查询对应的控制放行信息
- var passStudentView = passStudentViewList.Where(x=>x.UserID == userID).SingleOrDefault();
- if (passStudentView == null)
- {
- EC_PassStudent passStudent = new EC_PassStudent();
- passStudent.PassStudentID = Guid.NewGuid();
- passStudent.UserID = userID;
- passStudent.Remark = "放行(个性化允许登录,不受欠费控制)";
- SetNewStatus(passStudent, (int)SYS_STATUS.USABLE);
- passStudentInList.Add(passStudent);
- }
- else
- {
- throw new Exception("数据有误,请核查");
- }
- }
- //批量插入
- UnitOfWork.BulkInsert(passStudentInList);
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 控制(个性化控制登录)
- /// </summary>
- /// <param name="userIDList"></param>
- public void Control(List<Guid?> userIDList)
- {
- try
- {
- UnitOfWork.Delete<EC_PassStudent>(x => userIDList.Contains(x.UserID));
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- }
- }
|