作者 tangxvhui

清理 代码

... ... @@ -1208,15 +1208,6 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC
"transactionContext": transactionContext,
})
// permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
// // 获取权限配置
// _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": evaluationData.CompanyId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if len(permissionList) == 0 {
// return nil, nil
// }
permissionData, err := getPermission(int64(evaluationData.CompanyId))
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1977,13 +1968,6 @@ func (srv *SummaryEvaluationService) editEvaluationValue(
}
//完全更新itemValueList
*itemValueList = evaluationValueSlice
// *itemValueList = (*itemValueList)[0:0]
// for _, v := range evaluationValueMap {
// *itemValueList = append(*itemValueList, v)
// }
// sort.Slice(*itemValueList, func(i, j int) bool {
// return (*itemValueList)[i].EvaluationItemId < (*itemValueList)[j].EvaluationItemId
// })
// 计算总得分
err := evaluationData.EvaluationTotalScore(*itemValueList)
if err != nil {
... ...
... ... @@ -745,239 +745,6 @@ func (srv TaskService) CancelAttention(param *command.CancelAttentionCommand) er
return nil
}
// 员工绩效-任务管理-列表
// func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]interface{}, error) {
// 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()
// }()
// hrbpFlag, err := roleService.GetHrBp(transactionContext, int(param.CompanyId), int(param.UserId))
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息"+err.Error())
// }
// if len(param.SearchWord) > 0 {
// param.SearchWord = "%" + param.SearchWord + "%"
// }
// if hrbpFlag == domain.RoleTypeSystem {
// listData, err := srv.listTask2ForHrbp(param)
// return listData, err
// }
// 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,
// CompanyId: param.CompanyId,
// OnlyMy: param.OnlyMy,
// SearchWord: param.SearchWord,
// }
// taskDao := dao.NewTaskDao(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// //任务列表数据
// tasklistData, err := taskDao.ListTaskStageNotHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
// }
// //查到的任务数据总数
// taskCount, err := taskDao.CountTaskNotHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
// }
// //
// taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
// }
// taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(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,
// UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
// Anomaly: val.Anomaly,
// WarnFlag: val.WarnFlag,
// }
// 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,
// SortBy: val.StageSortBy,
// PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
// RealCompletedAt: "",
// }
// if val.RealCompletedAt > 0 {
// stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
// }
// 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)
// result["taskStageAnomaly"] = taskStageAnomalyCnt
// result["taskAnomalyCnt"] = taskAnomalyCnt
// return result, nil
// }
// 以hrbp角色权限获取任务列表
// 统计里程碑异常数,反馈异常数
// func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[string]interface{}, error) {
// 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,
// CompanyId: param.CompanyId,
// OnlyMy: param.OnlyMy,
// SearchWord: param.SearchWord,
// }
// 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()
// }()
// taskDao := dao.NewTaskDao(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// tasklistData, err := taskDao.ListTaskStageByHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
// }
// taskCount, err := taskDao.CountTaskByHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
// }
// taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyByHrbp(condition)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
// }
// taskAnomalyCnt, err := taskDao.CountTaskAnomalyByHrbp(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,
// UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
// Anomaly: val.Anomaly,
// WarnFlag: val.WarnFlag,
// // 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,
// SortBy: val.StageSortBy,
// PlanCompletedAt: time.Unix(int64(val.PlanCompletedAt), 0).Local().Format("2006-01-02"),
// RealCompletedAt: "",
// }
// if val.RealCompletedAt > 0 {
// stage.RealCompletedAt = time.Unix(int64(val.RealCompletedAt), 0).Local().Format("2006-01-02")
// }
// 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)
// result["taskStageAnomaly"] = taskStageAnomalyCnt
// result["taskAnomalyCnt"] = taskAnomalyCnt
// return result, nil
// }
// ReplyTaskStage 根据每日的任务反馈 ,更新任务里程碑
func (srv TaskService) ReplyTaskStage(transactionContext application.TransactionContext, param []*domain.TaskRecord, isFirstSubmit bool) error {
taskRepo := factory.CreateTaskRepository(map[string]interface{}{
... ... @@ -1002,17 +769,8 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction
if len(stageList) == 0 {
continue
}
// 避免当天多次编辑提交,数量递增
// if isFirstSubmit && val.AnomalyState == domain.AnomalyState0 {
// taskData.Anomaly += 1
// }
// trimSpace := strings.TrimLeft(val.AssistContent, "\n") // 去掉前换行符
// trimSpace = strings.TrimRight(trimSpace, "\n") // 去掉后换行符
// trimSpace = strings.TrimSpace(trimSpace) // 去掉前后空格符
// // 上级填写内容有值,选项是已辅导,变为正常
// if !(len(trimSpace) == 0 || trimSpace == "无") && val.AssistLevel >= domain.AssistLevel2 {
// taskData.Anomaly = 0
// }
//改为定时检查每日任务反馈,并计算反馈异常数
for _, val2 := range stageList {
if val2.Id != val.TaskStageCheck.Id {
continue
... ...
... ... @@ -116,37 +116,37 @@ func (itemValue *SummaryEvaluationValue) valueTypeScore(item *EvaluationItemUsed
}
// 填写综合自评
func (itemValue *SummaryEvaluationValue) EvaluationSelfFillValue(item *EvaluationItemUsed, value string, remark string) error {
itemValue.Remark = remark
if item.Weight == 0 {
//使用评级的形式
err := itemValue.valueTypeRating(item, value)
return err
}
//综合自评 评分的形式,特殊处理
err := itemValue.valueTypeScoreEvaluationSelf(item, value)
return err
}
// func (itemValue *SummaryEvaluationValue) EvaluationSelfFillValue(item *EvaluationItemUsed, value string, remark string) error {
// itemValue.Remark = remark
// if item.Weight == 0 {
// //使用评级的形式
// err := itemValue.valueTypeRating(item, value)
// return err
// }
// //综合自评 评分的形式,特殊处理
// err := itemValue.valueTypeScoreEvaluationSelf(item, value)
// return err
// }
func (itemValue *SummaryEvaluationValue) valueTypeScoreEvaluationSelf(item *EvaluationItemUsed, value string) error {
if item.Weight <= 0 {
return errors.New("评分方式错误")
}
value = strings.TrimSpace(value)
itemValue.Value = value
//处理空值
if len(value) == 0 {
itemValue.Score = "0"
return nil
}
valueNumber, err := strconv.ParseFloat(value, 64)
if err != nil {
return fmt.Errorf("条目%d:%s-%s评分值异常", item.Id, item.Category, item.Name)
}
// func (itemValue *SummaryEvaluationValue) valueTypeScoreEvaluationSelf(item *EvaluationItemUsed, value string) error {
// if item.Weight <= 0 {
// return errors.New("评分方式错误")
// }
// value = strings.TrimSpace(value)
// itemValue.Value = value
// //处理空值
// if len(value) == 0 {
// itemValue.Score = "0"
// return nil
// }
// valueNumber, err := strconv.ParseFloat(value, 64)
// if err != nil {
// return fmt.Errorf("条目%d:%s-%s评分值异常", item.Id, item.Category, item.Name)
// }
// 分数保留2位小数
score := valueNumber * item.Weight
itemValue.Score = fmt.Sprintf("%.2f", score)
// // 分数保留2位小数
// score := valueNumber * item.Weight
// itemValue.Score = fmt.Sprintf("%.2f", score)
return nil
}
// return nil
// }
... ...
... ... @@ -86,51 +86,6 @@ func (d *StaffAssessDao) CountTargetUserInviteAssess1(userIds []int, cycleId int
return result, err
}
// 根据评估的人执行人id,搜索 executorId参与的评估任务
// func (d *StaffAssessDao) SearchAssessTaskMe(executorId int, companyId int, limit int, offset int) ([]*domain.StaffAssessTask, error) {
// if limit < 0 {
// limit = 20
// }
// if offset < 0 {
// offset = 0
// }
// sqlStr := `SELECT DISTINCT staff_assess_task.* FROM staff_assess_task
// JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
// WHERE staff_assess.company_id=?
// and staff_assess_task.deleted_at isnull
// and staff_assess.executor->>'userId'='?'
// order by staff_assess_task.id desc
// limit ? offset ?
// `
// tx := d.transactionContext.PgTx
// condition := []interface{}{
// companyId, executorId, limit, offset,
// }
// result := []*domain.StaffAssessTask{}
// _, err := tx.Query(&result, sqlStr, condition...)
// return result, err
// }
// 搜索 executorId 参与的评估任务
// func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int, error) {
// sqlStr := `SELECT count( DISTINCT staff_assess_task."id") FROM staff_assess_task
// JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
// WHERE staff_assess.company_id=?
// and staff_assess_task.deleted_at isnull
// and staff_assess.executor->>'userId'='?'
// `
// tx := d.transactionContext.PgTx
// condition := []interface{}{
// companyId, executorId,
// }
// result := 0
// _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...)
// return result, err
// }
// 获取所以已经执行的评估周期
type AssessCycle struct {
CycleId string `json:"cycleId"` //周期id
... ... @@ -1043,38 +998,6 @@ type AssessCycleDayExecutor struct {
BeginTime string `pg:"begin_time"`
}
// 根据评估的人执行人id,搜索 executorId参与的评估周期
// func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limit int, offset int) ([]AssessCycleDayExecutor, error) {
// if limit < 0 {
// limit = 20
// }
// if offset < 0 {
// offset = 0
// }
// sqlStr := `
// SELECT
// distinct on(staff_assess_task.cycle_id,staff_assess_task.begin_day)
// staff_assess_task.cycle_id,staff_assess_task.cycle_name ,
// staff_assess_task.begin_day,
// to_char(staff_assess_task.end_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as end_time,
// to_char(staff_assess_task.begin_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as begin_time
// FROM staff_assess_task
// JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
// WHERE staff_assess.company_id=?
// and staff_assess_task.deleted_at isnull
// and staff_assess.executor->>'userId'='?'
// order by staff_assess_task.begin_day desc
// limit ? offset ?
// `
// tx := d.transactionContext.PgTx
// condition := []interface{}{
// companyId, executorId, limit, offset,
// }
// result := []AssessCycleDayExecutor{}
// _, err := tx.Query(&result, sqlStr, condition...)
// return result, err
// }
// 根据评估的人执行人id,统计executorId参与的评估周期
func (d *StaffAssessDao) CountAssessCycleMe(executorId int, companyId int) (int, error) {
sqlStr := `
... ...
... ... @@ -92,90 +92,6 @@ type ListTaskStage struct {
RealCompletedAt int `pg:"real_completed_at"`
}
// (弃用) 获取任务以及里程碑列表,用于页面展示; 有过滤查看权限
// userid 谁要查看任务数据
// limit 分页
// offset 分页
// func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage, error) {
// task1 := d.catchTaskIdByPermission(param.UserId)
// withSql := task1 + `,
// -- 获取的里程碑数据,以及排序
// t_task_tage_1 as(
// select
// task.id as task_id,
// task."name" as task_name,
// task."alias" as task_alias_name,
// task.leader ->>'name' as leader_name,
// task.leader ->>'id' as leader_id,
// task.level_name ,
// task.anomaly ,
// task.updated_at ,
// task.created_at ,
// task."level" ,
// task."warn_flag",
// task."status" as task_status,
// task_stage."id" as stage_id,
// task_stage."name" as stage_name,
// task_stage.sort_by as stage_sort_by,
// task_stage.plan_completed_at,
// task_stage.real_completed_at,
// (case
// when task_stage.real_completed_at =0
// then task_stage.plan_completed_at - floor( extract(epoch from now()))
// else task_stage.plan_completed_at - task_stage.real_completed_at
// end) as diff_time
// from task
// join t_task_1 on task.id=t_task_1.id
// join task_stage on task.id =task_stage.task_id
// where 1=1 and task.company_id=?
// order by diff_time,task."level",task.created_at desc
// ),
// -- 按任务数据分页获取
// t_task_page as (
// select distinct t_task_tage_1.task_id
// from t_task_tage_1
// where 1=1
// %s
// limit ? offset ?
// )
// select
// t_task_tage_1.task_id,
// t_task_tage_1.task_name,
// t_task_tage_1.task_alias_name,
// t_task_tage_1.leader_name,
// t_task_tage_1.level_name ,
// t_task_tage_1.anomaly ,
// t_task_tage_1.updated_at ,
// t_task_tage_1.created_at ,
// t_task_tage_1."level" ,
// t_task_tage_1.plan_completed_at,
// t_task_tage_1.real_completed_at,
// t_task_tage_1.stage_name,
// t_task_tage_1.stage_id,
// t_task_tage_1.stage_sort_by,
// t_task_tage_1."warn_flag"
// from t_task_tage_1
// where t_task_tage_1.task_id in(
// select t_task_page.task_id from t_task_page
// )`
// condition := []interface{}{param.CompanyId}
// whereSql := ``
// if param.OnlyMy {
// condition = append(condition, param.UserId)
// whereSql += ` and t_task_tage_1.leader_id = '?' `
// }
// if param.SearchWord != "" {
// condition = append(condition, param.SearchWord, param.SearchWord)
// whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
// }
// condition = append(condition, param.Limit, param.Offset)
// sqlStr := fmt.Sprintf(withSql, whereSql)
// result := []ListTaskStage{}
// tx := d.transactionContext.PgTx
// _, err := tx.Query(&result, sqlStr, condition...)
// return result, err
// }
// 获取任务总数,用于页面展示; 有过滤查看权限
func (d *TaskDao) CountTaskNotHrbp(param ListTaskCondition) (int, error) {
task1 := d.catchTaskIdByPermission(param.UserId)
... ... @@ -200,93 +116,6 @@ func (d *TaskDao) CountTaskNotHrbp(param ListTaskCondition) (int, error) {
return cnt, err
}
// (弃用)获取任务以及里程碑列表,用于页面展示; 无过滤查看权限
// userid 谁要查看任务数据
// limit 分页
// offset 分页
// func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, error) {
// withSql := `with
// t_task_ignore as (
// select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
// ),
// -- 获取的里程碑数据,以及排序
// t_task_tage_1 as(
// select
// task.id as task_id,
// task."name" as task_name,
// task."alias" as task_alias_name,
// task."status" as task_status,
// task.leader ->>'name' as leader_name,
// task.leader ->>'id' as leader_id,
// task.level_name ,
// task.anomaly ,
// task.updated_at ,
// task."warn_flag",
// task.created_at ,
// task."level" ,
// task_stage."id" as stage_id,
// task_stage."name" as stage_name,
// task_stage.sort_by as stage_sort_by,
// task_stage.plan_completed_at,
// task_stage.real_completed_at,
// (case
// when task_stage.real_completed_at =0
// then task_stage.plan_completed_at - floor( extract(epoch from now()))
// else task_stage.plan_completed_at - task_stage.real_completed_at
// end) as diff_time
// from task
// join task_stage on task.id =task_stage.task_id
// where 1=1 and task.company_id=?
// order by diff_time,task."level",task.created_at desc
// ),
// -- 按任务数据分页获取
// t_task_page as (
// select distinct t_task_tage_1.task_id
// from t_task_tage_1
// left join t_task_ignore on t_task_ignore.task_id=t_task_tage_1.task_id
// where t_task_ignore.id isnull
// %s
// limit ? offset ?
// )
// select
// t_task_tage_1.task_id,
// t_task_tage_1.task_name,
// t_task_tage_1.task_alias_name,
// t_task_tage_1.task_status,
// t_task_tage_1.leader_name,
// t_task_tage_1.level_name ,
// t_task_tage_1.anomaly ,
// t_task_tage_1.updated_at ,
// t_task_tage_1.created_at ,
// t_task_tage_1."level" ,
// t_task_tage_1.plan_completed_at,
// t_task_tage_1.real_completed_at,
// t_task_tage_1.stage_name,
// t_task_tage_1.stage_id,
// t_task_tage_1."warn_flag",
// t_task_tage_1.stage_sort_by
// from t_task_tage_1
// where t_task_tage_1.task_id in(
// select t_task_page.task_id from t_task_page
// )`
// condition := []interface{}{param.UserId, param.CompanyId}
// whereSql := ``
// if param.OnlyMy {
// condition = append(condition, param.UserId)
// whereSql += ` and t_task_tage_1.leader_id = '?' `
// }
// if param.SearchWord != "" {
// condition = append(condition, param.SearchWord, param.SearchWord)
// whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?) `
// }
// condition = append(condition, param.Limit, param.Offset)
// sqlStr := fmt.Sprintf(withSql, whereSql)
// result := []ListTaskStage{}
// tx := d.transactionContext.PgTx
// _, err := tx.Query(&result, sqlStr, condition...)
// return result, err
// }
// 获取任务总数,用于页面展示; 无过滤查看权限
func (d *TaskDao) CountTaskByHrbp(param ListTaskCondition) (int, error) {
... ... @@ -380,25 +209,6 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
return cnt, err
}
// func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error {
// if len(id) == 0 {
// return nil
// }
// sqlStr := `update task set anomaly=task.anomaly+?
// where id in(?)`
// tx := d.transactionContext.PgTx
// _, err := tx.Exec(sqlStr, incr, pg.In(id))
// return err
// }
// TaskStageData
// type TaskStageData struct {
// TaskStageId int `pg:"task_stage_id"`
// TaskStageName string `pg:"task_stage_name"`
// LeaderName string `pg:"leader_name"`
// TaskAlias string `pg:"task_alias"`
// }
type TaskData3 struct {
TaskId int `pg:"task_id"`
TaskName string `pg:"task_name"`
... ... @@ -574,28 +384,6 @@ func (d *TaskDao) ListTask2ForHrbp(userId int, companyId int) ([]TaskData1, erro
}
// 获取异常任务对应的公司
// func (d *TaskDao) TaskStageAnomalyForCompany() ([]int, error) {
// var companyIds []struct {
// CompanyId int `pg:"company_id"`
// }
// sqlStr := `select distinct company_id
// from task
// where 1=1
// and (task.warn_flag >0)`
// result := []TaskData1{}
// tx := d.transactionContext.PgTx
// _, err := tx.Query(&result, sqlStr)
// if err != nil {
// return nil, err
// }
// var ids []int
// for _, v := range companyIds {
// ids = append(ids, v.CompanyId)
// }
// return ids, nil
// }
type TaskData4 struct {
TaskId int `pg:"task_id"`
TaskName string `pg:"task_name"`
... ...
... ... @@ -48,16 +48,6 @@ func (d *UserDao) AllChildUser(userId int) ([]UserData1, error) {
return result, err
}
// func (d *UserDao) ChildUser(userId int) ([]UserData1, error) {
// sqlStr := `select "user".id,"user".parent_id ,"user".account,"user".name
// from "user"
// where "user".parent_id=?`
// result := []UserData1{}
// tx := d.transactionContext.PgTx
// _, err := tx.Query(&result, sqlStr, userId)
// return result, err
// }
// AllParentUser 获取我的全上级
func (d *UserDao) AllParentUser(userId int) ([]UserData1, error) {
sqlStr := `with
... ...