切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
d0286d0274293e1dab2306f99fd5b9f2acb4b8d1
2 个父辈
5e9091bb
10ab4bf2
Merge branch 'test' of
http://gitlab.fjmaimaimai.com/allied-creation/performance
into test
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
26 行增加
和
4 行删除
pkg/application/evaluation_project/project_service.go
pkg/application/node_task/node_task_service.go
pkg/domain/node_task.go
pkg/infrastructure/pg/models/node_task.go
pkg/infrastructure/repository/pg_node_task_repository.go
sql/2022-12-07.sql
pkg/application/evaluation_project/project_service.go
查看文件 @
d0286d0
...
...
@@ -187,8 +187,8 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
if
task
.
NextSentAt
==
nil
{
// 环节起始和截止本地时间
startLocal
:=
task
.
TimeStart
.
Local
()
sYear
,
sMonth
,
sDay
:=
startLocal
.
Date
()
startLocal
=
time
.
Date
(
sYear
,
sMonth
,
sDay
,
0
,
0
,
0
,
0
,
time
.
Local
)
// 开始时间以0点开始计算
sY
,
sM
,
sD
:=
startLocal
.
Date
()
startLocal
=
time
.
Date
(
sY
,
sM
,
sD
,
0
,
0
,
0
,
0
,
time
.
Local
)
// 开始时间以0点开始计算
endLocal
:=
task
.
TimeEnd
.
Local
()
// 在当前时间之前,则计算下一个周期时间
...
...
@@ -198,6 +198,17 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
}
else
{
task
.
NextSentAt
=
&
startLocal
}
// 注.最后一次发送时间和重新计算后的时间相同时,继续获取下一个周期
if
task
.
LastSentAt
!=
nil
{
nextY
,
nextM
,
nextD
:=
task
.
NextSentAt
.
Local
()
.
Date
()
lastY
,
lastM
,
lastD
:=
task
.
LastSentAt
.
Local
()
.
Date
()
if
nextY
==
lastY
&&
nextM
==
lastM
&&
nextD
==
lastD
{
nextTime
:=
utils
.
NextTimeInc
(
task
.
NextSentAt
.
Local
(),
task
.
KpiCycle
)
task
.
NextSentAt
=
&
nextTime
}
}
// 如果超出截至时间,则周期置空
if
task
.
NextSentAt
.
After
(
endLocal
)
{
task
.
NextSentAt
=
nil
...
...
@@ -483,8 +494,8 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
// 环节起始和截止本地时间
startLocal
:=
task
.
TimeStart
.
Local
()
sYear
,
sMonth
,
sDay
:=
startLocal
.
Date
()
startLocal
=
time
.
Date
(
sYear
,
sMonth
,
sDay
,
0
,
0
,
0
,
0
,
time
.
Local
)
// 开始时间以0点开始计算
sY
,
sM
,
sD
:=
startLocal
.
Date
()
startLocal
=
time
.
Date
(
sY
,
sM
,
sD
,
0
,
0
,
0
,
0
,
time
.
Local
)
// 开始时间以0点开始计算
endLocal
:=
task
.
TimeEnd
.
Local
()
// 在当前时间之前,则计算下一个周期时间
...
...
pkg/application/node_task/node_task_service.go
查看文件 @
d0286d0
...
...
@@ -79,6 +79,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
}
staffAssessService
:=
service
.
NewStaffAssessServeice
()
now
:=
time
.
Now
()
.
Local
()
for
i
:=
range
tasks
{
task
:=
tasks
[
i
]
project
,
ok
:=
projectIdsMap
[
task
.
ProjectId
]
// 项目
...
...
@@ -86,6 +88,9 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
// 环节截止时间
maxTime
:=
task
.
TimeEnd
.
Local
()
// 更新任务最后一次的发送时间(取当前时间)
task
.
LastSentAt
=
&
now
// 当前周起始时间和截止时间
var
cycleTimeStart
=
task
.
NextSentAt
.
Local
()
var
cycleTimeEnd
time
.
Time
...
...
pkg/domain/node_task.go
查看文件 @
d0286d0
...
...
@@ -18,6 +18,7 @@ type NodeTask struct {
TimeEnd
*
time
.
Time
`json:"timeEnd" comment:"截至时间"`
KpiCycle
int
`json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
NextSentAt
*
time
.
Time
`json:"nextSentAt" comment:"下一次发送时间"`
LastSentAt
*
time
.
Time
`json:"lastSentAt" comment:"最后一次发送时间"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
...
...
pkg/infrastructure/pg/models/node_task.go
查看文件 @
d0286d0
...
...
@@ -19,6 +19,7 @@ type NodeTask struct {
TimeEnd
*
time
.
Time
`comment:"截至时间"`
KpiCycle
int
`comment:"考核周期(1日、2周、3月)"`
NextSentAt
*
time
.
Time
`comment:"下一次发送时间"`
LastSentAt
*
time
.
Time
`comment:"最后一次发送时间"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
...
...
pkg/infrastructure/repository/pg_node_task_repository.go
查看文件 @
d0286d0
...
...
@@ -35,6 +35,7 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod
TimeEnd
:
m
.
TimeEnd
,
KpiCycle
:
m
.
KpiCycle
,
NextSentAt
:
m
.
NextSentAt
,
LastSentAt
:
m
.
LastSentAt
,
CreatedAt
:
m
.
CreatedAt
.
Local
(),
UpdatedAt
:
m
.
UpdatedAt
.
Local
(),
DeletedAt
:
m
.
DeletedAt
,
...
...
@@ -56,6 +57,7 @@ func (repo *NodeTaskRepository) TransformToModel(d *domain.NodeTask) models.Node
TimeEnd
:
d
.
TimeEnd
,
KpiCycle
:
d
.
KpiCycle
,
NextSentAt
:
d
.
NextSentAt
,
LastSentAt
:
d
.
LastSentAt
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
...
...
sql/2022-12-07.sql
0 → 100644
查看文件 @
d0286d0
ALTER
TABLE
"public"
.
"node_task"
ADD
COLUMN
"last_sent_at"
timestamptz
(
6
);
COMMENT
ON
COLUMN
"public"
.
"node_task"
.
"last_sent_at"
IS
'最后一次发送时间'
;
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论