切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
827b0d7da6487fc860bacb3f67627d8de055ed36
1 个父辈
99437b0b
调整一些逻辑
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
54 行增加
和
10 行删除
pkg/application/evaluation_cycle/cycle_service.go
pkg/application/summary_evaluation/service/scheduled.go
pkg/application/summary_evaluation/service/scheduled_v2.go
pkg/domain/staff_assess_task.go
pkg/domain/summary_evaluation.go
pkg/infrastructure/dao/staff_assess_dao_2.go
pkg/infrastructure/repository/pg_staff_assess_task_repository.go
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
sql/2023-04-03.sql
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
827b0d7
package
service
import
(
"strconv"
"time"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_cycle/adapter"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_cycle/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"strconv"
"time"
)
type
EvaluationCycleService
struct
{
...
...
@@ -356,7 +357,7 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
taskRepository
:=
factory
.
CreateNodeTaskRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
staffRepository
:=
factory
.
CreateStaffAssessTaskRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
summaryEvaluationRepository
:=
factory
.
CreateSummaryEvaluationRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
// 删除周期
cycle
,
err
:=
cycleRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
Id
})
if
err
!=
nil
{
...
...
@@ -380,11 +381,6 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf
if
_
,
err
:=
projectRepository
.
Remove
(
projects
[
i
]);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 删除项目已生成的周期评估数据
if
err
:=
staffRepository
.
RemoveByProjectId
(
int
(
projects
[
i
]
.
Id
));
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
}
// 删除周期下的所有定时任务
...
...
@@ -398,6 +394,14 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
}
// 删除项目已生成的周期评估数据
if
err
:=
staffRepository
.
RemoveByCycleId
(
int
(
cycle
.
Id
));
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
//
if
err
:=
summaryEvaluationRepository
.
RemoveByCycleId
(
cycle
.
Id
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
...
...
pkg/application/summary_evaluation/service/scheduled.go
查看文件 @
827b0d7
...
...
@@ -20,7 +20,7 @@ func sendSummaryEvaluation(project *domain.EvaluationProject,
userMap
map
[
int64
]
*
domain
.
User
,
departmentMap
map
[
int64
]
*
domain
.
Department
)
([]
domain
.
SummaryEvaluation
,
error
)
{
//自评的时间范围
beginTimeSelf
:=
project
.
EndTime
endTimeSelf
:=
dayZeroTime
(
project
.
EndTime
)
.
Add
(
3
*
24
*
time
.
Hour
-
time
.
Second
)
endTimeSelf
:=
dayZeroTime
(
project
.
EndTime
)
.
Add
(
4
*
24
*
time
.
Hour
-
time
.
Second
)
//人资、360评估的时间范围
beginTime360
:=
endTimeSelf
endTime360
:=
endTimeSelf
.
Add
(
2
*
24
*
time
.
Hour
)
...
...
pkg/application/summary_evaluation/service/scheduled_v2.go
查看文件 @
827b0d7
...
...
@@ -195,7 +195,8 @@ func (se *summaryEvaluationPublisher) sendSummaryEvaluationV2(
}
//自评的时间范围
beginTimeSelf
:=
*
cycleData
.
TimeEnd
endTimeSelf
:=
dayZeroTime
(
beginTimeSelf
)
.
Add
(
3
*
24
*
time
.
Hour
-
time
.
Second
)
//修改 周期结束时间那天的第二天开始计算
endTimeSelf
:=
dayZeroTime
(
beginTimeSelf
)
.
Add
(
4
*
24
*
time
.
Hour
-
time
.
Second
)
//人资、360评估的时间范围
beginTime360
:=
endTimeSelf
endTime360
:=
endTimeSelf
.
Add
(
2
*
24
*
time
.
Hour
)
...
...
pkg/domain/staff_assess_task.go
查看文件 @
827b0d7
...
...
@@ -42,4 +42,5 @@ type StaffAssessTaskRepository interface {
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
StaffAssessTask
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
StaffAssessTask
,
error
)
RemoveByProjectId
(
id
int
)
error
RemoveByCycleId
(
id
int
)
error
}
...
...
pkg/domain/summary_evaluation.go
查看文件 @
827b0d7
...
...
@@ -68,6 +68,7 @@ type SummaryEvaluationRepository interface {
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
SummaryEvaluation
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
SummaryEvaluation
,
error
)
RemoveByProjectId
(
id
int
)
error
RemoveByCycleId
(
id
int64
)
error
}
// 计算总分。TotalScore 保留1位小数
...
...
pkg/infrastructure/dao/staff_assess_dao_2.go
查看文件 @
827b0d7
...
...
@@ -125,6 +125,7 @@ and staff_assess.evaluation_project_id in (
// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否 (必填)
func
(
d
*
StaffAssessDao
)
catchProjectIdByPermission
(
companyId
int
,
cycleId
int
,
operaterId
int
,
hrbp
int
)
string
{
withSql
:=
`
set time zone 'PRC';
with
t_project_0 as(
select evaluation_project.id as project_id,
...
...
pkg/infrastructure/repository/pg_staff_assess_task_repository.go
查看文件 @
827b0d7
...
...
@@ -153,3 +153,13 @@ func (repo *StaffAssessTaskRepository) RemoveByProjectId(id int) error {
Update
()
return
err
}
func
(
repo
*
StaffAssessTaskRepository
)
RemoveByCycleId
(
id
int
)
error
{
tx
:=
repo
.
transactionContext
.
PgTx
nowTime
:=
time
.
Now
()
_
,
err
:=
tx
.
Model
(
&
models
.
StaffAssessTask
{})
.
Where
(
"cycle_id=?"
,
id
)
.
Set
(
"deleted_at=?"
,
nowTime
)
.
Update
()
return
err
}
...
...
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
查看文件 @
827b0d7
...
...
@@ -197,3 +197,13 @@ func (repo *SummaryEvaluationRepository) RemoveByProjectId(id int) error {
Update
()
return
err
}
func
(
repo
*
SummaryEvaluationRepository
)
RemoveByCycleId
(
id
int64
)
error
{
tx
:=
repo
.
transactionContext
.
PgTx
nowTime
:=
time
.
Now
()
_
,
err
:=
tx
.
Model
(
&
models
.
SummaryEvaluation
{})
.
Where
(
"cycle_id=?"
,
id
)
.
Set
(
"deleted_at=?"
,
nowTime
)
.
Update
()
return
err
}
...
...
sql/2023-04-03.sql
0 → 100644
查看文件 @
827b0d7
-- 调整旧数据
WITH
t1
AS
(
SELECT
evaluation_cycle
.
id
AS
cycle_id
FROM
evaluation_cycle
WHERE
deleted_at
IS
NOT
NULL
)
UPDATE
summary_evaluation
SET
deleted_at
=
now
()
FROM
t1
WHERE
summary_evaluation
.
cycle_id
=
t1
.
cycle_id
...
...
请
注册
或
登录
后发表评论