Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
0396ad0b
Commit
0396ad0b
authored
Jan 20, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OKR规则配置
parent
e0fd2517
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1202 additions
and
28 deletions
+1202
-28
RuleTypeEnum.cs
Edu.Common/Enum/OKR/RuleTypeEnum.cs
+43
-0
EducationTimerServer.cs
Edu.EducationCore/EducationTimerServer.cs
+1
-0
QuarzHelper.cs
Edu.EducationCore/Helper/QuarzHelper.cs
+57
-0
RB_OKR_KeyResult.cs
Edu.Model/Entity/OKR/RB_OKR_KeyResult.cs
+15
-0
RB_OKR_Rule.cs
Edu.Model/Entity/OKR/RB_OKR_Rule.cs
+106
-0
RB_OKR_RuleRelation.cs
Edu.Model/Entity/OKR/RB_OKR_RuleRelation.cs
+35
-0
RB_OKR_KeyResult_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_KeyResult_ViewModel.cs
+10
-0
RB_OKR_RuleRelation_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_RuleRelation_ViewModel.cs
+22
-0
RB_OKR_Rule_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_Rule_ViewModel.cs
+14
-0
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+526
-28
RB_OKR_KeyResultRepository.cs
Edu.Repository/OKR/RB_OKR_KeyResultRepository.cs
+3
-0
RB_OKR_RuleRelationRepository.cs
Edu.Repository/OKR/RB_OKR_RuleRelationRepository.cs
+38
-0
RB_OKR_RuleRepository.cs
Edu.Repository/OKR/RB_OKR_RuleRepository.cs
+78
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+254
-0
No files found.
Edu.Common/Enum/OKR/RuleTypeEnum.cs
0 → 100644
View file @
0396ad0b
using
Edu.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Common.Enum.OKR
{
/// <summary>
/// 规则类型枚举
/// </summary>
public
enum
RuleTypeEnum
{
/// <summary>
/// 求和
/// </summary>
[
EnumField
(
"求和"
)]
Sum
=
1
,
/// <summary>
/// 求平均
/// </summary>
[
EnumField
(
"求平均"
)]
Avg
=
2
,
/// <summary>
/// 求数量
/// </summary>
[
EnumField
(
"求数量"
)]
Count
=
3
,
/// <summary>
/// 最大值
/// </summary>
[
EnumField
(
"最大值"
)]
Max
=
4
,
/// <summary>
/// 最小值
/// </summary>
[
EnumField
(
"最小值"
)]
Min
=
5
}
}
Edu.EducationCore/EducationTimerServer.cs
View file @
0396ad0b
...
...
@@ -26,6 +26,7 @@ namespace Edu.Education
{
new
QuarzHelper
().
TeachingPerfTimer
().
GetAwaiter
().
GetResult
();
new
QuarzHelper
().
OKRPeriodTimer
().
GetAwaiter
().
GetResult
();
new
QuarzHelper
().
OKRPeriodRuleTimer
().
GetAwaiter
().
GetResult
();
}
/// <summary>
...
...
Edu.EducationCore/Helper/QuarzHelper.cs
View file @
0396ad0b
...
...
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using
Edu.Module.Course
;
using
Edu.Module.OKR
;
using
System.Linq
;
using
System.Collections.Generic
;
namespace
Edu.Education.Helper
{
...
...
@@ -83,6 +84,34 @@ namespace Edu.Education.Helper
await
scheduler
.
ScheduleJob
(
job
,
trigger
);
}
/// <summary>
/// 定时执行OKR规则
/// </summary>
/// <returns></returns>
public
async
Task
OKRPeriodRuleTimer
()
{
NameValueCollection
props
=
new
NameValueCollection
{
{
"quartz.serializer.type"
,
"binary"
}
};
StdSchedulerFactory
factory
=
new
StdSchedulerFactory
(
props
);
IScheduler
scheduler
=
await
factory
.
GetScheduler
();
await
scheduler
.
Start
();
IJobDetail
job
=
JobBuilder
.
Create
<
CreateOKRPeriodRule
>()
.
WithIdentity
(
"job3"
,
"group3"
)
.
Build
();
ITrigger
trigger
=
TriggerBuilder
.
Create
()
.
WithIdentity
(
"trigger3"
,
"group3"
)
.
StartNow
()
.
WithSimpleSchedule
(
x
=>
x
.
WithIntervalInHours
(
1
)
.
RepeatForever
())
.
Build
();
await
scheduler
.
ScheduleJob
(
job
,
trigger
);
}
}
/// <summary>
...
...
@@ -186,4 +215,32 @@ namespace Edu.Education.Helper
return
null
;
}
}
/// <summary>
/// 规则更新进度
/// </summary>
public
class
CreateOKRPeriodRule
:
IJob
{
/// <summary>
/// 这里是作业调度每次定时执行方法
/// </summary>
/// <param name="context"></param>
public
Task
Execute
(
IJobExecutionContext
context
)
{
try
{
LogHelper
.
Write
(
"开始执行规则适配...."
);
OKRPeriodModule
oKRPeriodModule
=
new
OKRPeriodModule
();
var
clist
=
oKRPeriodModule
.
GetOKRKeyResultList
(
new
Model
.
ViewModel
.
OKR
.
RB_OKR_KeyResult_ViewModel
()
{
IsUseRule
=
1
});
foreach
(
var
item
in
clist
)
{
oKRPeriodModule
.
UpdateOKRKeyresultRuleProgress
(
item
);
}
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"CreateOKRPeriodRule"
);
}
return
null
;
}
}
}
Edu.Model/Entity/OKR/RB_OKR_KeyResult.cs
View file @
0396ad0b
...
...
@@ -105,5 +105,20 @@ namespace Edu.Model.Entity.OKR
/// 修改时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
/// <summary>
/// 规则id
/// </summary>
public
int
RuleId
{
get
;
set
;
}
/// <summary>
/// 规则开始时间
/// </summary>
public
DateTime
?
RuleSTime
{
get
;
set
;
}
/// <summary>
/// 规则结束时间
/// </summary>
public
DateTime
?
RuleETime
{
get
;
set
;
}
}
}
Edu.Model/Entity/OKR/RB_OKR_Rule.cs
0 → 100644
View file @
0396ad0b
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
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_Rule
{
/// <summary>
/// id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 规则名称
/// </summary>
public
string
RuleName
{
get
;
set
;
}
/// <summary>
/// 数据库
/// </summary>
public
string
DataBase
{
get
;
set
;
}
/// <summary>
/// 表名
/// </summary>
public
string
Table
{
get
;
set
;
}
/// <summary>
/// 统计字段
/// </summary>
public
string
Field
{
get
;
set
;
}
/// <summary>
/// 统计方式 枚举
/// </summary>
public
RuleTypeEnum
Way
{
get
;
set
;
}
/// <summary>
/// 状态字段
/// </summary>
public
string
State
{
get
;
set
;
}
/// <summary>
/// 身份字段
/// </summary>
public
string
Identity
{
get
;
set
;
}
/// <summary>
/// 操作时间字段
/// </summary>
public
string
Time
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 状态 1启用 2停用
/// </summary>
public
int
Enable
{
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
;
}
}
}
Edu.Model/Entity/OKR/RB_OKR_RuleRelation.cs
0 → 100644
View file @
0396ad0b
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_RuleRelation
{
/// <summary>
/// id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 关键结果id
/// </summary>
public
int
KeyResultId
{
get
;
set
;
}
/// <summary>
/// 类型 1部门 2人员
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 部门/人员id
/// </summary>
public
int
RelationId
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/OKR/RB_OKR_KeyResult_ViewModel.cs
View file @
0396ad0b
...
...
@@ -24,6 +24,11 @@ namespace Edu.Model.ViewModel.OKR
/// </summary>
public
int
IsNotLook
{
get
;
set
;
}
/// <summary>
/// 是否使用规则 1是
/// </summary>
public
int
IsUseRule
{
get
;
set
;
}
/// <summary>
/// 分数名称
/// </summary>
...
...
@@ -32,5 +37,10 @@ namespace Edu.Model.ViewModel.OKR
/// 分数颜色
/// </summary>
public
string
ScoreColor
{
get
;
set
;
}
/// <summary>
/// 规则使用范围
/// </summary>
public
List
<
RB_OKR_RuleRelation_ViewModel
>
RelationList
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/OKR/RB_OKR_RuleRelation_ViewModel.cs
0 → 100644
View file @
0396ad0b
using
System
;
using
System.Collections.Generic
;
namespace
Edu.Model.ViewModel.OKR
{
/// <summary>
/// OKR规则关联扩展类
/// </summary>
[
Serializable
]
public
class
RB_OKR_RuleRelation_ViewModel
:
Model
.
Entity
.
OKR
.
RB_OKR_RuleRelation
{
/// <summary>
/// ids
/// </summary>
public
string
KeyResultIds
{
get
;
set
;
}
/// <summary>
/// 关联部门/人员名称
/// </summary>
public
string
RelationName
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/OKR/RB_OKR_Rule_ViewModel.cs
0 → 100644
View file @
0396ad0b
using
System
;
using
System.Collections.Generic
;
namespace
Edu.Model.ViewModel.OKR
{
/// <summary>
/// OKR规则扩展类
/// </summary>
[
Serializable
]
public
class
RB_OKR_Rule_ViewModel
:
Model
.
Entity
.
OKR
.
RB_OKR_Rule
{
}
}
\ No newline at end of file
Edu.Module.OKR/OKRPeriodModule.cs
View file @
0396ad0b
This diff is collapsed.
Click to expand it.
Edu.Repository/OKR/RB_OKR_KeyResultRepository.cs
View file @
0396ad0b
...
...
@@ -67,6 +67,9 @@ namespace Edu.Repository.OKR
{
where
+=
$@" and
{
nameof
(
RB_OKR_KeyResult_ViewModel
.
ProgressState
)}
=
{(
int
)
demodel
.
ProgressState
}
"
;
}
if
(
demodel
.
IsUseRule
==
1
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_KeyResult_ViewModel
.
RuleId
)}
>0"
;
}
string
sql
=
$@" select * from RB_OKR_KeyResult where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_KeyResult_ViewModel
>(
sql
).
ToList
();
...
...
Edu.Repository/OKR/RB_OKR_RuleRelationRepository.cs
0 → 100644
View file @
0396ad0b
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_RuleRelationRepository
:
BaseRepository
<
RB_OKR_RuleRelation
>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_RuleRelation_ViewModel
>
GetList
(
RB_OKR_RuleRelation_ViewModel
demodel
)
{
string
where
=
$@" 1=1 "
;
if
(
demodel
.
KeyResultId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_RuleRelation_ViewModel
.
KeyResultId
)}
=
{
demodel
.
KeyResultId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
KeyResultIds
))
{
where
+=
$@" and
{
nameof
(
RB_OKR_RuleRelation_ViewModel
.
KeyResultId
)}
in(
{
demodel
.
KeyResultIds
}
)"
;
}
string
sql
=
$@" select * from RB_OKR_RuleRelation where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_RuleRelation_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.Repository/OKR/RB_OKR_RuleRepository.cs
0 → 100644
View file @
0396ad0b
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_RuleRepository
:
BaseRepository
<
RB_OKR_Rule
>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Rule_ViewModel
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_OKR_Rule_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and Status =0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
RuleName
))
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
RuleName
)}
like '%
{
demodel
.
RuleName
}
%'"
;
}
if
(
demodel
.
Way
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Way
)}
=
{
demodel
.
Way
}
"
;
}
if
(
demodel
.
Enable
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Enable
)}
=
{
demodel
.
Enable
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Rule where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_OKR_Rule_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_OKR_Rule_ViewModel
>
GetList
(
RB_OKR_Rule_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and Status =0"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
RuleName
))
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
RuleName
)}
like '%
{
demodel
.
RuleName
}
%'"
;
}
if
(
demodel
.
Way
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Way
)}
=
{
demodel
.
Way
}
"
;
}
if
(
demodel
.
Enable
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_OKR_Rule_ViewModel
.
Enable
)}
=
{
demodel
.
Enable
}
"
;
}
string
sql
=
$@" select * from RB_OKR_Rule where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_Rule_ViewModel
>(
sql
).
ToList
();
}
}
}
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
0396ad0b
...
...
@@ -1221,6 +1221,260 @@ namespace Edu.WebApi.Controllers.OKR
#
endregion
#
endregion
#
region
规则管理
/// <summary>
/// 获取规则分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRRulePageList
()
{
var
userInfo
=
base
.
UserInfo
;
var
pageModel
=
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetOKRRulePageList
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
count
,
dmodel
);
pageModel
.
Count
=
Convert
.
ToInt32
(
count
);
pageModel
.
PageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
RuleName
,
x
.
DataBase
,
x
.
Table
,
x
.
Field
,
x
.
Way
,
x
.
State
,
x
.
Identity
,
x
.
Time
,
x
.
Remark
,
x
.
Enable
,
CreateTime
=
x
.
CreateTime
.
ToString
(
"yyyy-MM-dd"
)
});
return
ApiResult
.
Success
(
""
,
pageModel
);
}
/// <summary>
/// 获取规则列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRRuleDownLoadList
()
{
var
userInfo
=
base
.
UserInfo
;
var
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
var
list
=
okrPeriodModule
.
GetOKRRuleDownLoadList
(
dmodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
RuleName
,
}));
}
/// <summary>
/// 新增修改规则信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOKRRuleInfo
()
{
var
userInfo
=
base
.
UserInfo
;
RB_OKR_Rule_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_Rule_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
dmodel
.
RuleName
))
{
return
ApiResult
.
ParamIsNull
(
"请输入规则名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
DataBase
))
{
return
ApiResult
.
ParamIsNull
(
"请输入数据库名称"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Table
))
{
return
ApiResult
.
ParamIsNull
(
"请输入表名"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Field
))
{
return
ApiResult
.
ParamIsNull
(
"请输入统计字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
State
))
{
return
ApiResult
.
ParamIsNull
(
"请输入状态字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Identity
))
{
return
ApiResult
.
ParamIsNull
(
"请输入身份字段"
);
}
if
(
string
.
IsNullOrEmpty
(
dmodel
.
Time
))
{
return
ApiResult
.
ParamIsNull
(
"请输入操作时间字段"
);
}
dmodel
.
Status
=
0
;
dmodel
.
Group_Id
=
userInfo
.
Group_Id
;
dmodel
.
School_Id
=
userInfo
.
School_Id
;
dmodel
.
CreateBy
=
userInfo
.
Id
;
dmodel
.
CreateTime
=
DateTime
.
Now
;
dmodel
.
UpdateBy
=
userInfo
.
Id
;
dmodel
.
UpdateTime
=
DateTime
.
Now
;
bool
flag
=
okrPeriodModule
.
SetOKRRuleInfo
(
dmodel
,
userInfo
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置规则状态
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOKRRuleState
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
RuleId
=
parms
.
GetInt
(
"RuleId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
//类型 1启用 2禁用 3删除
string
msg
=
okrPeriodModule
.
SetOKRRuleState
(
RuleId
,
Type
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 获取枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetRuleTypeEnumList
()
{
var
list
=
EnumHelper
.
EnumToList
(
typeof
(
RuleTypeEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Name
,
x
.
Id
}));
}
/// <summary>
/// 设置关键结果使用规则
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOKRKeyResultUseRule
()
{
var
userInfo
=
base
.
UserInfo
;
RB_OKR_KeyResult_ViewModel
dmodel
=
JsonHelper
.
DeserializeObject
<
RB_OKR_KeyResult_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
if
(
dmodel
.
Id
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关键结果id"
);
}
if
(
dmodel
.
RuleId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递规则Id"
);
}
if
(!
dmodel
.
RuleSTime
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择规则适配开始时间"
);
}
if
(!
dmodel
.
RuleETime
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请选择规则适配结束时间"
);
}
if
(
dmodel
.
StartValue
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入结果的起始值"
);
}
if
(
dmodel
.
EndValue
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入结果的目标值"
);
}
if
(
dmodel
.
RelationList
==
null
||
!
dmodel
.
RelationList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择适配部门/直属人员"
);
}
foreach
(
var
item
in
dmodel
.
RelationList
)
{
if
(
item
.
RelationId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"关联部门/直属人员有误"
);
}
}
dmodel
.
RuleSTime
=
Convert
.
ToDateTime
(
dmodel
.
RuleSTime
.
Value
.
ToString
(
"yyyy-MM-dd"
));
dmodel
.
RuleETime
=
Convert
.
ToDateTime
(
dmodel
.
RuleETime
.
Value
.
ToString
(
"yyyy-MM-dd"
)
+
" 23:59:59"
);
string
msg
=
okrPeriodModule
.
SetOKRKeyResultUseRule
(
dmodel
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 取消使用规则
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
CancelOKRKeyResultUseRule
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
string
msg
=
okrPeriodModule
.
CancelOKRKeyResultUseRule
(
KeyResultId
,
userInfo
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 获取结果 规则关联人员/部门列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRKeyResultRuleReList
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
KeyResultId
=
parms
.
GetInt
(
"KeyResultId"
,
0
);
if
(
KeyResultId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关键结果id"
);
}
var
list
=
okrPeriodModule
.
GetOKRKeyResultRuleReList
(
KeyResultId
,
userInfo
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Type
,
x
.
RelationId
,
x
.
RelationName
}));
}
/// <summary>
/// 获取我负责的部门
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRMyManageDepartment
()
{
var
userInfo
=
base
.
UserInfo
;
var
list
=
okrPeriodModule
.
GetOKRMyManageDepartment_V2
(
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取我的直属下级
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRMyChildEmployeeList
()
{
var
userInfo
=
base
.
UserInfo
;
var
list
=
okrPeriodModule
.
GetOKRMyChildEmployeeList
(
userInfo
);
return
ApiResult
.
Success
(
""
,
list
);
}
#
endregion
#
region
统计模块
/// <summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment