123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Transactions;
- using Bowin.Common.Utility;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.SystemView;
- using EMIS.ViewModel.EnrollManage.SpecialtyManage;
- using EMIS.DataLogic.EnrollManage.SpecialtyManage;
- using EMIS.CommonLogic.SystemServices;
- namespace EMIS.CommonLogic.EnrollManage.SpecialtyManage
- {
- public class SpecialtyApplyServices : BaseWorkflowServices<CF_SpecialtyApply>, ISpecialtyApplyServices
- {
- public SpecialtyApplyDAL specialtyApplyDAL { get; set; }
- /// <summary>
- /// 数据范围
- /// </summary>
- public SpecialtyApplyServices()
- {
- DataRangeUserFunc = ((x, y) => this.IsUserInDataRangeByCollege<CF_SpecialtyApply>(x, y, (w => w.CollegeID)));
- }
- /// <summary>
- /// 查询对应的专业申请信息View
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyApplyView> GetSpecialtyApplyViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, 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<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyApply = expSpecialtyApply.And(x => applyStatusIDList.Contains(x.ApprovalStatus));
- if (collegeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.GradeID == gradeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expSpecialtyApply = expSpecialtyApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- var query = specialtyApplyDAL.GetSpecialtyApplyViewQueryable(expSpecialtyApply);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- 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.CollegeCode).ThenByDescending(x => x.GradeID).ThenBy(x => x.StandardName)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem)
- .ThenBy(x => x.CreateTime).ToGridResultSet<SpecialtyApplyView>(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="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="approvalStatus"></param>
- /// <returns></returns>
- public List<SpecialtyApplyView> GetSpecialtyApplyViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, 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<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyApply = expSpecialtyApply.And(x => applyStatusIDList.Contains(x.ApprovalStatus));
- if (collegeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.GradeID == gradeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expSpecialtyApply = expSpecialtyApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- var query = specialtyApplyDAL.GetSpecialtyApplyViewQueryable(expSpecialtyApply);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- 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.CollegeCode).ThenByDescending(x => x.GradeID).ThenBy(x => x.StandardName)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ThenBy(x => x.CreateTime).ToList();
- result.ForEach(x => x.ApprovalStatusName = applyStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询对应的专业审核信息View
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyApplyView> GetSpecialtyAuditingViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, int? approvalStatus, int pageIndex, int pageSize)
- {
- var approveStatusList = this.GetApproveStatusViewList();
- var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
- //专业申请
- Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyApply = expSpecialtyApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
- if (collegeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.GradeID == gradeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expSpecialtyApply = expSpecialtyApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- var query = specialtyApplyDAL.GetSpecialtyApplyViewQueryable(expSpecialtyApply);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- 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.CollegeCode).ThenByDescending(x => x.GradeID).ThenBy(x => x.StandardName)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ThenBy(x => x.CreateTime).ToGridResultSet<SpecialtyApplyView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询对应的专业审核信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="approvalStatus"></param>
- /// <returns></returns>
- public IList<SpecialtyApplyView> GetSpecialtyAuditingViewList(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? gradeID,
- int? standardID, int? educationID, int? learningformID, string learnSystem, int? approvalStatus)
- {
- var approveStatusList = this.GetApproveStatusViewList();
- var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
- //专业申请
- Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyApply = expSpecialtyApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
- if (collegeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.GradeID == gradeID);
- }
- if (approvalStatus.HasValue)
- {
- //审批状态
- expSpecialtyApply = expSpecialtyApply.And(x => x.ApprovalStatus == approvalStatus);
- }
- var query = specialtyApplyDAL.GetSpecialtyApplyViewQueryable(expSpecialtyApply);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- 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.CollegeCode).ThenByDescending(x => x.GradeID).ThenBy(x => x.StandardName)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ThenBy(x => x.CreateTime).ToList();
- result.ForEach(x => x.ApprovalStatusName = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询专业审核信息CF_SpecialtyApply(只查询审核状态信息,根据业务主键:专业信息ID、院系所、年级、学期)
- /// </summary>
- /// <param name="specialtyID"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="semesterID"></param>
- /// <returns></returns>
- public CF_SpecialtyApply GetSpecialtyApply(Guid? specialtyID, Guid? collegeID, int? gradeID, int? semesterID)
- {
- try
- {
- var approveStatusList = this.GetApproveStatusViewList();
- var aprroveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
- Expression<Func<CF_SpecialtyApply, bool>> exp = (x => aprroveStatusIDList.Contains(x.ApprovalStatus));
- if (specialtyID.HasValue)
- {
- exp = exp.And(x => x.SpecialtyID == specialtyID);
- }
- if (collegeID.HasValue)
- {
- exp = exp.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- exp = exp.And(x => x.GradeID == gradeID);
- }
- if (semesterID.HasValue)
- {
- exp = exp.And(x => x.SemesterID == semesterID);
- }
- return specialtyApplyDAL.specialtyApplyRepository.GetSingle(exp);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询专业申请信息SpecialtyApplyView
- /// </summary>
- /// <param name="specialtyApplyID"></param>
- /// <returns></returns>
- public SpecialtyApplyView GetSpecialtyApplyView(Guid? specialtyApplyID)
- {
- try
- {
- var query = specialtyApplyDAL.GetSpecialtyApplyViewQueryable(x => x.SpecialtyApplyID == specialtyApplyID).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 申请(批量新增,业务主键:专业信息ID、年级、学期、院系所)
- /// </summary>
- /// <param name="specialtyIDList"></param>
- /// <param name="specialtyApplyView"></param>
- /// <returns></returns>
- public string SpecialtyApplyBatchAdd(List<Guid?> specialtyIDList, SpecialtyApplyView specialtyApplyView)
- {
- try
- {
- //查询对应的工作流程环节状态信息View
- var approveStatusList = this.GetStatusViewList();
- if (approveStatusList == null || approveStatusList.Count() <= 0)
- {
- throw new Exception("工作流平台中,招生专业流程未配置,请核查。");
- }
- //查询工作流程开始环节状态
- var startStatusID = this.GetStartStatus();
- if (startStatusID == null)
- {
- throw new Exception("工作流平台中,招生专业流程开始环节未配置,请核查。");
- }
- //专业申请
- Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expSpecialtyApply = expSpecialtyApply.And(x => specialtyIDList.Contains(x.SpecialtyID));
- //查询对应的专业申请信息List
- var specialtyApplyList = specialtyApplyDAL.specialtyApplyRepository.GetList(expSpecialtyApply).ToList();
- int success = 0;
- int fail = 0;
- string tipMessage = null;
- List<CF_SpecialtyApply> specialtyApplyInList = new List<CF_SpecialtyApply>();
- foreach (var specialtyID in specialtyIDList)
- {
- var specialtyApplyVerify = specialtyApplyList.Where(x => x.SpecialtyID == specialtyID && x.CollegeID == specialtyApplyView.CollegeID
- && x.GradeID == specialtyApplyView.GradeID && x.SemesterID == specialtyApplyView.SemesterID).SingleOrDefault();
- if (specialtyApplyVerify == null)
- {
- //新增
- var specialtyApply = new CF_SpecialtyApply();
- specialtyApply.SpecialtyApplyID = Guid.NewGuid();
- specialtyApply.SpecialtyID = specialtyID;
- specialtyApply.CollegeID = specialtyApplyView.CollegeID;
- specialtyApply.GradeID = specialtyApplyView.GradeID;
- specialtyApply.SemesterID = specialtyApplyView.SemesterID;
- specialtyApply.ApprovalStatus = startStatusID;
- specialtyApply.Remark = specialtyApplyView.Remark;
- SetNewStatus(specialtyApply);
- specialtyApplyInList.Add(specialtyApply);
- success++;
- }
- else
- {
- //表示已存在相同的专业申请信息
- fail++;
- }
- }
- UnitOfWork.BulkInsert<CF_SpecialtyApply>(specialtyApplyInList);
- if (success > 0 && fail <= 0)
- {
- tipMessage = success + "条";
- }
- else
- {
- tipMessage = success + "条," + fail + "条失败,原因:已存在相同的专业申请信息,请检查";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询专业申请中的未申请专业信息SpecialtyView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="collegeID"></param>
- /// <param name="gradeID"></param>
- /// <param name="semesterID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="scienceclassID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<SpecialtyView> GetSpecialtyViewNoApply(ConfiguretView configuretView, Guid? collegeID, int? gradeID, int? semesterID, int? standardID,
- int? educationID, int? learningformID, string learnSystem, int? scienceclassID, int pageIndex, int pageSize)
- {
- //专业信息(只查询启用状态的专业信息)
- Expression<Func<CF_Specialty, bool>> expSpecialty = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (standardID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- expSpecialty = expSpecialty.And(x => x.LearnSystem == LearnSystems);
- }
- if (scienceclassID.HasValue)
- {
- expSpecialty = expSpecialty.And(x => x.ScienceclassID == scienceclassID);
- }
- //专业申请
- Expression<Func<CF_SpecialtyApply, bool>> expSpecialtyApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.GradeID == gradeID);
- }
- if (semesterID.HasValue)
- {
- expSpecialtyApply = expSpecialtyApply.And(x => x.SemesterID == semesterID);
- }
- //招生专业
- Expression<Func<CF_RecruitSpecialty, bool>> expRecruitSpecialty = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (collegeID.HasValue)
- {
- expRecruitSpecialty = expRecruitSpecialty.And(x => x.CollegeID == collegeID);
- }
- if (gradeID.HasValue)
- {
- expRecruitSpecialty = expRecruitSpecialty.And(x => x.GradeID == gradeID);
- }
- if (semesterID.HasValue)
- {
- expRecruitSpecialty = expRecruitSpecialty.And(x => x.SemesterID == semesterID);
- }
- var query = specialtyApplyDAL.GetSpecialtyViewNoApplyQueryable(expSpecialty, expSpecialtyApply, expRecruitSpecialty);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.StandardName).ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID).ThenBy(x => x.LearnSystem).ToGridResultSet<SpecialtyView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="specialtyApplyIDs"></param>
- /// <returns></returns>
- public bool SpecialtyApplyDelete(List<Guid?> specialtyApplyIDs)
- {
- try
- {
- //var startStatusID = this.GetStartStatus();
- //if (startStatusID == null)
- //{
- // throw new Exception("工作流平台中,招生专业流程开始环节流程未配置,请核查");
- //}
- //var approvalStatusList = specialtyApplyDAL.specialtyApplyRepository.GetList(x => specialtyApplyIDs.Contains(x.SpecialtyApplyID)).Select(x => x.ApprovalStatus).ToList();
- //foreach (var approvalStatus in approvalStatusList)
- //{
- // if (approvalStatus != startStatusID)
- // {
- // throw new Exception("只能对未提交状态的信息进行删除");
- // }
- //}
- UnitOfWork.Delete<CF_SpecialtyApply>(x => specialtyApplyIDs.Contains(x.SpecialtyApplyID));
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 提交
- /// </summary>
- /// <param name="specialtyApplyIDs"></param>
- /// <param name="userID"></param>
- /// <param name="comment"></param>
- /// <returns></returns>
- public string SpecialtyApplySubmit(List<Guid> specialtyApplyIDs, Guid userID, string comment = "")
- {
- try
- {
- //查询招生专业工作流程开始环节状态
- var startStatusID = this.GetStartStatus();
- if (startStatusID == null)
- {
- throw new Exception("工作流平台中,招生专业流程开始环节流程未配置,请核查");
- }
- //查询对应的专业申请信息List
- var specialtyApplyList = specialtyApplyDAL.specialtyApplyRepository.GetList(x => specialtyApplyIDs.Contains(x.SpecialtyApplyID)).ToList();
- int success = 0; //成功
- string tipMessage = null; //提示消息
- var submitIDList = new List<Guid>();
- var approveIDList = new List<Guid>();
- foreach (var specialtyApply in specialtyApplyList)
- {
- if (specialtyApply.ApprovalStatus == startStatusID)
- {
- submitIDList.Add(specialtyApply.SpecialtyApplyID);
- }
- else
- {
- approveIDList.Add(specialtyApply.SpecialtyApplyID);
- }
- success++;
- }
- if (submitIDList.Count > 0)
- {
- this.StartUp(submitIDList, userID, comment);
- }
- if (approveIDList.Count > 0)
- {
- this.Approve(approveIDList, userID, Guid.Empty, comment);
- }
- tipMessage = success + "条";
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 审核确定(批量)
- /// </summary>
- /// <param name="specialtyApplyIDs"></param>
- /// <param name="userID"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- public void SpecialtyApproveConfirm(List<Guid?> specialtyApplyIDs, Guid userID, Guid actionID, string comment)
- {
- try
- {
- //查询对应的专业审核信息List
- var specialtyApplyList = specialtyApplyDAL.specialtyApplyRepository.GetList(x => specialtyApplyIDs.Contains(x.SpecialtyApplyID)).ToList();
- foreach (var specialtyApplyID in specialtyApplyIDs)
- {
- //查询对应的专业审核信息
- var specialtyApply = specialtyApplyList.Where(x => x.SpecialtyApplyID == specialtyApplyID).SingleOrDefault();
- if (specialtyApply == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- }
- //审核
- this.Approve(specialtyApplyIDs.Select(x => x.Value).ToList(), userID, actionID, comment);
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的流程审批步骤详细信息(暂时不用)
- /// </summary>
- /// <param name="specialtyApplyID"></param>
- /// <returns></returns>
- public IGridResultSet<WorkflowApproveHistoryView> GetWorkflowApproveHistoryView(Guid? specialtyApplyID)
- {
- try
- {
- var query = this.GetApproveHistoryViewList((Guid)specialtyApplyID).ToList();
- return query.AsQueryable<WorkflowApproveHistoryView>().ToGridResultSet<WorkflowApproveHistoryView>(0, 100);
- }
- catch (Exception)
- {
- throw;
- }
- }
- /// <summary>
- /// 流程结束跳转函数(工作流平台中配置)
- /// 注:需对招生专业信息进行处理(根据业务主键处理,专业信息ID、院系所、年级、学期)
- /// </summary>
- /// <param name="specialtyApplyIDList"></param>
- /// <param name="userID"></param>
- public void OnApproveEnd(List<Guid> specialtyApplyIDList, Guid? userID)
- {
- try
- {
- //查询对应的专业申请信息List
- var specialtyApplyList = specialtyApplyDAL.specialtyApplyRepository.GetList(x => specialtyApplyIDList.Contains(x.SpecialtyApplyID)).ToList();
- //招生专业
- Expression<Func<CF_RecruitSpecialty, bool>> expRecruitSpecialty = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- //查询招生专业信息
- var recruitSpecialtyList = specialtyApplyDAL.recruitSpecialtyRepository.GetList(expRecruitSpecialty).ToList();
- //流程审核通过结束状态
- var endApproveStatusID = this.GetCorrectEndStatus();
- List<CF_RecruitSpecialty> recruitSpecialtyInList = new List<CF_RecruitSpecialty>();
- List<CF_RecruitSpecialty> recruitSpecialtyUpList = new List<CF_RecruitSpecialty>();
- foreach (var specialtyApply in specialtyApplyList)
- {
- //对招生专业信息进行验证(专业信息ID、院系所ID、年级、学期)
- var recruitSpecialtyEntity = recruitSpecialtyList.Where(x => x.SpecialtyID == specialtyApply.SpecialtyID && x.CollegeID == specialtyApply.CollegeID
- && x.GradeID == specialtyApply.GradeID && x.SemesterID == specialtyApply.SemesterID).SingleOrDefault();
- if (recruitSpecialtyEntity == null)
- {
- //新增
- var recruitSpecialty = new CF_RecruitSpecialty();
- recruitSpecialty.RecruitSpecialtyID = Guid.NewGuid();
- recruitSpecialty.SpecialtyApplyID = specialtyApply.SpecialtyApplyID;
- recruitSpecialty.SpecialtyID = specialtyApply.SpecialtyID;
- recruitSpecialty.CollegeID = specialtyApply.CollegeID;
- recruitSpecialty.GradeID = specialtyApply.GradeID;
- recruitSpecialty.SemesterID = specialtyApply.SemesterID;
- recruitSpecialty.ApprovalStatus = endApproveStatusID;
- recruitSpecialty.isGenerated = false;
- recruitSpecialty.Remark = specialtyApply.Remark;
- SetNewStatus(recruitSpecialty);
- recruitSpecialtyInList.Add(recruitSpecialty);
- }
- else
- {
- //修改
- recruitSpecialtyEntity.SpecialtyApplyID = specialtyApply.SpecialtyApplyID;
- recruitSpecialtyEntity.ApprovalStatus = endApproveStatusID;
- SetModifyStatus(recruitSpecialtyEntity);
- recruitSpecialtyUpList.Add(recruitSpecialtyEntity);
- }
- }
- using (TransactionScope ts = new TransactionScope())
- {
- //批量统一提交更新
- if (recruitSpecialtyInList != null && recruitSpecialtyInList.Count() > 0)
- {
- this.UnitOfWork.BulkInsert(recruitSpecialtyInList);
- }
- //批量统一提交更新
- if (recruitSpecialtyUpList != null && recruitSpecialtyUpList.Count() > 0)
- {
- this.UnitOfWork.BatchUpdate(recruitSpecialtyUpList);
- }
- ts.Complete();
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|