切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
c5b39c7b164c10e323b24957c03a8b163c2bcce1
2 个父辈
47e57380
37e11b7c
Merge branch 'test'
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
6 行增加
和
9 行删除
pkg/application/staff_assess/service/service_3.go
pkg/infrastructure/dao/staff_assess_dao.go
pkg/infrastructure/pg/init.go
pkg/utils/common.go
pkg/application/staff_assess/service/service_3.go
查看文件 @
c5b39c7
...
...
@@ -12,6 +12,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
)
//员工绩效-项目管理
...
...
@@ -154,7 +155,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
log
.
Logger
.
Debug
(
fmt
.
Sprintf
(
"获取到的数据列表%d"
,
len
(
contentList
)))
//可变的表格列
changeableHeader
:=
[]
adapter
.
ListTableHeader
{
{
Key
:
"targetUserName"
,
Name
:
"姓名"
},
//固定列
...
...
pkg/infrastructure/dao/staff_assess_dao.go
查看文件 @
c5b39c7
...
...
@@ -217,7 +217,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
sqlStr0
:=
d
.
useTStaffAssess
(
param
.
CompanyId
,
param
.
CycleId
,
param
.
OperaterId
,
param
.
BeginDay
,
param
.
Hrbp
,
param
.
Limit
,
param
.
Offset
)
sqlStr
=
sqlStr0
+
sqlStr
tx
:=
d
.
transactionContext
.
PgTx
var
result
[]
UserAssessContent
result
:=
[]
UserAssessContent
{}
_
,
err
:=
tx
.
Query
(
&
result
,
sqlStr
,
condition
...
)
return
result
,
err
}
...
...
@@ -259,6 +259,7 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
//offset int 分页偏移
func
(
d
*
StaffAssessDao
)
useTStaffAssess
(
companyId
int
,
cycleId
int
,
userId
int
,
beginDay
string
,
hrbp
int
,
limit
int
,
offset
int
)
string
{
sqlstr
:=
`
set time zone 'PRC';
with t_user_department as (
select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user"
where "user".company_id= %d
...
...
@@ -266,19 +267,16 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
t_department as (
select department.id::text as depart_id from department where charge_user_ids @>'[%d]'
),
-- 如果是部门管理员 获取用户列表
t_user_1 as (
select t_user_department.user_id::text from t_user_department
join t_department on t_user_department.depart_id = t_department.depart_id
),
-- 如果是hrbp
t_project_1 as(
select evaluation_project.id as project_id
from evaluation_project
where evaluation_project.cycle_id =%d
and evaluation_project.hr_bp = %d
),
-- 如果是项目管理员
t_project_2 as(
select evaluation_project.id as project_id
from evaluation_project
...
...
@@ -286,13 +284,11 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
and evaluation_project.pmp =1
and evaluation_project.pmp_ids @>'["%d"]'
),
-- 合并数据
t_project_3 as (
select t_project_2.project_id from t_project_2
union
select t_project_1.project_id from t_project_1
),
-- 初步过滤评估列表数据
t_staff_assess_0 as (
select staff_assess.id as assess_id,
staff_assess.target_user->>'userId' as target_user_id,
...
...
@@ -304,7 +300,6 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s'
and staff_assess."types" ='self'
),
-- 合并根据权限过滤后的数据
t_staff_assess_1 as (
(select t_staff_assess_0.assess_id,
t_staff_assess_0.target_user_id,
...
...
pkg/infrastructure/pg/init.go
查看文件 @
c5b39c7
...
...
@@ -15,6 +15,7 @@ import (
var
DB
*
pg
.
DB
func
init
()
{
DB
=
pg
.
Connect
(
&
pg
.
Options
{
User
:
constant
.
POSTGRESQL_USER
,
Password
:
constant
.
POSTGRESQL_PASSWORD
,
...
...
pkg/utils/common.go
查看文件 @
c5b39c7
...
...
@@ -45,7 +45,7 @@ func NextTime(now0 time.Time, start time.Time, kpiCycle int) time.Time {
var
nextTime
time
.
Time
switch
kpiCycle
{
case
domain
.
KpiCycleDay
:
nextTime
=
timeconv
.
AddDate
(
now0
,
0
,
0
,
1
)
// 当前时间的下一天
0点开始发送
nextTime
=
timeconv
.
AddDate
(
now0
,
0
,
0
,
0
)
// 当前时间的
0点开始发送
break
case
domain
.
KpiCycleWeek
:
offsetSeconds
:=
int64
(
now0
.
Sub
(
start0
)
.
Seconds
())
...
...
请
注册
或
登录
后发表评论