|
@@ -172,11 +172,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -172,11 +172,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
172
|
defer func() {
|
172
|
defer func() {
|
173
|
_ = transactionContext.RollbackTransaction()
|
173
|
_ = transactionContext.RollbackTransaction()
|
174
|
}()
|
174
|
}()
|
175
|
- // if len(param.StageList) < 3 {
|
|
|
176
|
- // return map[string]interface{}{
|
|
|
177
|
- // "id": param.Id,
|
|
|
178
|
- // }, application.ThrowError(application.INTERNAL_SERVER_ERROR, "里程碑数量至少3个")
|
|
|
179
|
- // }
|
|
|
180
|
if len(param.StageList) > 5 {
|
175
|
if len(param.StageList) > 5 {
|
181
|
return map[string]interface{}{
|
176
|
return map[string]interface{}{
|
182
|
"id": param.Id,
|
177
|
"id": param.Id,
|
|
@@ -277,17 +272,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -277,17 +272,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
277
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
272
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
278
|
"transactionContext": transactionContext,
|
273
|
"transactionContext": transactionContext,
|
279
|
})
|
274
|
})
|
280
|
- cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
281
|
- "taskId": taskData.Id,
|
|
|
282
|
- "limit": 1,
|
|
|
283
|
- })
|
|
|
284
|
- if err != nil {
|
|
|
285
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
286
|
- }
|
|
|
287
|
- if cnt > 0 {
|
|
|
288
|
- for _, v := range stageList {
|
|
|
289
|
- if v.DeletedAt != nil {
|
|
|
290
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已有日评数据,不能删除里程碑")
|
275
|
+
|
|
|
276
|
+ for _, v := range stageList {
|
|
|
277
|
+ if v.DeletedAt != nil {
|
|
|
278
|
+ cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
279
|
+ "taskId": taskData.Id,
|
|
|
280
|
+ "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, v.Id),
|
|
|
281
|
+ "limit": 1,
|
|
|
282
|
+ })
|
|
|
283
|
+ if err != nil {
|
|
|
284
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
285
|
+ }
|
|
|
286
|
+ if cnt > 0 {
|
|
|
287
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("里程碑[%s]已有日评数据,不能删除", v.Name))
|
291
|
}
|
288
|
}
|
292
|
}
|
289
|
}
|
293
|
}
|
290
|
}
|
|
@@ -452,17 +449,13 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
@@ -452,17 +449,13 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
452
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
449
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
453
|
"transactionContext": transactionContext,
|
450
|
"transactionContext": transactionContext,
|
454
|
})
|
451
|
})
|
455
|
- cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
456
|
- "taskId": param.TaskId,
|
|
|
457
|
- "limit": 1,
|
|
|
458
|
- })
|
|
|
459
|
- if err != nil {
|
|
|
460
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
461
|
- }
|
|
|
462
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
463
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
464
|
- }
|
|
|
465
|
-
|
452
|
+ // cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
453
|
+ // "taskId": param.TaskId,
|
|
|
454
|
+ // "limit": 1,
|
|
|
455
|
+ // })
|
|
|
456
|
+ // if err != nil {
|
|
|
457
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
458
|
+ // }
|
466
|
result := adapter.TaskInfoAdapter{
|
459
|
result := adapter.TaskInfoAdapter{
|
467
|
Id: taskData.Id,
|
460
|
Id: taskData.Id,
|
468
|
Name: taskData.Name,
|
461
|
Name: taskData.Name,
|
|
@@ -513,11 +506,19 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
@@ -513,11 +506,19 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
513
|
SortBy: val.SortBy,
|
506
|
SortBy: val.SortBy,
|
514
|
StatusDescription: val.StatusDescription(),
|
507
|
StatusDescription: val.StatusDescription(),
|
515
|
}
|
508
|
}
|
|
|
509
|
+ cnt, _, _ := taskRecordRepo.Find(map[string]interface{}{
|
|
|
510
|
+ "taskId": taskData.Id,
|
|
|
511
|
+ "taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, val.Id),
|
|
|
512
|
+ "limit": 1,
|
|
|
513
|
+ })
|
516
|
if cnt > 0 {
|
514
|
if cnt > 0 {
|
517
|
stage.IsRef = true
|
515
|
stage.IsRef = true
|
518
|
}
|
516
|
}
|
519
|
result.StageList = append(result.StageList, stage)
|
517
|
result.StageList = append(result.StageList, stage)
|
520
|
}
|
518
|
}
|
|
|
519
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
520
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
521
|
+ }
|
521
|
return &result, nil
|
522
|
return &result, nil
|
522
|
}
|
523
|
}
|
523
|
|
524
|
|