作者 tangxvhui

更新

... ... @@ -1256,7 +1256,7 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
if v.Check == domain.TaskStageUncompleted {
it.TaskStageCheck.RealCompletedAt = 0
} else {
it.TaskStageCheck.RealCompletedAt = time.Now().Unix()
it.TaskStageCheck.SetRealCompleted(time.Now())
}
}
for j := range it.TaskStages {
... ... @@ -1264,7 +1264,7 @@ func (srv StaffAssessServeice) SaveSelfAssess(in *command.SaveSelfAssessCommand)
if v.Check == domain.TaskStageUncompleted {
it.TaskStages[j].RealCompletedAt = 0
} else {
it.TaskStages[j].RealCompletedAt = time.Now().Unix()
it.TaskStages[j].SetRealCompleted(time.Now())
}
}
}
... ...
... ... @@ -151,7 +151,6 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
}
// 更新任务
// TODO 检查是否可以修改,和通知
func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -209,13 +208,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error())
}
}
ok, err := srv.canUpdateTask(taskData, stageList)
if err != nil {
return nil, err
}
if !ok {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "日评数据已生成,任务不能再被编辑")
}
//更新相关人员
taskData.RelatedUser = []int{}
for _, val := range relatedUser {
... ... @@ -622,10 +614,6 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
return result, nil
}
func (srv TaskService) canUpdateTask(taskData *domain.Task, stageList []*domain.TaskStage) (bool, error) {
return true, nil
}
// CancelAttention 用户取消关注某个任务
func (srv TaskService) CancelAttention(param *command.CancelAttentionCommand) error {
transactionContext, err := factory.CreateTransactionContext(nil)
... ...
... ... @@ -155,7 +155,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and t_task_tage_1.leader_id = '?' `
} else if param.LeaderId != "" {
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and t_task_tage_1.leader_id = ? `
}
... ... @@ -186,7 +186,7 @@ func (d *TaskDao) CountTaskStageNotHrbp(param ListTaskCondition) (int, error) {
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and task.leader ->>'id' = '?' `
} else if param.LeaderId != "" {
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and task.leader ->>'id' = ? `
}
... ... @@ -274,18 +274,18 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
whereSql := ``
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and task.leader ->>'id' = '?' `
} else if param.LeaderId != "" {
whereSql += ` and t_task_tage_1.leader_id = '?' `
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and task.leader ->>'id' = ? `
whereSql += ` and t_task_tage_1.leader_id = ? `
}
if len(param.TaskName) > 0 {
condition = append(condition, param.TaskName)
whereSql += ` and task.name like ? `
whereSql += ` and t_task_tage_1.task_name like ? `
}
if len(param.LevelName) > 0 {
condition = append(condition, param.LevelName)
whereSql += ` and task.level_name like ? `
whereSql += ` and t_task_tage_1.level_name like ? `
}
condition = append(condition, param.Limit, param.Offset)
sqlStr := fmt.Sprintf(withSql, whereSql)
... ... @@ -309,7 +309,7 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and task.leader ->>'id' = '?' `
} else if param.LeaderId != "" {
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and task.leader ->>'id' = ? `
}
... ... @@ -346,7 +346,7 @@ func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, er
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and task.leader ->>'id' = '?' `
} else if param.LeaderId != "" {
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and task.leader ->>'id' = ? `
}
... ... @@ -385,7 +385,7 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
if param.OnlyMy {
condition = append(condition, param.UserId)
whereSql += ` and task.leader ->>'id' = '?' `
} else if param.LeaderId != "" {
} else if param.LeaderId != "" && param.LeaderId != "0" {
condition = append(condition, param.LeaderId)
whereSql += ` and task.leader ->>'id' = ? `
}
... ...
... ... @@ -118,6 +118,7 @@ func (c *TaskController) CancelAttention() {
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.UserId = int(userReq.UserId)
paramReq.CompanyId = int(userReq.CompanyId)
err = srv.CancelAttention(paramReq)
c.Response(nil, err)
... ...