作者 tangxvhui

修复 获取自评详情是 异常报错

@@ -928,10 +928,14 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada @@ -928,10 +928,14 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
928 } 928 }
929 taskMap := map[int]*domain.Task{} 929 taskMap := map[int]*domain.Task{}
930 taskRepository := factory.CreateTaskRepository(map[string]interface{}{"transactionContext": transactionContext}) 930 taskRepository := factory.CreateTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
931 - _, tasks, err := taskRepository.Find(map[string]interface{}{"ids": taskIdArray, "limit": len(taskIdArray)}) 931 +
  932 + var tasks []*domain.Task
  933 + if len(taskIdArray) > 0 {
  934 + _, tasks, err = taskRepository.Find(map[string]interface{}{"ids": taskIdArray, "limit": len(taskIdArray)})
932 if err != nil { 935 if err != nil {
933 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取里程碑数据:"+err.Error()) 936 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取里程碑数据:"+err.Error())
934 } 937 }
  938 + }
935 for i := range tasks { 939 for i := range tasks {
936 taskMap[tasks[i].Id] = tasks[i] 940 taskMap[tasks[i].Id] = tasks[i]
937 } 941 }
@@ -787,10 +787,14 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA @@ -787,10 +787,14 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
787 787
788 taskMap := map[int]*domain.Task{} 788 taskMap := map[int]*domain.Task{}
789 taskRepository := factory.CreateTaskRepository(map[string]interface{}{"transactionContext": transactionContext}) 789 taskRepository := factory.CreateTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
790 - _, tasks, err := taskRepository.Find(map[string]interface{}{"ids": taskIdArray, "limit": len(taskIdArray)}) 790 + var tasks []*domain.Task
  791 + if len(taskIdArray) > 0 {
  792 + _, tasks, err = taskRepository.Find(map[string]interface{}{"ids": taskIdArray, "limit": len(taskIdArray)})
791 if err != nil { 793 if err != nil {
792 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取里程碑数据:"+err.Error()) 794 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务数据:"+err.Error())
  795 + }
793 } 796 }
  797 +
794 for i := range tasks { 798 for i := range tasks {
795 taskMap[tasks[i].Id] = tasks[i] 799 taskMap[tasks[i].Id] = tasks[i]
796 } 800 }