Commit 6c6d256d authored by 吴春's avatar 吴春

提交代码

parent 353a045f
......@@ -104,6 +104,17 @@ namespace Edu.Common.Plugin
/// <summary>
/// 获取星期的字符串
/// </summary>
/// <param name="day">指定日期</param>
/// <returns></returns>
public static string GetJapanWeekChar(DateTime day)
{
string[] str = new string[] { "日", "月", "火", "水", "木", "金", "土" };
int week = int.Parse(day.DayOfWeek.ToString("D"));
return "星期" + str[week];
}
/// <summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 老师教案
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_LessonPlan
{
/// <summary>
/// 教案id
/// </summary>
public int LessonPlanId { get; set; }
/// <summary>
/// 第几课
/// </summary>
public int CourseNum { get; set; }
/// <summary>
/// 教案名称
/// </summary>
public string LessonPlan { get; set; }
/// <summary>
/// 是否设置成模板0-否,1-是
/// </summary>
public int IsTemplate { get; set; }
// /// <summary>
///// 上课时间编号
///// </summary>
//public int ClassTimeId { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 上课计划编号
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 课程名称(活动篇/理解篇)
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 课程标题
/// </summary>
public string CourseTitle { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 删除状态(0-正常,1-禁用)
/// </summary>
public DateStateEnum Status { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 老师教案详细内容
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_LessonPlanDetails
{
/// <summary>
/// 编号Id
/// </summary>
public int LessonPlanDetailsId { get; set; }
/// <summary>
/// 教案id
/// </summary>
public int LessonPlanId { get; set; }
/// <summary>
/// 内容
/// </summary>
public string ProjectContent { get; set; }
/// <summary>
/// 课时
/// </summary>
public int Duration { get; set; }
/// <summary>
/// 课后总结
/// </summary>
public string Summary { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 老师教案指导项目
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_LessonPlanProjects
{
/// <summary>
/// 编号Id
/// </summary>
public int LessonPlanProjectsId { get; set; }
/// <summary>
/// 教案id
/// </summary>
public int LessonPlanId { get; set; }
/// <summary>
/// 内容
/// </summary>
public string ProjectContent { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using Edu.Model.Entity.Course;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 老师教案新增扩展表
/// </summary>
public class Class_LessonPlan_ViewModel
{
/// <summary>
/// 第几课
/// </summary>
public int CourseNum { get; set; }
/// <summary>
/// 班级
/// </summary>
public int ClassId { get; set; }
/// <summary>
/// 排课id
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 教案名称
/// </summary>
public string LessonPlan { get; set; }
/// <summary>
/// 是否设置成模板0-否,1-是
/// </summary>
public int IsTemplate { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 老师教案详情
/// </summary>
public List<RB_Class_LessonPlan_ViewModel> LessonPlanList { get; set; }
#region 展示无逻辑
/// <summary>
/// 老师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 上课时间
/// </summary>
public string WorkDate { get; set; }
public string WeekStr { get; set; }
/// <summary>
/// 上课时间
/// </summary>
public string DayTime { get; set; }
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Course;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 老师教案详细内容
/// </summary>
public class RB_Class_LessonPlanDetails_ViewModel: RB_Class_LessonPlanDetails
{
public string LessonPlanIds { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Course;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 老师教案指导项目扩展表
/// </summary>
public class RB_Class_LessonPlanProjects_ViewModel : RB_Class_LessonPlanProjects
{
public List<string> ProjectContentList { get; set; }
public string LessonPlanIds { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Course;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 老师教案扩展表
/// </summary>
public class RB_Class_LessonPlan_ViewModel : RB_Class_LessonPlan
{
/// <summary>
/// 老师教案详情
/// </summary>
public List<RB_Class_LessonPlanDetails_ViewModel> LessonPlanDetailsList { get; set; }
/// <summary>
/// 老师教案项目
/// </summary>
public List<RB_Class_LessonPlanProjects_ViewModel> LessonPlanProjectsList { get; set; }
/// <summary>
/// 休息时间
/// </summary>
public int Rest { get; set; }
}
}
......@@ -31,6 +31,17 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public int Dept_Id { get; set; }
/// <summary>
/// 员工部门
/// </summary>
public string DeptName { get; set; }
/// <summary>
/// 员工负责人
/// </summary>
public string DeptPersonName { get; set; }
/// <summary>
/// 填写量
/// </summary>
......@@ -51,11 +62,29 @@ namespace Edu.Model.ViewModel.OKR
public int Type { get; set; }
public int ChildrenNum { get; set; }
public int PeriodId { get; set; }
public int School_Id { get; set; }
public int Group_Id { get; set; }
public string Dept_Ids { get; set; }
public List<OKRPersonalDimension> OKRPersonalDimensionList { get; set; }
/// <summary>
/// 填写率
/// </summary>
public decimal ObjectiveRate { get; set; }
/// <summary>
/// 对齐率
/// </summary>
public decimal ObjectiveRelationRate { get; set; }
/// <summary>
/// 打分率
/// </summary>
public decimal ScoreRate { get; set; }
}
}
......@@ -39,6 +39,8 @@ namespace Edu.Model.ViewModel.User
public int DataType { get; set; }
public string ManagerIds { get; set; }
/// <summary>
/// 下级部门列表
/// </summary>
......
This diff is collapsed.
......@@ -142,8 +142,9 @@ namespace Edu.Module.OKR
}
};
bool flag = oKR_PeriodConfigRepository.Update(keyValues, wheres);
if (flag) {
if (flag)
{
#region 是否需要重新生成周期
if (model.PeriodMonth != dmodel.PeriodMonth || model.StartDate != dmodel.StartDate || model.EndDate != dmodel.EndDate)
{
......@@ -211,12 +212,14 @@ namespace Edu.Module.OKR
{
//天
var ds = dmodel.EndDate.Value - DateTime.Now;
if (ds.TotalDays < dmodel.BeforeNum) {
if (ds.TotalDays < dmodel.BeforeNum)
{
//生成下一个周期
CreatePeriodNext(dmodel);
}
}
else {
else
{
//月
var ds = DateTime.Now.AddMonths(dmodel.BeforeNum);
if (ds > dmodel.EndDate)
......@@ -358,7 +361,7 @@ namespace Edu.Module.OKR
/// 创建下一个周期
/// </summary>
/// <param name="dmodel"></param>
public void CreatePeriodNext(RB_OKR_PeriodConfig_ViewModel dmodel,bool IsCreateYear = false)
public void CreatePeriodNext(RB_OKR_PeriodConfig_ViewModel dmodel, bool IsCreateYear = false)
{
DateTime STime = Convert.ToDateTime(dmodel.EndDate.Value.AddDays(1).ToString("yyyy-MM-dd"));
DateTime ETime = Convert.ToDateTime(STime.AddMonths((int)dmodel.PeriodMonth).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59");
......@@ -382,7 +385,8 @@ namespace Edu.Module.OKR
UpdateTime = DateTime.Now,
IsNormal = 1
}) > 0;
if (flag && IsCreateYear && dmodel.YearOKR == 1) {
if (flag && IsCreateYear && dmodel.YearOKR == 1)
{
DateTime YearStart = Convert.ToDateTime(ETime.Year + "-01-01");
if (STime <= YearStart && YearStart < ETime)
{
......@@ -746,7 +750,8 @@ namespace Edu.Module.OKR
{
item.IsCurrent = 2;
if (item.StartDate <= DateTime.Now && item.EndDate >= DateTime.Now && item.IsNormal == 1 && item.IsYear == 2) {
if (item.StartDate <= DateTime.Now && item.EndDate >= DateTime.Now && item.IsNormal == 1 && item.IsYear == 2)
{
item.IsCurrent = 1;
}
}
......@@ -1600,7 +1605,7 @@ namespace Edu.Module.OKR
x.ScoreName,
x.ScoreColor,
CreateTime = x.CreateTime.ToString("MM-dd"),
KeyResultList = x.KeyResultList.Where(x=>x.IsNotLook == 2).Select(z => new
KeyResultList = x.KeyResultList.Where(x => x.IsNotLook == 2).Select(z => new
{
z.Id,
z.Name,
......@@ -6442,12 +6447,12 @@ namespace Edu.Module.OKR
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<OKRPersonalDimension> GetOKRPersonalDimensionList(int Group_Id,int Id, int DeptId = 0)
public List<OKRPersonalDimension> GetOKRPersonalDimensionList(int Group_Id, int Id, int DeptId = 0)
{
List<int> UserIdList = new List<int>();
List<OKRPersonalDimension> allList = new List<OKRPersonalDimension>();
#region 我的直属下级
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id =Group_Id, DirectSupervisor = Id, Dept_Id = DeptId });
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, DirectSupervisor = Id, Dept_Id = DeptId });
if (emList.Any())
{
foreach (var item in emList)
......@@ -6469,7 +6474,7 @@ namespace Edu.Module.OKR
if (xjdlist.Any())
{
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id =Group_Id, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)) });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
if (em1List.Any())
{
......@@ -6534,8 +6539,21 @@ namespace Edu.Module.OKR
/// <returns></returns>
public List<OKRPersonalDimension> GetAllEmployeeOKRPPageRepository(int pageIndex, int pageSize, out long rowsCount, OKRPersonalDimension query)
{
return oKR_ObjectiveRepository.GetAllEmployeeOKRPPageRepository(pageIndex, pageSize,out rowsCount, query);
return oKR_ObjectiveRepository.GetAllEmployeeOKRPPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取员工okr列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<OKRPersonalDimension> GetAllEmployeeOKRPList(OKRPersonalDimension query)
{
return oKR_ObjectiveRepository.GetAllEmployeeOKRPList(query);
}
}
}
......@@ -148,7 +148,7 @@ namespace Edu.Module.User
/// <param name="isQueryEmployee">是否查询员工</param>
/// <param name="isQueryPost">是否查询岗位</param>
/// <returns></returns>
public List<DepartmentTree_ViewModel> GetDepartmentTreeModule(RB_Department_ViewModel query,bool isQueryEmployee=false,bool isQueryPost=false)
public List<DepartmentTree_ViewModel> GetDepartmentTreeModule(RB_Department_ViewModel query, bool isQueryEmployee = false, bool isQueryPost = false)
{
//树形结构列表
List<DepartmentTree_ViewModel> list = new List<DepartmentTree_ViewModel>();
......@@ -173,7 +173,7 @@ namespace Edu.Module.User
}
if (isQueryPost)
{
postList= postRepository.GetPostListExtRepository(new RB_Post_ViewModel()
postList = postRepository.GetPostListExtRepository(new RB_Post_ViewModel()
{
Group_Id = query.Group_Id,
});
......@@ -202,7 +202,7 @@ namespace Edu.Module.User
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id = fItem.School_Id,
IsCompany = fItem.IsCompany,
DataType=1,
DataType = 1,
};
#region 添加员工信息
if (isQueryEmployee)
......@@ -248,7 +248,7 @@ namespace Edu.Module.User
}
#endregion
var childList = GetDeptTreeList(fItem.DeptId, deptList, empList: empList,postList:postList);
var childList = GetDeptTreeList(fItem.DeptId, deptList, empList: empList, postList: postList);
if (childList != null && childList.Count > 0)
{
tModel.ChildList.AddRange(childList);
......@@ -267,7 +267,7 @@ namespace Edu.Module.User
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
/// <param name="empList">员工列表</param>
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList, List<Employee_ViewModel> empList=null, List<RB_Post_ViewModel> postList=null)
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList, List<Employee_ViewModel> empList = null, List<RB_Post_ViewModel> postList = null)
{
List<DepartmentTree_ViewModel> treeList = new List<DepartmentTree_ViewModel>();
foreach (var item in sourceList.Where(qitem => qitem.ParentId == parentId))
......@@ -278,7 +278,7 @@ namespace Edu.Module.User
DeptName = item.DeptName,
ParentId = item.ParentId,
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id=item.School_Id,
School_Id = item.School_Id,
IsCompany = item.IsCompany,
DataType = 1,
};
......@@ -296,7 +296,7 @@ namespace Edu.Module.User
DeptId = eItem.Id,
DeptName = eItem.EmployeeName,
ParentId = 0,
School_Id=eItem.School_Id,
School_Id = eItem.School_Id,
ChildList = new List<DepartmentTree_ViewModel>(),
DataType = 2,
});
......@@ -496,5 +496,76 @@ namespace Edu.Module.User
};
return departmentRepository.Update(fileds, new WhereHelper(nameof(RB_Department_ViewModel.DeptId), DeptId));
}
/// <summary>
/// 获取组织机构
/// </summary>
/// <param name="groupModel"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<DepartmentTree_ViewModel> GetOrganizationOKRModule(RB_Department_ViewModel query, bool isQueryEmployee = false)
{
List<DepartmentTree_ViewModel> nodeList = new List<DepartmentTree_ViewModel>();
//List<object> linkList = new List<object>();
var list = GetDepartmentTreeModule(query, isQueryEmployee: true);
//员工列表
var empList = new List<Employee_ViewModel>();
////查询员工
//if (isQueryEmployee)
//{
// empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
// {
// Group_Id = query.Group_Id,
// School_Id = query.School_Id
// });
//}
foreach (var item in list)
{
//DepartmentTree_ViewModel tModel = new DepartmentTree_ViewModel()
//{
// DeptId = item.DeptId,
// DeptName = item.DeptName,
// ParentId = item.ParentId,
// ChildList = new List<DepartmentTree_ViewModel>(),
// School_Id = item.School_Id,
// IsCompany = item.IsCompany,
// DataType = 1,
//};
nodeList.Add(item);
GetChildDeptOKR(item, ref nodeList);
}
return nodeList;
}
/// <summary>
/// 获取下级部门
/// </summary>
/// <param name="item"></param>
/// <param name="nodeList"></param>
/// <param name="linkList"></param>
public void GetChildDeptOKR(DepartmentTree_ViewModel item, ref List<DepartmentTree_ViewModel> nodeList)
{
if (item.ChildList != null && item.ChildList.Count > 0)
{
foreach (var subItem in item.ChildList)
{
//DepartmentTree_ViewModel tModel = new DepartmentTree_ViewModel()
//{
// DeptId = subItem.DeptId,
// DeptName = subItem.DeptName,
// ParentId = subItem.ParentId,
// ChildList = new List<DepartmentTree_ViewModel>(),
// School_Id = subItem.School_Id,
// IsCompany = subItem.IsCompany,
// DataType = 1,
//};
nodeList.Add(subItem);
GetChildDeptOKR(subItem, ref nodeList);
}
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
namespace Edu.Repository.Course
{
public class RB_Class_LessonPlanDetailsRepository : BaseRepository<RB_Class_LessonPlanDetails>
{
/// <summary>
/// 获取老师教案详情分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlanDetails_ViewModel> GetLessonPlanDetailsPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_LessonPlanDetails_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Class_LessonPlanDetails WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.LessonPlanId), query.LessonPlanId);
}
}
return GetPage<RB_Class_LessonPlanDetails_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取老师教案详情分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlanDetails_ViewModel> GetLessonPlanDetailsListRepository(RB_Class_LessonPlanDetails_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Class_LessonPlanDetails WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanDetails.LessonPlanId), query.LessonPlanId);
}
if ( !string.IsNullOrWhiteSpace(query.LessonPlanIds))
{
builder.AppendFormat(" AND {0} in ({1}) ", nameof(RB_Class_LessonPlanDetails.LessonPlanId), query.LessonPlanId);
}
}
return Get<RB_Class_LessonPlanDetails_ViewModel>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
namespace Edu.Repository.Course
{
public class RB_Class_LessonPlanProjectsRepository:BaseRepository<RB_Class_LessonPlanProjects>
{
/// <summary>
/// 获取老师教案项目分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlanProjects_ViewModel> GetLessonPlanProjectsPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_LessonPlanProjects_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Class_LessonPlanProjects WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.LessonPlanId), query.LessonPlanId);
}
}
return GetPage<RB_Class_LessonPlanProjects_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取老师教案项目分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlanProjects_ViewModel> GetLessonPlanProjectsListRepository(RB_Class_LessonPlanProjects_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Class_LessonPlanProjects WHERE 1=1 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlanProjects.LessonPlanId), query.LessonPlanId);
}
if (!string.IsNullOrWhiteSpace(query.LessonPlanIds))
{
builder.AppendFormat(" AND {0} in ({1}) ", nameof(RB_Class_LessonPlanProjects.LessonPlanId), query.LessonPlanId);
}
}
return Get<RB_Class_LessonPlanProjects_ViewModel>(builder.ToString()).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
namespace Edu.Repository.Course
{
public class RB_Class_LessonPlanRepository : BaseRepository<RB_Class_LessonPlan>
{
/// <summary>
/// 获取老师教案分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlan_ViewModel> GetLessonPlanPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Class_LessonPlan_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@$" SELECT * FROM RB_Class_LessonPlan WHERE 1=1 AND {nameof(RB_Class_LessonPlan.Status)}=0 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.LessonPlanId), query.LessonPlanId);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.ClassId), query.ClassId);
}
if (query.ClassPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.ClassPlanId), query.ClassPlanId);
}
}
return GetPage<RB_Class_LessonPlan_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取老师教案分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_LessonPlan_ViewModel> GetLessonPlanListRepository(RB_Class_LessonPlan_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@$" SELECT * FROM RB_Class_LessonPlan WHERE 1=1 AND {nameof(RB_Class_LessonPlan.Status)}=0 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.Group_Id), query.Group_Id);
}
if (query.School_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.School_Id), query.School_Id);
}
if (query.LessonPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.LessonPlanId), query.LessonPlanId);
}
if (query.ClassId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.ClassId), query.ClassId);
}
if (query.ClassPlanId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.ClassPlanId), query.ClassPlanId);
}
if (query.IsTemplate > -1)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Class_LessonPlan.IsTemplate), query.IsTemplate);
}
}
return Get<RB_Class_LessonPlan_ViewModel>(builder.ToString()).ToList();
}
}
}
......@@ -330,6 +330,7 @@ WHERE o1.CreateBy in({CreateBys}) and o2.CreateBy ={id} and o1.`Status`=2 and
StringBuilder wheremanager = new StringBuilder();
StringBuilder whereteacher = new StringBuilder();
StringBuilder whereassist = new StringBuilder();
StringBuilder whereperiodId = new StringBuilder();
if (query != null)
{
if (query.Group_Id > 0)
......@@ -340,12 +341,18 @@ WHERE o1.CreateBy in({CreateBys}) and o2.CreateBy ={id} and o1.`Status`=2 and
{
where.AppendFormat(" AND B.{0}={1} ", nameof(OKRPersonalDimension.School_Id), query.School_Id);
}
if (!string.IsNullOrWhiteSpace(query.Dept_Ids))
{
where.AppendFormat(" AND B.{0} in({1}) ", nameof(OKRPersonalDimension.Dept_Id), query.Dept_Ids);
}
if (query.Dept_Id > 0)
{
where.AppendFormat(" AND B.{0}={1} ", nameof(OKRPersonalDimension.Dept_Id), query.Dept_Id);
}
if (query.PeriodId > 0)
{
whereperiodId.AppendFormat(" AND a.{0}={1} ", nameof(OKRPersonalDimension.PeriodId), query.PeriodId);
}
//if (!string.IsNullOrEmpty(query.StartEntryTime))
//{
// where.AppendFormat(" AND b.{0}>='{1}' ", nameof(Employee_ViewModel.EntryTime), query.StartEntryTime);
......@@ -389,10 +396,10 @@ FROM
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
LEFT JOIN rb_school AS s ON A.School_Id=s.SId
LEFT JOIN rb_department AS d ON A.Dept_Id=d.DeptId
LEFT JOIN (SELECT a.CreateBy,COUNT(*) as ObjectiveNCount,SUM(Score) as Score from rb_okr_objective as a LEFT JOIN rb_okr_objectiverelation as b on a.Id=b.ObjectiveId GROUP BY a.CreateBy) as
LEFT JOIN (SELECT a.CreateBy,COUNT(*) as ObjectiveNCount,SUM(Score) as Score from rb_okr_objective as a LEFT JOIN rb_okr_objectiverelation as b on a.Id=b.ObjectiveId where a.Status<>5 {4} GROUP BY a.CreateBy) as
orro on orro.CreateBy=a.Id
WHERE 1=1 {4}
", where.ToString(), wheremanager.ToString(), whereteacher.ToString(), whereassist.ToString(), where2.ToString());
WHERE 1=1 {5}
", where.ToString(), wheremanager.ToString(), whereteacher.ToString(), whereassist.ToString(), whereperiodId.ToString(), where2.ToString());
return builder.ToString();
}
......@@ -413,6 +420,20 @@ WHERE 1=1 {4}
return list;
}
/// <summary>
/// 获取员工okr列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<OKRPersonalDimension> GetAllEmployeeOKRPList(OKRPersonalDimension query)
{
DynamicParameters parameters = new DynamicParameters();
string sql = GetEmployeeSqlReposiroty(query, parameters);
var list = Get<OKRPersonalDimension>( sql, parameters).ToList();
return list;
}
}
}
......@@ -25,7 +25,7 @@ namespace Edu.WebApi.Controllers.OKR
/// OKR周期处理类对象
/// </summary>
private readonly OKRPeriodModule okrPeriodModule = new OKRPeriodModule();
private readonly Module.User.DepartmentModule departmentModule = new Module.User.DepartmentModule();
#region 基础配置
/// <summary>
......@@ -998,7 +998,8 @@ namespace Edu.WebApi.Controllers.OKR
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKROthersObjectiveInfo() {
public ApiResult GetOKROthersObjectiveInfo()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
......@@ -1457,9 +1458,9 @@ namespace Edu.WebApi.Controllers.OKR
{
return ApiResult.ParamIsNull();
}
List<OKRPersonalDimension> allList = okrPeriodModule.GetOKRPersonalDimensionList(userInfo.Group_Id,userInfo.Id, DeptId);
List<OKRPersonalDimension> allList = okrPeriodModule.GetOKRPersonalDimensionList(userInfo.Group_Id, userInfo.Id, DeptId);
if (allList == null || !allList.Any(x => x.Type == 2))
{
return ApiResult.Failed("您没有下级");
......@@ -1515,7 +1516,7 @@ namespace Edu.WebApi.Controllers.OKR
School_Id = base.ParmJObj.GetInt("School_Id"),
PeriodId = base.ParmJObj.GetInt("PeriodId", 0)
};
query.Group_Id = base.UserInfo.Group_Id;
var list = okrPeriodModule.GetAllEmployeeOKRPPageRepository(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
......@@ -1526,6 +1527,52 @@ namespace Edu.WebApi.Controllers.OKR
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取部门树形列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDeptOKR()
{
int PeriodId = base.ParmJObj.GetInt("PeriodId", 0);
var query = new Model.ViewModel.User.RB_Department_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id"),
QDeptIds = base.ParmJObj.GetStringValue("QDeptIds"),
};
var list = departmentModule.GetOrganizationOKRModule(query, true);
var okrPersonalList = okrPeriodModule.GetAllEmployeeOKRPList(new OKRPersonalDimension { School_Id = query.School_Id, Group_Id = query.Group_Id, Dept_Ids = query.QDeptIds, PeriodId = PeriodId });
int ChildrenNum = 0;
List<OKRPersonalDimension> listResult = new List<OKRPersonalDimension>();
foreach (var item in list.Where(x => x.DataType == 1))
{
OKRPersonalDimension model = new OKRPersonalDimension();
model.DeptName = item.DeptName;
model.DeptPersonName = string.IsNullOrWhiteSpace(item.ManagerIds) ? "" : string.Join(",", okrPersonalList.Where(x => item.ManagerIds.Contains(x.AccountId.ToString())).Select(x => x.EmployeeName));
model.ChildrenNum = list.Where(x => x.DataType == 2 && x.DeptId == item.DeptId).Count();
ChildrenNum += model.ChildrenNum;
if (model.ChildrenNum > 0)
{
model.ObjectiveRate = decimal.Round((okrPersonalList.Where(x => x.Dept_Id == item.DeptId && x.ObjectiveNCount > 0).Count()) / model.ChildrenNum, 2);
model.ScoreRate = decimal.Round((okrPersonalList.Where(x => x.Dept_Id == item.DeptId && x.ScoreCount > 0).Count()) / model.ChildrenNum, 2);
model.OBjectiveRelation = 0;
foreach (var okrItem in okrPersonalList.Where(x => x.Dept_Id == item.DeptId))
{
model.OBjectiveRelation += okrPeriodModule.GetOKRPersonalRelationAlignList(query.Group_Id, PeriodId, okrItem.AccountId.ToString(), okrItem.AccountId).Where(x => x.ChildNum > 0).Count();
}
model.ObjectiveRelationRate = decimal.Round(model.OBjectiveRelation / model.ChildrenNum, 2);
}
listResult.Add(model);
}
return ApiResult.Success(data: listResult.Select(x => new { x.DeptName, x.Dept_Id, x.ObjectiveRate, x.ObjectiveRelationRate, x.ScoreRate, x.ChildrenNum }));
}
#endregion
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment