12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Transactions;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.GraduationManage.GraduateCardManage;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.DataLogic.GraduationManage.GraduateCardManage;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.GraduationManage.GraduateCardManage
- {
- public class GraduateCardApplyServices : BaseWorkflowServices<ER_GraduateCardApply>, IGraduateCardApplyServices, IFileUploadServices
- {
- public GraduateCardApplyDAL GraduateCardApplyDAL { get; set; }
- public Lazy<IInSchoolSettingServices> InSchoolSettingServices { get; set; }
- public Lazy<IParameterServices> ParameterServices { get; set; }
- public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
- /// <summary>
- /// 查询去向申请信息View
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="campusID"></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="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<GraduateCardApplyView> GetGraduateCardApplyViewGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID,
- string learnSystem, int? graduationTypeID, int? inSchoolStatus, int? approvalStatus, int pageIndex, int pageSize)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- //审核流程状态IDList
- 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_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => applyStatusIDList.Contains(x.ApprovalStatus));
- if (gradSchoolyearID.HasValue)
- {
- //毕业学期(实际的毕业学期)
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expGraduateCardApply = expGraduateCardApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.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 = GraduateCardApplyDAL.GetGraduateCardApplyViewQueryable(expGraduateCardApply, expStudent);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == 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.ClassNo.Length).ThenBy(x => x.ClassNo)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ThenBy(x => x.GraduatingSemesterValue)
- .ToGridResultSet<GraduateCardApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询去向申请信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="campusID"></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="graduationTypeID"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="approvalStatus"></param>
- /// <returns></returns>
- public IList<GraduateCardApplyView> GetGraduateCardApplyViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID,
- string learnSystem, int? graduationTypeID, int? inSchoolStatus, int? approvalStatus)
- {
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- //审核流程状态IDList
- 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_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => applyStatusIDList.Contains(x.ApprovalStatus));
- if (gradSchoolyearID.HasValue)
- {
- //毕业学期(实际的毕业学期)
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expGraduateCardApply = expGraduateCardApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.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 = GraduateCardApplyDAL.GetGraduateCardApplyViewQueryable(expGraduateCardApply, expStudent);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == 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.ClassNo.Length).ThenBy(x => x.ClassNo)
- .ThenBy(x => x.StudentNo.Length).ThenBy(x => x.StudentNo)
- .ThenBy(x => x.GraduatingSemesterValue)
- .ToList();
- result.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询对应的去向申请信息GraduateCardApplyView
- /// </summary>
- /// <param name="graduateCardApplyID"></param>
- /// <returns></returns>
- public GraduateCardApplyView GetGraduateCardApplyView(Guid? graduateCardApplyID)
- {
- try
- {
- var graduateCardApplyView = GraduateCardApplyDAL.GetGraduateCardApplyViewQueryable(x => x.GraduateCardApplyID == graduateCardApplyID)
- .SingleOrDefault();
- return graduateCardApplyView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 名单生成(新增、修改)
- /// 新增包括:毕业学期小于等于当前启用的毕业学期、学籍信息为在校(排除在校状态为结业、毕业的信息)、在毕业申请允许最大年限(年)范围内
- /// 修改:未提交
- /// 业务主键:学生信息ID、毕业学期ID(实际的毕业学期)
- /// </summary>
- /// <returns></returns>
- public string GraduateCardApplyEdit()
- {
- try
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- if (approveStatusList == null || approveStatusList.Count() <= 0)
- {
- throw new Exception("工作流平台中,毕业去向流程未配置,请核查。");
- }
- //查询工作流程开始环节状态
- var approveStartStatusID = this.GetStartStatus();
- if (approveStartStatusID == null)
- {
- throw new Exception("工作流平台中,毕业去向流程开始环节未配置,请核查。");
- }
- //查询工作流程结束环节状态
- var approveEndStatusID = this.GetCorrectEndStatus();
- if (approveEndStatusID == null)
- {
- throw new Exception("工作流平台中,毕业去向流程结束环节未配置,请核查。");
- }
- //查询工作流程审核流程状态IDList
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- var applyStatusIDList = approveStatusList.Where(x => x.ID != approveEndStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- //查询培养类型设置信息List
- var educationTypeSettingList = GraduateCardApplyDAL.EducationTypeSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- if (educationTypeSettingList == null || educationTypeSettingList.Count() <= 0)
- {
- throw new Exception("培养类型设置未设置,请设置。");
- }
- //查询设置的毕业学期信息
- var graduatingSemesterID = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationSchoolyear);
- if (!string.IsNullOrEmpty(graduatingSemesterID))
- {
- var graSchoolYearView = SchoolYearServices.Value.GetSchoolYearView(Guid.Parse(graduatingSemesterID));
- if (graSchoolYearView == null)
- {
- throw new Exception("毕业学期设置有误,请重新设置。");
- }
- //查询设置的毕业申请允许最大年限(年)
- var setGraduationApplyMaxAgeLimit = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationApplyMaxAgeLimit);
- if (setGraduationApplyMaxAgeLimit == null)
- {
- throw new Exception("未设置毕业申请允许最大年限(年),请设置。");
- }
- var graduationApplyMaxAgeLimit = Convert.ToDecimal(setGraduationApplyMaxAgeLimit);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //在校状态
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- //排除在校状态为毕业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Graduation);
- //排除在校状态为结业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Complete);
- //毕业学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //应届、往届毕业(小于等于当前启用的毕业学期)
- expSchoolyear = expSchoolyear.And(x => x.Value <= graSchoolYearView.Value);
- //去向申请(需排除的信息)
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //去向申请中待审核、已通过状态
- expGraduateCardApply = expGraduateCardApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus)
- || x.ApprovalStatus == approveEndStatusID);
- //查询对应的毕业学生信息ViewList(注:数据范围)
- var query = GraduateCardApplyDAL.GetGraduationStudentViewQueryable(expStudent, expSchoolyear,
- expGraduateCardApply, graSchoolYearView.SchoolYearID);
- //在毕业申请允许最大年限(年)范围内
- query = query.Where(x => x.GraduationAgeLimitValue <= graduationApplyMaxAgeLimit);
- //匹配对应的数据范围
- var graduationStudentViewList = this.GetQueryByDataRangeByCollege(query).ToList();
- //对应的学生信息IDList
- var userIDList = graduationStudentViewList.Select(x => x.UserID).ToList();
- //查询去向申请信息graduateCardApplyList
- var graduateCardApplyList = GraduateCardApplyDAL.GraduateCardApplyRepository.GetList(x => true).ToList();
- //匹配对应的条件查询
- graduateCardApplyList = graduateCardApplyList.Where(x => userIDList.Contains(x.UserID)).ToList();
- int insert = 0;
- int update = 0;
- string tipMessage = null;
- List<ER_GraduateCardApply> graduateCardApplyInList = new List<ER_GraduateCardApply>();
- List<ER_GraduateCardApply> graduateCardApplyUpList = new List<ER_GraduateCardApply>();
- foreach (var graduationStudentView in graduationStudentViewList)
- {
- //根据对应的信息查询去向申请信息
- var graduateCardApply = graduateCardApplyList.Where(x => x.UserID == graduationStudentView.UserID
- && x.GraduatingSemesterID == graSchoolYearView.SchoolYearID)
- .SingleOrDefault();
- if (graduateCardApply == null)
- {
- //新增
- ER_GraduateCardApply newGraduateCardApply = new ER_GraduateCardApply();
- newGraduateCardApply.GraduateCardApplyID = Guid.NewGuid();
- newGraduateCardApply.UserID = graduationStudentView.UserID;
- if (graduationStudentView.GraduatingSemesterValue == graSchoolYearView.Value)
- {
- //应届
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Fresh;
- }
- else if (graduationStudentView.GraduatingSemesterValue < graSchoolYearView.Value)
- {
- //往届
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Former;
- }
- else
- {
- //提前
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Advance;
- }
- newGraduateCardApply.GraduatingSemesterID = graSchoolYearView.SchoolYearID;
- newGraduateCardApply.NeedCardResult = null;
- newGraduateCardApply.ApprovalStatus = approveStartStatusID;
- newGraduateCardApply.Remark = null;
- SetNewStatus(newGraduateCardApply);
- graduateCardApplyInList.Add(newGraduateCardApply);
- insert++;
- }
- else
- {
- //表示修改(只处理未提交状态)if (applyStatusIDList.Any(x => x == graduateCardApply.ApprovalStatus))
- if (graduateCardApply.ApprovalStatus == approveStartStatusID)
- {
- if (graduationStudentView.GraduatingSemesterValue == graSchoolYearView.Value)
- {
- //应届
- graduateCardApply.GraduationTypeID = (int)ER_GraduationType.Fresh;
- }
- else if (graduationStudentView.GraduatingSemesterValue < graSchoolYearView.Value)
- {
- //往届
- graduateCardApply.GraduationTypeID = (int)ER_GraduationType.Former;
- }
- else
- {
- //提前
- graduateCardApply.GraduationTypeID = (int)ER_GraduationType.Advance;
- }
- graduateCardApply.NeedCardResult = null;
- SetModifyStatus(graduateCardApply);
- graduateCardApplyUpList.Add(graduateCardApply);
- update++;
- }
- }
- }
- //批量插入
- UnitOfWork.BulkInsert<ER_GraduateCardApply>(graduateCardApplyInList);
- if (graduateCardApplyUpList != null && graduateCardApplyUpList.Count() > 0)
- {
- //批量更新
- UnitOfWork.BatchUpdate<ER_GraduateCardApply>(graduateCardApplyUpList);
- }
- if (insert > 0 && update <= 0)
- {
- tipMessage = insert + "条";
- }
- else
- {
- tipMessage = insert + "条,更新成功" + update + "条";
- }
- return tipMessage;
- }
- else
- {
- throw new Exception("未设置毕业学期,请设置。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的附件文件(根据外键表ID)
- /// </summary>
- /// <param name="formID"></param>
- /// <returns></returns>
- public List<FileUploadView> GetFileList(Guid? formID)
- {
- var query = GraduateCardApplyDAL.GetGraduateCardApplyAttachmentQueryable(x => x.GraduateCardApplyID == formID).ToList();
- return query;
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
- /// </summary>
- /// <param name="graduateCardApplyView"></param>
- /// <param name="fileList"></param>
- public void GraduateCardApplyEdit(GraduateCardApplyView graduateCardApplyView, List<FileUploadView> fileList)
- {
- 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("工作流平台中,毕业去向流程开始环节未配置,请核查。");
- }
- //结束流程环节ID
- var endStatusID = this.GetCorrectEndStatus();
- if (endStatusID == null)
- {
- throw new Exception("工作流平台中,毕业去向流程结束环节未配置,请核查。");
- }
- //审核流程状态IDList
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- var applyStatusIDList = approveStatusList.Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- //查询培养类型设置信息List
- var educationTypeSettingList = GraduateCardApplyDAL.EducationTypeSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- if (educationTypeSettingList == null || educationTypeSettingList.Count() <= 0)
- {
- throw new Exception("培养类型设置未设置,请设置。");
- }
- //查询数据库进行验证
- var graduateCardApplyVerification = GraduateCardApplyDAL.GraduateCardApplyRepository
- .GetList(x => x.GraduateCardApplyID != graduateCardApplyView.GraduateCardApplyID
- && x.UserID == graduateCardApplyView.UserID
- && x.GraduatingSemesterID == graduateCardApplyView.GraduatingSemesterID)
- .SingleOrDefault();
- if (graduateCardApplyVerification == null)
- {
- //数据有误验证
- if (graduateCardApplyView.GraduateCardApplyID != Guid.Empty)
- {
- var graduateCardApply = GraduateCardApplyDAL.GraduateCardApplyRepository
- .GetList(x => x.GraduateCardApplyID == graduateCardApplyView.GraduateCardApplyID,
- (x => x.ER_GraduateCardApplyAttachment)).SingleOrDefault();
- if (graduateCardApply == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- if (applyStatusIDList.Any(x => x == graduateCardApply.ApprovalStatus))
- {
- graduateCardApply.GraduationTypeID = graduateCardApplyView.GraduationTypeID;
- graduateCardApply.Remark = graduateCardApplyView.Remark;
- SetModifyStatus(graduateCardApply);
- }
- else
- {
- throw new Exception("数据有误,请核查(只能修改未提交、已退回状态的信息)。");
- }
- }
- }
- else
- {
- //表示新增
- ER_GraduateCardApply newGraduateCardApply = new ER_GraduateCardApply();
- newGraduateCardApply.GraduateCardApplyID = Guid.NewGuid();
- newGraduateCardApply.UserID = graduateCardApplyView.UserID;
- newGraduateCardApply.GraduationTypeID = graduateCardApplyView.GraduationTypeID;
- newGraduateCardApply.GraduatingSemesterID = graduateCardApplyView.GraduatingSemesterID;
- newGraduateCardApply.NeedCardResult = null;
- newGraduateCardApply.ApprovalStatus = approveStartStatus;
- newGraduateCardApply.Remark = graduateCardApplyView.Remark;
- SetNewStatus(newGraduateCardApply);
- UnitOfWork.Add(newGraduateCardApply);
- }
- }
- else
- {
- throw new Exception("已存在相同的去向申请信息,请核查。");
- }
- //事务提交
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 去向申请批量新增(业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
- /// </summary>
- /// <param name="graduationStudentViewList"></param>
- /// <param name="graduateCardApplyView"></param>
- /// <returns></returns>
- public string GraduateCardApplyBatchAdd(List<GraduateCardApplyView> graduationStudentViewList, GraduateCardApplyView graduateCardApplyView)
- {
- try
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- if (approveStatusList == null || approveStatusList.Count() <= 0)
- {
- throw new Exception("工作流平台中,毕业去向流程未配置,请核查。");
- }
- //查询工作流程开始环节状态
- var approveStartStatusID = this.GetStartStatus();
- if (approveStartStatusID == null)
- {
- throw new Exception("工作流平台中,毕业去向流程开始环节未配置,请核查。");
- }
- //查询工作流程结束环节状态
- var approveEndStatusID = this.GetCorrectEndStatus();
- if (approveEndStatusID == null)
- {
- throw new Exception("工作流平台中,毕业去向流程结束环节未配置,请核查。");
- }
- //查询培养类型设置信息List
- var educationTypeSettingList = GraduateCardApplyDAL.EducationTypeSettingRepository
- .GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).ToList();
- if (educationTypeSettingList == null || educationTypeSettingList.Count() <= 0)
- {
- throw new Exception("培养类型设置未设置,请设置。");
- }
- //查询设置的毕业学期信息
- var graduatingSemesterID = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationSchoolyear);
- if (!string.IsNullOrEmpty(graduatingSemesterID))
- {
- var graSchoolYearView = SchoolYearServices.Value.GetSchoolYearView(Guid.Parse(graduatingSemesterID));
- if (graSchoolYearView == null)
- {
- throw new Exception("毕业学期设置有误,请重新设置。");
- }
- //查询设置的毕业申请允许最大年限(年)
- var setGraduationApplyMaxAgeLimit = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationApplyMaxAgeLimit);
- if (setGraduationApplyMaxAgeLimit == null)
- {
- throw new Exception("未设置毕业申请允许最大年限(年),请设置。");
- }
- //查询去向申请信息graduationApplyList
- var graduateCardApplyList = GraduateCardApplyDAL.GraduateCardApplyRepository.GetList(x => true).ToList();
- //查询对应的学生信息userIDList
- var userIDList = graduationStudentViewList.Where(x => !string.IsNullOrEmpty(x.UserID.ToString()))
- .Select(x => x.UserID).ToList();
- //匹配对应的条件查询
- graduateCardApplyList = graduateCardApplyList.Where(x => userIDList.Contains(x.UserID)).ToList();
- int success = 0; //成功
- int fail = 0; //失败
- string tipMessage = null; //提示消息
- List<ER_GraduateCardApply> graduateCardApplyInList = new List<ER_GraduateCardApply>();
- foreach (var graduationStudentView in graduationStudentViewList)
- {
- //根据对应的信息查询去向申请信息(业务主键:学生信息ID、毕业学期ID(实际的毕业学期))
- var graduateCardApply = graduateCardApplyList.Where(x => x.UserID == graduationStudentView.UserID
- && x.GraduatingSemesterID == graSchoolYearView.SchoolYearID)
- .SingleOrDefault();
- if (graduateCardApply == null)
- {
- //新增
- ER_GraduateCardApply newGraduateCardApply = new ER_GraduateCardApply();
- newGraduateCardApply.GraduateCardApplyID = Guid.NewGuid();
- newGraduateCardApply.UserID = graduationStudentView.UserID;
- if (graduationStudentView.GraduatingSemesterValue == graSchoolYearView.Value)
- {
- //应届
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Fresh;
- }
- else if (graduationStudentView.GraduatingSemesterValue < graSchoolYearView.Value)
- {
- //往届
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Former;
- }
- else
- {
- //提前
- newGraduateCardApply.GraduationTypeID = (int)ER_GraduationType.Advance;
- }
- newGraduateCardApply.GraduatingSemesterID = graSchoolYearView.SchoolYearID;
- newGraduateCardApply.NeedCardResult = null;
- newGraduateCardApply.ApprovalStatus = approveStartStatusID;
- newGraduateCardApply.Remark = null;
- SetNewStatus(newGraduateCardApply);
- graduateCardApplyInList.Add(newGraduateCardApply);
- success++;
- }
- else
- {
- //表示已存在相同的去向申请信息
- fail++;
- }
- }
- //批量插入
- UnitOfWork.BulkInsert<ER_GraduateCardApply>(graduateCardApplyInList);
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条,失败" + fail + "条,原因:已存在相同的去向申请信息,请检查";
- }
- return tipMessage;
- }
- else
- {
- throw new Exception("未设置毕业学期,请设置。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询未新增毕业学生信息GraduateCardApplyView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<GraduateCardApplyView> GetGraduationStudentNoAddViewGrid(ConfiguretView configuretView, Guid? campusID,
- Guid? collegeID, int? schoolyearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- int? inSchoolStatus, Guid? gradSchoolyearID, int pageIndex, int pageSize)
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- //查询工作流程结束环节状态
- var approveEndStatusID = this.GetCorrectEndStatus();
- //查询工作流程审核流程状态IDList
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- var applyStatusIDList = approveStatusList.Where(x => x.ID != approveEndStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- //查询设置的毕业学期信息
- var graduatingSemesterID = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationSchoolyear);
- //查询毕业学期对应的学年学期信息graSchoolYearView
- var graSchoolYearView = SchoolYearServices.Value.GetSchoolYearView(Guid.Parse(graduatingSemesterID));
- //查询设置的毕业申请允许最大年限(年)
- var setGraduationApplyMaxAgeLimit = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationApplyMaxAgeLimit);
- var graduationApplyMaxAgeLimit = Convert.ToDecimal(setGraduationApplyMaxAgeLimit);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- //排除在校状态为毕业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Graduation);
- //排除在校状态为结业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Complete);
- //毕业学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //应届、往届毕业(小于等于当前启用的毕业学期)
- expSchoolyear = expSchoolyear.And(x => x.Value <= graSchoolYearView.Value);
- //去向申请(需排除的信息)
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //去向申请中待审核、已通过状态
- expGraduateCardApply = expGraduateCardApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus)
- || x.ApprovalStatus == approveEndStatusID);
- //查询对应的毕业学生信息ViewList(注:数据范围)
- var query = GraduateCardApplyDAL.GetGraduationStudentNoAddViewQueryable(expStudent, expSchoolyear,
- expGraduateCardApply, graSchoolYearView.SchoolYearID);
- //在毕业申请允许最大年限(年)范围内
- query = query.Where(x => x.GraduationAgeLimitValue <= graduationApplyMaxAgeLimit);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (schoolyearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- }
- 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 (gradSchoolyearID.HasValue)
- {
- //预毕业学期
- query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- 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.ClassNo.Length)
- .ThenBy(x => x.ClassNo).ThenBy(x => x.StudentNo.Length)
- .ThenBy(x => x.StudentNo).ThenBy(x => x.GraduatingSemesterValue)
- .ToGridResultSet<GraduateCardApplyView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询未新增毕业学生信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="inSchoolStatus"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <returns></returns>
- public IList<GraduateCardApplyView> GetGraduationStudentNoAddViewList(ConfiguretView configuretView, Guid? campusID,
- Guid? collegeID, int? schoolyearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- int? inSchoolStatus, Guid? gradSchoolyearID)
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- //查询工作流程结束环节状态
- var approveEndStatusID = this.GetCorrectEndStatus();
- //查询工作流程审核流程状态IDList
- var approveStatusIDList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- var applyStatusIDList = approveStatusList.Where(x => x.ID != approveEndStatusID && !approveStatusIDList.Contains(x.ID))
- .Select(x => x.ID).ToList();
- //查询设置的毕业学期信息
- var graduatingSemesterID = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationSchoolyear);
- //查询毕业学期对应的学年学期信息graSchoolYearView
- var graSchoolYearView = SchoolYearServices.Value.GetSchoolYearView(Guid.Parse(graduatingSemesterID));
- //查询设置的毕业申请允许最大年限(年)
- var setGraduationApplyMaxAgeLimit = ParameterServices.Value.GetParameterValue(CF_ParameterType.GraduationApplyMaxAgeLimit);
- var graduationApplyMaxAgeLimit = Convert.ToDecimal(setGraduationApplyMaxAgeLimit);
- //学生信息
- Expression<Func<CF_Student, bool>> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (inSchoolStatus != null && inSchoolStatus > -1)
- {
- var inschoolStatusList = InSchoolSettingServices.Value.GetInschoolStatusList(true);
- if (inSchoolStatus == 1)
- {
- //表示在校
- expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- if (inSchoolStatus == 0)
- {
- //不在校
- expStudent = expStudent.And(x => !inschoolStatusList.Contains(x.InSchoolStatusID));
- }
- }
- //排除在校状态为毕业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Graduation);
- //排除在校状态为结业的信息
- expStudent = expStudent.And(x => x.InSchoolStatusID != (int)CF_InschoolStatus.Complete);
- //毕业学期
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> expSchoolyear = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //应届、往届毕业(小于等于当前启用的毕业学期)
- expSchoolyear = expSchoolyear.And(x => x.Value <= graSchoolYearView.Value);
- //去向申请(需排除的信息)
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //去向申请中待审核、已通过状态
- expGraduateCardApply = expGraduateCardApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus)
- || x.ApprovalStatus == approveEndStatusID);
- //查询对应的毕业学生信息ViewList(注:数据范围)
- var query = GraduateCardApplyDAL.GetGraduationStudentNoAddViewQueryable(expStudent, expSchoolyear,
- expGraduateCardApply, graSchoolYearView.SchoolYearID);
- //在毕业申请允许最大年限(年)范围内
- query = query.Where(x => x.GraduationAgeLimitValue <= graduationApplyMaxAgeLimit);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (schoolyearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- }
- 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 (gradSchoolyearID.HasValue)
- {
- //预毕业学期
- query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- 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.ClassNo.Length)
- .ThenBy(x => x.ClassNo).ThenBy(x => x.StudentNo.Length)
- .ThenBy(x => x.StudentNo).ThenBy(x => x.GraduatingSemesterValue)
- .ToList();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduateCardApplyIDs"></param>
- /// <returns></returns>
- public bool GraduateCardApplyDelete(List<Guid?> graduateCardApplyIDs)
- {
- try
- {
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<ER_GraduateCardApplyAttachment>(x => graduateCardApplyIDs.Contains(x.GraduateCardApplyID));
- UnitOfWork.Delete<ER_GraduateCardApply>(x => graduateCardApplyIDs.Contains(x.GraduateCardApplyID));
- ts.Complete();
- return true;
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 查询去向申请对应的学生最终成绩信息FinallyScoreView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="graduateCardApplyID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="courseTypeID"></param>
- /// <param name="courseSelectTypeID"></param>
- /// <param name="examsCategoryID"></param>
- /// <param name="starttermID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="handleModeID"></param>
- /// <param name="isExecutablePlan"></param>
- /// <param name="executablePlanStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<FinallyScoreView> GetFinallyScoreViewGrid(ConfiguretView configuretView, Guid? graduateCardApplyID, Guid? schoolyearID,
- int? courseTypeID, int? courseSelectTypeID, int? examsCategoryID, int? starttermID, int? isMainCourse, int? handleModeID,
- int? isExecutablePlan, int? executablePlanStatus, int pageIndex, int pageSize)
- {
- //去向申请
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduateCardApplyID == graduateCardApplyID);
- var query = GraduateCardApplyDAL.GetFinallyScoreViewQueryable(expGraduateCardApply);
- if (schoolyearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- }
- if (courseTypeID.HasValue)
- {
- query = query.Where(x => x.CourseTypeID == courseTypeID);
- }
- if (courseSelectTypeID.HasValue)
- {
- query = query.Where(x => x.CourseSelectTypeID == courseSelectTypeID);
- }
- if (examsCategoryID.HasValue)
- {
- query = query.Where(x => x.ExamsCategoryID == examsCategoryID);
- }
- if (starttermID.HasValue)
- {
- query = query.Where(x => x.StarttermID == starttermID);
- }
- if (isMainCourse.HasValue)
- {
- //可否学位课程
- if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsMainCourse == true);
- }
- if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsMainCourse != true);
- }
- }
- if (handleModeID.HasValue)
- {
- query = query.Where(x => x.HandleModeID == handleModeID);
- }
- if (isExecutablePlan.HasValue)
- {
- //是否计划(执行计划)
- if (isExecutablePlan.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsExecutablePlan == true);
- }
- if (isExecutablePlan.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsExecutablePlan != true);
- }
- }
- if (executablePlanStatus.HasValue)
- {
- //执行计划状态
- query = query.Where(x => x.ExecutablePlanStatus == executablePlanStatus);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToGridResultSet<FinallyScoreView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询去向申请对应的学生最终成绩信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="graduateCardApplyID"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="courseTypeID"></param>
- /// <param name="courseSelectTypeID"></param>
- /// <param name="examsCategoryID"></param>
- /// <param name="starttermID"></param>
- /// <param name="isMainCourse"></param>
- /// <param name="handleModeID"></param>
- /// <param name="isExecutablePlan"></param>
- /// <param name="executablePlanStatus"></param>
- /// <returns></returns>
- public IList<FinallyScoreView> GetFinallyScoreViewList(ConfiguretView configuretView, Guid? graduateCardApplyID, Guid? schoolyearID,
- int? courseTypeID, int? courseSelectTypeID, int? examsCategoryID, int? starttermID, int? isMainCourse, int? handleModeID,
- int? isExecutablePlan, int? executablePlanStatus)
- {
- //去向申请
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduateCardApplyID == graduateCardApplyID);
- var query = GraduateCardApplyDAL.GetFinallyScoreViewQueryable(expGraduateCardApply);
- if (schoolyearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- }
- if (courseTypeID.HasValue)
- {
- query = query.Where(x => x.CourseTypeID == courseTypeID);
- }
- if (courseSelectTypeID.HasValue)
- {
- query = query.Where(x => x.CourseSelectTypeID == courseSelectTypeID);
- }
- if (examsCategoryID.HasValue)
- {
- query = query.Where(x => x.ExamsCategoryID == examsCategoryID);
- }
- if (starttermID.HasValue)
- {
- query = query.Where(x => x.StarttermID == starttermID);
- }
- if (isMainCourse.HasValue)
- {
- //可否学位课程
- if (isMainCourse.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsMainCourse == true);
- }
- if (isMainCourse.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsMainCourse != true);
- }
- }
- if (handleModeID.HasValue)
- {
- query = query.Where(x => x.HandleModeID == handleModeID);
- }
- if (isExecutablePlan.HasValue)
- {
- //是否计划(执行计划)
- if (isExecutablePlan.Value == (int)CF_GeneralPurpose.IsYes)
- {
- query = query.Where(x => x.IsExecutablePlan == true);
- }
- if (isExecutablePlan.Value == (int)CF_GeneralPurpose.IsNo)
- {
- query = query.Where(x => x.IsExecutablePlan != true);
- }
- }
- if (executablePlanStatus.HasValue)
- {
- //执行计划状态
- query = query.Where(x => x.ExecutablePlanStatus == executablePlanStatus);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderBy(x => x.SchoolyearCode.Length).ThenBy(x => x.SchoolyearCode)
- .ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode)
- .ToList();
- }
- /// <summary>
- /// 流程已退回跳转函数(工作流平台中配置)
- /// </summary>
- /// <param name="graduateCardApplyIDList"></param>
- /// <param name="userID"></param>
- public void OnApproveReturn(List<Guid> graduateCardApplyIDList, Guid? userID)
- {
- //查询对应的去向申请信息List
- var graduateCardApplyList = GraduateCardApplyDAL.GraduateCardApplyRepository
- .GetList(x => graduateCardApplyIDList.Contains(x.GraduateCardApplyID)).ToList();
- //更新对应的去向申请信息
- List<ER_GraduateCardApply> graduateCardApplyUpList = new List<ER_GraduateCardApply>();
- foreach (var graduateCardApply in graduateCardApplyList)
- {
- graduateCardApply.NeedCardResult = null;
- this.SetModifyStatus(graduateCardApply);
- graduateCardApplyUpList.Add(graduateCardApply);
- }
- this.UnitOfWork.BatchUpdate(graduateCardApplyUpList);
- }
- }
- }
|