作者 郑周

修复 定时任务 奔溃的BUG

package service
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
"strconv"
"time"
... ... @@ -28,6 +30,10 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
}
defer func() {
transactionContext.RollbackTransaction()
// 异常捕获
recError := recover()
log.Logger.Error(application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("定时发送评估任务异常:%s", recError)).Error())
}()
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
tasks, err := taskRepository.Find(map[string]interface{}{"now": time.Now().Local()})
... ... @@ -75,9 +81,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
staffAssessService := service.NewStaffAssessServeice()
for i := range tasks {
task := tasks[i]
// 项目
project, ok := projectIdsMap[task.ProjectId]
if ok {
project, ok := projectIdsMap[task.ProjectId] // 项目
if ok && project != nil {
// 环节截止时间
maxTime := task.TimeEnd.Local()
... ...