作者 tangxvhui

调整异常操作标记

... ... @@ -1281,8 +1281,8 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
if tk.Id != val3.TaskId {
continue
}
if val3.Marks == nil {
val3.Marks = map[string]string{}
if len(val3.Marks) == 0 {
val3.Marks = map[string]string{"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导"}
}
noticeWho := []string{}
for _, val2 := range val3.NoticeWho {
... ... @@ -1420,6 +1420,19 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 获取我的上级人员
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
_, me, err := userRepo.Find(map[string]interface{}{"id": param.UserId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的信息"+err.Error())
}
if len(me) == 0 {
return nil, nil
}
var meParent []*domain.User
if me[0].ParentId > 0 {
_, meParent, _ = userRepo.Find(map[string]interface{}{"id": me[0].ParentId})
}
var limit = 20
var offset = 0
if param.PageSize > 0 {
... ... @@ -1645,7 +1658,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
}
}
if len(val3.Marks) == 0 {
val3.Marks = map[string]string{}
val3.Marks = map[string]string{"a": "去更新", "b": "去反馈", "c": "找上级", "d": "去辅导"}
}
userId := strconv.Itoa(param.UserId)
isChildUser := false
... ... @@ -1662,8 +1675,10 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
if userId == val.LeaderId {
// 去更新
tk.Marks["a"] = val3.Marks["a"]
// 找上级
tk.Marks["c"] = val3.Marks["c"]
if len(meParent) > 0 {
// 找上级
tk.Marks["c"] = val3.Marks["c"]
}
} else if isChildUser {
// 去辅导
tk.Marks["d"] = val3.Marks["d"]
... ...
... ... @@ -808,7 +808,18 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
taskStatgeRepo := factory.CreateTaskStageRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
_, me, err := userRepo.Find(map[string]interface{}{"id": param.UserId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的信息"+err.Error())
}
if len(me) == 0 {
return nil, nil
}
var meParent []*domain.User
if me[0].ParentId > 0 {
_, meParent, _ = userRepo.Find(map[string]interface{}{"id": me[0].ParentId})
}
_, 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())
... ... @@ -874,25 +885,23 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
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("2006-01-02"),
MarkA: "",
MarkB: "",
MarkC: "",
MarkD: "",
AnomalyDesc: "",
AnomalyDesc2: map[string]string{
"": "",
},
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("2006-01-02"),
MarkA: "",
MarkB: "",
MarkC: "",
MarkD: "",
AnomalyDesc: "",
AnomalyDesc2: map[string]string{},
}
// 设置操作标记
{
... ... @@ -909,8 +918,10 @@ func (srv TaskService) TaskAnomalyInfo(param *command.GetTaskAnomalyCommand) (*a
if param.UserId == int(taskData.Leader.Id) {
// 去更新
result.MarkA = anomalyData.Marks["a"]
// 找上级
result.MarkC = anomalyData.Marks["c"]
if len(meParent) > 0 {
// 找上级
result.MarkC = anomalyData.Marks["c"]
}
} else if isChildUser {
// 去辅导
result.MarkD = anomalyData.Marks["d"]
... ...
... ... @@ -364,7 +364,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ?
and not exists (select t_user.id::text from t_user where t_user."level" <3 and task.leader->>'id'=t_user.id::text )
and task.leader->>'id' not in (select t_user.id::text from t_user where t_user."level" <4 )
and task_anomaly.is_last=1
`
... ... @@ -395,7 +395,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ?
and not exists (select t_user.id::text from t_user where t_user."level" <3 and task.leader->>'id'=t_user.id::text )
and task.leader->>'id' not in (select t_user.id::text from t_user where t_user."level" <4 )
and task_anomaly.is_last=1
`
... ...