...
|
...
|
@@ -185,18 +185,20 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp |
|
|
// 重新计算
|
|
|
if task.NextSentAt == nil {
|
|
|
// 环节起始和截止本地时间
|
|
|
startLocal := task.TimeStart
|
|
|
endLocal := task.TimeEnd
|
|
|
startLocal := task.TimeStart.Local()
|
|
|
sYear, sMonth, sDay := startLocal.Date()
|
|
|
startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
|
|
|
endLocal := task.TimeEnd.Local()
|
|
|
|
|
|
// 在当前时间之前,则计算下一个周期时间
|
|
|
if startLocal.Before(now) {
|
|
|
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
|
|
|
task.NextSentAt = &nextTime
|
|
|
} else {
|
|
|
task.NextSentAt = startLocal
|
|
|
task.NextSentAt = &startLocal
|
|
|
}
|
|
|
// 如果超出截至时间,则周期置空
|
|
|
if task.NextSentAt.After(endLocal.Local()) {
|
|
|
if task.NextSentAt.After(endLocal) {
|
|
|
task.NextSentAt = nil
|
|
|
}
|
|
|
} else {
|
...
|
...
|
@@ -435,6 +437,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
|
}()
|
|
|
|
|
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
project, err := projectRepository.FindOne(map[string]interface{}{"id": in.Id})
|
|
|
if err != nil {
|
...
|
...
|
@@ -456,8 +459,6 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
now := time.Now().Local()
|
|
|
nowO := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
|
|
|
|
...
|
...
|
@@ -479,18 +480,20 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
|
}
|
|
|
|
|
|
// 环节起始和截止本地时间
|
|
|
startLocal := node.TimeStart
|
|
|
endLocal := node.TimeEnd
|
|
|
startLocal := task.TimeStart.Local()
|
|
|
sYear, sMonth, sDay := startLocal.Date()
|
|
|
startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
|
|
|
endLocal := task.TimeEnd.Local()
|
|
|
|
|
|
// 在当前时间之前,则计算下一个周期时间
|
|
|
if startLocal.Before(now) {
|
|
|
nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
|
|
|
task.NextSentAt = &nextTime
|
|
|
} else {
|
|
|
task.NextSentAt = startLocal
|
|
|
task.NextSentAt = &startLocal
|
|
|
}
|
|
|
// 如果超出截至时间,则周期置空
|
|
|
if task.NextSentAt.After(endLocal.Local()) {
|
|
|
if task.NextSentAt.After(endLocal) {
|
|
|
task.NextSentAt = nil
|
|
|
}
|
|
|
|
...
|
...
|
|