using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.Entities;
using EMIS.CommonLogic.SystemServices;
namespace EMIS.ExtensionLogic.ServiceLogic.DegreeManage
{
public class DegreeListServices : EMIS.CommonLogic.DegreeManage.DegreeManage.DegreeListServices
{
///
/// 流水号生成Services
///
public Lazy SerialNumberServices { get; set; }
///
/// 流程结束跳转函数(工作流平台中配置)
/// 注:学位审核通过需对学位证书编号进行生成(东莞理工学院)
/// 生成规则:学校代码+学位级别(1位,博士为2,硕士为3,学士为4)+毕业年份+6位流水号(9+5位流水号)
/// 例如:学校代码+学位级别(学士)+毕业年份+6位流水号(9+5位流水号),11819+4+2016+900001
///
///
///
public override void OnApproveEnd(List degreeApplyIDList, Guid? userID)
{
////更新对应的学生信息(如:学位状态)
//base.OnApproveEnd(degreeApplyIDList, userID);
//查询对应的学位申请信息List
var degreeApplyList = DegreeApplyDAL.DegreeApplyRepository
.GetList(x => degreeApplyIDList.Contains(x.DegreeApplyID), (x => x.ER_GraduationApply.CF_Student)).ToList();
//查询对应的学位申请信息ViewList
var degreeApplyViewList = DegreeApplyDAL
.GetDegreeApplyViewQueryable(x => degreeApplyIDList.Contains(x.DegreeApplyID)).ToList();
//更新对应的学生信息(如:学位状态、学位证书编号)
List studentUpList = new List();
List degreeApplyUpList = new List();
foreach (var degreeApply in degreeApplyList)
{
degreeApply.ER_GraduationApply.CF_Student.DegreeStatus = true;
this.SetModifyStatus(degreeApply.ER_GraduationApply.CF_Student);
studentUpList.Add(degreeApply.ER_GraduationApply.CF_Student);
//查询对应的学位申请信息View
var degreeApplyView = degreeApplyViewList
.Where(x => x.DegreeApplyID == degreeApply.DegreeApplyID).SingleOrDefault();
//学位证书编号生成(学校代码+学位级别(学士)+毕业年份+6位流水号(9+5位流水号))
var degreeNoPrefix = string.Format("{0}{1}{2}{3}", degreeApplyView.UniversityCode, 4,
degreeApplyView.GraduationYear ?? null, 9);
degreeApply.DegreeNo = SerialNumberServices.Value.SetSN(degreeNoPrefix, 5);
degreeApplyUpList.Add(degreeApply);
}
this.UnitOfWork.BatchUpdate(studentUpList);
this.UnitOfWork.BatchUpdate(degreeApplyUpList);
}
}
}