...
|
...
|
@@ -643,10 +643,10 @@ func (srv TaskService) MarkTaskAnomaly(param *command.MarkTaskAnomalyCommand) (m |
|
|
return map[string]string{}, nil
|
|
|
}
|
|
|
|
|
|
// 我的下级负责任务,异常列表
|
|
|
// 我的下级负责任务,异常列表 数据结构变体
|
|
|
// 按任务负责人归类,列表整理成树形结构
|
|
|
func (srv TaskService) ListTreeTaskAnomaly2(param *command.ListTaskAnomalyCommand) (map[string]interface{}, error) {
|
|
|
_, taskAnomalyList, err := srv.listTaskAnomaly2(param)
|
|
|
total, taskAnomalyList, err := srv.listTaskAnomaly2(param)
|
|
|
if err != nil {
|
|
|
return map[string]interface{}{
|
|
|
"list": []adapter.TaskAnomalyItem2{},
|
...
|
...
|
@@ -682,14 +682,15 @@ func (srv TaskService) ListTreeTaskAnomaly2(param *command.ListTaskAnomalyComman |
|
|
result := map[string]interface{}{
|
|
|
"list": treeList,
|
|
|
"leader": leaderList,
|
|
|
"total": total,
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 我相关的任务,异常列表
|
|
|
// 我相关的任务,异常列表 数据结构变体
|
|
|
// 按任务负责人归类,列表整理成树形结构
|
|
|
func (srv TaskService) ListTreeTaskAnomaly3(param *command.ListTaskAnomalyCommand) (map[string]interface{}, error) {
|
|
|
_, taskAnomalyList, err := srv.listTaskAnomaly3(param)
|
|
|
total, taskAnomalyList, err := srv.listTaskAnomaly3(param)
|
|
|
if err != nil {
|
|
|
return map[string]interface{}{
|
|
|
"list": []adapter.TaskAnomalyItem2{},
|
...
|
...
|
@@ -725,6 +726,111 @@ func (srv TaskService) ListTreeTaskAnomaly3(param *command.ListTaskAnomalyComman |
|
|
result := map[string]interface{}{
|
|
|
"list": treeList,
|
|
|
"leader": leaderList,
|
|
|
"total": total,
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 异常任务记录的详情
|
|
|
func (srv TaskService) TaskAnomalyInfo(param command.GetTaskAnomalyCommand) (*adapter.TaskAnomalyInfo, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
taskAnomalyRepo := factory.CreateTaskAnomalyRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskRepo := factory.CreateTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskStatgeRepo := factory.CreateTaskStageRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
_, anomalyList, err := taskAnomalyRepo.Find(map[string]interface{}{"id": param.Id, "companyId": param.CompanyId, "limit": 1})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(anomalyList) == 0 {
|
|
|
return &adapter.TaskAnomalyInfo{}, nil
|
|
|
}
|
|
|
anomalyData := anomalyList[0]
|
|
|
_, taskList, err := taskRepo.Find(map[string]interface{}{"id": anomalyData.TaskId, "companyId": anomalyData.CompanyId, "limit": 1})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(taskList) == 0 {
|
|
|
return &adapter.TaskAnomalyInfo{}, nil
|
|
|
}
|
|
|
taskData := taskList[0]
|
|
|
|
|
|
_, stageList, err := taskStatgeRepo.Find(map[string]interface{}{"taskId": taskData.Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, nil
|
|
|
}
|
|
|
if len(anomalyData.Marks) == 0 {
|
|
|
anomalyData.Marks = map[string]string{}
|
|
|
}
|
|
|
|
|
|
result := &adapter.TaskAnomalyInfo{
|
|
|
Id: anomalyData.Id,
|
|
|
TaskId: anomalyData.TaskId,
|
|
|
TaskRecordId: anomalyData.TaskRecordId,
|
|
|
Category: anomalyData.Category,
|
|
|
Leader: taskData.Leader.Name,
|
|
|
LeaderId: strconv.FormatInt(taskData.Leader.Id, 10),
|
|
|
CurrentStage: adapter.TaskStage{
|
|
|
Id: anomalyData.CurrentStage.Id,
|
|
|
Name: anomalyData.CurrentStage.Name,
|
|
|
StatusDescription: anomalyData.CurrentStage.StatusDescription(),
|
|
|
SortBy: anomalyData.CurrentStage.SortBy,
|
|
|
PlanCompletedAt: time.Unix(anomalyData.CurrentStage.PlanCompletedAt, 0).Format("2006-01-02"),
|
|
|
RealCompletedAt: "",
|
|
|
},
|
|
|
LastStage: adapter.TaskStage{
|
|
|
Id: anomalyData.LastStage.Id,
|
|
|
Name: anomalyData.LastStage.Name,
|
|
|
StatusDescription: anomalyData.LastStage.StatusDescription(),
|
|
|
SortBy: anomalyData.LastStage.SortBy,
|
|
|
PlanCompletedAt: time.Unix(anomalyData.LastStage.PlanCompletedAt, 0).Format("2006-01-02"),
|
|
|
RealCompletedAt: "",
|
|
|
},
|
|
|
TaskStageCheck: adapter.TaskStage{
|
|
|
Id: anomalyData.TaskStageCheck.Id,
|
|
|
Name: anomalyData.TaskStageCheck.Name,
|
|
|
StatusDescription: anomalyData.TaskStageCheck.StatusDescription(),
|
|
|
SortBy: anomalyData.TaskStageCheck.SortBy,
|
|
|
PlanCompletedAt: time.Unix(anomalyData.TaskStageCheck.PlanCompletedAt, 0).Format("2006-01-02"),
|
|
|
RealCompletedAt: "",
|
|
|
},
|
|
|
ListStage: []adapter.TaskStage{},
|
|
|
AssessFlag: anomalyData.AssessFlag,
|
|
|
WarnFlag: anomalyData.WarnFlag,
|
|
|
AssistFlag: anomalyData.AssistFlag,
|
|
|
TaskLevel: taskData.LevelName,
|
|
|
TaskName: taskData.Name,
|
|
|
TaskAlias: taskData.Alias,
|
|
|
TaskEndTime: taskData.EndTime,
|
|
|
TaskSortBy: int(taskData.SortBy),
|
|
|
RecordBegin: anomalyData.RecordBegin,
|
|
|
CreatedAt: anomalyData.CreatedAt.Local().Format("066-017"),
|
|
|
MarkA: "",
|
|
|
MarkB: "",
|
|
|
MarkC: "",
|
|
|
MarkD: "",
|
|
|
AnomalyDesc: "",
|
|
|
AnomalyDesc2: map[string]string{
|
|
|
"": "",
|
|
|
},
|
|
|
}
|
|
|
return result, nil
|
|
|
} |
...
|
...
|
|