|
@@ -185,18 +185,20 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp |
|
@@ -185,18 +185,20 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp |
185
|
// 重新计算
|
185
|
// 重新计算
|
186
|
if task.NextSentAt == nil {
|
186
|
if task.NextSentAt == nil {
|
187
|
// 环节起始和截止本地时间
|
187
|
// 环节起始和截止本地时间
|
188
|
- startLocal := task.TimeStart
|
|
|
189
|
- endLocal := task.TimeEnd
|
188
|
+ startLocal := task.TimeStart.Local()
|
|
|
189
|
+ sYear, sMonth, sDay := startLocal.Date()
|
|
|
190
|
+ startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
|
|
|
191
|
+ endLocal := task.TimeEnd.Local()
|
190
|
|
192
|
|
191
|
// 在当前时间之前,则计算下一个周期时间
|
193
|
// 在当前时间之前,则计算下一个周期时间
|
192
|
if startLocal.Before(now) {
|
194
|
if startLocal.Before(now) {
|
193
|
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
|
195
|
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
|
194
|
task.NextSentAt = &nextTime
|
196
|
task.NextSentAt = &nextTime
|
195
|
} else {
|
197
|
} else {
|
196
|
- task.NextSentAt = startLocal
|
198
|
+ task.NextSentAt = &startLocal
|
197
|
}
|
199
|
}
|
198
|
// 如果超出截至时间,则周期置空
|
200
|
// 如果超出截至时间,则周期置空
|
199
|
- if task.NextSentAt.After(endLocal.Local()) {
|
201
|
+ if task.NextSentAt.After(endLocal) {
|
200
|
task.NextSentAt = nil
|
202
|
task.NextSentAt = nil
|
201
|
}
|
203
|
}
|
202
|
} else {
|
204
|
} else {
|
|
@@ -435,6 +437,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
@@ -435,6 +437,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
435
|
}()
|
437
|
}()
|
436
|
|
438
|
|
437
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
439
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
440
|
+ taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
438
|
|
441
|
|
439
|
project, err := projectRepository.FindOne(map[string]interface{}{"id": in.Id})
|
442
|
project, err := projectRepository.FindOne(map[string]interface{}{"id": in.Id})
|
440
|
if err != nil {
|
443
|
if err != nil {
|
|
@@ -456,8 +459,6 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
@@ -456,8 +459,6 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
456
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
459
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
457
|
}
|
460
|
}
|
458
|
|
461
|
|
459
|
- taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
460
|
-
|
|
|
461
|
now := time.Now().Local()
|
462
|
now := time.Now().Local()
|
462
|
nowO := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
|
463
|
nowO := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
|
463
|
|
464
|
|
|
@@ -479,18 +480,20 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
|
@@ -479,18 +480,20 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) |
479
|
}
|
480
|
}
|
480
|
|
481
|
|
481
|
// 环节起始和截止本地时间
|
482
|
// 环节起始和截止本地时间
|
482
|
- startLocal := node.TimeStart
|
|
|
483
|
- endLocal := node.TimeEnd
|
483
|
+ startLocal := task.TimeStart.Local()
|
|
|
484
|
+ sYear, sMonth, sDay := startLocal.Date()
|
|
|
485
|
+ startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
|
|
|
486
|
+ endLocal := task.TimeEnd.Local()
|
484
|
|
487
|
|
485
|
// 在当前时间之前,则计算下一个周期时间
|
488
|
// 在当前时间之前,则计算下一个周期时间
|
486
|
if startLocal.Before(now) {
|
489
|
if startLocal.Before(now) {
|
487
|
nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
|
490
|
nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
|
488
|
task.NextSentAt = &nextTime
|
491
|
task.NextSentAt = &nextTime
|
489
|
} else {
|
492
|
} else {
|
490
|
- task.NextSentAt = startLocal
|
493
|
+ task.NextSentAt = &startLocal
|
491
|
}
|
494
|
}
|
492
|
// 如果超出截至时间,则周期置空
|
495
|
// 如果超出截至时间,则周期置空
|
493
|
- if task.NextSentAt.After(endLocal.Local()) {
|
496
|
+ if task.NextSentAt.After(endLocal) {
|
494
|
task.NextSentAt = nil
|
497
|
task.NextSentAt = nil
|
495
|
}
|
498
|
}
|
496
|
|
499
|
|