...
|
...
|
@@ -327,6 +327,18 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取相关人员"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//查询是否已经有每日评估
|
|
|
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())
|
|
|
}
|
...
|
...
|
@@ -368,14 +380,18 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
if val.RealCompletedAt > 0 {
|
|
|
t2 = time.Unix(val.RealCompletedAt, 0).Local().Format("2006-01-02")
|
|
|
}
|
|
|
result.StageList = append(result.StageList, adapter.TaskStage{
|
|
|
stage := adapter.TaskStage{
|
|
|
Id: val.Id,
|
|
|
Name: val.Name,
|
|
|
PlanCompletedAt: t1,
|
|
|
RealCompletedAt: t2,
|
|
|
SortBy: val.SortBy,
|
|
|
StatusDescription: val.StatusDescription(),
|
|
|
})
|
|
|
}
|
|
|
if cnt > 0 {
|
|
|
stage.IsRef = true
|
|
|
}
|
|
|
result.StageList = append(result.StageList, stage)
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
...
|
...
|
@@ -907,3 +923,39 @@ func (srv TaskService) ListTaskRecord(param *command.ListTaskRecordCommand) (map |
|
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 获取任务详情
|
|
|
func (srv TaskService) DeleteTaskInfo(param *command.GetTaskCommand) (*adapter.TaskInfoAdapter, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskData, err := taskRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.TaskId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "xx"+err.Error())
|
|
|
}
|
|
|
if taskData.CompanyId != param.CompanyId {
|
|
|
return nil, nil
|
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
taskData.DeletedAt = &nowTime
|
|
|
err = taskRepo.Save(taskData)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "xx"+err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|