...
|
...
|
@@ -115,21 +115,21 @@ func (d *StaffAssessDao) CountTargetUserInviteAssess1(userIds []int, cycleId int |
|
|
// }
|
|
|
|
|
|
// 搜索 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
|
|
|
}
|
|
|
// 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 {
|
...
|
...
|
@@ -1000,45 +1000,45 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa |
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
type AssessCycleDayMe struct {
|
|
|
BeginDay string
|
|
|
CycleId string
|
|
|
CycleName string
|
|
|
EndTime string
|
|
|
BeginTime string
|
|
|
type AssessCycleDayExecutor struct {
|
|
|
BeginDay string `pg:"begin_day"`
|
|
|
CycleId string `pg:"cycle_id"`
|
|
|
CycleName string `pg:"cycle_name"`
|
|
|
EndTime string `pg:"end_time"`
|
|
|
BeginTime string `pg:"begin_time"`
|
|
|
}
|
|
|
|
|
|
// 根据评估的人执行人id,搜索 executorId参与的评估周期
|
|
|
func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limit int, offset int) ([]AssessCycleDayMe, 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 := []AssessCycleDayMe{}
|
|
|
_, err := tx.Query(&result, sqlStr, condition...)
|
|
|
return result, err
|
|
|
}
|
|
|
// 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) {
|
...
|
...
|
@@ -1254,8 +1254,8 @@ func (d *StaffAssessDao) CountUncompletedSelfAssess(companyId int, projectIds [] |
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// SearchAssesBeforeNow
|
|
|
func (d *StaffAssessDao) SearchAssesBeforeNow(executorId int, companyId int, limit int, offset int) ([]AssessCycleDayMe, int, error) {
|
|
|
// SearchExecutorAssesBeforeNow
|
|
|
func (d *StaffAssessDao) SearchExecutorAssessBeforeNow(executorId int, companyId int, limit int, offset int) ([]AssessCycleDayExecutor, int, error) {
|
|
|
sqlStr1 := `select
|
|
|
distinct on(cycle_id ,begin_day)
|
|
|
staff_assess.cycle_id ,
|
...
|
...
|
@@ -1269,20 +1269,66 @@ func (d *StaffAssessDao) SearchAssesBeforeNow(executorId int, companyId int, lim |
|
|
and (
|
|
|
staff_assess.end_time < now() or staff_assess.status ='completed'
|
|
|
)
|
|
|
and staff_assess.executor ->> 'userId'=''
|
|
|
and staff_assess.executor ->> 'userId'='?'
|
|
|
order by begin_day desc
|
|
|
limit ? offset ?`
|
|
|
|
|
|
// sqlStr2 := ``
|
|
|
|
|
|
condition1 := []interface{}{
|
|
|
companyId, executorId, limit, offset,
|
|
|
}
|
|
|
|
|
|
_ = sqlStr1
|
|
|
_ = condition1
|
|
|
return nil, 0, nil
|
|
|
sqlStr2 := `select
|
|
|
count(
|
|
|
distinct (staff_assess.cycle_id ,to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD'))
|
|
|
) as cnt
|
|
|
from staff_assess
|
|
|
WHERE staff_assess.company_id=?
|
|
|
and staff_assess.deleted_at isnull
|
|
|
and (
|
|
|
staff_assess.end_time < now() or staff_assess.status ='completed'
|
|
|
)
|
|
|
and staff_assess.executor ->> 'userId'='?'
|
|
|
`
|
|
|
condition2 := []interface{}{
|
|
|
companyId, executorId,
|
|
|
}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
result := []AssessCycleDayExecutor{}
|
|
|
_, err := tx.Query(&result, sqlStr1, condition1...)
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
var cnt int
|
|
|
_, err = tx.QueryOne(pg.Scan(&cnt), sqlStr2, condition2...)
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
return result, cnt, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
func (d *StaffAssessDao) SearchAssessAfterNow(executorId int, companyId int) {} |
|
|
// SearchExecutorAssessAfterNow SearchExecutorAssesAfterNow
|
|
|
func (d *StaffAssessDao) SearchExecutorAssessAfterNow(executorId int, companyId int) ([]AssessCycleDayExecutor, error) {
|
|
|
sqlStr := `select
|
|
|
distinct on(cycle_id ,begin_day)
|
|
|
staff_assess.cycle_id ,
|
|
|
staff_assess.cycle_name ,
|
|
|
to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') as begin_day,
|
|
|
to_char(staff_assess.end_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as end_time,
|
|
|
to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as begin_time
|
|
|
from staff_assess
|
|
|
WHERE staff_assess.company_id=?
|
|
|
and staff_assess.deleted_at isnull
|
|
|
and (
|
|
|
staff_assess.end_time >= now() and staff_assess.status ='uncompleted'
|
|
|
)
|
|
|
and staff_assess.executor ->> 'userId'='?'
|
|
|
order by begin_day`
|
|
|
condition1 := []interface{}{
|
|
|
companyId, executorId,
|
|
|
}
|
|
|
tx := d.transactionContext.PgTx
|
|
|
result := []AssessCycleDayExecutor{}
|
|
|
_, err := tx.Query(&result, sqlStr, condition1...)
|
|
|
return result, err
|
|
|
} |
...
|
...
|
|