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 ...@@ -22,6 +22,11 @@ namespace Edu.Model.Entity.OKR
/// </summary> /// </summary>
public int PeriodId { get; set; } public int PeriodId { get; set; }
/// <summary>
/// 属于谁的
/// </summary>
public int AccountId { get; set; }
/// <summary> /// <summary>
/// 内容 /// 内容
/// </summary> /// </summary>
......
...@@ -102,5 +102,20 @@ namespace Edu.Model.Entity.OKR ...@@ -102,5 +102,20 @@ namespace Edu.Model.Entity.OKR
/// 分数规则id /// 分数规则id
/// </summary> /// </summary>
public int ScoreRuleId { get; set; } 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 ...@@ -24,7 +24,7 @@ namespace Edu.Model.Entity.OKR
/// <summary> /// <summary>
/// 周期/目标/结果 的id /// 周期/目标/结果 的id
/// </summary> /// </summary>
public int ObjectiveId { get; set; } public int TargetId { get; set; }
/// <summary> /// <summary>
/// 类型 1员工 2部门 3岗位 /// 类型 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 ...@@ -77,5 +77,10 @@ namespace Edu.Model.Entity.User
/// </summary> /// </summary>
public double AnnualLeaveDay { get; set; } 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 ...@@ -44,6 +44,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary> /// </summary>
public int IsLock { get; set; } public int IsLock { get; set; }
/// <summary>
/// 是否已对齐
/// </summary>
public int IsParent { get; set; }
/// <summary> /// <summary>
/// 员工姓名 /// 员工姓名
/// </summary> /// </summary>
......
...@@ -13,5 +13,10 @@ namespace Edu.Model.ViewModel.OKR ...@@ -13,5 +13,10 @@ namespace Edu.Model.ViewModel.OKR
/// 目标ids /// 目标ids
/// </summary> /// </summary>
public string ObjectiveIds { get; set; } 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
This diff is collapsed.
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"; ...@@ -193,5 +193,34 @@ where {where} order by o.Id desc";
} }
return Execute(sql) > 0; 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 ...@@ -33,9 +33,9 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Permission_ViewModel.PermissionType)} ={demodel.PermissionType}"; 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) if (demodel.Type > 0)
{ {
...@@ -70,13 +70,13 @@ namespace Edu.Repository.OKR ...@@ -70,13 +70,13 @@ namespace Edu.Repository.OKR
{ {
where += $@" and {nameof(RB_OKR_Permission_ViewModel.PermissionType)} ={demodel.PermissionType}"; 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)) 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) 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} ...@@ -229,6 +229,10 @@ WHERE 1=1 {1}
{ {
where.AppendFormat(" AND A.{0}='{1}' ", nameof(Employee_ViewModel.Account), query.Account.Trim()); 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)) if (!string.IsNullOrEmpty(query.QIds))
{ {
where.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.Id), query.QIds); where.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.Id), query.QIds);
......
...@@ -661,10 +661,243 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -661,10 +661,243 @@ namespace Edu.WebApi.Controllers.OKR
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SgetOKRMyObjectiveParent() { 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>
/// 获取他人的目标列表 /// 获取他人的目标列表
/// </summary> /// </summary>
...@@ -684,9 +917,21 @@ namespace Edu.WebApi.Controllers.OKR ...@@ -684,9 +917,21 @@ namespace Edu.WebApi.Controllers.OKR
{ {
return ApiResult.ParamIsNull("请传递用户id"); return ApiResult.ParamIsNull("请传递用户id");
} }
if (UserId == userInfo.Id)
{
return ApiResult.Failed("只能查看他人目标");
}
var list = okrPeriodModule.GetOKROthersObjectiveList(PeriodId, UserId, userInfo); var list = okrPeriodModule.GetOKROthersObjectiveList(PeriodId, UserId, userInfo);
return ApiResult.Success("", list); return ApiResult.Success("", list);
} }
#endregion
#region 评论+关注
#endregion #endregion
#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