作者 linmadan

修复关闭任务记录任务不显示bug

@@ -331,23 +331,29 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand * @@ -331,23 +331,29 @@ func (taskService *TaskService) SearchOffTaskRecord(searchOffTaskRecordCommand *
331 if err != nil { 331 if err != nil {
332 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 332 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
333 } 333 }
334 - fmt.Println(tasks)  
335 var taskIds []int64 334 var taskIds []int64
336 for _, task := range tasks { 335 for _, task := range tasks {
337 taskIds = append(taskIds, task.TaskId) 336 taskIds = append(taskIds, task.TaskId)
338 } 337 }
339 if count, offTaskRecords, err := offTaskRecordRepository.Find(map[string]interface{}{ 338 if count, offTaskRecords, err := offTaskRecordRepository.Find(map[string]interface{}{
340 - "taskIds": taskIds,  
341 - "customerValue": searchOffTaskRecordCommand.CustomerValue,  
342 - "offStartTime": searchOffTaskRecordCommand.OffStartTime,  
343 - "offEndTime": searchOffTaskRecordCommand.OffEndTime,  
344 - "limit": searchOffTaskRecordCommand.Limit, 339 + "taskIds": taskIds,
  340 + "offStartTime": searchOffTaskRecordCommand.OffStartTime,
  341 + "offEndTime": searchOffTaskRecordCommand.OffEndTime,
  342 + "offset": searchOffTaskRecordCommand.Offset,
  343 + "limit": searchOffTaskRecordCommand.Limit,
345 }); err != nil { 344 }); err != nil {
346 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 345 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
347 } else { 346 } else {
348 if err := transactionContext.CommitTransaction(); err != nil { 347 if err := transactionContext.CommitTransaction(); err != nil {
349 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 348 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
350 } 349 }
  350 + for _, offTaskRecord := range offTaskRecords {
  351 + for _, task := range tasks {
  352 + if offTaskRecord.Task.TaskId == task.TaskId {
  353 + offTaskRecord.Task = task
  354 + }
  355 + }
  356 + }
351 return map[string]interface{}{ 357 return map[string]interface{}{
352 "count": count, 358 "count": count,
353 "offTaskRecords": offTaskRecords, 359 "offTaskRecords": offTaskRecords,
@@ -100,7 +100,6 @@ func (repository *OffTaskRecordRepository) Find(queryOptions map[string]interfac @@ -100,7 +100,6 @@ func (repository *OffTaskRecordRepository) Find(queryOptions map[string]interfac
100 } else { 100 } else {
101 offTaskRecords = append(offTaskRecords, offTaskRecord) 101 offTaskRecords = append(offTaskRecords, offTaskRecord)
102 } 102 }
103 - offTaskRecords = append(offTaskRecords, &domain.OffTaskRecord{})  
104 } 103 }
105 return int64(count), offTaskRecords, nil 104 return int64(count), offTaskRecords, nil
106 } 105 }