123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.ChargeManage.ChargeSituation;
- using EMIS.ViewModel.ChargeManage.ChargeSituation;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Linq;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.ViewModel;
- using EMIS.ViewModel.WorkflowManage;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.ChargeManage.ChargeSituation
- {
- public class ChargeDelayServices : BaseWorkflowServices<EC_ChargeDelay>, IChargeDelayServices
- {
- public ChargeDelayDAL chargeDelayDAL { get; set; }
- public StudentChargeDAL studentChargeDAL { get; set; }
- public IInSchoolSettingServices InSchoolSettingServices { 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="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="chargeDelayStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ChargeDelayView> GetChargeDelayList(ConfiguretView configuretView, Guid? collegeID, int? yearID, int? standardID, int? educationID,
- int? learningformID, string learnSystem, int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus, int? chargeDelayStatus, int pageIndex, int pageSize)
- {
- var approveStatusList = this.GetStatusViewList();
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelay = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (chargeDelayStatus.HasValue)
- {
- expChargeDelay = expChargeDelay.And(x => x.RecordStatus == chargeDelayStatus);
- }
- Expression<Func<EC_StudentCharge, bool>> 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<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 = chargeDelayDAL.GetChargeDelayQueryAble(expChargeDelay, expStudentCharge, 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());
- }
- var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo).ThenBy(x => x.ChargeProjectStr)
- .ThenByDescending(x => x.ChargeYear).ThenBy(x => x.RecordStatus).ThenBy(x => x.CreateTime).ToGridResultSet<ChargeDelayView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.RecordStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name);
- return result;
- }
- /// <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="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="chargeDelayStatus"></param>
- /// <returns></returns>
- public List<ChargeDelayView> GetChargeDelayList(ConfiguretView configuretView, Guid? collegeID,
- int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- int? chargeYearID, Guid? chargeProjectID, int? inSchoolStatus, int? chargeDelayStatus)
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- //缓交名单
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelay = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (chargeDelayStatus.HasValue)
- {
- //审批状态
- expChargeDelay = expChargeDelay.And(x => x.RecordStatus == chargeDelayStatus);
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> 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<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 = chargeDelayDAL.GetChargeDelayQueryAble(expChargeDelay, expStudentCharge, 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());
- }
- var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StudentNo.Length)
- .ThenBy(x => x.StudentNo).ThenBy(x => x.ChargeProjectStr)
- .ThenByDescending(x => x.ChargeYear).ThenBy(x => x.RecordStatus)
- .ThenBy(x => x.CreateTime)
- .ToList();
- result.ForEach(x => x.RecordStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询应收名单中对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
- /// </summary>
- /// <param name="userID"></param>
- /// <param name="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <returns></returns>
- public ChargeDelayView GetChargeDelayStandardView(Guid? userID, int? chargeYearID, Guid? chargeProjectID)
- {
- try
- {
- //查询对应的应收名单信息
- var studentCharge = chargeDelayDAL.StudentChargeRepository
- .GetList(x => x.UserID == userID
- && x.ChargeYear == chargeYearID
- && x.ChargeProjectID == chargeProjectID).SingleOrDefault();
- if (studentCharge == null)
- {
- throw new Exception("对应的应收名单不存在,请核查");
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expStudentCharge = expStudentCharge.And(x => x.StudentChargeID == studentCharge.StudentChargeID);
- //查询对应的全部流程环节信息(WorkflowStatusView)
- var chargeDelayWorkflowStatusView = this.GetStatusViewList();
- if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
- {
- throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
- }
- //查询缓交申请工作流程开始环节状态
- var chargeDelayStartStatus = this.GetStartStatus();
- if (chargeDelayStartStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
- }
- //缓交申请流程中的ID(包含未提交、待审核)
- var applyStatusList = this.GetStartApproveStatusList();
- //缓交申请(流程中)
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expChargeDelayApply = expChargeDelayApply.And(x => x.StudentChargeID == studentCharge.StudentChargeID);
- expChargeDelayApply = expChargeDelayApply.And(x => applyStatusList.Contains(x.RecordStatus));
- //查询缓交申请工作流程结束环节状态
- var chargeDelayEndtStatus = this.GetCorrectEndStatus();
- if (chargeDelayEndtStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //缓交申请(审核通过)
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expChargeDelayPass = expChargeDelayPass.And(x => x.StudentChargeID == studentCharge.StudentChargeID);
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus);
- //查询对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
- var chargeDelayView = studentChargeDAL.GetStudentChargeChargeDelayView(expStudentCharge, expChargeDelayApply, expChargeDelayPass)
- .SingleOrDefault();
- return chargeDelayView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的缓交名单信息View(根据缓交信息)
- /// </summary>
- /// <param name="chargeDelayID"></param>
- /// <returns></returns>
- public ChargeDelayView GetChargeDelayView(Guid? chargeDelayID)
- {
- var query = chargeDelayDAL.GetChargeDelayQueryAble(x => x.ChargeDelayID == chargeDelayID).SingleOrDefault();
- return query;
- }
- /// <summary>
- /// 查询对应的缓交名单信息View(对应的应收名单信息全部查询,左联-待缓交金额、已缓交金额)
- /// </summary>
- /// <param name="chargeDelayID"></param>
- /// <returns></returns>
- public ChargeDelayView GetChargeDelayEditView(Guid? chargeDelayID)
- {
- try
- {
- //查询对应的缓交名单信息
- var chargeDelay = chargeDelayDAL.ChargeDelayRepository
- .GetList(x => x.ChargeDelayID == chargeDelayID).SingleOrDefault();
- if (chargeDelay == null)
- {
- throw new Exception("对应的缓交名单信息不存在,请核查");
- }
- //缓交名单
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelay = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expChargeDelay = expChargeDelay.And(x => x.ChargeDelayID == chargeDelayID);
- //查询对应的全部流程环节信息(WorkflowStatusView)
- var chargeDelayWorkflowStatusView = this.GetStatusViewList();
- if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
- {
- throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
- }
- //查询缓交申请工作流程开始环节状态
- var chargeDelayStartStatus = this.GetStartStatus();
- if (chargeDelayStartStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
- }
- //缓交申请流程中的ID(未提交、待审核)
- var applyStatusList = this.GetStartApproveStatusList();
- //缓交申请(流程中)
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expChargeDelayApply = expChargeDelayApply.And(x => x.StudentChargeID == chargeDelay.StudentChargeID);
- expChargeDelayApply = expChargeDelayApply.And(x => applyStatusList.Contains(x.RecordStatus));
- //查询缓交申请工作流程结束环节状态
- var chargeDelayEndtStatus = this.GetCorrectEndStatus();
- if (chargeDelayEndtStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
- }
- //缓交申请(审核通过)
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expChargeDelayPass = expChargeDelayPass.And(x => x.StudentChargeID == chargeDelay.StudentChargeID);
- expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus);
- //查询对应的缴交信息View(对应的应收名单信息全部查询,左联-待缓交金额、已缓交金额)
- var chargeDelayView = chargeDelayDAL.GetChargeDelayQueryView(expChargeDelay, expChargeDelayApply, expChargeDelayPass)
- .SingleOrDefault();
- return chargeDelayView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(申请、修改)
- /// 同时对相应的缓交信息进行验证(缓交金额需在可缓交金额范围内)
- /// </summary>
- /// <param name="chargeDelayView"></param>
- public void ChaegeDelayEdit(ChargeDelayView chargeDelayView)
- {
- try
- {
- //注:可通过缓交申请表单来获取相关缓交信息(目前暂时不采用此种方式)
- //查询缓交申请工作流程开始环节状态
- var chargeDelayStartStatus = this.GetStartStatus();
- if (chargeDelayStartStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
- }
- if (chargeDelayView.ChargeDelayID == null || chargeDelayView.ChargeDelayID == Guid.Empty)
- {
- //申请
- var chargeDelayStandardView = this.GetChargeDelayStandardView(chargeDelayView.UserID,
- chargeDelayView.ChargeYear, chargeDelayView.ChargeProjectID);
- if (chargeDelayStandardView == null)
- {
- throw new Exception("数据有误,请核查");
- }
- //缓交金额需在可缓交金额范围内
- if (chargeDelayStandardView.DelayAmount > chargeDelayStandardView.CanDelayAmount)
- {
- throw new Exception("缓交金额不能大于可缓交金额,请核查");
- }
- else
- {
- EC_ChargeDelay newChargeDelay = new EC_ChargeDelay();
- newChargeDelay.ChargeDelayID = Guid.NewGuid();
- newChargeDelay.StudentChargeID = chargeDelayStandardView.StudentChargeID;
- newChargeDelay.DelayAmount = chargeDelayView.DelayAmount;
- newChargeDelay.DelayPercent = chargeDelayView.DelayPercent;
- newChargeDelay.Reason = chargeDelayView.Reason;
- SetNewStatus(newChargeDelay, chargeDelayStartStatus.Value);
- UnitOfWork.Add(newChargeDelay);
- }
- }
- else
- {
- //修改(只能对未开始流程的信息进行修改-未提交)
- if (chargeDelayView.RecordStatus != chargeDelayStartStatus)
- {
- throw new Exception("只能对未提交状态的信息进行修改");
- }
- //缓交金额需在可缓交金额范围内
- if (chargeDelayView.DelayAmount > chargeDelayView.CanDelayAmount)
- {
- throw new Exception("缓交金额不能大于可缓交金额,请核查");
- }
- else
- {
- //查询对应的缓交信息
- var chargeDelay = chargeDelayDAL.ChargeDelayRepository
- .GetList(x => x.ChargeDelayID == chargeDelayView.ChargeDelayID).SingleOrDefault();
- chargeDelay.DelayAmount = chargeDelayView.DelayAmount;
- chargeDelay.DelayPercent = chargeDelayView.DelayPercent;
- chargeDelay.Reason = chargeDelayView.Reason;
- SetModifyStatus(chargeDelay);
- }
- }
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <returns></returns>
- public bool ChargeDelayDelete(List<Guid> chargeDelayIDs)
- {
- try
- {
- //查询缓交申请工作流程开始环节状态
- var chargeDelayStartStatus = this.GetStartStatus();
- if (chargeDelayStartStatus == null)
- {
- throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
- }
- //查询对应的缓交信息流程状态ID
- var recordStatusList = chargeDelayDAL.ChargeDelayRepository.GetList(x => chargeDelayIDs.Contains(x.ChargeDelayID))
- .Select(x => x.RecordStatus).ToList();
- foreach (var recordStatus in recordStatusList)
- {
- if (recordStatus != chargeDelayStartStatus)
- {
- throw new Exception("只能对未提交状态的信息进行删除");
- }
- }
- UnitOfWork.Delete<EC_ChargeDelay>(x => chargeDelayIDs.Contains(x.ChargeDelayID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <param name="userID"></param>
- /// <param name="comment"></param>
- /// <returns></returns>
- public string SubmitChargeDelay(List<Guid> chargeDelayIDs, Guid userID, string comment)
- {
- try
- {
- //查询缓交申请工作流程开始环节状态
- var startStatusID = this.GetStartStatus();
- if (startStatusID == null)
- {
- throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
- }
- //查询对应的缓交信息List
- var chargeDelayList = chargeDelayDAL.ChargeDelayRepository
- .GetList(x => chargeDelayIDs.Contains(x.ChargeDelayID)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- var submitIDList = new List<Guid>();
- foreach (var chargeDelay in chargeDelayList)
- {
- if (chargeDelay.RecordStatus == startStatusID)
- {
- submitIDList.Add(chargeDelay.ChargeDelayID);
- success++;
- }
- else
- {
- fail++;
- }
- }
- this.StartUp(submitIDList, userID, comment);
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条," + fail + "条失败,原因:选择提交的数据有误,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 审核(可批量)
- /// </summary>
- /// <param name="chargeDelayIDs"></param>
- /// <param name="userID"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- public void ApproveChargeDelay(List<Guid?> chargeDelayIDs, Guid userID, Guid actionID, string comment)
- {
- try
- {
- //查询对应的缓交信息List
- var chargeDelayList = chargeDelayDAL.ChargeDelayRepository
- .GetList(x => chargeDelayIDs.Contains(x.ChargeDelayID)).ToList();
- var apprveIDList = new List<Guid>();
- foreach (var chargeDelayID in chargeDelayIDs)
- {
- //查询对应的缓交信息
- var chargeDelay = chargeDelayList.Where(x => x.ChargeDelayID == chargeDelayID).SingleOrDefault();
- if (chargeDelay == null)
- {
- throw new Exception("数据有误,请核查");
- }
- apprveIDList.Add(chargeDelay.ChargeDelayID);
- }
- //审核
- this.Approve(apprveIDList, userID, actionID, comment);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的缓交名单信息View(学生平台)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="userID"></param>
- /// <param name="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <param name="chargeDelayStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<ChargeDelayView> GetStudentChargeDelayViewGrid(ConfiguretView configuretView, Guid userID, int? chargeYearID,
- Guid? chargeProjectID, int? chargeDelayStatus, int pageIndex, int pageSize)
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- //缓交名单
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelay = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (chargeDelayStatus.HasValue)
- {
- //审批状态
- expChargeDelay = expChargeDelay.And(x => x.RecordStatus == chargeDelayStatus);
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //用户信息ID
- expStudentCharge = expStudentCharge.And(x => x.UserID == userID);
- if (chargeYearID.HasValue)
- {
- //缴费学年
- expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
- }
- if (chargeProjectID.HasValue)
- {
- //收费项目
- expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //学生信息ID
- expStudent = expStudent.And(x => x.UserID == userID);
- var query = chargeDelayDAL.GetChargeDelayQueryAble(expChargeDelay, expStudentCharge, expStudent);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.ChargeProjectStr).ThenByDescending(x => x.ChargeYear)
- .ThenBy(x => x.RecordStatus).ThenBy(x => x.CreateTime)
- .ToGridResultSet<ChargeDelayView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.RecordStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询对应的缓交名单信息List(学生平台)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="userID"></param>
- /// <param name="chargeYearID"></param>
- /// <param name="chargeProjectID"></param>
- /// <param name="chargeDelayStatus"></param>
- /// <returns></returns>
- public List<ChargeDelayView> GetStudentChargeDelayViewList(ConfiguretView configuretView, Guid userID, int? chargeYearID,
- Guid? chargeProjectID, int? chargeDelayStatus)
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- //缓交名单
- Expression<Func<EC_ChargeDelay, bool>> expChargeDelay = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (chargeDelayStatus.HasValue)
- {
- //审批状态
- expChargeDelay = expChargeDelay.And(x => x.RecordStatus == chargeDelayStatus);
- }
- //应收名单
- Expression<Func<EC_StudentCharge, bool>> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //用户信息ID
- expStudentCharge = expStudentCharge.And(x => x.UserID == userID);
- if (chargeYearID.HasValue)
- {
- //缴费学年
- expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
- }
- if (chargeProjectID.HasValue)
- {
- //收费项目
- expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //学生信息ID
- expStudent = expStudent.And(x => x.UserID == userID);
- var query = chargeDelayDAL.GetChargeDelayQueryAble(expChargeDelay, expStudentCharge, expStudent);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.ChargeProjectStr).ThenByDescending(x => x.ChargeYear)
- .ThenBy(x => x.RecordStatus).ThenBy(x => x.CreateTime)
- .ToList();
- result.ForEach(x => x.RecordStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.RecordStatus).Name);
- return result;
- }
- }
- }
|