...
|
...
|
@@ -172,11 +172,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
// if len(param.StageList) < 3 {
|
|
|
// return map[string]interface{}{
|
|
|
// "id": param.Id,
|
|
|
// }, application.ThrowError(application.INTERNAL_SERVER_ERROR, "里程碑数量至少3个")
|
|
|
// }
|
|
|
if len(param.StageList) > 5 {
|
|
|
return map[string]interface{}{
|
|
|
"id": param.Id,
|
...
|
...
|
@@ -277,17 +272,19 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
"taskId": taskData.Id,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
}
|
|
|
if cnt > 0 {
|
|
|
for _, v := range stageList {
|
|
|
if v.DeletedAt != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已有日评数据,不能删除里程碑")
|
|
|
|
|
|
for _, v := range stageList {
|
|
|
if v.DeletedAt != nil {
|
|
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
"taskId": taskData.Id,
|
|
|
"taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, v.Id),
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
}
|
|
|
if cnt > 0 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("里程碑[%s]已有日评数据,不能删除", v.Name))
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -452,17 +449,13 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
taskRecordRepo := factory.CreateTaskRecordRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
"taskId": param.TaskId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// cnt, _, err := taskRecordRepo.Find(map[string]interface{}{
|
|
|
// "taskId": param.TaskId,
|
|
|
// "limit": 1,
|
|
|
// })
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "相关联的任务反馈信息"+err.Error())
|
|
|
// }
|
|
|
result := adapter.TaskInfoAdapter{
|
|
|
Id: taskData.Id,
|
|
|
Name: taskData.Name,
|
...
|
...
|
@@ -513,11 +506,19 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
SortBy: val.SortBy,
|
|
|
StatusDescription: val.StatusDescription(),
|
|
|
}
|
|
|
cnt, _, _ := taskRecordRepo.Find(map[string]interface{}{
|
|
|
"taskId": taskData.Id,
|
|
|
"taskStageCheck": fmt.Sprintf(`{"id":"%d"}`, val.Id),
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if cnt > 0 {
|
|
|
stage.IsRef = true
|
|
|
}
|
|
|
result.StageList = append(result.StageList, stage)
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
...
|
...
|
|