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, 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; } /// /// 辅修毕业申请页面 /// /// /// /// /// /// /// /// /// /// /// /// /// public IGridResultSet 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> exp = x => true; Expression> 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(pageIndex, pageSize); result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name); return result; } /// /// 辅修毕业申请页面(excel) /// /// /// /// /// /// /// /// /// /// /// /// public List GetMinorGraduationApplyViewList(ConfiguretView configuretView, Guid? gradSchoolyearID, Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List 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> exp = x => true; Expression> 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 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> exp = x => true; Expression> 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(pageIndex, pageSize); result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name); return result; } /// /// 辅修毕业审核页面(excel) /// /// /// /// /// /// /// /// /// /// /// /// public List GetMinorGraduationApproveViewList(ConfiguretView configuretView, Guid? gradSchoolyearID, Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List 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> exp = x => true; Expression> 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 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> exp = x => true; Expression> 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(pageIndex, pageSize); result.rows.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name); return result; } public List GetMinorGraduationListList(ConfiguretView configuretView, Guid? gradSchoolyearID, Guid? collegeID, int? yearID, int? standardID, int? graduationTypeID, int? inSchoolStatus, int? graduationResult, int? approvalStatus, List 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> exp = x => true; Expression> 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> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); //表示在校 expStudent = expStudent.And(x => inschoolStatusList.Contains(x.InSchoolStatusID)); //毕业学期 Expression> 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 minorGraduationApplyInList = new List(); 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(minorGraduationApplyInList); //批量插入 UnitOfWork.Commit(); } else { throw new Exception("未设置毕业学期,请设置"); } } catch (Exception ex) { throw new Exception(ex.Message); } } public string MinorGraduationApplySubmit(List 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 graduationApplyUpList = new List(); List needSubmitIDList = new List(); List needApproveIDList = new List(); 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(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 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 minorGraduationApplyIDList) { try { UnitOfWork.Delete(x => minorGraduationApplyIDList.Contains(x.MinorGraduationApplyID)); } catch (Exception ex) { throw new Exception(ex.Message); } } public void OnApproveEnd(List minorGraduationApplyIDList, Guid? userID) { //辅修毕业审核通过时执行方法 } } }