Commit 0b1945b2 authored by liudong1993's avatar liudong1993

OKR周期调整

parent 98e620f7
......@@ -120,5 +120,10 @@ namespace Edu.Model.Entity.OKR
/// 规则结束时间
/// </summary>
public DateTime? RuleETime { get; set; }
/// <summary>
/// 是否默认全部可见权限 1是 2否
/// </summary>
public int IsDefaultPermission { get; set; }
}
}
......@@ -117,5 +117,10 @@ namespace Edu.Model.Entity.OKR
/// 审核备注
/// </summary>
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; }
}
}
This diff is collapsed.
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.User
{
......@@ -428,5 +429,26 @@ namespace Edu.Module.User
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
}
}
/// <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
#region 左边人员列表
......
......@@ -707,7 +707,8 @@ namespace Edu.WebApi.Controllers.User
qitem.Dept_Id,
qitem.AccountRemark,
qitem.Email,
EmAccountId = qitem.Id
EmAccountId = qitem.Id,
qitem.DirectSupervisor
});
return ApiResult.Success(data: pageModel);
}
......@@ -735,23 +736,23 @@ namespace Edu.WebApi.Controllers.User
{
var extModel = new Employee_ViewModel()
{
AccountId=base.ParmJObj.GetInt("AccountId"),
AccountType=(AccountTypeEnum)base.ParmJObj.GetInt("AccountType"),
EmployeeName=base.ParmJObj.GetStringValue("EmployeeName"),
EmployeeTel=base.ParmJObj.GetStringValue("EmployeeTel"),
UserIcon=base.ParmJObj.GetStringValue("UserIcon"),
Dept_Id=base.ParmJObj.GetInt("Dept_Id"),
Post_Id=base.ParmJObj.GetInt("Post_Id"),
IDCard=base.ParmJObj.GetStringValue("IDCard"),
Sex=base.ParmJObj.GetInt("Sex"),
EntryTime=base.ParmJObj.GetDateTime("EntryTime"),
Address=base.ParmJObj.GetStringValue("Address"),
BirthDate=base.ParmJObj.GetDateTime("BirthDate"),
LeaveStatus=(LeaveStatusEnum)base.ParmJObj.GetInt("LeaveStatus"),
LeaveTime=base.ParmJObj.GetDateTime("LeaveTime"),
Education=(EducationEnum)base.ParmJObj.GetInt("Education"),
School_Id=base.ParmJObj.GetInt("School_Id"),
Email=base.ParmJObj.GetStringValue("Email"),
AccountId = base.ParmJObj.GetInt("AccountId"),
AccountType = (AccountTypeEnum)base.ParmJObj.GetInt("AccountType"),
EmployeeName = base.ParmJObj.GetStringValue("EmployeeName"),
EmployeeTel = base.ParmJObj.GetStringValue("EmployeeTel"),
UserIcon = base.ParmJObj.GetStringValue("UserIcon"),
Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
Post_Id = base.ParmJObj.GetInt("Post_Id"),
IDCard = base.ParmJObj.GetStringValue("IDCard"),
Sex = base.ParmJObj.GetInt("Sex"),
EntryTime = base.ParmJObj.GetDateTime("EntryTime"),
Address = base.ParmJObj.GetStringValue("Address"),
BirthDate = base.ParmJObj.GetDateTime("BirthDate"),
LeaveStatus = (LeaveStatusEnum)base.ParmJObj.GetInt("LeaveStatus"),
LeaveTime = base.ParmJObj.GetDateTime("LeaveTime"),
Education = (EducationEnum)base.ParmJObj.GetInt("Education"),
School_Id = base.ParmJObj.GetInt("School_Id"),
Email = base.ParmJObj.GetStringValue("Email"),
};
extModel.CreateBy = base.UserInfo.Id;
extModel.CreateTime = DateTime.Now;
......@@ -896,7 +897,7 @@ namespace Edu.WebApi.Controllers.User
EducationStr = (extModel?.Education ?? 0).ToName(),
EmployeeName = extModel?.EmployeeName ?? "",
EmployeeTel = extModel?.EmployeeTel ?? "",
EntryTime =Common.ConvertHelper.FormatDate((extModel?.EntryTime)),
EntryTime = Common.ConvertHelper.FormatDate((extModel?.EntryTime)),
GroupName = extModel?.GroupName ?? "",
Group_Id = extModel?.Group_Id ?? 0,
IDCard = extModel?.IDCard ?? "",
......@@ -905,7 +906,7 @@ namespace Edu.WebApi.Controllers.User
LeaveStatus = extModel?.LeaveStatus ?? 0,
LeaveStatusStr = (extModel?.LeaveStatus ?? 0).ToName(),
LeaveTime = Common.ConvertHelper.FormatDate(extModel?.LeaveTime),
PostName = extModel?.PostName??"",
PostName = extModel?.PostName ?? "",
Post_Id = extModel?.Post_Id ?? 0,
SchoolName = extModel?.SchoolName ?? "",
School_Id = extModel?.School_Id ?? 0,
......@@ -913,11 +914,32 @@ namespace Edu.WebApi.Controllers.User
SexStr = (extModel?.Sex ?? 0) == 0 ? "男" : "女",
UserIcon = extModel?.UserIcon ?? "",
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);
}
/// <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>
......
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