...
|
...
|
@@ -35,9 +35,9 @@ func (srv TaskService) listTaskAnomaly2(param *command.ListTaskAnomalyCommand) ( |
|
|
})
|
|
|
limit := 500
|
|
|
offset := 0
|
|
|
if param.SubLevel < 1 {
|
|
|
param.SubLevel = 2
|
|
|
}
|
|
|
// if param.SubLevel < 1 {
|
|
|
// param.SubLevel = 2
|
|
|
// }
|
|
|
cnt, anomalyList, err := taskAnomalyDao.List2(param.UserId, param.CompanyId, param.TaskName, param.Category, param.DayTime, param.LeaderId, param.SubLevel, limit, offset)
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -657,11 +657,74 @@ func (srv TaskService) ListTreeTaskAnomaly2(param *command.ListTaskAnomalyComman |
|
|
"list": []adapter.TaskAnomalyItem2{},
|
|
|
}, nil
|
|
|
}
|
|
|
// leaderMap := map[string]*adapter.TaskAnomalyItem2{}
|
|
|
// var treeList []*adapter.TaskAnomalyItem2
|
|
|
// for _, val := range taskAnomalyList {
|
|
|
// leader, ok := leaderMap[val.Leader]
|
|
|
leaderMap := map[string]*adapter.TaskAnomalyItem2{}
|
|
|
leaderList := []map[string]string{}
|
|
|
var treeList []*adapter.TaskAnomalyItem2
|
|
|
for _, val := range taskAnomalyList {
|
|
|
leader, ok := leaderMap[val.LeaderId]
|
|
|
if !ok {
|
|
|
item := &adapter.TaskAnomalyItem2{
|
|
|
Leader: map[string]string{
|
|
|
"id": val.LeaderId,
|
|
|
"name": val.Leader,
|
|
|
},
|
|
|
TaskAnomaly: []adapter.TaskAnomalyItem{val},
|
|
|
}
|
|
|
leaderMap[val.LeaderId] = item
|
|
|
treeList = append(treeList, item)
|
|
|
leaderList = append(leaderList, map[string]string{
|
|
|
"id": val.LeaderId,
|
|
|
"name": val.Leader})
|
|
|
} else {
|
|
|
leader.TaskAnomaly = append(leader.TaskAnomaly, val)
|
|
|
}
|
|
|
}
|
|
|
result := map[string]interface{}{
|
|
|
"list": treeList,
|
|
|
"leader": leaderList,
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// }
|
|
|
return nil, nil
|
|
|
// 我相关的任务,异常列表
|
|
|
// 按任务负责人归类,列表整理成树形结构
|
|
|
func (srv TaskService) ListTreeTaskAnomaly3(param *command.ListTaskAnomalyCommand) (map[string]interface{}, error) {
|
|
|
_, taskAnomalyList, err := srv.listTaskAnomaly3(param)
|
|
|
if err != nil {
|
|
|
return map[string]interface{}{
|
|
|
"list": []adapter.TaskAnomalyItem2{},
|
|
|
}, nil
|
|
|
}
|
|
|
if len(taskAnomalyList) == 0 {
|
|
|
return map[string]interface{}{
|
|
|
"list": []adapter.TaskAnomalyItem2{},
|
|
|
}, nil
|
|
|
}
|
|
|
leaderMap := map[string]*adapter.TaskAnomalyItem2{}
|
|
|
leaderList := []map[string]string{}
|
|
|
var treeList []*adapter.TaskAnomalyItem2
|
|
|
for _, val := range taskAnomalyList {
|
|
|
leader, ok := leaderMap[val.LeaderId]
|
|
|
if !ok {
|
|
|
item := &adapter.TaskAnomalyItem2{
|
|
|
Leader: map[string]string{
|
|
|
"id": val.LeaderId,
|
|
|
"name": val.Leader,
|
|
|
},
|
|
|
TaskAnomaly: []adapter.TaskAnomalyItem{val},
|
|
|
}
|
|
|
leaderMap[val.LeaderId] = item
|
|
|
treeList = append(treeList, item)
|
|
|
leaderList = append(leaderList, map[string]string{
|
|
|
"id": val.LeaderId,
|
|
|
"name": val.Leader})
|
|
|
} else {
|
|
|
leader.TaskAnomaly = append(leader.TaskAnomaly, val)
|
|
|
}
|
|
|
}
|
|
|
result := map[string]interface{}{
|
|
|
"list": treeList,
|
|
|
"leader": leaderList,
|
|
|
}
|
|
|
return result, nil
|
|
|
} |
...
|
...
|
|