123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- 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.WorkflowManage;
- using EMIS.ViewModel.GraduationManage.GraduateCardManage;
- using EMIS.DataLogic.GraduationManage.GraduateCardManage;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.CommonLogic.StudentManage.StudentStatistics;
- namespace EMIS.CommonLogic.GraduationManage.GraduateCardManage
- {
- public class GraduateCardApproveServices : BaseWorkflowServices<ER_GraduateCardApply>, IGraduateCardApproveServices
- {
- public GraduateCardApplyDAL GraduateCardApplyDAL { get; set; }
- public Lazy<IInSchoolSettingServices> InSchoolSettingServices { 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="needCardResult"></param>
- /// <param name="approvalStatus"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<GraduateCardApplyView> GetGraduateCardApproveViewGrid(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- int? graduationTypeID, int? inSchoolStatus, int? needCardResult, int? approvalStatus, int pageIndex, int pageSize)
- {
- var approveStatusList = this.GetApproveStatusViewList();
- var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
- //去向申请
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
- if (gradSchoolyearID.HasValue)
- {
- //毕业学期(实际的毕业学期)
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (needCardResult.HasValue)
- {
- //去向结论
- expGraduateCardApply = expGraduateCardApply.And(x => x.NeedCardResult == needCardResult);
- }
- 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 = approveStatusList.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="needCardResult"></param>
- /// <param name="approvalStatus"></param>
- /// <returns></returns>
- public IList<GraduateCardApplyView> GetGraduateCardApproveViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? campusID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem,
- int? graduationTypeID, int? inSchoolStatus, int? needCardResult, int? approvalStatus)
- {
- var approveStatusList = this.GetApproveStatusViewList();
- var approveStatusIDList = approveStatusList.Select(x => x.ID).ToList();
- //去向申请
- Expression<Func<ER_GraduateCardApply, bool>> expGraduateCardApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expGraduateCardApply = expGraduateCardApply.And(x => approveStatusIDList.Contains(x.ApprovalStatus));
- if (gradSchoolyearID.HasValue)
- {
- //毕业学期(实际的毕业学期)
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (graduationTypeID.HasValue)
- {
- //毕业类型
- expGraduateCardApply = expGraduateCardApply.And(x => x.GraduationTypeID == graduationTypeID);
- }
- if (needCardResult.HasValue)
- {
- //去向结论
- expGraduateCardApply = expGraduateCardApply.And(x => x.NeedCardResult == needCardResult);
- }
- 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 = approveStatusList.FirstOrDefault(w => w.ID == x.ApprovalStatus).Name);
- return result;
- }
- /// <summary>
- /// 查询对应的去向审核信息GraduateCardApplyView
- /// </summary>
- /// <param name="graduateCardApplyID"></param>
- /// <returns></returns>
- public GraduateCardApplyView GetGraduateCardApproveView(Guid? graduateCardApplyID)
- {
- try
- {
- var graduateCardApplyView = GraduateCardApplyDAL.GetGraduateCardApplyViewQueryable(x => x.GraduateCardApplyID == graduateCardApplyID)
- .SingleOrDefault();
- return graduateCardApplyView;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的流程环节动作List(ActionView)
- /// </summary>
- /// <param name="formID"></param>
- /// <param name="userID"></param>
- /// <returns></returns>
- public List<ActionView> GetAuditingActionView(Guid formID, Guid userID)
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduateCardApplyIDs"></param>
- /// <returns></returns>
- public bool GraduateCardApproveDelete(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>
- /// 审核确定(批量)
- /// </summary>
- /// <param name="graduateCardApplyIDs"></param>
- /// <param name="userID"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- public void GraduateCardApproveConfirm(List<Guid?> graduateCardApplyIDs, Guid userID, Guid actionID, string comment)
- {
- throw new NotImplementedException();
- }
- }
- }
|