...
|
...
|
@@ -605,6 +605,10 @@ func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]inte |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
|
|
|
}
|
|
|
if hrbpFlag == domain.RoleTypeSystem {
|
|
|
listData, err := t.ListTask2ForHrbp(param)
|
|
|
return listData, err
|
|
|
}
|
|
|
var limit = 20
|
|
|
var offset = 0
|
|
|
if param.PageSize > 0 {
|
...
|
...
|
@@ -623,22 +627,166 @@ func (t TaskService) ListTask2(param command.SearchTaskCommand) (map[string]inte |
|
|
LeaderId: param.LeaderId,
|
|
|
}
|
|
|
|
|
|
if hrbpFlag == domain.RoleTypeSystem {
|
|
|
//已hrbp权限获取
|
|
|
// info.IsHrbp = true
|
|
|
return nil, nil
|
|
|
}
|
|
|
taskDato := dao.NewTaskDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskDato.ListTaskStageNotHrbp(condition)
|
|
|
tasklistData, err := taskDato.ListTaskStageNotHrbp(condition)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
}
|
|
|
taskCount, err := taskDato.CountTaskStageNotHrbp(condition)
|
|
|
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())
|
|
|
}
|
|
|
return nil, nil
|
|
|
taskResult := []*adapter.TaskItem{}
|
|
|
taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
for _, val := range tasklistData {
|
|
|
if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
continue
|
|
|
}
|
|
|
tk := adapter.TaskItem{
|
|
|
Id: val.TaskId,
|
|
|
Name: val.TaskName,
|
|
|
Alias: val.TaskAliasName,
|
|
|
Leader: val.LeaderName,
|
|
|
Status: val.TaskStatus,
|
|
|
Level: val.Level,
|
|
|
LevelName: val.LevelName,
|
|
|
// StageA: adapter.TaskStage{},
|
|
|
// StageB: adapter.TaskStage{},
|
|
|
// StageC: adapter.TaskStage{},
|
|
|
// StageD: adapter.TaskStage{},
|
|
|
// StageE: adapter.TaskStage{},
|
|
|
}
|
|
|
taskMapResult[val.TaskId] = &tk
|
|
|
taskResult = append(taskResult, &tk)
|
|
|
}
|
|
|
for _, val := range tasklistData {
|
|
|
taskData, ok := taskMapResult[val.TaskId]
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
stage := adapter.TaskStage{
|
|
|
Id: val.StageId,
|
|
|
Name: val.StageName,
|
|
|
Status: val.StageStatus,
|
|
|
SortBy: val.StageSortBy,
|
|
|
}
|
|
|
switch val.StageSortBy {
|
|
|
case 1:
|
|
|
taskData.StageA = stage
|
|
|
case 2:
|
|
|
taskData.StageB = stage
|
|
|
case 3:
|
|
|
taskData.StageC = stage
|
|
|
case 4:
|
|
|
taskData.StageD = stage
|
|
|
case 5:
|
|
|
taskData.StageE = stage
|
|
|
}
|
|
|
}
|
|
|
result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 以hrbp角色权限获取任务列表
|
|
|
func (t TaskService) ListTask2ForHrbp(param command.SearchTaskCommand) (map[string]interface{}, error) {
|
|
|
return nil, nil
|
|
|
var limit = 20
|
|
|
var offset = 0
|
|
|
if param.PageSize > 0 {
|
|
|
limit = param.PageSize
|
|
|
if param.PageNumber > 0 {
|
|
|
offset = (param.PageNumber - 1) * param.PageSize
|
|
|
}
|
|
|
}
|
|
|
condition := dao.ListTaskCondition{
|
|
|
Limit: limit,
|
|
|
Offset: offset,
|
|
|
UserId: param.UserId,
|
|
|
TaskName: param.TaskName,
|
|
|
LevelName: param.LevelName,
|
|
|
OnlyMy: param.OnlyMy,
|
|
|
LeaderId: param.LeaderId,
|
|
|
}
|
|
|
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()
|
|
|
}()
|
|
|
taskDato := dao.NewTaskDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
tasklistData, err := taskDato.ListTaskStageByHrbp(condition)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
|
|
|
}
|
|
|
taskCount, err := taskDato.CountTaskStageByHrbp(condition)
|
|
|
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())
|
|
|
}
|
|
|
taskResult := []*adapter.TaskItem{}
|
|
|
taskMapResult := map[int]*adapter.TaskItem{}
|
|
|
for _, val := range tasklistData {
|
|
|
if _, ok := taskMapResult[val.TaskId]; ok {
|
|
|
continue
|
|
|
}
|
|
|
tk := adapter.TaskItem{
|
|
|
Id: val.TaskId,
|
|
|
Name: val.TaskName,
|
|
|
Alias: val.TaskAliasName,
|
|
|
Leader: val.LeaderName,
|
|
|
Status: val.TaskStatus,
|
|
|
Level: val.Level,
|
|
|
LevelName: val.LevelName,
|
|
|
// StageA: adapter.TaskStage{},
|
|
|
// StageB: adapter.TaskStage{},
|
|
|
// StageC: adapter.TaskStage{},
|
|
|
// StageD: adapter.TaskStage{},
|
|
|
// StageE: adapter.TaskStage{},
|
|
|
}
|
|
|
taskMapResult[val.TaskId] = &tk
|
|
|
taskResult = append(taskResult, &tk)
|
|
|
}
|
|
|
for _, val := range tasklistData {
|
|
|
taskData, ok := taskMapResult[val.TaskId]
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
stage := adapter.TaskStage{
|
|
|
Id: val.StageId,
|
|
|
Name: val.StageName,
|
|
|
Status: val.StageStatus,
|
|
|
SortBy: val.StageSortBy,
|
|
|
}
|
|
|
switch val.StageSortBy {
|
|
|
case 1:
|
|
|
taskData.StageA = stage
|
|
|
case 2:
|
|
|
taskData.StageB = stage
|
|
|
case 3:
|
|
|
taskData.StageC = stage
|
|
|
case 4:
|
|
|
taskData.StageD = stage
|
|
|
case 5:
|
|
|
taskData.StageE = stage
|
|
|
}
|
|
|
}
|
|
|
result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 更新任务里程碑的状态
|
|
|
func (t TaskService) UpdateTaskStageStatus(param command.UpdateTaskStageStatusCommand) {
|
|
|
|
|
|
} |
...
|
...
|
|