@@ -346,6 +346,287 @@ t.SupportChangeTime,t.SupportChangeUserName
}
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">查询条件</param>
/// <param name="type">1:军训;2:学费</param>
/// <returns></returns>
internal object GetMilitaryStatistics(string queryJson, int type)
{
//try
//{
// var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>()
// //.Where(a => string.IsNullOrEmpty(DeptNo) || a.DeptNo == DeptNo)
// //.Where(a => string.IsNullOrEmpty(MajorNo) || a.MajorNo == MajorNo)
// //.Where(a => string.IsNullOrEmpty(ClassNo) || a.ClassNo == ClassNo)
// ;
// var aa = data.Count(a => a.IsMilitary == true);
// var bb = data.Count(a => a.IsMilitary == false);
// return new { aa, bb };
//}
try
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(@"
t.StuId,
t.StuName,IsMilitary,IsSubsidize1
");
strSql.Append(" FROM StuEnroll t ");
strSql.Append(" WHERE 1=1 ");
var queryParam = queryJson.ToJObject();
// 虚拟参数
var dp = new DynamicParameters(new { });
if (!queryParam["IDCard"].IsEmpty())
{
dp.Add("IDCard", "%" + queryParam["IDCard"].ToString() + "%", DbType.String);
strSql.Append(" AND t.IDCard Like @IDCard ");
}
if (!queryParam["Year"].IsEmpty())
{
dp.Add("Year", "%" + queryParam["Year"].ToString() + "%", DbType.String);
strSql.Append(" AND t.ClassNo Like @Year ");
}
//sql条件
if (!queryParam["SqlParameter"].IsEmpty())
{
strSql.Append(queryParam["SqlParameter"].ToString());
}
if (!queryParam["RegistrationNo"].IsEmpty())
{
dp.Add("RegistrationNo", "%" + queryParam["RegistrationNo"].ToString() + "%", DbType.String);
strSql.Append(" AND t.RegistrationNo Like @RegistrationNo ");
}
if (!queryParam["Admissions"].IsEmpty())
{
dp.Add("Admissions", queryParam["Admissions"].ToString(), DbType.String);
strSql.Append(" AND t.Admissions = @Admissions ");
}
if (!queryParam["DeptNo"].IsEmpty())
{
dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
strSql.Append(" AND t.DeptNo = @DeptNo ");
}
if (!queryParam["MajorNo"].IsEmpty())
{
dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
strSql.Append(" AND t.MajorNo = @MajorNo ");
}
if (!queryParam["Grade"].IsEmpty())
{
dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
strSql.Append(" AND t.Grade = @Grade ");
}
if (!queryParam["ClassNo"].IsEmpty())
{
dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
strSql.Append(" AND t.ClassNo = @ClassNo ");
}
if (!queryParam["IsAllocation"].IsEmpty())
{
var IsAllocation = Convert.ToBoolean(queryParam["IsAllocation"].ToString());
if (IsAllocation)
{
strSql.Append(" AND (t.ClassNo IS NOT NULL AND t.ClassNo<>'')");
}
else
{
strSql.Append(" AND (t.ClassNo IS NULL OR t.ClassNo='')");
}
}
if (!queryParam["IsAllocationDormitory"].IsEmpty())
{
var IsAllocation = Convert.ToBoolean(queryParam["IsAllocationDormitory"].ToString());
if (IsAllocation)
{
strSql.Append(" AND (t.DormitoryNo IS NOT NULL AND t.DormitoryNo<>'')");
}
else
{
strSql.Append(" AND (t.DormitoryNo IS NULL OR t.DormitoryNo='')");
}
}
if (!queryParam["StuName"].IsEmpty())
{
dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String);
strSql.Append(" AND t.StuName Like @StuName ");
}
if (!queryParam["Status"].IsEmpty())
{
dp.Add("Status", queryParam["Status"].ToString(), DbType.String);
strSql.Append(" AND t.Status = @Status ");
}
if (!queryParam["Gender"].IsEmpty())
{
dp.Add("Gender", Convert.ToBoolean(queryParam["Gender"].ToString()), DbType.Boolean);
strSql.Append(" AND t.Gender = @Gender ");
}
if (!queryParam["PayList"].IsEmpty())
{
strSql.Append(" AND t.Status>=3 AND t.Status<6 ");
}
if (!queryParam["IsCheckIn"].IsEmpty())
{
if (queryParam["IsCheckIn"].ToString() == "null")
{
strSql.Append(" AND t.IsCheckIn is null ");
}
else
{
dp.Add("IsCheckIn", queryParam["IsCheckIn"].ToString(), DbType.String);
strSql.Append(" AND t.IsCheckIn = @IsCheckIn ");
}
}
if (!queryParam["IsSubsidize1"].IsEmpty())
{
if (queryParam["IsSubsidize1"].ToString() == "null")
{
strSql.Append(" AND t.IsSubsidize1 is null ");
}
else
{
dp.Add("IsSubsidize1", queryParam["IsSubsidize1"].ToString(), DbType.String);
strSql.Append(" AND t.IsSubsidize1 = @IsSubsidize1 ");
}
}
if (!queryParam["IsMilitary"].IsEmpty())
{
if (queryParam["IsMilitary"].ToString() == "null")
{
strSql.Append(" AND t.IsMilitary is null ");
}
else
{
dp.Add("IsMilitary", queryParam["IsMilitary"].ToString(), DbType.String);
strSql.Append(" AND t.IsMilitary = @IsMilitary ");
}
}
if (!queryParam["IsPay"].IsEmpty())
{
if (queryParam["IsPay"].ToString() == "null")
{
strSql.Append(" AND t.IsPay is null ");
}
else
{
dp.Add("IsPay", queryParam["IsPay"].ToString(), DbType.String);
strSql.Append(" AND t.IsPay = @IsPay ");
}
}
if (!queryParam["IsMug"].IsEmpty())
{
if (queryParam["IsMug"].ToString() == "null")
{
strSql.Append(" AND t.IsMug is null ");
}
else
{
dp.Add("IsMug", queryParam["IsMug"].ToString(), DbType.String);
strSql.Append(" AND t.IsMug = @IsMug ");
}
}
if (!queryParam["IsTakeCloths"].IsEmpty())
{
if (queryParam["IsTakeCloths"].ToString() == "null")
{
strSql.Append(" AND t.IsTakeCloths is null ");
}
else
{
dp.Add("IsTakeCloths", queryParam["IsTakeCloths"].ToString(), DbType.String);
strSql.Append(" AND t.IsTakeCloths = @IsTakeCloths ");
}
}
if (!queryParam["IsQuantity"].IsEmpty())
{
if (queryParam["IsQuantity"].ToString() == "null")
{
strSql.Append(" AND t.IsQuantity is null ");
}
else
{
dp.Add("IsQuantity", queryParam["IsQuantity"].ToString(), DbType.String);
strSql.Append(" AND t.IsQuantity = @IsQuantity ");
}
}
if (!queryParam["IsGetBeddingArticle"].IsEmpty())
{
if (queryParam["IsGetBeddingArticle"].ToString() == "null")
{
strSql.Append(" AND t.IsGetBeddingArticle is null ");
}
else
{
dp.Add("IsGetBeddingArticle", queryParam["IsGetBeddingArticle"].ToString(), DbType.String);
strSql.Append(" AND t.IsGetBeddingArticle = @IsGetBeddingArticle ");
}
}
//获取班主任所带的班级
var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "班主任")?.F_RoleId;
var userInfo = LoginUserInfo.Get();
var sqlClasses = "";
if (!string.IsNullOrEmpty(roleid))
{
if (userInfo.roleIds.Contains(roleid))
{
var classes = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>(a => a.ClassDiredctorNo == userInfo.account).Select(a => a.ClassNo).ToList();
if (classes != null)
{
foreach (var item in classes)
{
sqlClasses += $"'{item}',";
}
sqlClasses = sqlClasses.TrimEnd(',');
}
}
if (!string.IsNullOrEmpty(sqlClasses))
{
strSql.Append($" AND t.ClassNo IN({sqlClasses})");
}
}
var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(strSql.ToString(), dp);
int aa = 0, bb = 0;
if (type == 1)
{
aa = list.Count(x => x.IsMilitary == true);
bb = list.Count(x => x.IsMilitary == false);
}
else if (type == 2)
{
aa = list.Count(x => x.IsSubsidize1 == true);
bb = list.Count(x => x.IsSubsidize1 == false);
}
return new { aa, bb };
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 获取页面显示列表数据
/// <summary>
@@ -959,32 +1240,6 @@ t.SupportChangeTime,t.SupportChangeUserName
}
}
internal object GetMilitaryStatistics(string DeptNo, string MajorNo, string ClassNo)
{
try
{
var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>()
.Where(a => string.IsNullOrEmpty(DeptNo) || a.DeptNo == DeptNo)
.Where(a => string.IsNullOrEmpty(MajorNo) || a.MajorNo == MajorNo)
.Where(a => string.IsNullOrEmpty(ClassNo) || a.ClassNo == ClassNo)
;
var aa = data.Count(a => a.IsMilitary == true);
var bb = data.Count(a => a.IsMilitary == false);
return new { aa, bb };
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
/// <summary>
/// 获取页面显示列表数据
@@ -2217,7 +2472,7 @@ t.SupportChangeTime,t.SupportChangeUserName
{
try
{
var entity = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(x=>x.SupportProcessId== processId);
var entity = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(x => x.SupportProcessId == processId);
//if (!string.IsNullOrEmpty(entity.Photo))
//{
// var path = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_Id == entity.Photo)?.F_FilePath;
@@ -2241,7 +2496,7 @@ t.SupportChangeTime,t.SupportChangeUserName
}
}
}
#endregion 获取数据
#region 提交数据