Commit a6b7e41d authored by liudong1993's avatar liudong1993

okr列表

parent 12f112d2
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.OKR
{
/// <summary>
/// okr关注实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OKR_Attention
{
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 账号id
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// 关注人id
/// </summary>
public int AttentionId { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校id
/// </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; }
}
}
......@@ -22,6 +22,11 @@ namespace Edu.Model.Entity.OKR
/// </summary>
public int PeriodId { get; set; }
/// <summary>
/// 属于谁的
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// 内容
/// </summary>
......
......@@ -102,5 +102,20 @@ namespace Edu.Model.Entity.OKR
/// 分数规则id
/// </summary>
public int ScoreRuleId { get; set; }
/// <summary>
/// 审核人
/// </summary>
public int AuditUserId { get; set; }
/// <summary>
/// 审核时间
/// </summary>
public DateTime? AuditTime { get; set; }
/// <summary>
/// 审核备注
/// </summary>
public string AuditRemark { get; set; }
}
}
......@@ -24,7 +24,7 @@ namespace Edu.Model.Entity.OKR
/// <summary>
/// 周期/目标/结果 的id
/// </summary>
public int ObjectiveId { get; set; }
public int TargetId { get; set; }
/// <summary>
/// 类型 1员工 2部门 3岗位
......
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.OKR
{
/// <summary>
/// okr更新通知实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OKR_UpdateNotification
{
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 接收人id
/// </summary>
public int ReceiveId { get; set; }
/// <summary>
/// 状态 1已看 2未看
/// </summary>
public int State { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
......@@ -77,5 +77,10 @@ namespace Edu.Model.Entity.User
/// </summary>
public double AnnualLeaveDay { get; set; }
/// <summary>
/// 直接主管 (OKR专用)
/// </summary>
public int DirectSupervisor { get; set; }
}
}
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.OKR
{
/// <summary>
/// OKR关注扩展类
/// </summary>
[Serializable]
public class RB_OKR_Attention_ViewModel : Model.Entity.OKR.RB_OKR_Attention
{
}
}
\ No newline at end of file
......@@ -44,6 +44,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public int IsLock { get; set; }
/// <summary>
/// 是否已对齐
/// </summary>
public int IsParent { get; set; }
/// <summary>
/// 员工姓名
/// </summary>
......
......@@ -13,5 +13,10 @@ namespace Edu.Model.ViewModel.OKR
/// 目标ids
/// </summary>
public string ObjectiveIds { get; set; }
/// <summary>
/// 来源名称
/// </summary>
public string SourceName { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.OKR
{
/// <summary>
/// OKR更新通知扩展类
/// </summary>
[Serializable]
public class RB_OKR_UpdateNotification_ViewModel : Model.Entity.OKR.RB_OKR_UpdateNotification
{
/// <summary>
/// 接收人ids
/// </summary>
public string ReceiveIds { get; set; }
/// <summary>
/// 发送人ids
/// </summary>
public string UpdateByIds { get; set; }
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ using Edu.Model.CacheModel;
using Edu.Model.ViewModel.OKR;
using Edu.Repository.Log;
using Edu.Repository.OKR;
using Edu.Repository.User;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
......@@ -30,6 +31,10 @@ namespace Edu.Module.OKR
/// </summary>
private readonly RB_OKR_ObjectiveRepository oKR_ObjectiveRepository = new RB_OKR_ObjectiveRepository();
/// <summary>
/// 对齐
/// </summary>
private readonly RB_OKR_ObjectiveRelationRepository oKR_ObjectiveRelationRepository = new RB_OKR_ObjectiveRelationRepository();
/// <summary>
/// 周期配置
/// </summary>
private readonly RB_OKR_PeriodConfigRepository oKR_PeriodConfigRepository = new RB_OKR_PeriodConfigRepository();
......@@ -54,9 +59,29 @@ namespace Edu.Module.OKR
/// </summary>
private readonly RB_OKR_ScoreRepository oKR_ScoreRepository = new RB_OKR_ScoreRepository();
/// <summary>
/// 关注
/// </summary>
private readonly RB_OKR_AttentionRepository oKR_AttentionRepository = new RB_OKR_AttentionRepository();
/// <summary>
/// 用户日志
/// </summary>
private readonly RB_User_ChangeLogRepository changeLogRepository = new RB_User_ChangeLogRepository();
/// <summary>
/// 更新通知
/// </summary>
private readonly RB_OKR_UpdateNotificationRepository oKR_UpdateNotificationRepository = new RB_OKR_UpdateNotificationRepository();
/// <summary>
/// 账户
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 部门
/// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary>
/// 岗位
/// </summary>
private readonly RB_PostRepository postRepository = new RB_PostRepository();
#region 基础配置
......@@ -569,7 +594,7 @@ namespace Edu.Module.OKR
foreach (var item in krList)
{
item.IsLock = 2;
if (pkrList.Where(x => x.ObjectiveId == item.Id).Any())
if (pkrList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -578,7 +603,7 @@ namespace Edu.Module.OKR
{
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -587,14 +612,14 @@ namespace Edu.Module.OKR
{
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
}
foreach (var item in list) {
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -732,9 +757,22 @@ namespace Edu.Module.OKR
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKROthersObjectiveList(int periodId, int userId, UserInfo userInfo)
{
throw new NotImplementedException();
}
/// <summary>
/// 获取他人的目标列表
/// </summary>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="userId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKROthersObjectiveDropList(int periodId, int objectiveId, int userId, UserInfo userInfo)
{
//查询是否有权限
var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, ObjectiveId = periodId, CreateBy = userId });
var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = periodId, CreateBy = userId });
if (zpList.Any()) {
var NotLookList = zpList.Where(x => x.State == 2).ToList();
var LookList = zpList.Where(x => x.State == 1).ToList();
......@@ -781,7 +819,7 @@ namespace Edu.Module.OKR
}
}
}
var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = periodId, CreateBy = userId });
var list = oKR_ObjectiveRepository.GetList(new RB_OKR_Objective_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = periodId, CreateBy = userId, Status = 2 });
if (list.Any())
{
string objectiveIds = string.Join(",", list.Select(x => x.Id));
......@@ -798,10 +836,10 @@ namespace Edu.Module.OKR
foreach (var item in krList)
{
item.IsLock = 2;
if (pkrList.Where(x => x.ObjectiveId == item.Id).Any())
if (pkrList.Where(x => x.TargetId == item.Id).Any())
{
var NotLookList = pkrList.Where(x => x.ObjectiveId == item.Id && x.State == 2).ToList();
var LookList = pkrList.Where(x => x.ObjectiveId == item.Id && x.State == 1).ToList();
var NotLookList = pkrList.Where(x => x.TargetId == item.Id && x.State == 2).ToList();
var LookList = pkrList.Where(x => x.TargetId == item.Id && x.State == 1).ToList();
if (NotLookList.Any())
{
//有不可看的
......@@ -818,27 +856,67 @@ namespace Edu.Module.OKR
item.IsLock = 1;
}
}
if (LookList.Any())
if (item.IsLock == 2)
{
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Post && x.SourceId == userInfo.PostId).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Department && x.SourceId == userInfo.DeptId).Any())
if (LookList.Any())
{
//OK
}
else
{
item.IsLock = 1;
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Post && x.SourceId == userInfo.PostId).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Department && x.SourceId == userInfo.DeptId).Any())
{
//OK
}
else
{
item.IsLock = 1;
}
}
}
}
}
#region 查询已对齐目标
//查询向上对齐
var sdqList = oKR_ObjectiveRelationRepository.GetList(new Model.Entity.OKR.RB_OKR_ObjectiveRelation() { ObjectiveId = objectiveId });
#endregion
foreach (var item in list)
{
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
var NotLookList = pList.Where(x => x.TargetId == item.Id && x.State == 2).ToList();
var LookList = pList.Where(x => x.TargetId == item.Id && x.State == 1).ToList();
if (NotLookList.Any())
{
//有不可看的
if (NotLookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).Any())
{
item.IsLock = 1;
}
if (NotLookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Post && x.SourceId == userInfo.PostId).Any())
{
item.IsLock = 1;
}
if (NotLookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Department && x.SourceId == userInfo.DeptId).Any())
{
item.IsLock = 1;
}
}
if (item.IsLock == 2)
{
if (LookList.Any())
{
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Post && x.SourceId == userInfo.PostId).Any()
|| LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Department && x.SourceId == userInfo.DeptId).Any())
{
//OK
}
else
{
item.IsLock = 1;
}
}
}
}
//结果列表
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
......@@ -846,81 +924,38 @@ namespace Edu.Module.OKR
{
item.ProgressState = item.KeyResultList.Max(x => x.ProgressState);
}
item.IsParent = 2;
if (sdqList.Where(x => x.ParentId == item.Id).Any())
{
item.IsParent = 1;
}
}
}
return list.Select(x => new
list = list.Where(x => x.IsLock == 2).ToList();
return new
{
x.Id,
x.Title,
x.Sort,
x.Progress,
x.Weight,
x.Score,
x.ProgressRemark,
x.IsDefaultState,
x.ProgressState,
ProgressStateName = x.ProgressState.ToName(),
x.Status,
x.IsLock,
x.ScoreName,
x.ScoreColor,
KeyResultList = x.KeyResultList.Select(z => new
{
z.Id,
z.Name,
z.Sort,
z.Progress,
z.Weight,
z.Score,
z.ProgressState,
ProgressStateName = z.ProgressState.ToName(),
z.StartValue,
z.EndValue,
z.CurrentValue,
z.IsEasyMode,
z.IsLock,
z.ScoreName,
z.ScoreColor
}),
ParentList = x.ParentList.Select(y => new
Status = 1,
List = list.Select(x => new
{
y.AccountId,
y.AccountName,
AlignList = y.AlignList.Select(q => new
x.Id,
x.Title,
x.Sort,
x.Progress,
x.ProgressState,
ProgressStateName = x.ProgressState.ToName(),
x.IsParent,
KeyResultList = x.KeyResultList.Where(x => x.IsLock == 2).Select(z => new
{
q.Id,
q.Title,
q.Sort,
q.IsLock,
KeyResultList = x.KeyResultList.Select(z => new
{
z.Id,
z.Name,
z.Sort,
z.IsLock
}),
z.Id,
z.Name,
z.Sort,
z.Progress,
z.ProgressState,
ProgressStateName = z.ProgressState.ToName()
})
}),
ChildList = x.ChildList.Select(y => new
{
y.AccountId,
y.AccountName,
AlignList = y.AlignList.Select(q => new
{
q.Id,
q.Title,
q.Sort,
q.IsLock,
KeyResultList = x.KeyResultList.Select(z => new
{
z.Id,
z.Name,
z.Sort,
z.IsLock
}),
})
}),
});
})
};
}
/// <summary>
......@@ -970,7 +1005,7 @@ namespace Edu.Module.OKR
foreach (var item in krList)
{
item.IsLock = 2;
if (pkrList.Where(x => x.ObjectiveId == item.Id).Any())
if (pkrList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -979,7 +1014,7 @@ namespace Edu.Module.OKR
{
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -988,7 +1023,7 @@ namespace Edu.Module.OKR
{
item.KeyResultList = krList.Where(x => x.ObjectiveId == item.Id).ToList();
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -996,7 +1031,7 @@ namespace Edu.Module.OKR
foreach (var item in list)
{
item.IsLock = 2;
if (pList.Where(x => x.ObjectiveId == item.Id).Any())
if (pList.Where(x => x.TargetId == item.Id).Any())
{
item.IsLock = 1;
}
......@@ -2084,6 +2119,461 @@ namespace Edu.Module.OKR
}
return ApiResult.Failed();
}
/// <summary>
/// 设置对齐
/// </summary>
/// <param name="objectiveId"></param>
/// <param name="parentId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetOKRMyObjectiveParent(int objectiveId, int parentId, UserInfo userInfo)
{
var vlist = oKR_ObjectiveRelationRepository.GetList(new Model.Entity.OKR.RB_OKR_ObjectiveRelation() { ObjectiveId = objectiveId, ParentId = parentId });
if (vlist.Any()) {
return "已存在对齐,无法再次对齐";
}
var omodel = oKR_ObjectiveRepository.GetEntity(objectiveId);
var pmodel = oKR_ObjectiveRepository.GetEntity(parentId);
if (omodel == null) {
return "目标不存在";
}
if (pmodel == null) {
return "对齐目标不存在";
}
if (pmodel.Status != 2) {
return "未审核目标,无法对齐";
}
//验证是否会出现循环对齐 父级继续向上找, 当前向下找;看是否有交集
int Id = oKR_ObjectiveRelationRepository.Insert(new Model.Entity.OKR.RB_OKR_ObjectiveRelation()
{
Id = 0,
ObjectiveId = objectiveId,
ParentId = parentId
});
if (Id > 0) {
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
Type = 1,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id,
LogContent = "新增OKR对齐,由【" + objectiveId + "】向【" + parentId + "】对齐",
School_Id = userInfo.School_Id,
SourceId = 0
});
}
return Id > 0 ? "" : "出错了,请联系管理员";
}
/// <summary>
/// 取消对齐
/// </summary>
/// <param name="objectiveId"></param>
/// <param name="parentId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SgetOKRMyObjectiveParentCancel(int objectiveId, int parentId, UserInfo userInfo)
{
var vlist = oKR_ObjectiveRelationRepository.GetList(new Model.Entity.OKR.RB_OKR_ObjectiveRelation() { ObjectiveId = objectiveId, ParentId = parentId });
if (vlist.Any())
{
foreach (var item in vlist)
{
oKR_ObjectiveRelationRepository.Delete(item);
}
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
Type = 1,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now,
Group_Id = userInfo.Group_Id,
LogContent = "取消OKR对齐,取消由【" + objectiveId + "】向【" + parentId + "】对齐",
School_Id = userInfo.School_Id,
SourceId = 0
});
return "";
}
else {
return "";
}
}
/// <summary>
/// 获取权限列表
/// </summary>
/// <param name="targetId"></param>
/// <param name="type"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public List<RB_OKR_Permission_ViewModel> GetOKRPermissionList(int targetId, int type, UserInfo userInfo)
{
var list = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = type, TargetId = targetId, CreateBy = userInfo.Id });
if (list.Any()) {
//人员 部门 岗位查询
string rids = string.Join(",", list.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee).Select(x => x.SourceId));
string bids = string.Join(",", list.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Department).Select(x => x.SourceId));
string gids = string.Join(",", list.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Post).Select(x => x.SourceId));
var peopleList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (!string.IsNullOrEmpty(rids))
{
peopleList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = rids });
}
var departmentList = new List<Model.ViewModel.User.RB_Department_ViewModel>();
if (!string.IsNullOrEmpty(bids)) {
departmentList = departmentRepository.GetDepartmentListRepository(new Model.ViewModel.User.RB_Department_ViewModel() { QDeptIds = bids });
}
var postList = new List<Model.ViewModel.User.RB_Post_ViewModel>();
if (!string.IsNullOrEmpty(gids)) {
postRepository.GetPostListRepository(new Model.ViewModel.User.RB_Post_ViewModel() { QPostIds = gids });
}
foreach (var item in list) {
if (item.Type == Common.Enum.OKR.PermissionTypeEnum.Employee)
{
item.SourceName = peopleList.Where(x => x.Id == item.SourceId).FirstOrDefault()?.EmployeeName ?? "";
}
else if (item.Type == Common.Enum.OKR.PermissionTypeEnum.Department)
{
item.SourceName = departmentList.Where(x => x.DeptId == item.SourceId).FirstOrDefault()?.DeptName ?? "";
}
else if (item.Type == Common.Enum.OKR.PermissionTypeEnum.Post) {
item.SourceName = postList.Where(x => x.PostId == item.SourceId).FirstOrDefault()?.PostName ?? "";
}
}
}
return list;
}
/// <summary>
/// 保存权限
/// </summary>
/// <param name="permissionType"></param>
/// <param name="targetId"></param>
/// <param name="list"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SgetOKRPermissionInfo(int permissionType, int targetId, List<RB_OKR_Permission_ViewModel> list, UserInfo userInfo)
{
//查询该用户是否已有该权限
var plist = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = permissionType, TargetId = targetId, CreateBy = userInfo.Id });
var trans = oKR_PermissionRepository.DbTransaction;
try
{
if (list.Any())
{
//没有新增 多的删除
foreach (var item in list) {
var model = plist.Where(x => x.Type == item.Type && x.SourceId == item.SourceId).FirstOrDefault();
if (model == null)
{
//新增
oKR_PermissionRepository.Insert(item);
}
else if (model.State != item.State) {
//修改
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Permission_ViewModel.State),item.State},
{ nameof(RB_OKR_Permission_ViewModel.UpdateBy),userInfo.Id},
{ nameof(RB_OKR_Permission_ViewModel.UpdateTime),DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_Permission_ViewModel.Id),
FiledValue=model.Id,
OperatorEnum=OperatorEnum.Equal
}
};
oKR_PermissionRepository.Update(keyValues, wheres, trans);
}
}
foreach (var item in plist) {
if (!list.Where(x => x.Type == item.Type && x.SourceId == item.SourceId).Any()) {
oKR_PermissionRepository.Delete(item, trans);
}
}
}
else {
//删除所有权限
oKR_PermissionRepository.DeleteBatch(plist, trans);
}
oKR_PermissionRepository.DBSession.Commit();
return "";
}
catch (Exception ex)
{
oKR_PermissionRepository.DBSession.Rollback();
LogHelper.Write(ex, "SgetOKRPermissionInfo");
return "出错了,请联系管理员";
}
}
/// <summary>
/// 获取左边人员列表
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKRMyEmployeeList(UserInfo userInfo)
{
var deptModel = departmentRepository.GetEntity(userInfo.DeptId);
List<int> UserIdList = new List<int>();
#region 我的直属上级
List<Model.ViewModel.User.Employee_ViewModel> ZSList = new List<Model.ViewModel.User.Employee_ViewModel>();
var accountModel = accountRepository.GetEntity(userInfo.Id);
if (accountModel.DirectSupervisor > 0)
{
var directModel = accountRepository.GetEmployeeInfo(accountModel.DirectSupervisor);
ZSList.Add(new Model.ViewModel.User.Employee_ViewModel
{
Id = directModel.Id,
EmployeeName = directModel.EmployeeName,
UserIcon = directModel.UserIcon
});
UserIdList.Add(directModel.Id);
}
else {
//根据部门查询
string ManagerIds = "";
if (("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
//说明自己是当前部门的主管 再查上级部门主管
var deptpModel = departmentRepository.GetEntity(deptModel.ParentId);
ManagerIds = deptpModel?.ManagerIds ?? "";
}
else {
ManagerIds = deptModel.ManagerIds;
}
if (!string.IsNullOrEmpty(ManagerIds)) {
var list = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = ManagerIds });
foreach (var item in list) {
ZSList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
}
}
#endregion
#region 我的直属下级
List<Model.ViewModel.User.Employee_ViewModel> ChildList = new List<Model.ViewModel.User.Employee_ViewModel>();
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = userInfo.Id });
if (emList.Any())
{
foreach (var item in emList) {
ChildList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if (("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ",")) {
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = userInfo.DeptId });
em1List = em1List.Where(x => !emList.Select(y => y.Id).Contains(x.Id)).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
ChildList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
}
#endregion
#region 我的同级
List<Model.ViewModel.User.Employee_ViewModel> SiblingList = new List<Model.ViewModel.User.Employee_ViewModel>();
if (accountModel.DirectSupervisor > 0) {
var em2List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = accountModel.DirectSupervisor });
em2List = em2List.Where(x => x.Id != userInfo.Id).ToList();
foreach (var item in em2List)
{
SiblingList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
}
//继续查询同部门的 也算同级
if (!("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = userInfo.DeptId });
em1List = em1List.Where(x => !emList.Select(y => y.Id).Contains(x.Id) && x.Id != userInfo.Id).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
ChildList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
}
#endregion
#region 我的关注
List<Model.ViewModel.User.Employee_ViewModel> AttentionList = new List<Model.ViewModel.User.Employee_ViewModel>();
var alist = oKR_AttentionRepository.GetList(new RB_OKR_Attention_ViewModel() { Group_Id = userInfo.Group_Id, AccountId = userInfo.Id });
string aids = string.Join(",", alist.Select(x => x.AttentionId));
var em3List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = aids });
foreach (var item in em3List)
{
AttentionList.Add(new Model.ViewModel.User.Employee_ViewModel()
{
Id = item.Id,
EmployeeName = item.EmployeeName,
UserIcon = item.UserIcon
});
UserIdList.Add(item.Id);
}
#endregion
//还差了个 是否有最新消息返回------------------------------------------------------
if (UserIdList.Any()) {
var list = oKR_UpdateNotificationRepository.GetList(new RB_OKR_UpdateNotification_ViewModel() { ReceiveId = userInfo.Id, UpdateByIds = string.Join(",", UserIdList), State = 2 });
var UserUpdateList = list.Select(x => x.UpdateBy).ToList();
ZSList.Where(x => UserUpdateList.Contains(x.Id)).ToList().ForEach(x =>
{
x.IsBirth = 1;
});
ChildList.Where(x => UserUpdateList.Contains(x.Id)).ToList().ForEach(x =>
{
x.IsBirth = 1;
});
SiblingList.Where(x => UserUpdateList.Contains(x.Id)).ToList().ForEach(x =>
{
x.IsBirth = 1;
});
AttentionList.Where(x => UserUpdateList.Contains(x.Id)).ToList().ForEach(x =>
{
x.IsBirth = 1;
});
}
return new
{
ParentList = ZSList.Select(x => new {
x.Id,
x.EmployeeName,
x.UserIcon,
IsHaveUpdate = x.IsBirth
}),
ChildList = ChildList.Select(x => new {
x.Id,
x.EmployeeName,
x.UserIcon,
IsHaveUpdate = x.IsBirth
}),
SiblingList = SiblingList.Select(x => new {
x.Id,
x.EmployeeName,
x.UserIcon,
IsHaveUpdate = x.IsBirth
}),
AttentionList = AttentionList.Select(x => new {
x.Id,
x.EmployeeName,
x.UserIcon,
IsHaveUpdate = x.IsBirth
})
};
}
/// <summary>
/// 获取我的审核人员列表
/// </summary>
/// <param name="periodId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKRMyEmployeeAuditList(int periodId, UserInfo userInfo)
{
var deptModel = departmentRepository.GetEntity(userInfo.DeptId);
#region 我的直属下级
List<int> ChildIdList = new List<int>();
var emList = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, DirectSupervisor = userInfo.Id });
if (emList.Any())
{
foreach (var item in emList)
{
ChildIdList.Add(item.Id);
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if (("," + deptModel.ManagerIds + ",").Contains("," + userInfo.Id + ","))
{
//查询该部门下所有人
var em1List = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { Group_Id = userInfo.Group_Id, Dept_Id = userInfo.DeptId });
em1List = em1List.Where(x => !emList.Select(y => y.Id).Contains(x.Id)).ToList();//排序 已存在的直接关系
foreach (var item in em1List)
{
ChildIdList.Add(item.Id);
}
}
#endregion
#region 我的审批
List<object> AuditList = new List<object>();
//直接拿直属下级 待审核的
if (ChildIdList.Any())
{
var list = oKR_ObjectiveRepository.GetOKRMyEmployeeAuditList(userInfo.Group_Id, periodId, string.Join(",", ChildIdList));
string emIds = string.Join(",", list.Select(x => x.CreateBy));
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds });
foreach (var item in emlist)
{
AuditList.Add(new
{
item.Id,
item.EmployeeName,
item.UserIcon
});
}
}
#endregion
return AuditList;
}
/// <summary>
/// 获取我的对齐
/// </summary>
/// <param name="periodId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKRMyEmployeeAlignList(int periodId, UserInfo userInfo)
{
//查询当期目标所有对齐 , 对齐目标的所有用户
List<object> AlignList = new List<object>();
var list = oKR_ObjectiveRepository.GetOKRMyEmployeeAlignList(userInfo.Group_Id, periodId, userInfo.Id);
string emIds = string.Join(",", list.Select(x => x.CreateBy));
var unlist = oKR_UpdateNotificationRepository.GetList(new RB_OKR_UpdateNotification_ViewModel() { ReceiveId = userInfo.Id, UpdateByIds = emIds, State = 2 });
var UserUpdateList = list.Select(x => x.UpdateBy).ToList();
var emlist = accountRepository.GetEmployeeListRepository(new Model.ViewModel.User.Employee_ViewModel() { QIds = emIds });
foreach (var item in emlist)
{
AlignList.Add(new
{
item.Id,
item.EmployeeName,
item.UserIcon,
IsHaveUpdate = unlist.Where(x => x.UpdateBy == item.Id).Any() ? 1 : 0
});
}
return AlignList;
}
#endregion
}
......
using Edu.Common.Enum;
using Edu.Model.Entity.OKR;
using Edu.Model.ViewModel.OKR;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.OKR
{
/// <summary>
/// OKR关注仓储层
/// </summary>
public class RB_OKR_AttentionRepository : BaseRepository<RB_OKR_Attention>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <returns></returns>
//public List<RB_OKR_Comment_ViewModel> GetPageList(int pageIndex, int pageSize, out long rowsCount, RB_OKR_Comment_ViewModel demodel)
//{
// string where = $@" 1=1 and State <> 3";
// if (demodel.Group_Id > 0)
// {
// where += $@" and {nameof(RB_OKR_Comment_ViewModel.Group_Id)} ={demodel.Group_Id}";
// }
// if (demodel.PeriodId > 0)
// {
// where += $@" and {nameof(RB_OKR_Comment_ViewModel.PeriodId)} ={demodel.PeriodId}";
// }
// if (demodel.State > 0)
// {
// where += $@" and {nameof(RB_OKR_Comment_ViewModel.State)} ={demodel.State}";
// }
// string sql = $@" select * from RB_OKR_Comment where {where} order by Id desc";
// return GetPage<RB_OKR_Comment_ViewModel>(pageIndex, pageSize, out rowsCount, sql).ToList();
//}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_Attention_ViewModel> GetList(RB_OKR_Attention_ViewModel demodel)
{
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_OKR_Attention_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.AccountId > 0)
{
where += $@" and {nameof(RB_OKR_Attention_ViewModel.AccountId)} ={demodel.AccountId}";
}
if (demodel.AttentionId > 0)
{
where += $@" and {nameof(RB_OKR_Attention_ViewModel.AttentionId)} ={demodel.AttentionId}";
}
string sql = $@" select * from RB_OKR_Attention where {where} order by Id desc";
return Get<RB_OKR_Attention_ViewModel>(sql).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.OKR;
using Edu.Model.ViewModel.OKR;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.OKR
{
/// <summary>
/// OKR对齐仓储层
/// </summary>
public class RB_OKR_ObjectiveRelationRepository : BaseRepository<RB_OKR_ObjectiveRelation>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_ObjectiveRelation> GetList(RB_OKR_ObjectiveRelation demodel)
{
string where = $@" 1=1 and State <> 3";
if (demodel.ObjectiveId > 0)
{
where += $@" and {nameof(RB_OKR_ObjectiveRelation.ObjectiveId)} ={demodel.ObjectiveId}";
}
if (demodel.ParentId > 0)
{
where += $@" and {nameof(RB_OKR_ObjectiveRelation.ParentId)} ={demodel.ParentId}";
}
string sql = $@" select * from RB_OKR_ObjectiveRelation where {where} order by Id desc";
return Get<RB_OKR_ObjectiveRelation>(sql).ToList();
}
}
}
......@@ -193,5 +193,34 @@ where {where} order by o.Id desc";
}
return Execute(sql) > 0;
}
/// <summary>
/// 获取待审核的目标人员
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="v"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRMyEmployeeAuditList(int group_Id, int periodId, string v)
{
string sql = $@" select CreateBy from RB_OKR_Objective WHERE Group_Id={group_Id} and `Status` =1 and PeriodId ={periodId} and CreateBy in ({v}) GROUP BY CreateBy";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取我的对齐人员
/// </summary>
/// <param name="group_Id"></param>
/// <param name="periodId"></param>
/// <param name="id"></param>
/// <returns></returns>
public List<RB_OKR_Objective_ViewModel> GetOKRMyEmployeeAlignList(int group_Id, int periodId, int id)
{
string sql = $@"select o2.CreateBy from RB_OKR_Objective o1
LEFT JOIN rb_okr_objectiverelation re on o1.Id = re.ObjectiveId
LEFT JOIN RB_OKR_Objective o2 on re.ParentId = o2.Id
WHERE o1.Group_Id={group_Id} and o1.`Status` <>5 and o2.`Status` <>5 and o1.PeriodId ={periodId} and o1.CreateBy in ({id}) GROUP BY o2.CreateBy";
return Get<RB_OKR_Objective_ViewModel>(sql).ToList();
}
}
}
......@@ -33,9 +33,9 @@ namespace Edu.Repository.OKR
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.PermissionType)} ={demodel.PermissionType}";
}
if (demodel.ObjectiveId > 0)
if (demodel.TargetId > 0)
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.ObjectiveId)} ={demodel.ObjectiveId}";
where += $@" and {nameof(RB_OKR_Permission_ViewModel.TargetId)} ={demodel.TargetId}";
}
if (demodel.Type > 0)
{
......@@ -70,13 +70,13 @@ namespace Edu.Repository.OKR
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.PermissionType)} ={demodel.PermissionType}";
}
if (demodel.ObjectiveId > 0)
if (demodel.TargetId > 0)
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.ObjectiveId)} ={demodel.ObjectiveId}";
where += $@" and {nameof(RB_OKR_Permission_ViewModel.TargetId)} ={demodel.TargetId}";
}
if (!string.IsNullOrEmpty(demodel.ObjectiveIds))
{
where += $@" and {nameof(RB_OKR_Permission_ViewModel.ObjectiveId)} in({demodel.ObjectiveIds})";
where += $@" and {nameof(RB_OKR_Permission_ViewModel.TargetId)} in({demodel.ObjectiveIds})";
}
if (demodel.Type > 0)
{
......
using Edu.Common.Enum;
using Edu.Model.Entity.OKR;
using Edu.Model.ViewModel.OKR;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.OKR
{
/// <summary>
/// OKR更新通知仓储层
/// </summary>
public class RB_OKR_UpdateNotificationRepository : BaseRepository<RB_OKR_UpdateNotification>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_UpdateNotification_ViewModel> GetList(RB_OKR_UpdateNotification_ViewModel demodel)
{
string where = $@" 1=1 and Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.ReceiveId > 0)
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.ReceiveId)} ={demodel.ReceiveId}";
}
if (!string.IsNullOrEmpty(demodel.ReceiveIds))
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.ReceiveId)} in({demodel.ReceiveIds})";
}
if (demodel.UpdateBy > 0)
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.UpdateBy)} ={demodel.UpdateBy}";
}
if (!string.IsNullOrEmpty(demodel.UpdateByIds))
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.UpdateBy)} in({demodel.UpdateByIds})";
}
if (demodel.State > 0)
{
where += $@" and {nameof(RB_OKR_UpdateNotification_ViewModel.State)} ={demodel.State}";
}
string sql = $@" select * from RB_OKR_UpdateNotification where {where} order by Id desc";
return Get<RB_OKR_UpdateNotification_ViewModel>(sql).ToList();
}
}
}
......@@ -229,6 +229,10 @@ WHERE 1=1 {1}
{
where.AppendFormat(" AND A.{0}='{1}' ", nameof(Employee_ViewModel.Account), query.Account.Trim());
}
if (query.DirectSupervisor > 0)
{
where.AppendFormat(" AND A.{0} ={1} ", nameof(Employee_ViewModel.Id), query.DirectSupervisor);
}
if (!string.IsNullOrEmpty(query.QIds))
{
where.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.Id), query.QIds);
......
......@@ -661,10 +661,243 @@ namespace Edu.WebApi.Controllers.OKR
/// <returns></returns>
[HttpPost]
public ApiResult SgetOKRMyObjectiveParent() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ObjectiveId = parms.GetInt("ObjectiveId", 0);
int ParentId = parms.GetInt("ParentId", 0);
if (ParentId <= 0)
{
return ApiResult.ParamIsNull("请传递对齐目标id");
}
if (ObjectiveId <= 0)
{
return ApiResult.ParamIsNull("请传递当前目标id");
}
if (ObjectiveId == ParentId)
{
return ApiResult.ParamIsNull();
}
string msg = okrPeriodModule.SetOKRMyObjectiveParent(ObjectiveId, ParentId, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 取消对齐
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SgetOKRMyObjectiveParentCancel()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int ObjectiveId = parms.GetInt("ObjectiveId", 0);
int ParentId = parms.GetInt("ParentId", 0);
if (ParentId <= 0)
{
return ApiResult.ParamIsNull("请传递对齐目标id");
}
if (ObjectiveId <= 0)
{
return ApiResult.ParamIsNull("请传递当前目标id");
}
string msg = okrPeriodModule.SgetOKRMyObjectiveParentCancel(ObjectiveId, ParentId, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 获取他人的目标列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKROthersObjectiveDropList()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//周期id
int UserId = parms.GetInt("UserId", 0);//他人id
int ObjectiveId = parms.GetInt("ObjectiveId", 0);//当前目标
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull("请传递周期id");
}
if (UserId <= 0)
{
return ApiResult.ParamIsNull("请传递用户id");
}
if (ObjectiveId <= 0)
{
return ApiResult.ParamIsNull("请传递当前目标id");
}
if (UserId == userInfo.Id)
{
return ApiResult.Failed("只能对齐他人目标");
}
var list = okrPeriodModule.GetOKROthersObjectiveDropList(PeriodId, ObjectiveId, UserId, userInfo);
return ApiResult.Success("", list);
}
#endregion
#region 权限控制
/// <summary>
/// 获取权限控制列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRPermissionList() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int TargetId = parms.GetInt("TargetId", 0);
int Type = parms.GetInt("Type", 0);// 1周期 2目标 3关键结果
if (TargetId <= 0)
{
return ApiResult.ParamIsNull("请传递当前目标id");
}
var list = okrPeriodModule.GetOKRPermissionList(TargetId, Type, userInfo);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.PermissionType,
x.TargetId,
x.Type,
TypeName = x.Type.ToName(),
x.SourceId,
x.SourceName,
x.State
}));
}
/// <summary>
/// 设置权限
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SgetOKRPermissionInfo() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PermissionType = parms.GetInt("PermissionType", 0);
int TargetId = parms.GetInt("TargetId", 0);
string List = parms.GetStringValue("List");
if (PermissionType <= 0)
{
return ApiResult.ParamIsNull("请传递权限类型");
}
if (TargetId <= 0)
{
return ApiResult.ParamIsNull("请传递目标值");
}
if (string.IsNullOrEmpty(List)) {
return ApiResult.ParamIsNull("请传递列表数据");
}
List<RB_OKR_Permission_ViewModel> dmodel = JsonHelper.DeserializeObject<List<RB_OKR_Permission_ViewModel>>(List);
foreach (var item in dmodel)
{
item.PermissionType = PermissionType;
item.TargetId = TargetId;
if (item.Type <= 0)
{
return ApiResult.ParamIsNull("请传递类型");
}
if (item.SourceId <= 0)
{
return ApiResult.ParamIsNull("请传递来源id");
}
if (item.State <= 0)
{
return ApiResult.ParamIsNull("请传递查看状态");
}
item.Group_Id = userInfo.Group_Id;
item.School_Id = userInfo.School_Id;
item.CreateBy = userInfo.Id;
item.CreateTime = DateTime.Now;
item.UpdateBy = userInfo.Id;
item.UpdateTime = DateTime.Now;
}
string msg = okrPeriodModule.SgetOKRPermissionInfo(PermissionType, TargetId, dmodel, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
#endregion
#region 左边人员列表
/// <summary>
/// 获取我的人员列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMyEmployeeList() {
var userInfo = base.UserInfo;
var obj = okrPeriodModule.GetOKRMyEmployeeList(userInfo);
return ApiResult.Success("", obj);
}
/// <summary>
/// 获取我的对齐人员列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMyEmployeeAlignList()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);
if (PeriodId <= 0) {
return ApiResult.ParamIsNull();
}
var obj = okrPeriodModule.GetOKRMyEmployeeAlignList(PeriodId, userInfo);
return ApiResult.Success("", obj);
}
/// <summary>
/// 获取我的审核人员列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRMyEmployeeAuditList()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
return ApiResult.Success();
var obj = okrPeriodModule.GetOKRMyEmployeeAuditList(PeriodId, userInfo);
return ApiResult.Success("", obj);
}
#endregion
#region 他人目标
/// <summary>
/// 获取他人的目标列表
/// </summary>
......@@ -684,9 +917,21 @@ namespace Edu.WebApi.Controllers.OKR
{
return ApiResult.ParamIsNull("请传递用户id");
}
if (UserId == userInfo.Id)
{
return ApiResult.Failed("只能查看他人目标");
}
var list = okrPeriodModule.GetOKROthersObjectiveList(PeriodId, UserId, userInfo);
return ApiResult.Success("", list);
}
#endregion
#region 评论+关注
#endregion
#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