Commit 9b0142f1 authored by 吴春's avatar 吴春

提交diamante

parent b3e80f90
......@@ -819,7 +819,8 @@ namespace Edu.Module.OKR
/// </summary>
/// <param name="RuleId"></param>
/// <returns></returns>
public RB_OKR_Rule_ViewModel GetOKRRuleModel(int RuleId) {
public RB_OKR_Rule_ViewModel GetOKRRuleModel(int RuleId)
{
return oKR_RuleRepository.GetEntity<RB_OKR_Rule_ViewModel>(RuleId);
}
......@@ -862,7 +863,8 @@ namespace Edu.Module.OKR
}
};
bool flag = oKR_RuleRepository.Update(keyValues, wheres);
if (flag) {
if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
......@@ -877,11 +879,13 @@ namespace Edu.Module.OKR
}
return flag;
}
else {
else
{
dmodel.Enable = dmodel.Enable == 0 ? 1 : dmodel.Enable;
int id = oKR_RuleRepository.Insert(dmodel);
bool flag = id > 0;
if (flag) {
if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
......@@ -920,7 +924,8 @@ namespace Edu.Module.OKR
{
keyValues.Add(nameof(RB_OKR_Rule_ViewModel.Status), 1);
}
else {
else
{
return "状态不正确";
}
List<WhereHelper> wheres = new List<WhereHelper>() {
......@@ -980,7 +985,8 @@ namespace Edu.Module.OKR
try
{
bool flag = oKR_KeyResultRepository.Update(keyValues, wheres, trans);
if (flag) {
if (flag)
{
//关联表信息
var list = oKR_RuleRelationRepository.GetList(new RB_OKR_RuleRelation_ViewModel() { KeyResultId = dmodel.Id });
if (list.Any())
......@@ -991,7 +997,8 @@ namespace Edu.Module.OKR
var hempList = list.Where(x => x.Type == 2).ToList();
var deptInsert = deptList.Where(y => !hdeptList.Select(x => x.RelationId).Contains(y.RelationId)).ToList();
var deptDelete = hdeptList.Where(y => !deptList.Select(x => x.RelationId).Contains(y.RelationId)).ToList();
foreach (var item in deptInsert) {
foreach (var item in deptInsert)
{
oKR_RuleRelationRepository.Insert(new Model.Entity.OKR.RB_OKR_RuleRelation()
{
Id = 0,
......@@ -1000,12 +1007,14 @@ namespace Edu.Module.OKR
Type = item.Type
}, trans);
}
foreach (var item in deptDelete) {
foreach (var item in deptDelete)
{
oKR_RuleRelationRepository.Delete(item, trans);
}
var empInsert = empList.Where(y => !hempList.Select(x => x.RelationId).Contains(y.RelationId)).ToList();
var empDelete = hempList.Where(y => !empList.Select(x => x.RelationId).Contains(y.RelationId)).ToList();
foreach (var item in empInsert) {
foreach (var item in empInsert)
{
oKR_RuleRelationRepository.Insert(new Model.Entity.OKR.RB_OKR_RuleRelation()
{
Id = 0,
......@@ -1014,13 +1023,16 @@ namespace Edu.Module.OKR
Type = item.Type
}, trans);
}
foreach (var item in empDelete) {
foreach (var item in empDelete)
{
oKR_RuleRelationRepository.Delete(item, trans);
}
}
else {
else
{
//直接新增
foreach (var item in dmodel.RelationList) {
foreach (var item in dmodel.RelationList)
{
oKR_RuleRelationRepository.Insert(new Model.Entity.OKR.RB_OKR_RuleRelation()
{
Id = 0,
......@@ -1064,20 +1076,25 @@ namespace Edu.Module.OKR
public List<RB_OKR_RuleRelation_ViewModel> GetOKRKeyResultRuleReList(int keyResultId, UserInfo userInfo)
{
var list = oKR_RuleRelationRepository.GetList(new RB_OKR_RuleRelation_ViewModel() { KeyResultId = keyResultId });
if (list.Any()) {
if (list.Any())
{
var dlist = list.Where(x => x.Type == 1).ToList();
var elist = list.Where(x => x.Type == 2).ToList();
if (dlist.Any()) {
if (dlist.Any())
{
string deptIds = string.Join(",", dlist.Select(x => x.RelationId));
var d2list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, School_Id = userInfo.School_Id, QDeptIds = deptIds });
foreach (var item in dlist) {
foreach (var item in dlist)
{
item.RelationName = d2list.Where(x => x.DeptId == item.RelationId).FirstOrDefault()?.DeptName ?? "";
}
}
if (elist.Any()) {
if (elist.Any())
{
string empIds = string.Join(",", elist.Select(x => x.RelationId));
var e2list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = empIds, IsLeave = 1 });
foreach (var item in elist) {
foreach (var item in elist)
{
var emModel = e2list.Where(x => x.Id == item.RelationId).FirstOrDefault();
item.RelationName = emModel?.EmployeeName ?? "";
item.UserIcon = emModel?.UserIcon ?? "";
......@@ -1109,9 +1126,11 @@ namespace Edu.Module.OKR
{
var RList = new List<object>();
var list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, ManagerIds = userInfo.Id.ToString() });
foreach (var item in list) {
foreach (var item in list)
{
var dlist = departmentRepository.GetCurrentAndChildDepartmentListRepository(item.DeptId);
foreach (var qitem in dlist) {
foreach (var qitem in dlist)
{
RList.Add(new
{
qitem.DeptId,
......@@ -1145,10 +1164,12 @@ namespace Edu.Module.OKR
/// <param name="dmodel"></param>
/// <param name="list"></param>
/// <returns></returns>
public List<object> GetChildDepartment(Model.ViewModel.User.RB_Department_ViewModel dmodel, List<Model.ViewModel.User.RB_Department_ViewModel> list) {
public List<object> GetChildDepartment(Model.ViewModel.User.RB_Department_ViewModel dmodel, List<Model.ViewModel.User.RB_Department_ViewModel> list)
{
var ChildList = new List<object>();
var clist = list.Where(x => x.ParentId == dmodel.DeptId).ToList();
foreach (var item in clist) {
foreach (var item in clist)
{
ChildList.AddRange(GetChildDepartment(item, list));
}
return new List<object>() {
......@@ -1200,7 +1221,8 @@ namespace Edu.Module.OKR
}
};
bool flag = oKR_KeyResultRepository.Update(keyValues, wheres);
if (flag) {
if (flag)
{
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
......@@ -1221,7 +1243,8 @@ namespace Edu.Module.OKR
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public bool UpdateOKRKeyresultRuleProgress(RB_OKR_KeyResult_ViewModel dmodel) {
public bool UpdateOKRKeyresultRuleProgress(RB_OKR_KeyResult_ViewModel dmodel)
{
//查询结果适配部门/人员列表
List<int> empIdList = new List<int>() { dmodel.CreateBy };
var reList = GetOKRKeyResultRuleReList(dmodel.Id);
......@@ -1384,7 +1407,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
qitem.IsLock = 1;
}
if (qitem.RuleId > 0) {
if (qitem.RuleId > 0)
{
qitem.RuleName = krRuleList.Where(x => x.Id == qitem.RuleId).FirstOrDefault()?.RuleName ?? "";
}
}
......@@ -1527,7 +1551,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
})
}),
x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
......@@ -1735,7 +1759,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
// var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userId, Status = 2 });
var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userId, selectStatus =1 });
var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userId, selectStatus = 1 });
if (list.Any())
{
string objectiveIds = string.Join(",", list.Select(x => x.Id));
......@@ -1941,7 +1965,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
})
}),
x.AuditRemark,
AuditTime= Common.ConvertHelper.FormatTime(x.AuditTime),
AuditTime = Common.ConvertHelper.FormatTime(x.AuditTime),
x.AuditUserId,
AuditUserName = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.AccountName ?? "",
UserIcon = UserReidsCache.GetUserLoginInfo((x.AuditUserId > 0 ? x.AuditUserId : 0))?.UserIcon ?? "",
......@@ -2640,8 +2664,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
if (pplist.Any()) {
else
{
if (pplist.Any())
{
return new
{
Status = 2,
......@@ -2828,7 +2854,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
list = list.Where(x => x.IsNotLook == 2).ToList();
List<object> RList = new List<object>();
foreach (var item in DQUserId) {
foreach (var item in DQUserId)
{
var emModel = emList.Where(x => x.Id == item).FirstOrDefault();
if ((UserLookList.Where(x => x.CreateBy == item).FirstOrDefault()?.IsLock ?? 0) == 1)
{
......@@ -2843,7 +2870,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
List = new List<object>()
});
}
else {
else
{
RList.Add(new
{
IsNotLook = 2,
......@@ -2852,7 +2880,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
UserPhoto = emModel.UserIcon,
emModel.DeptName,
emModel.PostName,
List = list.Where(x=>x.CreateBy == item).Select(x => new
List = list.Where(x => x.CreateBy == item).Select(x => new
{
x.Id,
x.Title,
......@@ -3126,7 +3154,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
ObjectiveId = dmodel.Id;
var hmodel = oKR_ObjectiveRepository.GetEntity(dmodel.Id);
if (hmodel.ProgressRemark == dmodel.ProgressRemark && hmodel.Title == dmodel.Title) {
if (hmodel.ProgressRemark == dmodel.ProgressRemark && hmodel.Title == dmodel.Title)
{
return "";
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
......@@ -3169,7 +3198,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
Group_Id = userInfo.Group_Id
});
}
if (hmodel.Title == dmodel.Title) {
if (hmodel.Title == dmodel.Title)
{
oKR_UpdateHistoryRepository.Insert(new Model.Entity.OKR.RB_OKR_UpdateHistory()
{
Id = 0,
......@@ -3303,7 +3333,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
RKeyResultId = keyResultId;
var hmodel = oKR_KeyResultRepository.GetEntity(keyResultId);
if (hmodel.Name == name) {
if (hmodel.Name == name)
{
return "";
}
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
......@@ -3463,7 +3494,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_OKR_KeyResult_ViewModel> GetOKRKeyResultList(RB_OKR_KeyResult_ViewModel dmodel) {
public List<RB_OKR_KeyResult_ViewModel> GetOKRKeyResultList(RB_OKR_KeyResult_ViewModel dmodel)
{
return oKR_KeyResultRepository.GetList(dmodel);
}
......@@ -3857,10 +3889,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
model = oKR_KeyResultRepository.GetEntity<RB_OKR_KeyResult_ViewModel>(keyResultId);
}
if (model == null || model.Status == 1){
if (model == null || model.Status == 1)
{
return ApiResult.Failed("关键结果不存在");
}
if (keyResultId > 0 && model.RuleId > 0) {
if (keyResultId > 0 && model.RuleId > 0)
{
return ApiResult.Failed("关键结果已设置规则,无法手动调整进度");
}
if (type == 1)
......@@ -4617,8 +4651,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
oKR_PeriodPermissionRepository.Delete(item);
}
}
else {
if (!list.Any()) {
else
{
if (!list.Any())
{
oKR_PeriodPermissionRepository.Insert(new Model.Entity.OKR.RB_OKR_PeriodPermission()
{
Id = 0,
......@@ -4960,7 +4996,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <param name="Group_Id"></param>
/// <param name="QDeptIds"></param>
/// <returns></returns>
public List<Model.ViewModel.User.Employee_ViewModel> GetDepartmentEmployeeList(int Group_Id, string QDeptIds) {
public List<Model.ViewModel.User.Employee_ViewModel> GetDepartmentEmployeeList(int Group_Id, string QDeptIds)
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = Group_Id, IsLeave = 1, QDeptIds = QDeptIds });
return em1List;
}
......@@ -4970,7 +5007,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<int> GetMyUnderlingUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0, int leaveStatus =0)
public List<int> GetMyUnderlingUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0, int leaveStatus = 0)
{
List<int> UserIdList = new List<int>();
#region 我的直属下级
......@@ -4988,7 +5025,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
if (xjdlist.Any())
{
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)), Post_Id = PostId ,LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", xjdlist.Select(x => x.DeptId)), Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
if (em1List.Any())
{
......@@ -5079,7 +5116,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
else
{
//非部门负责人 直接查直属
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id, Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
......@@ -5121,7 +5159,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.Id,
item.EmployeeName,
item.UserIcon,
PeriodIds = list?.Where(qitem=>qitem.CreateBy==item.Id)?.FirstOrDefault()?.PeriodIds??""
PeriodIds = list?.Where(qitem => qitem.CreateBy == item.Id)?.FirstOrDefault()?.PeriodIds ?? ""
});
}
}
......@@ -5684,9 +5722,11 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// </summary>
/// <param name="GroupId"></param>
/// <returns></returns>
public bool SendOKRRemid() {
public bool SendOKRRemid()
{
var rlist = oKR_RemindRepository.GetList(new RB_OKR_Remind_ViewModel() { Enable = 1 });
if (rlist.Any()) {
if (rlist.Any())
{
var groupIdList = rlist.Select(x => x.Group_Id).Distinct().ToList();
foreach (var GroupId in groupIdList)
{
......@@ -5938,8 +5978,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
if (pplist.Where(x => x.CreateBy == UserId).Any()) {
else
{
if (pplist.Where(x => x.CreateBy == UserId).Any())
{
IsLook = 1;
}
}
......@@ -6251,8 +6293,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
if (pplist.Where(x => x.CreateBy == UserId).Any()) {
else
{
if (pplist.Where(x => x.CreateBy == UserId).Any())
{
IsLook = 1;
}
}
......@@ -6436,8 +6480,10 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
if (pplist.Where(x => x.CreateBy == UserId).Any()) {
else
{
if (pplist.Where(x => x.CreateBy == UserId).Any())
{
IsLook = 1;
}
}
......@@ -7044,11 +7090,14 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
};
bool flag = oKR_CommentRepository.Update(keyValues, wheres);
if (flag) {
if (omodel.ParentId > 0 && model.State == 3) {
if (flag)
{
if (omodel.ParentId > 0 && model.State == 3)
{
//查询该父级下是否还有未删除的评论 没有的话删除该父级评论
var list = oKR_CommentRepository.GetList(new RB_OKR_Comment_ViewModel() { Group_Id = omodel.Group_Id, ParentId = omodel.ParentId });
if (!list.Any()) {
if (!list.Any())
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_OKR_Comment_ViewModel.State),3},
{ nameof(RB_OKR_Comment_ViewModel.UpdateBy),model.UpdateBy},
......@@ -7131,14 +7180,17 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
public List<RB_OKR_Comment_ViewModel> GetCommentPageList_V2(int pageIndex, int pageSize, out long rowsCount, RB_OKR_Comment_ViewModel query)
{
var list = oKR_CommentRepository.GetCommentPageList_V2(pageIndex, pageSize, out rowsCount, query);
if (list.Any()) {
if (list.Any())
{
//非周期评论的 都需要查询下级评论
string cids = string.Join(",", list.Where(x => x.Type != 4).Select(x => x.Id));
List<RB_OKR_Comment_ViewModel> ChildList = new List<RB_OKR_Comment_ViewModel>();
if (!string.IsNullOrEmpty(cids)) {
if (!string.IsNullOrEmpty(cids))
{
ChildList = oKR_CommentRepository.GetList_V2(new RB_OKR_Comment_ViewModel() { Group_Id = query.Group_Id, ParentIds = cids });
}
foreach (var item in list) {
foreach (var item in list)
{
item.ChildList = new List<RB_OKR_Comment_ViewModel>();
if (item.Type == 4)
{
......@@ -7154,7 +7206,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
});
item.Content = "评论";
}
else {
else
{
item.ChildList = ChildList.Where(x => x.ParentId == item.Id).ToList();
}
}
......@@ -7186,7 +7239,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
userIdList = GetMyUnderlingUserIdList(userInfo, departId, postId, leaveStatus);
}
}
else {
else
{
var accountList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = departId, IsSelectLevelNor = 1 });
userIdList = accountList.Select(x => x.Id).ToList();
}
......@@ -7195,7 +7249,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var olist = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = periodId, CreateByIds = string.Join(",", userIdList), Status = 2 });
//查询出每个人的objective的数量
var objectiveNumList = new List<RB_OKR_Objective_ViewModel>();
foreach (var item in userIdList) {
foreach (var item in userIdList)
{
objectiveNumList.Add(new RB_OKR_Objective_ViewModel()
{
CreateBy = item,
......@@ -7564,7 +7619,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
//返回部门树形结构
foreach (var item in xjdlist) {
foreach (var item in xjdlist)
{
List<Model.ViewModel.User.Employee_ViewModel> ManagerList1 = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
......@@ -7579,10 +7635,12 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
rmodel.ObjectiveNum2,
rmodel.ObjectiveNum3
};
if (type == 1) {
if (type == 1)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
}
else if (type == 3 || type == 4) {
else if (type == 3 || type == 4)
{
ObjectiveNumList.Add(rmodel.ObjectiveNum4);
ObjectiveNumList.Add(rmodel.ObjectiveNum5);
}
......@@ -7673,7 +7731,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
}
}
else {
else
{
if (departId > 0)
{
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, DeptId = departId });
......@@ -7743,7 +7802,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
});
}
}
else {
else
{
//直接查询所有部门
var dlist = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { Group_Id = userInfo.Group_Id });
if (dlist.Any())
......@@ -7838,7 +7898,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
{
List<object> Rlist = new List<object>();
var clist = d2list.Where(x => x.ParentId == model.DeptId).ToList();
foreach (var item in clist) {
foreach (var item in clist)
{
List<Employee_ViewModel> ManagerList1 = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(item.ManagerIds))
{
......@@ -7908,6 +7969,17 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
/// <summary>
/// 获取个人维度对齐量
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="id"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRPersonalRelationAlignList_V2(int group_Id, int periodId, string CreateBys)
{
return oKR_ObjectiveRepository.GetOKRPersonalRelationAlignList_V2(group_Id, periodId, CreateBys);
}
/// <summary>
......@@ -7995,7 +8067,110 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}
/// <summary>
/// 获取我所有下级
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<OKRPersonalDimension> GetOKRMyAllDownlineUserIdList(UserInfo userInfo, int DeptId = 0, int PostId = 0, int leaveStatus = 0)
{
List<int> UserIdList = new List<int>() { userInfo.Id };
List<OKRPersonalDimension> allList = new List<OKRPersonalDimension>();
#region 我的所有下级(部门层级所有人+直属人)
//如果是部门主管 需要将部门下除自己其他人加入
//查询部门负责人 负责的所有部门
var xjdlist = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { DeptId = DeptId, Group_Id = userInfo.Group_Id, ManagerIds = userInfo.Id.ToString() });
if (xjdlist.Any())
{
List<int> DeptIdList = new List<int>();
foreach (var item in xjdlist)
{
//查询出所有的部门
string DeptIds = departmentRepository.GetCurrentAndChildDepartmentIdsRepository(item.DeptId);
if (!string.IsNullOrEmpty(DeptIds))
{
DeptIdList.AddRange(JsonHelper.DeserializeObject<List<int>>("[" + DeptIds + "]"));
}
}
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QDeptIds = string.Join(",", DeptIdList.Distinct()), Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
//上级部门下所有子部门的负责人
var d2list = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { Group_Id = userInfo.Group_Id, QDeptIds = string.Join(",", DeptIdList.Distinct()) });
string ManagerIds = string.Join(",", d2list.Where(x => !string.IsNullOrEmpty(x.ManagerIds)).Select(x => x.ManagerIds));
if (!string.IsNullOrEmpty(ManagerIds))
{
em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, QIds = ManagerIds, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
em1List = em1List.Where(x => !UserIdList.Contains(x.Id) && x.Id != userInfo.Id && x.DirectSupervisor == 0).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
}
UserIdList = UserIdList.Distinct().ToList();
//查询这些人的直属人
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisorIds = string.Join(",", UserIdList), Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
{
foreach (var item in emList)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
}
}
else
{
//非部门负责人 直接查直属
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, IsLeave = 1, DirectSupervisor = userInfo.Id, Dept_Id = DeptId, Post_Id = PostId, LeaveStatus = (Common.Enum.User.LeaveStatusEnum)leaveStatus });
if (emList.Any())
{
foreach (var item in emList)
{
allList.Add(new OKRPersonalDimension()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon,
Dept_Id = item.Dept_Id,
Type = 2
});
UserIdList.Add(item.Id);
}
}
}
#endregion
return allList.Distinct().ToList();
}
/// <summary>
/// 获取员工okr列表
......
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