1
|
-package service
|
|
|
2
|
-
|
|
|
3
|
-// TODO 检查任务里程碑反馈, 记录异常情况
|
|
|
4
|
-
|
|
|
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]
|
|
|
27
|
-
|
|
|
28
|
-// //检查每日评估中任务的异常
|
|
|
29
|
-
|
|
|
30
|
-// // anomaly1 := &domain.TaskAnomaly{}
|
|
|
31
|
-// // ok := anomaly1.IsWarnFlag(taskData, param)
|
|
|
32
|
-// // if ok {
|
|
|
33
|
-
|
|
|
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
|
-// }
|
|
|
82
|
-
|
|
|
83
|
-// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
84
|
-// return err
|
|
|
85
|
-// }
|
|
|
86
|
-// return nil
|
|
|
87
|
-// }
|
|
|
88
|
-
|
|
|
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
|
-// }
|
|
|
114
|
-
|
|
|
115
|
-// // 处理里程碑异常的情况, 日评中 里程碑未正常填写,包含 逾期完成,逾期未完成。
|
|
|
116
|
-// // 记录异常
|
|
|
117
|
-// func isWarnFlag(transactionContext application.TransactionContext, taskData *domain.Task, taskRecord *domain.TaskRecord) error {
|
|
|
118
|
-
|
|
|
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
|
-// }
|
|
|
128
|
-
|
|
|
129
|
-// taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
130
|
-// "transactionContext": transactionContext,
|
|
|
131
|
-// })
|
|
|
132
|
-
|
|
|
133
|
-// userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
134
|
-// "transactionContext": transactionContext,
|
|
|
135
|
-// })
|
|
|
136
|
-
|
|
|
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
|
-// }
|
|
|
147
|
-
|
|
|
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
|
-// }
|
|
|
190
|
-
|
|
|
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
|
-// }
|
|
|
207
|
-
|
|
|
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
|
-// })
|
|
|
213
|
-
|
|
|
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
|
-// }
|
|
|
233
|
-
|
|
|
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
|
-// })
|
|
|
239
|
-
|
|
|
240
|
-// userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
241
|
-// "transactionContext": transactionContext,
|
|
|
242
|
-// })
|
|
|
243
|
-
|
|
|
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
|
-// }
|
|
|
275
|
-
|
|
|
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
|
-// }
|
|
|
316
|
-
|
|
|
317
|
-// err = taskAnomalyRepo.Save(&anomalyDataTmp)
|
|
|
318
|
-// if err != nil {
|
|
|
319
|
-// return fmt.Errorf("保存里程碑异常记录:%s", err)
|
|
|
320
|
-// }
|
|
|
321
|
-// return nil
|
|
|
322
|
-
|
|
|
323
|
-// }
|
|
|
324
|
-
|
|
|
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
|
-// })
|
|
|
330
|
-
|
|
|
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
|
-// }
|
|
|
350
|
-
|
|
|
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
|
|
|
425
|
-
|
|
|
426
|
-// } |
|
|