1
|
package service
|
1
|
package service
|
2
|
|
2
|
|
3
|
-import (
|
|
|
4
|
- "fmt"
|
|
|
5
|
- "time"
|
|
|
6
|
-
|
|
|
7
|
- "github.com/linmadan/egglib-go/core/application"
|
|
|
8
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
9
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
10
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils/xtime"
|
|
|
11
|
-)
|
|
|
12
|
-
|
|
|
13
|
// TODO 检查任务里程碑反馈, 记录异常情况
|
3
|
// TODO 检查任务里程碑反馈, 记录异常情况
|
14
|
|
4
|
|
15
|
-func checkTaskRecordV2(param *domain.TaskRecord) error {
|
|
|
16
|
- transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
17
|
- if err != nil {
|
|
|
18
|
- return err
|
|
|
19
|
- }
|
|
|
20
|
- if err := transactionContext.StartTransaction(); err != nil {
|
|
|
21
|
- return err
|
|
|
22
|
- }
|
|
|
23
|
- defer func() {
|
|
|
24
|
- _ = transactionContext.RollbackTransaction()
|
|
|
25
|
- }()
|
|
|
26
|
- taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
27
|
- "transactionContext": transactionContext,
|
|
|
28
|
- })
|
|
|
29
|
- _, taskDataList, err := taskRepo.Find(map[string]interface{}{"id": param.TaskId})
|
|
|
30
|
- if err != nil {
|
|
|
31
|
- return fmt.Errorf("获取任务数据失败:%s", err)
|
|
|
32
|
- }
|
|
|
33
|
- if len(taskDataList) == 0 {
|
|
|
34
|
- return nil
|
|
|
35
|
- }
|
|
|
36
|
- taskData := taskDataList[0]
|
5
|
+// func checkTaskRecordV2(param *domain.TaskRecord) error {
|
|
|
6
|
+// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
7
|
+// if err != nil {
|
|
|
8
|
+// return err
|
|
|
9
|
+// }
|
|
|
10
|
+// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
11
|
+// return err
|
|
|
12
|
+// }
|
|
|
13
|
+// defer func() {
|
|
|
14
|
+// _ = transactionContext.RollbackTransaction()
|
|
|
15
|
+// }()
|
|
|
16
|
+// taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
17
|
+// "transactionContext": transactionContext,
|
|
|
18
|
+// })
|
|
|
19
|
+// _, taskDataList, err := taskRepo.Find(map[string]interface{}{"id": param.TaskId})
|
|
|
20
|
+// if err != nil {
|
|
|
21
|
+// return fmt.Errorf("获取任务数据失败:%s", err)
|
|
|
22
|
+// }
|
|
|
23
|
+// if len(taskDataList) == 0 {
|
|
|
24
|
+// return nil
|
|
|
25
|
+// }
|
|
|
26
|
+// taskData := taskDataList[0]
|
37
|
|
27
|
|
38
|
- //检查每日评估中任务的异常
|
|
|
39
|
- // taskData.CheckAndRecordAnomaly(param)
|
28
|
+// //检查每日评估中任务的异常
|
40
|
|
29
|
|
41
|
- // anomaly1 := &domain.TaskAnomaly{}
|
|
|
42
|
- // ok := anomaly1.IsWarnFlag(taskData, param)
|
|
|
43
|
- // if ok {
|
30
|
+// // anomaly1 := &domain.TaskAnomaly{}
|
|
|
31
|
+// // ok := anomaly1.IsWarnFlag(taskData, param)
|
|
|
32
|
+// // if ok {
|
44
|
|
33
|
|
45
|
- // }
|
|
|
46
|
- // 检查反馈异常
|
|
|
47
|
- if param.IsRemarkAnomaly() {
|
|
|
48
|
- taskData.Anomaly += 1
|
|
|
49
|
- err = isAssessFlag(transactionContext, taskData, param)
|
|
|
50
|
- if err != nil {
|
|
|
51
|
- return err
|
|
|
52
|
- }
|
|
|
53
|
- } else {
|
|
|
54
|
- taskData.Anomaly = 0
|
|
|
55
|
- err = isNotAssessFlag(transactionContext, taskData, param)
|
|
|
56
|
- if err != nil {
|
|
|
57
|
- return err
|
|
|
58
|
- }
|
|
|
59
|
- }
|
|
|
60
|
- // 检查里程碑异常
|
|
|
61
|
- if param.IsTaskStageAnomaly() {
|
|
|
62
|
- taskData.WarnFlag += 1
|
|
|
63
|
- err := isWarnFlag(transactionContext, taskData, param)
|
|
|
64
|
- if err != nil {
|
|
|
65
|
- return err
|
|
|
66
|
- }
|
|
|
67
|
- } else {
|
|
|
68
|
- taskData.WarnFlag = 0
|
|
|
69
|
- err := isNotWarnFlag(transactionContext, taskData, param)
|
|
|
70
|
- if err != nil {
|
|
|
71
|
- return err
|
|
|
72
|
- }
|
|
|
73
|
- }
|
|
|
74
|
- // 检查辅导异常
|
|
|
75
|
- if param.IsAssistAnomaly() {
|
|
|
76
|
- taskData.AssistFlag += 1
|
|
|
77
|
- err = isAssistFlag(transactionContext, taskData, param)
|
|
|
78
|
- if err != nil {
|
|
|
79
|
- return err
|
|
|
80
|
- }
|
|
|
81
|
- } else {
|
|
|
82
|
- taskData.AssistFlag = 0
|
|
|
83
|
- err = isNotAssistFlag(transactionContext, taskData, param)
|
|
|
84
|
- if err != nil {
|
|
|
85
|
- return err
|
|
|
86
|
- }
|
|
|
87
|
- }
|
|
|
88
|
- // 保存任务数据
|
|
|
89
|
- err = taskRepo.Save(taskData)
|
|
|
90
|
- if err != nil {
|
|
|
91
|
- return fmt.Errorf("保存任务数据:%s", err)
|
|
|
92
|
- }
|
34
|
+// // }
|
|
|
35
|
+// // 检查反馈异常
|
|
|
36
|
+// if param.IsRemarkAnomaly() {
|
|
|
37
|
+// taskData.Anomaly += 1
|
|
|
38
|
+// err = isAssessFlag(transactionContext, taskData, param)
|
|
|
39
|
+// if err != nil {
|
|
|
40
|
+// return err
|
|
|
41
|
+// }
|
|
|
42
|
+// } else {
|
|
|
43
|
+// taskData.Anomaly = 0
|
|
|
44
|
+// err = isNotAssessFlag(transactionContext, taskData, param)
|
|
|
45
|
+// if err != nil {
|
|
|
46
|
+// return err
|
|
|
47
|
+// }
|
|
|
48
|
+// }
|
|
|
49
|
+// // 检查里程碑异常
|
|
|
50
|
+// if param.IsTaskStageAnomaly() {
|
|
|
51
|
+// taskData.WarnFlag += 1
|
|
|
52
|
+// err := isWarnFlag(transactionContext, taskData, param)
|
|
|
53
|
+// if err != nil {
|
|
|
54
|
+// return err
|
|
|
55
|
+// }
|
|
|
56
|
+// } else {
|
|
|
57
|
+// taskData.WarnFlag = 0
|
|
|
58
|
+// err := isNotWarnFlag(transactionContext, taskData, param)
|
|
|
59
|
+// if err != nil {
|
|
|
60
|
+// return err
|
|
|
61
|
+// }
|
|
|
62
|
+// }
|
|
|
63
|
+// // 检查辅导异常
|
|
|
64
|
+// if param.IsAssistAnomaly() {
|
|
|
65
|
+// taskData.AssistFlag += 1
|
|
|
66
|
+// err = isAssistFlag(transactionContext, taskData, param)
|
|
|
67
|
+// if err != nil {
|
|
|
68
|
+// return err
|
|
|
69
|
+// }
|
|
|
70
|
+// } else {
|
|
|
71
|
+// taskData.AssistFlag = 0
|
|
|
72
|
+// err = isNotAssistFlag(transactionContext, taskData, param)
|
|
|
73
|
+// if err != nil {
|
|
|
74
|
+// return err
|
|
|
75
|
+// }
|
|
|
76
|
+// }
|
|
|
77
|
+// // 保存任务数据
|
|
|
78
|
+// err = taskRepo.Save(taskData)
|
|
|
79
|
+// if err != nil {
|
|
|
80
|
+// return fmt.Errorf("保存任务数据:%s", err)
|
|
|
81
|
+// }
|
93
|
|
82
|
|
94
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
95
|
- return err
|
|
|
96
|
- }
|
|
|
97
|
- return nil
|
|
|
98
|
-}
|
83
|
+// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
84
|
+// return err
|
|
|
85
|
+// }
|
|
|
86
|
+// return nil
|
|
|
87
|
+// }
|
99
|
|
88
|
|
100
|
-// 取消里程碑异常
|
|
|
101
|
-func isNotWarnFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
102
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
103
|
- "transactionContext": transactionContext,
|
|
|
104
|
- })
|
|
|
105
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
106
|
- "isLast": 1,
|
|
|
107
|
- "category": domain.AnomalyCategoryType1,
|
|
|
108
|
- "limit": 1,
|
|
|
109
|
- "taskId": taskData.Id,
|
|
|
110
|
- "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
|
|
|
111
|
- })
|
|
|
112
|
- if err != nil {
|
|
|
113
|
- return fmt.Errorf("查询里程碑异常的数据:%s", err)
|
|
|
114
|
- }
|
|
|
115
|
- if len(oldAnomaly) == 0 {
|
|
|
116
|
- return nil
|
|
|
117
|
- }
|
|
|
118
|
- oldAnomaly[0].IsLast = 2
|
|
|
119
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
120
|
- if err != nil {
|
|
|
121
|
- return fmt.Errorf("取消里程碑异常:%s", err)
|
|
|
122
|
- }
|
|
|
123
|
- return nil
|
|
|
124
|
-}
|
89
|
+// // 取消里程碑异常
|
|
|
90
|
+// func isNotWarnFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
91
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
92
|
+// "transactionContext": transactionContext,
|
|
|
93
|
+// })
|
|
|
94
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
95
|
+// "isLast": 1,
|
|
|
96
|
+// "category": domain.AnomalyCategoryType1,
|
|
|
97
|
+// "limit": 1,
|
|
|
98
|
+// "taskId": taskData.Id,
|
|
|
99
|
+// "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
|
|
|
100
|
+// })
|
|
|
101
|
+// if err != nil {
|
|
|
102
|
+// return fmt.Errorf("查询里程碑异常的数据:%s", err)
|
|
|
103
|
+// }
|
|
|
104
|
+// if len(oldAnomaly) == 0 {
|
|
|
105
|
+// return nil
|
|
|
106
|
+// }
|
|
|
107
|
+// oldAnomaly[0].IsLast = 2
|
|
|
108
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
109
|
+// if err != nil {
|
|
|
110
|
+// return fmt.Errorf("取消里程碑异常:%s", err)
|
|
|
111
|
+// }
|
|
|
112
|
+// return nil
|
|
|
113
|
+// }
|
125
|
|
114
|
|
126
|
-// 处理里程碑异常的情况, 日评中 里程碑未正常填写,包含 逾期完成,逾期未完成。
|
|
|
127
|
-// 记录异常
|
|
|
128
|
-func isWarnFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
115
|
+// // 处理里程碑异常的情况, 日评中 里程碑未正常填写,包含 逾期完成,逾期未完成。
|
|
|
116
|
+// // 记录异常
|
|
|
117
|
+// func isWarnFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
129
|
|
118
|
|
130
|
- nowTime := time.Now()
|
|
|
131
|
- if taskData.CurrentStage.Id == 0 && taskRecord.TaskStageCheck.RealCompletedAt > 0 {
|
|
|
132
|
- // 逾期完成,且没有后续的任务
|
|
|
133
|
- return isNotWarnFlag(transactionContext, taskData, taskRecord)
|
|
|
134
|
- }
|
|
|
135
|
- if taskData.CurrentStage.PlanCompletedAt > nowTime.Unix() && taskRecord.TaskStageCheck.RealCompletedAt > 0 {
|
|
|
136
|
- //逾期完成,且后续任务为过期
|
|
|
137
|
- return isNotWarnFlag(transactionContext, taskData, taskRecord)
|
|
|
138
|
- }
|
119
|
+// nowTime := time.Now()
|
|
|
120
|
+// if taskData.CurrentStage.Id == 0 && taskRecord.TaskStageCheck.RealCompletedAt > 0 {
|
|
|
121
|
+// // 逾期完成,且没有后续的任务
|
|
|
122
|
+// return isNotWarnFlag(transactionContext, taskData, taskRecord)
|
|
|
123
|
+// }
|
|
|
124
|
+// if taskData.CurrentStage.PlanCompletedAt > nowTime.Unix() && taskRecord.TaskStageCheck.RealCompletedAt > 0 {
|
|
|
125
|
+// //逾期完成,且后续任务为过期
|
|
|
126
|
+// return isNotWarnFlag(transactionContext, taskData, taskRecord)
|
|
|
127
|
+// }
|
139
|
|
128
|
|
140
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
141
|
- "transactionContext": transactionContext,
|
|
|
142
|
- })
|
129
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
130
|
+// "transactionContext": transactionContext,
|
|
|
131
|
+// })
|
143
|
|
132
|
|
144
|
- userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
145
|
- "transactionContext": transactionContext,
|
|
|
146
|
- })
|
133
|
+// userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
134
|
+// "transactionContext": transactionContext,
|
|
|
135
|
+// })
|
147
|
|
136
|
|
148
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
149
|
- "isLast": 1,
|
|
|
150
|
- "category": domain.AnomalyCategoryType1,
|
|
|
151
|
- "limit": 1,
|
|
|
152
|
- "taskId": taskData.Id,
|
|
|
153
|
- "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
|
|
|
154
|
- })
|
|
|
155
|
- if err != nil {
|
|
|
156
|
- return fmt.Errorf("查询里程碑异常的数据:%s", err)
|
|
|
157
|
- }
|
137
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
138
|
+// "isLast": 1,
|
|
|
139
|
+// "category": domain.AnomalyCategoryType1,
|
|
|
140
|
+// "limit": 1,
|
|
|
141
|
+// "taskId": taskData.Id,
|
|
|
142
|
+// "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, taskRecord.TaskStageCheck.Id),
|
|
|
143
|
+// })
|
|
|
144
|
+// if err != nil {
|
|
|
145
|
+// return fmt.Errorf("查询里程碑异常的数据:%s", err)
|
|
|
146
|
+// }
|
158
|
|
147
|
|
159
|
- anomalyDataTmp := domain.TaskAnomaly{
|
|
|
160
|
- Id: 0,
|
|
|
161
|
- CreatedAt: time.Now(),
|
|
|
162
|
- UpdatedAt: time.Now(),
|
|
|
163
|
- CompanyId: taskData.CompanyId,
|
|
|
164
|
- TaskId: taskData.Id,
|
|
|
165
|
- TaskRecordId: taskRecord.Id,
|
|
|
166
|
- Category: domain.AnomalyCategoryType1,
|
|
|
167
|
- CurrentStage: taskData.CurrentStage,
|
|
|
168
|
- LastStage: taskData.LastStage,
|
|
|
169
|
- TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
170
|
- AssessFlag: 0,
|
|
|
171
|
- WarnFlag: int(taskData.WarnFlag),
|
|
|
172
|
- AssistFlag: 0,
|
|
|
173
|
- IsLast: 1,
|
|
|
174
|
- RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
175
|
- NoticeWho: []map[string]string{},
|
|
|
176
|
- Marks: map[string]string{
|
|
|
177
|
- "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
178
|
- },
|
|
|
179
|
- }
|
|
|
180
|
- if len(oldAnomaly) > 0 {
|
|
|
181
|
- anomalyDataTmp.WarnFlag = oldAnomaly[0].WarnFlag + 1
|
|
|
182
|
- anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
183
|
- oldAnomaly[0].IsLast = 2
|
|
|
184
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
185
|
- if err != nil {
|
|
|
186
|
- return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
187
|
- }
|
|
|
188
|
- }
|
|
|
189
|
- _ = anomalyDataTmp.AnomalyDesc()
|
|
|
190
|
- // 异常就通知自己和上级
|
|
|
191
|
- //获取任务Leader的数据
|
|
|
192
|
- _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
193
|
- if err != nil {
|
|
|
194
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
195
|
- }
|
|
|
196
|
- var userParentId int64
|
|
|
197
|
- if len(useList) > 0 {
|
|
|
198
|
- anomalyDataTmp.SetNoticeWho(useList[0])
|
|
|
199
|
- userParentId = useList[0].ParentId
|
|
|
200
|
- }
|
148
|
+// anomalyDataTmp := domain.TaskAnomaly{
|
|
|
149
|
+// Id: 0,
|
|
|
150
|
+// CreatedAt: time.Now(),
|
|
|
151
|
+// UpdatedAt: time.Now(),
|
|
|
152
|
+// CompanyId: taskData.CompanyId,
|
|
|
153
|
+// TaskId: taskData.Id,
|
|
|
154
|
+// TaskRecordId: taskRecord.Id,
|
|
|
155
|
+// Category: domain.AnomalyCategoryType1,
|
|
|
156
|
+// CurrentStage: taskData.CurrentStage,
|
|
|
157
|
+// LastStage: taskData.LastStage,
|
|
|
158
|
+// TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
159
|
+// AssessFlag: 0,
|
|
|
160
|
+// WarnFlag: int(taskData.WarnFlag),
|
|
|
161
|
+// AssistFlag: 0,
|
|
|
162
|
+// IsLast: 1,
|
|
|
163
|
+// RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
164
|
+// NoticeWho: []map[string]string{},
|
|
|
165
|
+// Marks: map[string]string{
|
|
|
166
|
+// "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
167
|
+// },
|
|
|
168
|
+// }
|
|
|
169
|
+// if len(oldAnomaly) > 0 {
|
|
|
170
|
+// anomalyDataTmp.WarnFlag = oldAnomaly[0].WarnFlag + 1
|
|
|
171
|
+// anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
172
|
+// oldAnomaly[0].IsLast = 2
|
|
|
173
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
174
|
+// if err != nil {
|
|
|
175
|
+// return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
176
|
+// }
|
|
|
177
|
+// }
|
|
|
178
|
+// _ = anomalyDataTmp.AnomalyDesc()
|
|
|
179
|
+// // 异常就通知自己和上级
|
|
|
180
|
+// //获取任务Leader的数据
|
|
|
181
|
+// _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
182
|
+// if err != nil {
|
|
|
183
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
184
|
+// }
|
|
|
185
|
+// var userParentId int64
|
|
|
186
|
+// if len(useList) > 0 {
|
|
|
187
|
+// anomalyDataTmp.SetNoticeWho(useList[0])
|
|
|
188
|
+// userParentId = useList[0].ParentId
|
|
|
189
|
+// }
|
201
|
|
190
|
|
202
|
- if userParentId > 0 {
|
|
|
203
|
- // 获取上级用户的数据
|
|
|
204
|
- _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
205
|
- if err != nil {
|
|
|
206
|
- return fmt.Errorf("获取任务Leader的上级:%s", err)
|
|
|
207
|
- }
|
|
|
208
|
- if len(useList2) > 0 {
|
|
|
209
|
- anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
210
|
- }
|
|
|
211
|
- }
|
|
|
212
|
- err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
213
|
- if err != nil {
|
|
|
214
|
- return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
215
|
- }
|
|
|
216
|
- return nil
|
|
|
217
|
-}
|
191
|
+// if userParentId > 0 {
|
|
|
192
|
+// // 获取上级用户的数据
|
|
|
193
|
+// _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
194
|
+// if err != nil {
|
|
|
195
|
+// return fmt.Errorf("获取任务Leader的上级:%s", err)
|
|
|
196
|
+// }
|
|
|
197
|
+// if len(useList2) > 0 {
|
|
|
198
|
+// anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
199
|
+// }
|
|
|
200
|
+// }
|
|
|
201
|
+// err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
202
|
+// if err != nil {
|
|
|
203
|
+// return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
204
|
+// }
|
|
|
205
|
+// return nil
|
|
|
206
|
+// }
|
218
|
|
207
|
|
219
|
-// 取消辅导异常的情况
|
|
|
220
|
-func isNotAssistFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
221
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
222
|
- "transactionContext": transactionContext,
|
|
|
223
|
- })
|
208
|
+// // 取消辅导异常的情况
|
|
|
209
|
+// func isNotAssistFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
210
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
211
|
+// "transactionContext": transactionContext,
|
|
|
212
|
+// })
|
224
|
|
213
|
|
225
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
226
|
- "isLast": 1,
|
|
|
227
|
- "category": domain.AnomalyCategoryType3,
|
|
|
228
|
- "limit": 1,
|
|
|
229
|
- "taskId": taskData.Id,
|
|
|
230
|
- })
|
|
|
231
|
- if err != nil {
|
|
|
232
|
- return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
233
|
- }
|
|
|
234
|
- if len(oldAnomaly) == 0 {
|
|
|
235
|
- return nil
|
|
|
236
|
- }
|
|
|
237
|
- oldAnomaly[0].IsLast = 2
|
|
|
238
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
239
|
- if err != nil {
|
|
|
240
|
- return fmt.Errorf("取消辅导异常:%s", err)
|
|
|
241
|
- }
|
|
|
242
|
- return nil
|
|
|
243
|
-}
|
214
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
215
|
+// "isLast": 1,
|
|
|
216
|
+// "category": domain.AnomalyCategoryType3,
|
|
|
217
|
+// "limit": 1,
|
|
|
218
|
+// "taskId": taskData.Id,
|
|
|
219
|
+// })
|
|
|
220
|
+// if err != nil {
|
|
|
221
|
+// return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
222
|
+// }
|
|
|
223
|
+// if len(oldAnomaly) == 0 {
|
|
|
224
|
+// return nil
|
|
|
225
|
+// }
|
|
|
226
|
+// oldAnomaly[0].IsLast = 2
|
|
|
227
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
228
|
+// if err != nil {
|
|
|
229
|
+// return fmt.Errorf("取消辅导异常:%s", err)
|
|
|
230
|
+// }
|
|
|
231
|
+// return nil
|
|
|
232
|
+// }
|
244
|
|
233
|
|
245
|
-// 处理辅导异常的情况
|
|
|
246
|
-func isAssistFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
247
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
248
|
- "transactionContext": transactionContext,
|
|
|
249
|
- })
|
234
|
+// // 处理辅导异常的情况
|
|
|
235
|
+// func isAssistFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
236
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
237
|
+// "transactionContext": transactionContext,
|
|
|
238
|
+// })
|
250
|
|
239
|
|
251
|
- userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
252
|
- "transactionContext": transactionContext,
|
|
|
253
|
- })
|
240
|
+// userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
241
|
+// "transactionContext": transactionContext,
|
|
|
242
|
+// })
|
254
|
|
243
|
|
255
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
256
|
- "isLast": 1,
|
|
|
257
|
- "category": domain.AnomalyCategoryType3,
|
|
|
258
|
- "limit": 1,
|
|
|
259
|
- "taskId": taskData.Id,
|
|
|
260
|
- })
|
|
|
261
|
- if err != nil {
|
|
|
262
|
- return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
263
|
- }
|
|
|
264
|
- // 辅导异常通知该条任务负责人的上级;辅导异常超过N天,通知任务负责人的上上级
|
|
|
265
|
- anomalyDataTmp := domain.TaskAnomaly{
|
|
|
266
|
- Id: 0,
|
|
|
267
|
- CreatedAt: time.Now(),
|
|
|
268
|
- UpdatedAt: time.Now(),
|
|
|
269
|
- CompanyId: taskData.CompanyId,
|
|
|
270
|
- TaskRecordId: taskRecord.Id,
|
|
|
271
|
- TaskId: taskData.Id,
|
|
|
272
|
- Category: domain.AnomalyCategoryType3,
|
|
|
273
|
- CurrentStage: taskData.CurrentStage,
|
|
|
274
|
- LastStage: taskData.LastStage,
|
|
|
275
|
- TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
276
|
- AssessFlag: 0,
|
|
|
277
|
- WarnFlag: 0,
|
|
|
278
|
- AssistFlag: taskData.AssistFlag,
|
|
|
279
|
- IsLast: 1,
|
|
|
280
|
- RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
281
|
- NoticeWho: []map[string]string{},
|
|
|
282
|
- Marks: map[string]string{
|
|
|
283
|
- "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
284
|
- },
|
|
|
285
|
- }
|
244
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
245
|
+// "isLast": 1,
|
|
|
246
|
+// "category": domain.AnomalyCategoryType3,
|
|
|
247
|
+// "limit": 1,
|
|
|
248
|
+// "taskId": taskData.Id,
|
|
|
249
|
+// })
|
|
|
250
|
+// if err != nil {
|
|
|
251
|
+// return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
252
|
+// }
|
|
|
253
|
+// // 辅导异常通知该条任务负责人的上级;辅导异常超过N天,通知任务负责人的上上级
|
|
|
254
|
+// anomalyDataTmp := domain.TaskAnomaly{
|
|
|
255
|
+// Id: 0,
|
|
|
256
|
+// CreatedAt: time.Now(),
|
|
|
257
|
+// UpdatedAt: time.Now(),
|
|
|
258
|
+// CompanyId: taskData.CompanyId,
|
|
|
259
|
+// TaskRecordId: taskRecord.Id,
|
|
|
260
|
+// TaskId: taskData.Id,
|
|
|
261
|
+// Category: domain.AnomalyCategoryType3,
|
|
|
262
|
+// CurrentStage: taskData.CurrentStage,
|
|
|
263
|
+// LastStage: taskData.LastStage,
|
|
|
264
|
+// TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
265
|
+// AssessFlag: 0,
|
|
|
266
|
+// WarnFlag: 0,
|
|
|
267
|
+// AssistFlag: taskData.AssistFlag,
|
|
|
268
|
+// IsLast: 1,
|
|
|
269
|
+// RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
270
|
+// NoticeWho: []map[string]string{},
|
|
|
271
|
+// Marks: map[string]string{
|
|
|
272
|
+// "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
273
|
+// },
|
|
|
274
|
+// }
|
286
|
|
275
|
|
287
|
- if len(oldAnomaly) > 0 {
|
|
|
288
|
- anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
289
|
- oldAnomaly[0].IsLast = 2
|
|
|
290
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
291
|
- if err != nil {
|
|
|
292
|
- return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
293
|
- }
|
|
|
294
|
- }
|
|
|
295
|
- _ = anomalyDataTmp.AnomalyDesc()
|
|
|
296
|
- //获取任务Leader的数据
|
|
|
297
|
- _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
298
|
- if err != nil {
|
|
|
299
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
300
|
- }
|
|
|
301
|
- var userParentId int64
|
|
|
302
|
- if len(useList) > 0 {
|
|
|
303
|
- userParentId = useList[0].ParentId
|
|
|
304
|
- }
|
|
|
305
|
- if userParentId > 0 {
|
|
|
306
|
- //通知任务负责人的上级
|
|
|
307
|
- _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
308
|
- if err != nil {
|
|
|
309
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
310
|
- }
|
|
|
311
|
- var userParentId2 int64
|
|
|
312
|
- if len(useList2) > 0 {
|
|
|
313
|
- anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
314
|
- userParentId2 = useList2[0].ParentId
|
|
|
315
|
- }
|
|
|
316
|
- // 辅导异常超过N天,通知任务负责人的上上级
|
|
|
317
|
- if taskData.AssistFlag >= taskData.AssistFlagMax && userParentId2 > 0 {
|
|
|
318
|
- _, useList3, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
319
|
- if err != nil {
|
|
|
320
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
321
|
- }
|
|
|
322
|
- if len(useList3) > 0 {
|
|
|
323
|
- anomalyDataTmp.SetNoticeWho(useList3[0])
|
|
|
324
|
- }
|
|
|
325
|
- }
|
|
|
326
|
- }
|
276
|
+// if len(oldAnomaly) > 0 {
|
|
|
277
|
+// anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
278
|
+// oldAnomaly[0].IsLast = 2
|
|
|
279
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
280
|
+// if err != nil {
|
|
|
281
|
+// return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
282
|
+// }
|
|
|
283
|
+// }
|
|
|
284
|
+// _ = anomalyDataTmp.AnomalyDesc()
|
|
|
285
|
+// //获取任务Leader的数据
|
|
|
286
|
+// _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
287
|
+// if err != nil {
|
|
|
288
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
289
|
+// }
|
|
|
290
|
+// var userParentId int64
|
|
|
291
|
+// if len(useList) > 0 {
|
|
|
292
|
+// userParentId = useList[0].ParentId
|
|
|
293
|
+// }
|
|
|
294
|
+// if userParentId > 0 {
|
|
|
295
|
+// //通知任务负责人的上级
|
|
|
296
|
+// _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
297
|
+// if err != nil {
|
|
|
298
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
299
|
+// }
|
|
|
300
|
+// var userParentId2 int64
|
|
|
301
|
+// if len(useList2) > 0 {
|
|
|
302
|
+// anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
303
|
+// userParentId2 = useList2[0].ParentId
|
|
|
304
|
+// }
|
|
|
305
|
+// // 辅导异常超过N天,通知任务负责人的上上级
|
|
|
306
|
+// if taskData.AssistFlag >= taskData.AssistFlagMax && userParentId2 > 0 {
|
|
|
307
|
+// _, useList3, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
308
|
+// if err != nil {
|
|
|
309
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
310
|
+// }
|
|
|
311
|
+// if len(useList3) > 0 {
|
|
|
312
|
+// anomalyDataTmp.SetNoticeWho(useList3[0])
|
|
|
313
|
+// }
|
|
|
314
|
+// }
|
|
|
315
|
+// }
|
327
|
|
316
|
|
328
|
- err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
329
|
- if err != nil {
|
|
|
330
|
- return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
331
|
- }
|
|
|
332
|
- return nil
|
317
|
+// err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
318
|
+// if err != nil {
|
|
|
319
|
+// return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
320
|
+// }
|
|
|
321
|
+// return nil
|
333
|
|
322
|
|
334
|
-}
|
323
|
+// }
|
335
|
|
324
|
|
336
|
-// 取消反馈异常的情况
|
|
|
337
|
-func isNotAssessFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
338
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
339
|
- "transactionContext": transactionContext,
|
|
|
340
|
- })
|
325
|
+// // 取消反馈异常的情况
|
|
|
326
|
+// func isNotAssessFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
327
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
328
|
+// "transactionContext": transactionContext,
|
|
|
329
|
+// })
|
341
|
|
330
|
|
342
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
343
|
- "isLast": 1,
|
|
|
344
|
- "category": domain.AnomalyCategoryType2,
|
|
|
345
|
- "limit": 1,
|
|
|
346
|
- "taskId": taskData.Id,
|
|
|
347
|
- })
|
|
|
348
|
- if err != nil {
|
|
|
349
|
- return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
350
|
- }
|
|
|
351
|
- if len(oldAnomaly) == 0 {
|
|
|
352
|
- return nil
|
|
|
353
|
- }
|
|
|
354
|
- oldAnomaly[0].IsLast = 2
|
|
|
355
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
356
|
- if err != nil {
|
|
|
357
|
- return fmt.Errorf("取消辅导异常:%s", err)
|
|
|
358
|
- }
|
|
|
359
|
- return nil
|
|
|
360
|
-}
|
331
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
332
|
+// "isLast": 1,
|
|
|
333
|
+// "category": domain.AnomalyCategoryType2,
|
|
|
334
|
+// "limit": 1,
|
|
|
335
|
+// "taskId": taskData.Id,
|
|
|
336
|
+// })
|
|
|
337
|
+// if err != nil {
|
|
|
338
|
+// return fmt.Errorf("查询辅导异常的数据:%s", err)
|
|
|
339
|
+// }
|
|
|
340
|
+// if len(oldAnomaly) == 0 {
|
|
|
341
|
+// return nil
|
|
|
342
|
+// }
|
|
|
343
|
+// oldAnomaly[0].IsLast = 2
|
|
|
344
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
345
|
+// if err != nil {
|
|
|
346
|
+// return fmt.Errorf("取消辅导异常:%s", err)
|
|
|
347
|
+// }
|
|
|
348
|
+// return nil
|
|
|
349
|
+// }
|
361
|
|
350
|
|
362
|
-// 处理反馈异常的情况
|
|
|
363
|
-func isAssessFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
364
|
- taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
365
|
- "transactionContext": transactionContext,
|
|
|
366
|
- })
|
|
|
367
|
- userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
368
|
- "transactionContext": transactionContext,
|
|
|
369
|
- })
|
|
|
370
|
- _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
371
|
- "isLast": 1,
|
|
|
372
|
- "category": domain.AnomalyCategoryType2,
|
|
|
373
|
- "limit": 1,
|
|
|
374
|
- "taskId": taskData.Id,
|
|
|
375
|
- })
|
|
|
376
|
- if err != nil {
|
|
|
377
|
- return fmt.Errorf("查询反馈异常的数据:%s", err)
|
|
|
378
|
- }
|
|
|
379
|
- //
|
|
|
380
|
- anomalyDataTmp := domain.TaskAnomaly{
|
|
|
381
|
- Id: 0,
|
|
|
382
|
- CreatedAt: time.Now(),
|
|
|
383
|
- UpdatedAt: time.Now(),
|
|
|
384
|
- CompanyId: taskData.CompanyId,
|
|
|
385
|
- TaskId: taskData.Id,
|
|
|
386
|
- TaskRecordId: taskRecord.Id,
|
|
|
387
|
- Category: domain.AnomalyCategoryType2,
|
|
|
388
|
- CurrentStage: taskData.CurrentStage,
|
|
|
389
|
- LastStage: taskData.LastStage,
|
|
|
390
|
- TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
391
|
- AssessFlag: taskData.Anomaly,
|
|
|
392
|
- WarnFlag: 0,
|
|
|
393
|
- AssistFlag: 0,
|
|
|
394
|
- IsLast: 1,
|
|
|
395
|
- RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
396
|
- NoticeWho: []map[string]string{},
|
|
|
397
|
- Marks: map[string]string{
|
|
|
398
|
- "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
399
|
- },
|
|
|
400
|
- }
|
|
|
401
|
- if len(oldAnomaly) > 0 {
|
|
|
402
|
- anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
403
|
- oldAnomaly[0].IsLast = 2
|
|
|
404
|
- err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
405
|
- if err != nil {
|
|
|
406
|
- return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
407
|
- }
|
|
|
408
|
- }
|
|
|
409
|
- _ = anomalyDataTmp.AnomalyDesc()
|
|
|
410
|
- // 2天未反馈通知被评估人自己;3天通知上级
|
|
|
411
|
- // 获取任务Leader的数据
|
|
|
412
|
- _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
413
|
- if err != nil {
|
|
|
414
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
415
|
- }
|
|
|
416
|
- var userParentId int64
|
|
|
417
|
- if len(useList) > 0 {
|
|
|
418
|
- anomalyDataTmp.SetNoticeWho(useList[0])
|
|
|
419
|
- userParentId = useList[0].ParentId
|
|
|
420
|
- }
|
|
|
421
|
- anomalyDay := xtime.SubDayAbs(time.Now(), time.Unix(anomalyDataTmp.RecordBegin, 0))
|
|
|
422
|
- if anomalyDay >= 3 && userParentId > 0 {
|
|
|
423
|
- _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
424
|
- if err != nil {
|
|
|
425
|
- return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
426
|
- }
|
|
|
427
|
- if len(useList2) > 0 {
|
|
|
428
|
- anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
429
|
- }
|
|
|
430
|
- }
|
|
|
431
|
- err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
432
|
- if err != nil {
|
|
|
433
|
- return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
434
|
- }
|
|
|
435
|
- return nil
|
351
|
+// // 处理反馈异常的情况
|
|
|
352
|
+// func isAssessFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
353
|
+// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
354
|
+// "transactionContext": transactionContext,
|
|
|
355
|
+// })
|
|
|
356
|
+// userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
357
|
+// "transactionContext": transactionContext,
|
|
|
358
|
+// })
|
|
|
359
|
+// _, oldAnomaly, err := taskAnomalyRepo.Find(map[string]interface{}{
|
|
|
360
|
+// "isLast": 1,
|
|
|
361
|
+// "category": domain.AnomalyCategoryType2,
|
|
|
362
|
+// "limit": 1,
|
|
|
363
|
+// "taskId": taskData.Id,
|
|
|
364
|
+// })
|
|
|
365
|
+// if err != nil {
|
|
|
366
|
+// return fmt.Errorf("查询反馈异常的数据:%s", err)
|
|
|
367
|
+// }
|
|
|
368
|
+// //
|
|
|
369
|
+// anomalyDataTmp := domain.TaskAnomaly{
|
|
|
370
|
+// Id: 0,
|
|
|
371
|
+// CreatedAt: time.Now(),
|
|
|
372
|
+// UpdatedAt: time.Now(),
|
|
|
373
|
+// CompanyId: taskData.CompanyId,
|
|
|
374
|
+// TaskId: taskData.Id,
|
|
|
375
|
+// TaskRecordId: taskRecord.Id,
|
|
|
376
|
+// Category: domain.AnomalyCategoryType2,
|
|
|
377
|
+// CurrentStage: taskData.CurrentStage,
|
|
|
378
|
+// LastStage: taskData.LastStage,
|
|
|
379
|
+// TaskStageCheck: taskRecord.TaskStageCheck,
|
|
|
380
|
+// AssessFlag: taskData.Anomaly,
|
|
|
381
|
+// WarnFlag: 0,
|
|
|
382
|
+// AssistFlag: 0,
|
|
|
383
|
+// IsLast: 1,
|
|
|
384
|
+// RecordBegin: taskRecord.CreatedAt.Unix(),
|
|
|
385
|
+// NoticeWho: []map[string]string{},
|
|
|
386
|
+// Marks: map[string]string{
|
|
|
387
|
+// "a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导",
|
|
|
388
|
+// },
|
|
|
389
|
+// }
|
|
|
390
|
+// if len(oldAnomaly) > 0 {
|
|
|
391
|
+// anomalyDataTmp.RecordBegin = oldAnomaly[0].RecordBegin
|
|
|
392
|
+// oldAnomaly[0].IsLast = 2
|
|
|
393
|
+// err = taskAnomalyRepo.Save(oldAnomaly[0])
|
|
|
394
|
+// if err != nil {
|
|
|
395
|
+// return fmt.Errorf("更新里程碑异常记录:%s", err)
|
|
|
396
|
+// }
|
|
|
397
|
+// }
|
|
|
398
|
+// _ = anomalyDataTmp.AnomalyDesc()
|
|
|
399
|
+// // 2天未反馈通知被评估人自己;3天通知上级
|
|
|
400
|
+// // 获取任务Leader的数据
|
|
|
401
|
+// _, useList, err := userRepo.Find(map[string]interface{}{"id": taskData.Leader.Id, "limit": 1})
|
|
|
402
|
+// if err != nil {
|
|
|
403
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
404
|
+// }
|
|
|
405
|
+// var userParentId int64
|
|
|
406
|
+// if len(useList) > 0 {
|
|
|
407
|
+// anomalyDataTmp.SetNoticeWho(useList[0])
|
|
|
408
|
+// userParentId = useList[0].ParentId
|
|
|
409
|
+// }
|
|
|
410
|
+// anomalyDay := xtime.SubDayAbs(time.Now(), time.Unix(anomalyDataTmp.RecordBegin, 0))
|
|
|
411
|
+// if anomalyDay >= 3 && userParentId > 0 {
|
|
|
412
|
+// _, useList2, err := userRepo.Find(map[string]interface{}{"id": userParentId, "limit": 1})
|
|
|
413
|
+// if err != nil {
|
|
|
414
|
+// return fmt.Errorf("获取任务Leader:%s", err)
|
|
|
415
|
+// }
|
|
|
416
|
+// if len(useList2) > 0 {
|
|
|
417
|
+// anomalyDataTmp.SetNoticeWho(useList2[0])
|
|
|
418
|
+// }
|
|
|
419
|
+// }
|
|
|
420
|
+// err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
421
|
+// if err != nil {
|
|
|
422
|
+// return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
423
|
+// }
|
|
|
424
|
+// return nil
|
436
|
|
425
|
|
437
|
-} |
426
|
+// } |