123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.MinorGraduation.MinorGraduationManage;
- using EMIS.ViewModel;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Entities;
- using System.Linq.Expressions;
- using Bowin.Common.Linq;
- using EMIS.CommonLogic.Students;
- using EMIS.DataLogic.MinorGraduation.MinorGraduationManage;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.DataLogic.MinorGraduation.MinorGraduationSetting;
- using EMIS.Utility;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.MinorGraduation.MinorGraduationManage
- {
- public class MinorGraduationApplyServices : BaseWorkflowServices<ER_MinorGraduationApply>, IMinorGraduationApplyServices
- {
- public IInSchoolSettingServices inSchoolStatusSettingServices { get; set; }
- public MinorGraduationApplyDAL minorGraduationApplyDAL { get; set; }
- public IParameterServices parameterServices { get; set; }
- public ISchoolYearServices schoolYearServices { get; set; }
- public MinorGraduationConditionPackageDAL minorGraduationConditionPackageDAL { get; set; }
- public MinorGraduationConditionDAL minorGraduationConditionDAL { get; set; }
- /// <summary>
- /// 辅修毕业申请页面
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="graduationResult"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<MinorGraduationApplyView> GetMinorGraduationApplyViewGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, int pageIndex, int pageSize)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
-
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- exp = exp.And(x => applyStatusIDList.Contains(x.RecordStatus));
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToGridResultSet<MinorGraduationApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 辅修毕业申请页面(excel)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="graduationResult"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="idList"></param>
- /// <returns></returns>
- public List<MinorGraduationApplyView> GetMinorGraduationApplyViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List<Guid?> idList)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- exp = exp.And(x => applyStatusIDList.Contains(x.RecordStatus));
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- if (idList != null && idList.Count > 0)
- {
- exp = exp.And(x => idList.Contains(x.MinorGraduationApplyID));
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToList();
- result.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 辅修毕业审核页面
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="graduationResult"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<MinorGraduationApplyView> GetMinorGraduationApproveViewGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, int pageIndex, int pageSize)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x => approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- exp = exp.And(x => applyStatusIDList.Contains(x.RecordStatus));
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToGridResultSet<MinorGraduationApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 辅修毕业审核页面(excel)
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="graduationResult"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="idList"></param>
- /// <returns></returns>
- public List<MinorGraduationApplyView> GetMinorGraduationApproveViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List<Guid?> idList)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x =>approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- exp = exp.And(x => applyStatusIDList.Contains(x.RecordStatus));
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- if (idList != null && idList.Count > 0)
- {
- exp = exp.And(x => idList.Contains(x.MinorGraduationApplyID));
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToList();
- result.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- public IGridResultSet<MinorGraduationApplyView> GetMinorGraduationListGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, int pageIndex, int pageSize)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToGridResultSet<MinorGraduationApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- public List<MinorGraduationApplyView> GetMinorGraduationListList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List<Guid?> idList)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- var approveStatusIDList = this.GetApproveStatusViewList()
- .Select(x => x.ID).ToList();
- var applyStatusList = this.GetStatusViewList();
- var applyStatusIDList = applyStatusList.Where(x => approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- Expression<Func<ER_MinorGraduationApply, bool>> exp = x => true;
- Expression<Func<CF_Student, bool>> expstu = x => true;
- if (gradSchoolyearID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.CollegeID == collegeID);
- }
- if (standardID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.CF_Facultymajor.StandardID == standardID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- exp = exp.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (graduationResult.HasValue)
- {
- //毕业结论
- exp = exp.And(x => x.MinorGraduationResult == graduationResult);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- exp = exp.And(x => x.RecordStatus == approvalStatus);
- }
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expstu = expstu.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expstu = expstu.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- if (yearID.HasValue)
- {
- expstu = expstu.And(x => x.CF_Classmajor.CF_Grademajor.GradeID == yearID);
- }
- if (idList != null && idList.Count > 0)
- {
- exp = exp.And(x => idList.Contains(x.MinorGraduationApplyID));
- }
- var query = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(exp, expstu);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.GraduatingSemesterValue)
- .ThenBy(x => x.ApplySchoolyearCode.Length).ThenByDescending(x => x.ApplySchoolyearCode)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ToList();
- result.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- public void MinorGraduationApplyGenerate(int? yearID)
- {
- try
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- if (approveStatusList == null || approveStatusList.Count() <= 0)
- {
- throw new Exception("工作流平台中,毕业处理流程未配置,请核查");
- }
- //查询工作流程开始环节状态
- var approveStartStatus = this.GetStartStatus();
- if (approveStartStatus == null)
- {
- throw new Exception("工作流平台中,毕业处理流程开始环节未配置,请核查");
- }
- //查询设置的毕业学期信息
- var graduatingSemesterID = parameterServices.GetParameterValue(CF_ParameterType.GraduationSchoolyear);
- if (!string.IsNullOrEmpty(graduatingSemesterID))
- {
- var schoolYearView = schoolYearServices.GetSchoolYearView(Guid.Parse(graduatingSemesterID));
- if (schoolYearView == null)
- {
- throw new Exception("毕业学期设置有误,请重新设置");
- }
- //查询当前启用的学年学期View
- var currentSchoolYearView = schoolYearServices.GetCurrentSchoolYear();
- if (currentSchoolYearView == null)
- {
- throw new Exception("未设置启用的学年学期,请设置");
- }
- //在校状态
- var inschoolStatusList = inSchoolStatusSettingServices.GetInschoolStatusList(true);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- //毕业学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //应届、往届毕业
- expSchoolyear = expSchoolyear.And(x => x.Value <= schoolYearView.Value);
- var studentIDList = minorGraduationApplyDAL.classminorStudentRepository.GetList(x => true).Select(x => x.UserID).ToList();
- if (yearID.HasValue)
- {
- studentIDList = minorGraduationApplyDAL.classminorStudentRepository.GetList(x => x.CF_Classminor.CF_Grademinor.YearID == yearID).Select(x => x.UserID).ToList();
- }
- //对应的学生信息IDList
- //var userIDList = graduationStudentViewList.Select(x => x.UserID).ToList();
- //查询对应的毕业申请信息graduationApplyViewList
- var minorGraduationApplyViewList = minorGraduationApplyDAL.minorGraduationApplyRepository
- .GetList(x => true).ToList();
- //匹配对应的条件查询
- var dbMinorGraduationApplyViewList = minorGraduationApplyViewList.Where(x => studentIDList.Contains(x.UserID.Value)).ToList();
- List<ER_MinorGraduationApply> minorGraduationApplyInList = new List<ER_MinorGraduationApply>();
- foreach (var studentID in studentIDList)
- {
- //根据对应的信息查询毕业申请信息
- var minorGraduationApplyView = dbMinorGraduationApplyViewList.Where(x => x.UserID == studentID
- && x.GraduatingSemesterID == schoolYearView.SchoolYearID)
- .SingleOrDefault();
- if (minorGraduationApplyView == null)
- {
- //新增
- ER_MinorGraduationApply minorGraduationApply = new ER_MinorGraduationApply();
- minorGraduationApply.MinorGraduationApplyID = Guid.NewGuid();
- minorGraduationApply.UserID = studentID;
- //默认应届
- minorGraduationApply.GraduationTypeID = (int)ER_GraduationType.Fresh;
- minorGraduationApply.GraduatingSemesterID = schoolYearView.SchoolYearID;
- minorGraduationApply.ApplySchoolyearID = currentSchoolYearView.SchoolYearID;
- minorGraduationApply.RecordStatus = approveStartStatus;
- minorGraduationApply.MinorGraduationResult = (int)ER_GraduationResult.UnAudit;
- SetNewStatus(minorGraduationApply);
- minorGraduationApplyInList.Add(minorGraduationApply);
- }
- else
- {
- continue;
- }
- }
- UnitOfWork.BulkInsert<ER_MinorGraduationApply>(minorGraduationApplyInList); //批量插入
- UnitOfWork.Commit();
- }
- else
- {
- throw new Exception("未设置毕业学期,请设置");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public string MinorGraduationApplySubmit(List<Guid?> minorGraduationApplyIDs, Guid userID, MinorGraduationApplyView minorGraduationApplyView)
- {
- try
- {
- //查询工作流程开始环节状态
- var startStatusID = this.GetStartStatus();
- if (startStatusID == null)
- {
- throw new Exception("工作流平台中,开始环节流程未配置,请核查");
- }
- //查询对应的毕业申请信息List
- var minorGraduationApplyList = minorGraduationApplyDAL.minorGraduationApplyRepository
- .GetList(x => minorGraduationApplyIDs.Contains(x.MinorGraduationApplyID), (x => x.CF_Student)).ToList();
- if (minorGraduationApplyList.Any(x => x.CF_Student.StudentType != minorGraduationApplyView.StudentTypeID))
- {
- throw new Exception("提交的信息中学生类别与毕业公式不匹配,请核查");
- }
- //查询毕业公式对应的毕业条件信息
- var minorGraduationConditionViewList = minorGraduationConditionDAL
- .GetMinorGraduationConditionByPackageID(x => x.MinorGraduationConditionPackageID == minorGraduationApplyView.MinorGraduationConditionPackageID);
- if (minorGraduationConditionViewList == null || minorGraduationConditionViewList.Count() <= 0)
- {
- throw new Exception("毕业公式中毕业条件为空,请核查");
- }
- int success = 0; //成功
- int fail = 0; //失败
- bool isPass = true; //条件公式验证标识
- string tipMessage = null; //提示消息
- List<ER_MinorGraduationApply> graduationApplyUpList = new List<ER_MinorGraduationApply>();
- List<Guid> needSubmitIDList = new List<Guid>();
- List<Guid> needApproveIDList = new List<Guid>();
- foreach (var minorGraduationApply in minorGraduationApplyList)
- {
- foreach (var minorGraduationConditionView in minorGraduationConditionViewList)
- {
- var retValue = ReflectorHelper.RunMethod(minorGraduationConditionView.MethodFullName, minorGraduationApply.UserID);
- if (!(bool)retValue)
- {
- //表示条件不通过
- isPass = false;
- minorGraduationApply.MinorGraduationResult = (int)ER_GraduationResult.UnPass;
- minorGraduationApply.ApprovalResult = "条件不通过";
- //终止循环
- break;
- }
- }
- if (isPass)
- {
- if (minorGraduationApply.RecordStatus == startStatusID)
- {
- //提交--未提交状态
- needSubmitIDList.Add(minorGraduationApply.MinorGraduationApplyID);
- }
- else
- {
- //var actionView = this.GetActionView()
- // .Where(x => x.Pid == graduationApply.ApprovalStatus).SingleOrDefault();
- //提交--不包括开始环节状态的流程状态(如:已退回)
- needApproveIDList.Add(minorGraduationApply.MinorGraduationApplyID);
- }
- minorGraduationApply.MinorGraduationResult = (int)ER_GraduationResult.Graduation;
- minorGraduationApply.ApprovalResult = "条件通过";
- success++;
- }
- else
- {
- fail++;
- isPass = true;
- }
- minorGraduationApply.MinorGraduationConditionPackageID = minorGraduationApplyView.MinorGraduationConditionPackageID;
- SetModifyStatus(minorGraduationApply);
- graduationApplyUpList.Add(minorGraduationApply);
- }
- //批量统一提交更新
- if (graduationApplyUpList != null && graduationApplyUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate<ER_MinorGraduationApply>(graduationApplyUpList);
- }
- if (needSubmitIDList.Count > 0)
- {
- this.StartUp(needSubmitIDList, userID, minorGraduationApplyView.Comment);
- }
- if (needApproveIDList.Count > 0)
- {
- this.Approve(needApproveIDList, userID, Guid.Empty, minorGraduationApplyView.Comment);
- }
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条," + fail + "条失败,原因:条件不通过,请查看对应的预审说明";
- }
-
- UnitOfWork.Commit();
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public MinorGraduationApplyView GetMinorGraduationApproveView(Guid? minorGraduationApplyID)
- {
- try
- {
- var minorGraduationApproveView = minorGraduationApplyDAL.GetMinorGraduationApplyViewQueryable(x => x.MinorGraduationApplyID == minorGraduationApplyID, x => true)
- .SingleOrDefault();
- return minorGraduationApproveView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public void MinorGraduationApproveConfirm(List<Guid?> minorGraduationApplyIDs, Guid userID, Guid actionID, string comment)
- {
- try
- {
- //查询对应的毕业审核信息List
- var minorGraduationApplyList = minorGraduationApplyDAL.minorGraduationApplyRepository
- .GetList(x => minorGraduationApplyIDs.Contains(x.MinorGraduationApplyID)).ToList();
- foreach (var minorGraduationApplyID in minorGraduationApplyIDs)
- {
- //查询对应的毕业审核信息
- var minorGraduationApply = minorGraduationApplyList.Where(x => x.MinorGraduationApplyID == minorGraduationApplyID).SingleOrDefault();
- if (minorGraduationApply == null)
- {
- throw new Exception("数据有误,请核查");
- }
- }
- //审核
- this.Approve(minorGraduationApplyIDs.Select(x => x.Value).ToList(), userID, actionID, comment);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public void MinorGraduationApplyDelete(List<Guid?> minorGraduationApplyIDList)
- {
- try
- {
- UnitOfWork.Delete<ER_MinorGraduationApply>(x => minorGraduationApplyIDList.Contains(x.MinorGraduationApplyID));
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public void OnApproveEnd(List<Guid> minorGraduationApplyIDList, Guid? userID)
- {
- //辅修毕业审核通过时执行方法
- }
- }
- }
|