using System;
using System.Web;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using Bowin.Common.Linq;
using Bowin.Common.Linq.Entity;
using EMIS.ViewModel;
using EMIS.ViewModel.WorkflowManage;
using EMIS.ViewModel.ChargeManage.ChargeSituation;
using EMIS.ViewModel.Students;
using EMIS.Entities;
using EMIS.DataLogic.ChargeManage.ChargeSituation;
using EMIS.DataLogic.Repositories;
using EMIS.CommonLogic.StudentManage.StudentStatistics;
namespace EMIS.CommonLogic.ChargeManage.ChargeSituation
{
public class StudentChargeServices : BaseServices, IStudentChargeServices
{
public StudentChargeDAL StudentChargeDAL { get; set; }
public ChargeProjectDAL ChargeProjectDAL { get; set; }
public ChargeStandardDAL ChargeStandardDAL { get; set; }
public StudentChargeRepository StudentChargeRepository { get; set; }
public IInSchoolSettingServices InSchoolSettingServices { get; set; }
public IChargeDelayServices IChargeDelayServices { get; set; }
///
/// 查询应收名单信息View
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetStudentChargeViewGrid(ConfiguretView configuretView, Guid? collegeID, int? yearID,
int? standardID, int? educationID, int? learningformID, string learnSystem, int? chargeYearID,
Guid? chargeProjectID, int? chargeTagID, int? inSchoolStatus, int? isDream, int pageIndex, int pageSize)
{
//应收名单
Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (chargeYearID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
}
if (chargeProjectID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
}
if (chargeTagID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeTag == chargeTagID);
}
Expression> expStudent = (x => true);
if (isDream.HasValue)
{
//expStudent = expStudent.And(x => x.IsDreamProject == (isDream == 1 ? true : false));
if (isDream.Value == (int)CF_GeneralPurpose.IsYes)
{
expStudent = expStudent.And(x => x.CF_StudentProfile.IsDreamProject == true);
}
if (isDream.Value == (int)CF_GeneralPurpose.IsNo)
{
expStudent = expStudent.And(x => x.CF_StudentProfile.IsDreamProject != true);
}
}
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.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 = StudentChargeDAL.GetStudentChargeViewQueryAble(expStudentCharge, expStudent);
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (yearID.HasValue)
{
query = query.Where(x => x.GradeStr == 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());
}
return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StudentNo.Length)
.ThenBy(x => x.StudentNo).ThenBy(x => x.ChargeProjectStr)
.ThenByDescending(x => x.ChargeYear)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询应收名单信息List
///
///
///
///
///
///
///
///
///
///
public List GetStudentChargeViewGrid(ConfiguretView configuretView, Guid? collegeID, int? yearID,
int? standardID, int? educationID, int? learningformID, string learnSystem, int? chargeYearID, Guid? chargeProjectID,
int? chargeTagID, int? inSchoolStatus, int? isDream)
{
//应收名单
Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (chargeYearID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
}
if (chargeProjectID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
}
if (chargeTagID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.ChargeTag == chargeTagID);
}
Expression> expStudent = (x => true);
if (isDream.HasValue)
{
//expStudent = expStudent.And(x => x.IsDreamProject == (isDream == 1 ? true : false));
if (isDream.Value == (int)CF_GeneralPurpose.IsYes)
{
expStudent = expStudent.And(x => x.CF_StudentProfile.IsDreamProject == true);
}
if (isDream.Value == (int)CF_GeneralPurpose.IsNo)
{
expStudent = expStudent.And(x => x.CF_StudentProfile.IsDreamProject != true);
}
}
if (inSchoolStatus != null && inSchoolStatus > -1)
{
var inschoolStatusList = InSchoolSettingServices.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 = StudentChargeDAL.GetStudentChargeViewQueryAble(expStudentCharge, expStudent);
if (collegeID.HasValue)
{
query = query.Where(x => x.CollegeID == collegeID);
}
if (yearID.HasValue)
{
query = query.Where(x => x.GradeStr == 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());
}
return this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.StudentNo.Length)
.ThenBy(x => x.StudentNo).ThenBy(x => x.ChargeProjectStr)
.ThenByDescending(x => x.ChargeYear)
.ToList();
}
///
/// 查询应收名单信息View
///
///
///
public StudentChargeView GetStudentChargeView(Guid? studentChargeID)
{
var query = StudentChargeDAL.GetStudentChargeViewQueryAble(x => x.StudentChargeID == studentChargeID, x => true)
.SingleOrDefault();
return query;
}
///
/// 查询应收名单实体
///
///
///
public EC_StudentCharge GetStudentCharge(Guid? studentChargeID)
{
//查询条件
Expression> expression = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
expression = (x => x.StudentChargeID == studentChargeID);
return StudentChargeDAL.StudentChargeRepository.GetSingle(expression);
}
///
/// 获取学生信息视图
///
///
///
public StudentsView GetStudentView(Guid? userID)
{
var query = StudentChargeDAL.GetStudentViewQueryAble(x => x.UserID == userID);
return query.SingleOrDefault();
}
///
/// 查询收费项目信息
///
///
///
public ChargeProjectView GetChargeProjectView(Guid? chargeProjectID)
{
Expression> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
exp = exp.And(x => x.ChargeProjectID == chargeProjectID);
var query = ChargeProjectDAL.GetChargeProjectViewQueryAble(exp);
return query.SingleOrDefault();
}
///
/// 查询应收名单对应的收费标准
///
///
///
///
///
public ChargeStandardView StudentChargeChargeStandard(Guid? userID, int? chargeYearID, Guid? chargeProjectID)
{
try
{
//查询用户ID对应的信息
var studentView = StudentChargeDAL.GetStudentViewQueryAble(x => x.UserID == userID).SingleOrDefault();
//收费标准
Expression> expChargeStandard = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (userID.HasValue)
{
if (studentView != null)
{
expChargeStandard = expChargeStandard.And(x => x.GrademajorID == studentView.GradeMajorID);
}
}
if (chargeYearID.HasValue)
{
expChargeStandard = expChargeStandard.And(x => x.ChargeYear == chargeYearID);
}
if (chargeProjectID.HasValue)
{
expChargeStandard = expChargeStandard.And(x => x.ChargeProjectID == chargeProjectID);
}
var chargeStandardView = StudentChargeDAL.GetStudentChargeChargeStandard(expChargeStandard)
.SingleOrDefault();
return chargeStandardView;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 编辑(新增、修改)
/// 存在对应的收费标准时,才可新增
/// 业务主键不可修改(业务主键:用户ID、缴费学年、收费项目ID)
///
///
public void StudentChaegeEdit(StudentChargeView studentChargeView)
{
try
{
//查询用户ID对应的信息
var studentView = StudentChargeDAL.GetStudentViewQueryAble(x => x.UserID == studentChargeView.UserID)
.SingleOrDefault();
if (studentView != null)
{
//验证是否存在对应的收费标准
var chargeStandardView = StudentChargeDAL.GetStudentChargeChargeStandard(x => x.GrademajorID == studentView.GradeMajorID
&& x.ChargeYear == studentChargeView.ChargeYear
&& x.ChargeProjectID == studentChargeView.ChargeProjectID)
.SingleOrDefault();
if (chargeStandardView == null)
{
throw new Exception("对应的收费标准不存在");
}
else
{
//查询数据库进行验证(需排除自己)
var studentChargeVerification = StudentChargeDAL.StudentChargeRepository.GetList(x => x.StudentChargeID != studentChargeView.StudentChargeID
&& x.UserID == studentChargeView.UserID
&& x.ChargeYear == studentChargeView.ChargeYear
&& x.ChargeProjectID == studentChargeView.ChargeProjectID)
.SingleOrDefault();
if (studentChargeVerification == null)
{
//数据有误验证
if (studentChargeView.StudentChargeID != Guid.Empty)
{
//表示修改
var studentCharge = StudentChargeDAL.StudentChargeRepository
.GetList(x => x.StudentChargeID == studentChargeView.StudentChargeID)
.SingleOrDefault();
if (studentCharge == null)
{
throw new Exception("数据有误,请核查");
}
else
{
//业务主键不可修改(业务主键:用户ID、缴费学年、收费项目ID)
//验证是否存在对应的学生缴费信息
studentCharge.Amount = chargeStandardView.Amount;
studentCharge.ActualAmount = studentChargeView.ActualAmount;
studentCharge.ChargeTag = studentChargeView.ChargeTag;
studentCharge.Remark = studentChargeView.Remark;
SetModifyStatus(studentCharge);
}
}
else
{
//表示新增
//应收名单
EC_StudentCharge studentCharge = new EC_StudentCharge();
studentCharge.StudentChargeID = Guid.NewGuid();
studentCharge.UserID = studentChargeView.UserID;
studentCharge.ChargeProjectID = studentChargeView.ChargeProjectID;
studentCharge.ChargeYear = studentChargeView.ChargeYear;
studentCharge.Amount = chargeStandardView.Amount;
studentCharge.ActualAmount = studentChargeView.ActualAmount; //实收金额(减免后金额)
studentCharge.ChargeTag = (int)EC_ChargeTag.Normal; //默认为正常收费
studentCharge.Remark = studentChargeView.Remark;
SetNewStatus(studentCharge, (int)SYS_STATUS.USABLE);
UnitOfWork.Add(studentCharge);
}
}
else
{
throw new Exception("已存在相同的应收名单,请核查");
}
}
}
else
{
throw new Exception("数据有误,请核查");
}
//事务提交
UnitOfWork.Commit();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 删除(当选择删除的信息中存在对应的缓交名单信息、学生缴费信息时,无法删除)
///
///
///
public bool StudentChargedDelete(List studentChargeIDs)
{
try
{
//查询应收名单信息List
var studentChargeList = StudentChargeDAL.StudentChargeRepository
.GetList(x => studentChargeIDs.Contains(x.StudentChargeID)).ToList();
//用户IDList
var userIDList = studentChargeList.Where(x => !string.IsNullOrEmpty(x.UserID.ToString()))
.Select(x => x.UserID).ToList();
//缴费学年IDList
var chargeYearIDList = studentChargeList.Where(x => !string.IsNullOrEmpty(x.ChargeYear.ToString()))
.Select(x => x.ChargeYear).ToList();
//收费项目IDList
var chargeProjectIDList = studentChargeList.Where(x => !string.IsNullOrEmpty(x.ChargeProjectID.ToString()))
.Select(x => x.ChargeProjectID).ToList();
//应收名单
Expression> expStudentCharge = (x => true);
if (studentChargeIDs != null && studentChargeIDs.Count() > 0)
{
//应收名单ID
expStudentCharge = expStudentCharge.And(x => studentChargeIDs.Contains(x.StudentChargeID));
}
if (userIDList != null && userIDList.Count() > 0)
{
//用户ID
expStudentCharge = expStudentCharge.And(x => userIDList.Contains(x.UserID));
}
if (chargeYearIDList != null && chargeYearIDList.Count() > 0)
{
//缴费学年
expStudentCharge = expStudentCharge.And(x => chargeYearIDList.Contains(x.ChargeYear));
}
if (chargeProjectIDList != null && chargeProjectIDList.Count() > 0)
{
//收费项目
expStudentCharge = expStudentCharge.And(x => chargeProjectIDList.Contains(x.ChargeProjectID));
}
//查询学生缴费信息(业务主键:用户ID、缴费学年、收费项目ID)
var studentChargePaymentList = StudentChargeDAL.GetStudentChargePaymentView(expStudentCharge).ToList();
//查询对应的缓交名单信息
var chargeDelayList = StudentChargeDAL.GetStudentChargeChargeDelayView(expStudentCharge).ToList();
//注:由于用户会选择多条信息进行删除
//目前的删除逻辑暂时不处理更进一步的删除操作(如:同时存在可删除、不可删除的信息)
if (chargeDelayList != null && chargeDelayList.Count() > 0)
{
//表示已存在缓交名单信息
throw new Exception("选择删除的信息中存在相应的缓交名单信息,如需删除,请删除相关的缓交名单信息。");
}
else
{
if (studentChargePaymentList != null && studentChargePaymentList.Count() > 0)
{
//表示已存在学生缴费信息
throw new Exception("选择删除的信息中存在相应的学生缴费信息,如需删除,请删除相关的学生缴费信息。");
}
else
{
UnitOfWork.Delete(x => studentChargeIDs.Contains(x.StudentChargeID));
}
}
return true;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 费用调整(可批量调整)
///
///
///
///
///
public void UpdateActualAmount(List studentChargeViewList, decimal? actualAmount,
int? chargeTag, string remark)
{
try
{
if (studentChargeViewList.Count() > 0)
{
//应收名单IDList
var studentChargeIDList = studentChargeViewList.Where(x => !string.IsNullOrEmpty(x.StudentChargeID.ToString()))
.Select(x => x.StudentChargeID).ToList();
//查询对应的应收名单List
var studentChargeList = StudentChargeDAL.StudentChargeRepository
.GetList(x => studentChargeIDList.Contains(x.StudentChargeID)).ToList();
List studentChargeUpList = new List();
foreach (var studentCharge in studentChargeList)
{
studentCharge.ActualAmount = actualAmount;
studentCharge.ChargeTag = chargeTag;
studentCharge.Remark = remark;
SetModifyStatus(studentCharge);
studentChargeUpList.Add(studentCharge);
}
//批量提交
if (studentChargeUpList != null && studentChargeUpList.Count() > 0)
{
UnitOfWork.Commit();
}
}
else
{
throw new Exception("数据有误,请核查");
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询应收名单中对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
/// 同时对相应的缓交信息进行验证
///
///
///
public ChargeDelayView GetStudentChargeChargeDelayView(Guid? studentChargeID)
{
try
{
//应收名单
Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (studentChargeID.HasValue)
{
expStudentCharge = expStudentCharge.And(x => x.StudentChargeID == studentChargeID);
}
//查询对应的全部流程环节信息(WorkflowStatusView)
var chargeDelayWorkflowStatusView = IChargeDelayServices.GetStatusViewList();
if (chargeDelayWorkflowStatusView == null || chargeDelayWorkflowStatusView.Count() <= 0)
{
throw new Exception("工作流平台中,费用缓交流程未配置,请核查");
}
//查询缓交申请工作流程开始环节状态
var chargeDelayStartStatus = IChargeDelayServices.GetStartStatus();
if (chargeDelayStartStatus == null)
{
throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
}
//缓交申请流程中的ID(包含未提交、待审核)
var applyStatusList = IChargeDelayServices.GetStartApproveStatusList();
//缓交申请(流程中)
Expression> expChargeDelayApply = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (studentChargeID.HasValue)
{
expChargeDelayApply = expChargeDelayApply.And(x => x.StudentChargeID == studentChargeID);
expChargeDelayApply = expChargeDelayApply.And(x => applyStatusList.Contains(x.RecordStatus));
}
//查询缓交申请工作流程结束环节状态ID(通过)
var chargeDelayEndtStatus = IChargeDelayServices.GetCorrectEndStatus();
if (chargeDelayEndtStatus == null)
{
throw new Exception("工作流平台中,费用缓交结束环节流程未配置,请核查");
}
//缓交申请(审核通过)
Expression> expChargeDelayPass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
if (studentChargeID.HasValue)
{
expChargeDelayPass = expChargeDelayPass.And(x => x.StudentChargeID == studentChargeID);
expChargeDelayPass = expChargeDelayPass.And(x => x.RecordStatus == chargeDelayEndtStatus);
}
//查询对应的缴交信息View(对应的缴交信息全部查询,左联-待缓交金额、已缓交金额)
var chargeDelayView = StudentChargeDAL.GetStudentChargeChargeDelayView(expStudentCharge, expChargeDelayApply, expChargeDelayPass)
.SingleOrDefault();
return chargeDelayView;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 缓交申请
///
///
public void ChargeDelay(ChargeDelayView chargeDelayView)
{
try
{
//注:可通过缓交申请表单来获取相关缓交信息(目前暂时不采用此种方式)
var chargeDelay = this.GetStudentChargeChargeDelayView(chargeDelayView.StudentChargeID);
if (chargeDelay == null)
{
throw new Exception("数据有误,请核查");
}
//缓交金额需在可缓交金额范围内
if (chargeDelay.DelayAmount > chargeDelay.CanDelayAmount)
{
throw new Exception("缓交金额不能大于可缓交金额,请核查");
}
else
{
//查询缓交申请工作流程开始环节状态
var chargeDelayStartStatus = IChargeDelayServices.GetStartStatus();
if (chargeDelayStartStatus == null)
{
throw new Exception("工作流平台中,费用缓交开始环节流程未配置,请核查");
}
EC_ChargeDelay newChargeDelay = new EC_ChargeDelay();
newChargeDelay.ChargeDelayID = Guid.NewGuid();
newChargeDelay.StudentChargeID = chargeDelayView.StudentChargeID;
newChargeDelay.DelayAmount = chargeDelayView.DelayAmount;
newChargeDelay.DelayPercent = chargeDelayView.DelayPercent;
newChargeDelay.Reason = chargeDelayView.Reason;
SetNewStatus(newChargeDelay, chargeDelayStartStatus.Value);
UnitOfWork.Add(newChargeDelay);
}
UnitOfWork.Commit();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 应收名单验证(业务主键:用户ID、缴费学年、收费项目ID)
/// 存在对应的收费标准时,才可新增
/// 业务主键不可修改(业务主键:用户ID、缴费学年、收费项目ID)
///
///
///
///
///
///
public string GetVerification(Guid? studentChargeID, Guid? userID, int? chargeYearID, Guid? chargeProjectID)
{
try
{
//查询数据库进行验证(需排除自己)
var studentCharge = StudentChargeDAL.StudentChargeRepository.GetList(x => x.StudentChargeID != studentChargeID
&& x.UserID == userID
&& x.ChargeYear == chargeYearID
&& x.ChargeProjectID == chargeProjectID)
.SingleOrDefault();
if (studentCharge == null)
{
//数据有误验证
if (studentChargeID.HasValue && studentChargeID != Guid.Empty)
{
studentCharge = StudentChargeDAL.StudentChargeRepository.GetList(x => x.StudentChargeID == studentChargeID)
.SingleOrDefault();
if (studentCharge == null)
{
return "数据有误,请核查";
}
else
{
return "成功";
}
}
else
{
//查询用户ID对应的信息
var studentView = StudentChargeDAL.GetStudentViewQueryAble(x => x.UserID == userID).SingleOrDefault();
if (studentView != null)
{
//验证是否存在对应的收费标准
var chargeStandardView = StudentChargeDAL.GetStudentChargeChargeStandard(x => x.GrademajorID == studentView.GradeMajorID
&& x.ChargeYear == chargeYearID
&& x.ChargeProjectID == chargeProjectID)
.SingleOrDefault();
if (chargeStandardView == null)
{
return "对应的收费标准不存在";
}
else
{
return "成功";
}
}
else
{
return "数据有误,请核查";
}
}
}
else
{
return "已存在相同的应收名单";
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
///
/// 查询对应的缴费信息View(学生平台)
///
///
///
///
///
///
///
///
///
///
public IGridResultSet GetPersonalPaymentViewGrid(ConfiguretView configuretView, Guid userID, int? chargeYearID,
Guid? chargeProjectID, int? chargeTagID, int? isArrear, int pageIndex, int pageSize)
{
//应收名单
Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//用户ID
expStudentCharge = expStudentCharge.And(x => x.UserID == userID);
if (chargeYearID.HasValue)
{
//缴费学年
expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
}
if (chargeProjectID.HasValue)
{
//收费项目
expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
}
if (chargeTagID.HasValue)
{
//缴费标记
expStudentCharge = expStudentCharge.And(x => x.ChargeTag == chargeTagID);
}
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//学生信息ID
expStudent = expStudent.And(x => x.UserID == userID);
var query = StudentChargeDAL.GetStudentChargeViewQueryAble(expStudentCharge, expStudent);
//欠费状态
if (isArrear.HasValue)
{
if (isArrear.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsYes);
}
if (isArrear.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsNo);
}
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return query.OrderBy(x => x.ChargeProjectStr).ThenByDescending(x => x.ChargeYear)
.ToGridResultSet(pageIndex, pageSize);
}
///
/// 查询对应的缴费信息List(学生平台)
///
///
///
///
///
///
///
///
public List GetPersonalPaymentViewList(ConfiguretView configuretView, Guid userID, int? chargeYearID,
Guid? chargeProjectID, int? chargeTagID, int? isArrear)
{
//应收名单
Expression> expStudentCharge = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//用户ID
expStudentCharge = expStudentCharge.And(x => x.UserID == userID);
if (chargeYearID.HasValue)
{
//缴费学年
expStudentCharge = expStudentCharge.And(x => x.ChargeYear == chargeYearID);
}
if (chargeProjectID.HasValue)
{
//收费项目
expStudentCharge = expStudentCharge.And(x => x.ChargeProjectID == chargeProjectID);
}
if (chargeTagID.HasValue)
{
//缴费标记
expStudentCharge = expStudentCharge.And(x => x.ChargeTag == chargeTagID);
}
//学生信息
Expression> expStudent = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
//学生信息ID
expStudent = expStudent.And(x => x.UserID == userID);
var query = StudentChargeDAL.GetStudentChargeViewQueryAble(expStudentCharge, expStudent);
//欠费状态
if (isArrear.HasValue)
{
if (isArrear.Value == (int)CF_GeneralPurpose.IsYes)
{
query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsYes);
}
if (isArrear.Value == (int)CF_GeneralPurpose.IsNo)
{
query = query.Where(x => x.IsArrear == (int)CF_GeneralPurpose.IsNo);
}
}
//查询条件
if (!string.IsNullOrEmpty(configuretView.ConditionValue))
{
query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
}
return query.OrderBy(x => x.ChargeProjectStr).ThenByDescending(x => x.ChargeYear)
.ToList();
}
}
}