作者 tangxvhui

修复一些bug

@@ -623,30 +623,28 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m @@ -623,30 +623,28 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m
623 if err != nil { 623 if err != nil {
624 return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 624 return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
625 } 625 }
626 - if len(taskList) == 0 {  
627 - return map[string]interface{}{"have": false}, nil  
628 - }  
629 - taskData := taskList[0]  
630 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext}) 626 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
631 // 获取员工的评估 627 // 获取员工的评估
632 today := time.Now().Format("2006-01-02") 628 today := time.Now().Format("2006-01-02")
633 - _, assessList, err := assessReps.Find(map[string]interface{}{  
634 - "companyId": param.CompanyId,  
635 - "executorId": taskData.Leader.Id,  
636 - "beginDay": today,  
637 - "typesList": []string{string(domain.AssessSelf)},  
638 - "limit": 1,  
639 - })  
640 - if err != nil {  
641 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) 629 + var assessList []*domain.StaffAssess
  630 + if len(taskList) > 0 {
  631 + _, assessList, err = assessReps.Find(map[string]interface{}{
  632 + "companyId": param.CompanyId,
  633 + "executorId": taskList[0].Leader.Id,
  634 + "beginDay": today,
  635 + "typesList": []string{string(domain.AssessSelf)},
  636 + "limit": 1,
  637 + })
  638 + if err != nil {
  639 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
  640 + }
642 } 641 }
643 taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext}) 642 taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
644 -  
645 var taskRecordId int 643 var taskRecordId int
646 var cycleId int 644 var cycleId int
647 var executorId int 645 var executorId int
648 if len(assessList) > 0 { 646 if len(assessList) > 0 {
649 - _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id}) 647 + _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": anomalyData.TaskId})
650 if err != nil { 648 if err != nil {
651 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error()) 649 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
652 } 650 }
@@ -1029,15 +1027,6 @@ func (srv TaskService) MarkTaskAnomalyByTask(param *command.MarkTaskAnomalyComma @@ -1029,15 +1027,6 @@ func (srv TaskService) MarkTaskAnomalyByTask(param *command.MarkTaskAnomalyComma
1029 if err != nil { 1027 if err != nil {
1030 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1028 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1031 } 1029 }
1032 - if len(anomalyList) == 0 {  
1033 - return map[string]interface{}{  
1034 - "have": false,  
1035 - "cycleId": "0",  
1036 - "beginDay": "",  
1037 - "taskRecordId": "0",  
1038 - "userId": "0",  
1039 - }, nil  
1040 - }  
1041 for _, val := range anomalyList { 1030 for _, val := range anomalyList {
1042 switch param.MarkType { 1031 switch param.MarkType {
1043 case "a": 1032 case "a":