Commit 0b1945b2 authored by liudong1993's avatar liudong1993

OKR周期调整

parent 98e620f7
...@@ -120,5 +120,10 @@ namespace Edu.Model.Entity.OKR ...@@ -120,5 +120,10 @@ namespace Edu.Model.Entity.OKR
/// 规则结束时间 /// 规则结束时间
/// </summary> /// </summary>
public DateTime? RuleETime { get; set; } public DateTime? RuleETime { get; set; }
/// <summary>
/// 是否默认全部可见权限 1是 2否
/// </summary>
public int IsDefaultPermission { get; set; }
} }
} }
...@@ -117,5 +117,10 @@ namespace Edu.Model.Entity.OKR ...@@ -117,5 +117,10 @@ namespace Edu.Model.Entity.OKR
/// 审核备注 /// 审核备注
/// </summary> /// </summary>
public string AuditRemark { get; set; } public string AuditRemark { get; set; }
/// <summary>
/// 是否默认全部可见权限 1是 2否
/// </summary>
public int IsDefaultPermission { get; set; }
} }
} }
using Edu.Common.Enum.OKR;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.OKR
{
/// <summary>
/// okr周期权限实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_OKR_PeriodPermission
{
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 周期id
/// </summary>
public int PeriodId { get; set; }
/// <summary>
/// 是否默认全部可见权限 1是 2否
/// </summary>
public int IsDefaultPermission { get; set; }
/// <summary>
/// 集团id
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}
}
...@@ -97,6 +97,10 @@ namespace Edu.Module.OKR ...@@ -97,6 +97,10 @@ namespace Edu.Module.OKR
/// 修改历史 /// 修改历史
/// </summary> /// </summary>
private readonly RB_OKR_UpdateHistoryRepository oKR_UpdateHistoryRepository = new RB_OKR_UpdateHistoryRepository(); private readonly RB_OKR_UpdateHistoryRepository oKR_UpdateHistoryRepository = new RB_OKR_UpdateHistoryRepository();
/// <summary>
/// 周期默认所有人可见权限
/// </summary>
private readonly RB_OKR_PeriodPermissionRepository oKR_PeriodPermissionRepository = new RB_OKR_PeriodPermissionRepository();
#region 基础配置 #region 基础配置
...@@ -1333,7 +1337,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1333,7 +1337,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1378,7 +1382,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1378,7 +1382,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1426,7 +1430,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1426,7 +1430,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1471,7 +1475,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1471,7 +1475,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1694,7 +1698,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1694,7 +1698,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}; };
} }
} }
if (LookList.Any()) var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userId });
if (LookList.Any() && pplist.Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -1777,7 +1782,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1777,7 +1782,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1822,7 +1827,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1822,7 +1827,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1870,7 +1875,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1870,7 +1875,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1915,7 +1920,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1915,7 +1920,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -1963,7 +1968,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -1963,7 +1968,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2008,7 +2013,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2008,7 +2013,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2212,7 +2217,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2212,7 +2217,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}; };
} }
} }
if (LookList.Any()) var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId, CreateBy = userId });
if (LookList.Any() && pplist.Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -2295,7 +2301,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2295,7 +2301,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2340,7 +2346,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2340,7 +2346,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2388,7 +2394,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2388,7 +2394,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2433,7 +2439,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2433,7 +2439,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2481,7 +2487,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2481,7 +2487,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2526,7 +2532,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2526,7 +2532,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -2953,7 +2959,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2953,7 +2959,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
}; };
} }
} }
if (LookList.Any()) var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = periodId, CreateBy = userId });
if (LookList.Any() && pplist.Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -2986,47 +2993,6 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -2986,47 +2993,6 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
string krIds = string.Join(",", krList.Select(x => x.Id)); string krIds = string.Join(",", krList.Select(x => x.Id));
pkrList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 3, ObjectiveIds = krIds }); pkrList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 3, ObjectiveIds = krIds });
} }
foreach (var item in krList)
{
item.IsLock = 2;
if (pkrList.Where(x => x.TargetId == item.Id).Any())
{
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())
{
//有不可看的
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;
}
}
}
}
}
#region 查询已对齐目标 #region 查询已对齐目标
//查询向上对齐 //查询向上对齐
var sdqList = oKR_ObjectiveRelationRepository.GetList(new Model.Entity.OKR.RB_OKR_ObjectiveRelation() { ObjectiveId = objectiveId }); var sdqList = oKR_ObjectiveRelationRepository.GetList(new Model.Entity.OKR.RB_OKR_ObjectiveRelation() { ObjectiveId = objectiveId });
...@@ -3059,7 +3025,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3059,7 +3025,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3104,7 +3070,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3104,7 +3070,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3239,7 +3205,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3239,7 +3205,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3284,7 +3250,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3284,7 +3250,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3332,7 +3298,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3332,7 +3298,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3377,7 +3343,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3377,7 +3343,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
qitem.IsNotLook = 1; qitem.IsNotLook = 1;
} }
} }
if (qitem.IsNotLook == 2) if (qitem.IsNotLook == 2 && qitem.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -3697,6 +3663,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3697,6 +3663,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
dmodel.CreateTime = DateTime.Now; dmodel.CreateTime = DateTime.Now;
dmodel.UpdateBy = userInfo.Id; dmodel.UpdateBy = userInfo.Id;
dmodel.UpdateTime = DateTime.Now; dmodel.UpdateTime = DateTime.Now;
dmodel.IsDefaultPermission = 1;
int Id = oKR_ObjectiveRepository.Insert(dmodel); int Id = oKR_ObjectiveRepository.Insert(dmodel);
ObjectiveId = Id; ObjectiveId = Id;
...@@ -3848,7 +3815,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -3848,7 +3815,8 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
Status = 0, Status = 0,
UpdateBy = userInfo.Id, UpdateBy = userInfo.Id,
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
Weight = NowWeight Weight = NowWeight,
IsDefaultPermission = 1
}); });
RKeyResultId = Id; RKeyResultId = Id;
if (Id > 0) if (Id > 0)
...@@ -5007,6 +4975,101 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -5007,6 +4975,101 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
} }
} }
/// <summary>
/// 获取周期/目标/结果 默认所有人可见权限
/// </summary>
/// <param name="permissionType"></param>
/// <param name="targetId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetOKRDefaultPermissionInfo(int permissionType, int targetId, UserInfo userInfo)
{
if (permissionType == 1)
{
if (oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = targetId, CreateBy = userInfo.Id }).Any())
{
return 2;
}
else
{
return 1;
}
}
else if (permissionType == 2)
{
return oKR_ObjectiveRepository.GetEntity(targetId)?.IsDefaultPermission ?? 1;
}
else
{
return oKR_KeyResultRepository.GetEntity(targetId)?.IsDefaultPermission ?? 1;
}
}
/// <summary>
/// 设置周期/目标/结果 默认所有人可见权限
/// </summary>
/// <param name="permissionType"></param>
/// <param name="targetId"></param>
/// <param name="permission"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public bool SgetOKRDefaultPermissionInfo(int permissionType, int targetId, int permission, UserInfo userInfo)
{
if (permissionType == 1)
{
var list = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = targetId, CreateBy = userInfo.Id });
if (permission == 1)
{
foreach (var item in list)
{
oKR_PeriodPermissionRepository.Delete(item);
}
}
else {
if (!list.Any()) {
oKR_PeriodPermissionRepository.Insert(new Model.Entity.OKR.RB_OKR_PeriodPermission()
{
Id = 0,
Group_Id = userInfo.Group_Id,
PeriodId = targetId,
IsDefaultPermission = 2,
CreateBy = userInfo.Id,
CreateTime = DateTime.Now
});
}
}
return true;
}
else if (permissionType == 2)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_Objective_ViewModel.IsDefaultPermission),permission}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_Objective_ViewModel.Id),
FiledValue=targetId,
OperatorEnum=OperatorEnum.Equal
}
};
return oKR_ObjectiveRepository.Update(keyValues, wheres);
}
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_OKR_KeyResult_ViewModel.IsDefaultPermission),permission}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_OKR_KeyResult_ViewModel.Id),
FiledValue=targetId,
OperatorEnum=OperatorEnum.Equal
}
};
return oKR_KeyResultRepository.Update(keyValues, wheres);
}
}
/// <summary> /// <summary>
/// 获取左边人员列表 /// 获取左边人员列表
/// </summary> /// </summary>
...@@ -6164,6 +6227,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6164,6 +6227,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) }); var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) });
if (zpList.Any()) if (zpList.Any())
{ {
var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId }, string.Join(",", DQUserId));
foreach (var UserId in DQUserId) foreach (var UserId in DQUserId)
{ {
int IsLook = 2; int IsLook = 2;
...@@ -6185,7 +6249,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6185,7 +6249,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
IsLook = 1; IsLook = 1;
} }
} }
if (LookList.Any()) if (LookList.Any() && pplist.Where(x => x.CreateBy == UserId).Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -6246,7 +6310,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6246,7 +6310,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -6306,7 +6370,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6306,7 +6370,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -6432,6 +6496,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6432,6 +6496,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) }); var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) });
if (zpList.Any()) if (zpList.Any())
{ {
var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId }, string.Join(",", DQUserId));
foreach (var UserId in DQUserId) foreach (var UserId in DQUserId)
{ {
int IsLook = 2; int IsLook = 2;
...@@ -6453,7 +6518,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6453,7 +6518,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
IsLook = 1; IsLook = 1;
} }
} }
if (LookList.Any()) if (LookList.Any() && pplist.Where(x => x.CreateBy == UserId).Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -6514,7 +6579,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6514,7 +6579,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
...@@ -6590,6 +6655,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6590,6 +6655,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) }); var zpList = oKR_PermissionRepository.GetList(new RB_OKR_Permission_ViewModel() { Group_Id = userInfo.Group_Id, PermissionType = 1, TargetId = PeriodId, CreateByIds = string.Join(",", DQUserId) });
if (zpList.Any()) if (zpList.Any())
{ {
var pplist = oKR_PeriodPermissionRepository.GetList(new Model.Entity.OKR.RB_OKR_PeriodPermission() { Group_Id = userInfo.Group_Id, PeriodId = PeriodId }, string.Join(",", DQUserId));
foreach (var UserId in DQUserId) foreach (var UserId in DQUserId)
{ {
int IsLook = 2; int IsLook = 2;
...@@ -6611,7 +6677,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6611,7 +6677,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
IsLook = 1; IsLook = 1;
} }
} }
if (LookList.Any()) if (LookList.Any() && pplist.Where(x => x.CreateBy == UserId).Any())
{ {
if (LookList.Where(x => x.Type == Common.Enum.OKR.PermissionTypeEnum.Employee && x.SourceId == userInfo.Id).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.Post && x.SourceId == userInfo.PostId).Any()
...@@ -6672,7 +6738,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru ...@@ -6672,7 +6738,7 @@ and {ruleModel.Time} >='{dmodel.RuleSTime.Value.ToString("yyyy-MM-dd")}' and {ru
item.IsNotLook = 1; item.IsNotLook = 1;
} }
} }
if (item.IsNotLook == 2) if (item.IsNotLook == 2 && item.IsDefaultPermission == 2)
{ {
if (LookList.Any()) if (LookList.Any())
{ {
......
...@@ -4,6 +4,7 @@ using System; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB;
namespace Edu.Module.User namespace Edu.Module.User
{ {
...@@ -428,5 +429,26 @@ namespace Edu.Module.User ...@@ -428,5 +429,26 @@ namespace Edu.Module.User
return flag; return flag;
} }
/// <summary>
/// 设置用户OKR直属上级
/// </summary>
/// <param name="userId"></param>
/// <param name="directSupervisor"></param>
/// <returns></returns>
public bool SetEmployeeDirectSupervisor(int userId, int directSupervisor)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Account_ViewModel.DirectSupervisor),directSupervisor}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Account_ViewModel.Id),
FiledValue=userId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = accountRepository.Update(keyValues, wheres);
return flag;
}
} }
} }
\ No newline at end of file
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_PeriodPermissionRepository : BaseRepository<RB_OKR_PeriodPermission>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_OKR_PeriodPermission> GetList(RB_OKR_PeriodPermission demodel,string CreateByIds ="")
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and {nameof(RB_OKR_PeriodPermission.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.PeriodId > 0)
{
where += $@" and {nameof(RB_OKR_PeriodPermission.PeriodId)} ={demodel.PeriodId}";
}
if (demodel.CreateBy > 0)
{
where += $@" and {nameof(RB_OKR_PeriodPermission.CreateBy)} ={demodel.CreateBy}";
}
if (!string.IsNullOrEmpty(CreateByIds))
{
where += $@" and {nameof(RB_OKR_PeriodPermission.CreateBy)} in({CreateByIds})";
}
string sql = $@" select * from RB_OKR_PeriodPermission where {where} order by Id desc";
return Get<RB_OKR_PeriodPermission>(sql).ToList();
}
}
}
...@@ -926,6 +926,49 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -926,6 +926,49 @@ namespace Edu.WebApi.Controllers.OKR
} }
} }
/// <summary>
/// 获取默认所有人可见权限
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetOKRDefaultPermissionInfo() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PermissionType = parms.GetInt("PermissionType", 0);// 权限类型 1周期 2目标 3结果
int TargetId = parms.GetInt("TargetId", 0);//周期/目标/结果 的id
if (PermissionType <= 0 || TargetId <= 0) {
return ApiResult.ParamIsNull();
}
var obj = okrPeriodModule.GetOKRDefaultPermissionInfo(PermissionType, TargetId, userInfo);
return ApiResult.Success("", obj);
}
/// <summary>
/// 设置默认所有人可见权限
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SgetOKRDefaultPermissionInfo()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PermissionType = parms.GetInt("PermissionType", 0);// 权限类型 1周期 2目标 3结果
int TargetId = parms.GetInt("TargetId", 0);//周期/目标/结果 的id
int Permission = parms.GetInt("Permission", 1);// 权限 1包含所有人可见 2不包含所有人可见
if (PermissionType <= 0 || TargetId <= 0)
{
return ApiResult.ParamIsNull();
}
bool flag = okrPeriodModule.SgetOKRDefaultPermissionInfo(PermissionType, TargetId, Permission, userInfo);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion #endregion
#region 左边人员列表 #region 左边人员列表
......
...@@ -707,7 +707,8 @@ namespace Edu.WebApi.Controllers.User ...@@ -707,7 +707,8 @@ namespace Edu.WebApi.Controllers.User
qitem.Dept_Id, qitem.Dept_Id,
qitem.AccountRemark, qitem.AccountRemark,
qitem.Email, qitem.Email,
EmAccountId = qitem.Id EmAccountId = qitem.Id,
qitem.DirectSupervisor
}); });
return ApiResult.Success(data: pageModel); return ApiResult.Success(data: pageModel);
} }
...@@ -735,23 +736,23 @@ namespace Edu.WebApi.Controllers.User ...@@ -735,23 +736,23 @@ namespace Edu.WebApi.Controllers.User
{ {
var extModel = new Employee_ViewModel() var extModel = new Employee_ViewModel()
{ {
AccountId=base.ParmJObj.GetInt("AccountId"), AccountId = base.ParmJObj.GetInt("AccountId"),
AccountType=(AccountTypeEnum)base.ParmJObj.GetInt("AccountType"), AccountType = (AccountTypeEnum)base.ParmJObj.GetInt("AccountType"),
EmployeeName=base.ParmJObj.GetStringValue("EmployeeName"), EmployeeName = base.ParmJObj.GetStringValue("EmployeeName"),
EmployeeTel=base.ParmJObj.GetStringValue("EmployeeTel"), EmployeeTel = base.ParmJObj.GetStringValue("EmployeeTel"),
UserIcon=base.ParmJObj.GetStringValue("UserIcon"), UserIcon = base.ParmJObj.GetStringValue("UserIcon"),
Dept_Id=base.ParmJObj.GetInt("Dept_Id"), Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
Post_Id=base.ParmJObj.GetInt("Post_Id"), Post_Id = base.ParmJObj.GetInt("Post_Id"),
IDCard=base.ParmJObj.GetStringValue("IDCard"), IDCard = base.ParmJObj.GetStringValue("IDCard"),
Sex=base.ParmJObj.GetInt("Sex"), Sex = base.ParmJObj.GetInt("Sex"),
EntryTime=base.ParmJObj.GetDateTime("EntryTime"), EntryTime = base.ParmJObj.GetDateTime("EntryTime"),
Address=base.ParmJObj.GetStringValue("Address"), Address = base.ParmJObj.GetStringValue("Address"),
BirthDate=base.ParmJObj.GetDateTime("BirthDate"), BirthDate = base.ParmJObj.GetDateTime("BirthDate"),
LeaveStatus=(LeaveStatusEnum)base.ParmJObj.GetInt("LeaveStatus"), LeaveStatus = (LeaveStatusEnum)base.ParmJObj.GetInt("LeaveStatus"),
LeaveTime=base.ParmJObj.GetDateTime("LeaveTime"), LeaveTime = base.ParmJObj.GetDateTime("LeaveTime"),
Education=(EducationEnum)base.ParmJObj.GetInt("Education"), Education = (EducationEnum)base.ParmJObj.GetInt("Education"),
School_Id=base.ParmJObj.GetInt("School_Id"), School_Id = base.ParmJObj.GetInt("School_Id"),
Email=base.ParmJObj.GetStringValue("Email"), Email = base.ParmJObj.GetStringValue("Email"),
}; };
extModel.CreateBy = base.UserInfo.Id; extModel.CreateBy = base.UserInfo.Id;
extModel.CreateTime = DateTime.Now; extModel.CreateTime = DateTime.Now;
...@@ -896,7 +897,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -896,7 +897,7 @@ namespace Edu.WebApi.Controllers.User
EducationStr = (extModel?.Education ?? 0).ToName(), EducationStr = (extModel?.Education ?? 0).ToName(),
EmployeeName = extModel?.EmployeeName ?? "", EmployeeName = extModel?.EmployeeName ?? "",
EmployeeTel = extModel?.EmployeeTel ?? "", EmployeeTel = extModel?.EmployeeTel ?? "",
EntryTime =Common.ConvertHelper.FormatDate((extModel?.EntryTime)), EntryTime = Common.ConvertHelper.FormatDate((extModel?.EntryTime)),
GroupName = extModel?.GroupName ?? "", GroupName = extModel?.GroupName ?? "",
Group_Id = extModel?.Group_Id ?? 0, Group_Id = extModel?.Group_Id ?? 0,
IDCard = extModel?.IDCard ?? "", IDCard = extModel?.IDCard ?? "",
...@@ -905,7 +906,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -905,7 +906,7 @@ namespace Edu.WebApi.Controllers.User
LeaveStatus = extModel?.LeaveStatus ?? 0, LeaveStatus = extModel?.LeaveStatus ?? 0,
LeaveStatusStr = (extModel?.LeaveStatus ?? 0).ToName(), LeaveStatusStr = (extModel?.LeaveStatus ?? 0).ToName(),
LeaveTime = Common.ConvertHelper.FormatDate(extModel?.LeaveTime), LeaveTime = Common.ConvertHelper.FormatDate(extModel?.LeaveTime),
PostName = extModel?.PostName??"", PostName = extModel?.PostName ?? "",
Post_Id = extModel?.Post_Id ?? 0, Post_Id = extModel?.Post_Id ?? 0,
SchoolName = extModel?.SchoolName ?? "", SchoolName = extModel?.SchoolName ?? "",
School_Id = extModel?.School_Id ?? 0, School_Id = extModel?.School_Id ?? 0,
...@@ -913,11 +914,32 @@ namespace Edu.WebApi.Controllers.User ...@@ -913,11 +914,32 @@ namespace Edu.WebApi.Controllers.User
SexStr = (extModel?.Sex ?? 0) == 0 ? "男" : "女", SexStr = (extModel?.Sex ?? 0) == 0 ? "男" : "女",
UserIcon = extModel?.UserIcon ?? "", UserIcon = extModel?.UserIcon ?? "",
Status = extModel?.Status ?? 0, Status = extModel?.Status ?? 0,
Email=extModel?.Email??"", Email = extModel?.Email ?? "",
//DirectSupervisor = extModel?.DirectSupervisor ?? 0,
//DirectSupervisorName = base.GetUserInfo(extModel?.DirectSupervisor ?? 0)?.AccountName ?? ""
}; };
return ApiResult.Success(data: obj); return ApiResult.Success(data: obj);
} }
/// <summary>
/// 设置用户OKR直接主管
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetEmployeeDirectSupervisor() {
var parms = ParmJObj;
int UserId = parms.GetInt("UserId", 0);
int DirectSupervisor = parms.GetInt("DirectSupervisor", 0);
if (UserId <= 0) {
return ApiResult.ParamIsNull("请传递用户id");
}
if (DirectSupervisor <= 0) {
return ApiResult.ParamIsNull("请传递直接主管id");
}
bool flag = employeeModule.SetEmployeeDirectSupervisor(UserId, DirectSupervisor);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary> /// <summary>
/// 删除管理者 /// 删除管理者
/// </summary> /// </summary>
......
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