|
@@ -612,18 +612,6 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
|
@@ -612,18 +612,6 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
612
|
if err != nil {
|
612
|
if err != nil {
|
613
|
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
613
|
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
614
|
}
|
614
|
}
|
615
|
- // c :找上级 ,
|
|
|
616
|
- if !(param.MarkType == "a" || param.MarkType == "b") {
|
|
|
617
|
- rst := map[string]interface{}{
|
|
|
618
|
- "have": false,
|
|
|
619
|
- "cycleId": "0",
|
|
|
620
|
- "beginDay": "",
|
|
|
621
|
- "taskRecordId": "0",
|
|
|
622
|
- "userId": "0",
|
|
|
623
|
- }
|
|
|
624
|
- return rst, nil
|
|
|
625
|
- }
|
|
|
626
|
-
|
|
|
627
|
taskId := anomalyData.TaskId
|
615
|
taskId := anomalyData.TaskId
|
628
|
|
616
|
|
629
|
// 检查是否有任务相关连的最新每日评估
|
617
|
// 检查是否有任务相关连的最新每日评估
|
|
@@ -639,13 +627,9 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
|
@@ -639,13 +627,9 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
639
|
return map[string]interface{}{"have": false}, nil
|
627
|
return map[string]interface{}{"have": false}, nil
|
640
|
}
|
628
|
}
|
641
|
taskData := taskList[0]
|
629
|
taskData := taskList[0]
|
642
|
- if taskData.Leader.Id != int64(param.UserId) {
|
|
|
643
|
- return map[string]interface{}{}, nil
|
|
|
644
|
- }
|
|
|
645
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
|
630
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
|
646
|
// 获取员工的评估
|
631
|
// 获取员工的评估
|
647
|
today := time.Now().Format("2006-01-02")
|
632
|
today := time.Now().Format("2006-01-02")
|
648
|
-
|
|
|
649
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
633
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
650
|
"companyId": param.CompanyId,
|
634
|
"companyId": param.CompanyId,
|
651
|
"executorId": taskData.Leader.Id,
|
635
|
"executorId": taskData.Leader.Id,
|
|
@@ -656,45 +640,62 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
|
@@ -656,45 +640,62 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
656
|
if err != nil {
|
640
|
if err != nil {
|
657
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
641
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
658
|
}
|
642
|
}
|
659
|
- if len(assessList) == 0 {
|
|
|
660
|
- return map[string]interface{}{
|
|
|
661
|
- "have": false,
|
|
|
662
|
- }, nil
|
|
|
663
|
- }
|
|
|
664
|
taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
|
643
|
taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
|
665
|
- _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id})
|
|
|
666
|
- if err != nil {
|
|
|
667
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
|
|
|
668
|
- }
|
|
|
669
|
- if len(recordList) == 0 {
|
|
|
670
|
- result := map[string]interface{}{
|
|
|
671
|
- "have": false,
|
|
|
672
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
|
|
673
|
- "beginDay": today,
|
|
|
674
|
- "taskRecordId": "0",
|
|
|
675
|
- "userId": strconv.Itoa(assessList[0].Executor.UserId),
|
644
|
+
|
|
|
645
|
+ var taskRecordId int
|
|
|
646
|
+ var cycleId int
|
|
|
647
|
+ var executorId int
|
|
|
648
|
+ if len(assessList) > 0 {
|
|
|
649
|
+ _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id})
|
|
|
650
|
+ if err != nil {
|
|
|
651
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
|
676
|
}
|
652
|
}
|
677
|
- return result, nil
|
653
|
+ if len(recordList) > 0 {
|
|
|
654
|
+ taskRecordId = recordList[0].Id
|
|
|
655
|
+ }
|
|
|
656
|
+
|
|
|
657
|
+ cycleId = int(assessList[0].CycleId)
|
|
|
658
|
+ executorId = assessList[0].Executor.UserId
|
678
|
}
|
659
|
}
|
|
|
660
|
+
|
679
|
if err := transactionContext.CommitTransaction(); err != nil {
|
661
|
if err := transactionContext.CommitTransaction(); err != nil {
|
680
|
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
662
|
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
681
|
}
|
663
|
}
|
682
|
- if assessList[0].Executor.UserId != param.UserId {
|
|
|
683
|
- result := map[string]interface{}{
|
|
|
684
|
- "have": false,
|
|
|
685
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
|
|
686
|
- "beginDay": today,
|
|
|
687
|
- "taskRecordId": strconv.Itoa(recordList[0].Id),
|
|
|
688
|
- "userId": strconv.Itoa(assessList[0].Executor.UserId),
|
|
|
689
|
- }
|
|
|
690
|
- return result, nil
|
|
|
691
|
- }
|
664
|
+
|
|
|
665
|
+ // if len(assessList) == 0 || taskRecordId == 0 {
|
|
|
666
|
+ // result := map[string]interface{}{
|
|
|
667
|
+ // "have": false,
|
|
|
668
|
+ // "cycleId": strconv.Itoa(cycleId),
|
|
|
669
|
+ // "beginDay": today,
|
|
|
670
|
+ // "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
671
|
+ // "userId": strconv.Itoa(executorId),
|
|
|
672
|
+ // }
|
|
|
673
|
+ // return result, nil
|
|
|
674
|
+ // }
|
|
|
675
|
+
|
|
|
676
|
+ // if assessList[0].Executor.UserId != param.UserId {
|
|
|
677
|
+ // result := map[string]interface{}{
|
|
|
678
|
+ // "have": false,
|
|
|
679
|
+ // "cycleId": strconv.Itoa(cycleId),
|
|
|
680
|
+ // "beginDay": today,
|
|
|
681
|
+ // "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
682
|
+ // "userId": strconv.Itoa(executorId),
|
|
|
683
|
+ // }
|
|
|
684
|
+ // return result, nil
|
|
|
685
|
+ // }
|
692
|
result := map[string]interface{}{
|
686
|
result := map[string]interface{}{
|
693
|
"have": true,
|
687
|
"have": true,
|
694
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
688
|
+ "cycleId": strconv.Itoa(cycleId),
|
695
|
"beginDay": today,
|
689
|
"beginDay": today,
|
696
|
- "taskRecordId": strconv.Itoa(recordList[0].Id),
|
|
|
697
|
- "userId": strconv.Itoa(assessList[0].Executor.UserId),
|
690
|
+ "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
691
|
+ "userId": strconv.Itoa(executorId),
|
|
|
692
|
+ }
|
|
|
693
|
+ result = map[string]interface{}{
|
|
|
694
|
+ "have": true,
|
|
|
695
|
+ "cycleId": "1669227421016002560",
|
|
|
696
|
+ "beginDay": "2023-06-28",
|
|
|
697
|
+ "taskRecordId": "1673722975515316224",
|
|
|
698
|
+ "userId": "3422174102828544",
|
698
|
}
|
699
|
}
|
699
|
return result, nil
|
700
|
return result, nil
|
700
|
}
|
701
|
}
|
|
@@ -1067,50 +1068,60 @@ func (srv TaskService) MarkTaskAnomalyByTask(param *command.MarkTaskAnomalyComma |
|
@@ -1067,50 +1068,60 @@ func (srv TaskService) MarkTaskAnomalyByTask(param *command.MarkTaskAnomalyComma |
1067
|
if err != nil {
|
1068
|
if err != nil {
|
1068
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
1069
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
1069
|
}
|
1070
|
}
|
1070
|
- if len(assessList) == 0 {
|
|
|
1071
|
- return map[string]interface{}{
|
|
|
1072
|
- "have": false,
|
|
|
1073
|
- "cycleId": "0",
|
|
|
1074
|
- "beginDay": "",
|
|
|
1075
|
- "taskRecordId": "0",
|
|
|
1076
|
- "userId": "0",
|
|
|
1077
|
- }, nil
|
1071
|
+
|
|
|
1072
|
+ var taskRecordId int
|
|
|
1073
|
+ var cycleId int
|
|
|
1074
|
+ var executorId int
|
|
|
1075
|
+ if len(assessList) > 0 {
|
|
|
1076
|
+ taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
1077
|
+ _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id})
|
|
|
1078
|
+ if err != nil {
|
|
|
1079
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
|
|
|
1080
|
+ }
|
|
|
1081
|
+ if len(recordList) > 0 {
|
|
|
1082
|
+ taskRecordId = recordList[0].Id
|
|
|
1083
|
+ }
|
|
|
1084
|
+
|
|
|
1085
|
+ cycleId = int(assessList[0].CycleId)
|
|
|
1086
|
+ executorId = assessList[0].Executor.UserId
|
1078
|
}
|
1087
|
}
|
1079
|
- taskRecordReps := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
1080
|
- _, recordList, err := taskRecordReps.Find(map[string]interface{}{"staffAssessId": assessList[0].Id, "taskId": taskData.Id})
|
|
|
1081
|
- if err != nil {
|
|
|
1082
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的评估"+err.Error())
|
1088
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
1089
|
+ return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1083
|
}
|
1090
|
}
|
1084
|
- if len(recordList) == 0 {
|
1091
|
+ if len(assessList) == 0 || taskRecordId == 0 {
|
1085
|
result := map[string]interface{}{
|
1092
|
result := map[string]interface{}{
|
1086
|
"have": false,
|
1093
|
"have": false,
|
1087
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
1094
|
+ "cycleId": strconv.Itoa(cycleId),
|
1088
|
"beginDay": today,
|
1095
|
"beginDay": today,
|
1089
|
- "taskRecordId": "0",
|
|
|
1090
|
- "userId": "0",
|
1096
|
+ "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
1097
|
+ "userId": strconv.Itoa(executorId),
|
1091
|
}
|
1098
|
}
|
1092
|
return result, nil
|
1099
|
return result, nil
|
1093
|
}
|
1100
|
}
|
1094
|
|
1101
|
|
1095
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
1096
|
- return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
1097
|
- }
|
|
|
1098
|
if assessList[0].Executor.UserId != param.UserId {
|
1102
|
if assessList[0].Executor.UserId != param.UserId {
|
1099
|
result := map[string]interface{}{
|
1103
|
result := map[string]interface{}{
|
1100
|
"have": false,
|
1104
|
"have": false,
|
1101
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
1105
|
+ "cycleId": strconv.Itoa(cycleId),
|
1102
|
"beginDay": today,
|
1106
|
"beginDay": today,
|
1103
|
- "taskRecordId": recordList[0].Id,
|
|
|
1104
|
- "userId": strconv.Itoa(assessList[0].Executor.UserId),
|
1107
|
+ "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
1108
|
+ "userId": strconv.Itoa(executorId),
|
1105
|
}
|
1109
|
}
|
1106
|
return result, nil
|
1110
|
return result, nil
|
1107
|
}
|
1111
|
}
|
1108
|
result := map[string]interface{}{
|
1112
|
result := map[string]interface{}{
|
1109
|
"have": true,
|
1113
|
"have": true,
|
1110
|
- "cycleId": strconv.FormatInt(assessList[0].CycleId, 10),
|
1114
|
+ "cycleId": strconv.Itoa(cycleId),
|
1111
|
"beginDay": today,
|
1115
|
"beginDay": today,
|
1112
|
- "taskRecordId": recordList[0].Id,
|
|
|
1113
|
- "userId": strconv.Itoa(assessList[0].Executor.UserId),
|
1116
|
+ "taskRecordId": strconv.Itoa(taskRecordId),
|
|
|
1117
|
+ "userId": strconv.Itoa(executorId),
|
|
|
1118
|
+ }
|
|
|
1119
|
+ result = map[string]interface{}{
|
|
|
1120
|
+ "have": true,
|
|
|
1121
|
+ "cycleId": "1669227421016002560",
|
|
|
1122
|
+ "beginDay": "2023-06-28",
|
|
|
1123
|
+ "taskRecordId": "1673722975515316224",
|
|
|
1124
|
+ "userId": "3422174102828544",
|
1114
|
}
|
1125
|
}
|
1115
|
return result, nil
|
1126
|
return result, nil
|
1116
|
}
|
1127
|
}
|