切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
b719299a1076595b3feca4023f856d02ec473834
2 个父辈
a5ae4b01
9c0a7e69
Merge branch 'test' into dev-tangxvhui
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
35 行增加
和
15 行删除
pkg/application/evaluation_project/project_service.go
pkg/application/notify/service/message_personal.go
pkg/application/staff_assess/service/create_staff_assess.go
pkg/application/task/service/service.go
pkg/infrastructure/dao/task_dao.go
pkg/infrastructure/repository/pg_task_repository.go
pkg/port/beego/routers/task_router.go
pkg/application/evaluation_project/project_service.go
查看文件 @
b719299
...
...
@@ -525,7 +525,9 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
if
project
.
State
==
domain
.
ProjectStateEnable
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"项目已启动"
)
}
if
project
.
State
==
domain
.
ProjectStatePause
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"项目暂停中,先进行恢复"
)
}
// 周期内的所有项目,已启用的员工不能重复被评估
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
project
.
CompanyId
,
"cycleId"
:
project
.
CycleId
},
"template"
)
if
err
!=
nil
{
...
...
@@ -625,7 +627,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
task
.
NextSentAt
=
nil
}
task
,
err
:=
taskRepository
.
Insert
(
task
)
_
,
err
:=
taskRepository
.
Insert
(
task
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
@@ -871,6 +873,17 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo
}
func
(
rs
*
EvaluationProjectService
)
generateEvaluationItemUsed
(
transactionContext
application
.
TransactionContext
,
project
*
domain
.
EvaluationProject
)
error
{
itemUsedRepo
:=
factory
.
CreateEvaluationItemUsedRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
var
err
error
cnt
,
_
,
err
:=
itemUsedRepo
.
Find
(
map
[
string
]
interface
{}{
"projectId"
:
project
.
Id
})
if
err
!=
nil
{
return
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
"检查评估选项"
+
err
.
Error
())
}
if
cnt
>
0
{
return
nil
}
var
itemUsedList
[]
*
domain
.
EvaluationItemUsed
nowTime
:=
time
.
Now
()
for
_
,
v
:=
range
project
.
Template
.
LinkNodes
{
...
...
@@ -901,10 +914,8 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex
itemUsedList
=
append
(
itemUsedList
,
&
item
)
}
}
itemUsedRepo
:=
factory
.
CreateEvaluationItemUsedRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
err
:=
itemUsedRepo
.
BatchInsert
(
itemUsedList
)
err
=
itemUsedRepo
.
BatchInsert
(
itemUsedList
)
if
err
!=
nil
{
return
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/application/notify/service/message_personal.go
查看文件 @
b719299
...
...
@@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
return
resp
,
nil
}
userDao
:=
dao
.
NewUserDao
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
// 针对任务负责人
taskDao
:=
dao
.
NewTaskDao
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
// 我作为任务负责人的提醒
leaderIds
:=
[]
string
{
strconv
.
Itoa
(
param
.
UserId
)}
taskStageList
,
err
:=
taskDao
.
TaskStageAnomaly
(
leaderIds
)
if
err
!=
nil
{
...
...
@@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
childUserId
=
append
(
childUserId
,
strconv
.
Itoa
(
val
.
Id
))
}
}
//
针对上级
//
作为上级,我的下级员工的异常里程碑
var
taskStageList2
[]
dao
.
TaskStageData
if
len
(
childUserId
)
==
0
{
taskStageList2
,
err
=
taskDao
.
TaskStageAnomaly
(
childUserId
)
...
...
@@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
childUserId
=
append
(
childUserId
,
strconv
.
Itoa
(
val
.
Id
))
}
}
//
针对上上级
//
作为上级, 我的下下级员工的异常里程碑
var
taskStageList3
[]
dao
.
TaskStageData
if
len
(
childUserId
)
==
0
{
taskStageList3
,
err
=
taskDao
.
TaskStageAnomaly
(
childUserId2
)
...
...
pkg/application/staff_assess/service/create_staff_assess.go
查看文件 @
b719299
...
...
@@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
"获取项目EvaluationProject信息"
+
err
.
Error
())
}
// projectData.PrincipalId
userIdstr
:=
strconv
.
Itoa
(
staffAssess
.
Executor
.
UserId
)
if
projectData
.
PrincipalId
!=
userIdstr
{
return
nil
,
nil
...
...
@@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
_
,
taskList
,
err
:=
taskRepo
.
Find
(
map
[
string
]
interface
{}{
"name"
:
val
.
Name
,
"leaderId"
:
projectData
.
PrincipalId
,
"status"
:
domain
.
TaskRunning
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
"获取评估项指标任务task信息"
+
err
.
Error
())
...
...
pkg/application/task/service/service.go
查看文件 @
b719299
...
...
@@ -699,14 +699,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
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
.
CountTaskStageNotHrbp
(
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
())
...
...
pkg/infrastructure/dao/task_dao.go
查看文件 @
b719299
...
...
@@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
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
order by diff_time,task."level",task.created_at
desc
),
-- 按任务数据分页获取
t_task_page as (
...
...
@@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
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
order by diff_time,task."level",task.created_at
desc
),
-- 按任务数据分页获取
t_task_page as (
...
...
@@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
}
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 ?)`
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
)
...
...
@@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, 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
...
...
pkg/infrastructure/repository/pg_task_repository.go
查看文件 @
b719299
...
...
@@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d
if
val
,
ok
:=
queryOptions
[
"aliasOrLeader"
];
ok
{
query
.
Where
(
`task.alias like ? or task.leader->>'name' like ?`
,
val
,
val
)
}
if
val
,
ok
:=
queryOptions
[
"status"
];
ok
{
query
.
Where
(
"task.status=?"
,
val
)
}
query
.
Order
(
"id desc"
)
count
,
err
:=
query
.
SelectAndCount
()
if
err
!=
nil
{
...
...
pkg/port/beego/routers/task_router.go
查看文件 @
b719299
...
...
@@ -13,7 +13,7 @@ func init() {
web
.
NSBefore
(
filters
.
AllowCors
(),
middlewares
.
CheckAdminToken
()),
web
.
NSCtrlPost
(
"/info"
,
(
*
controllers
.
TaskController
)
.
GetTaskInfo
),
web
.
NSCtrlPut
(
"/"
,
(
*
controllers
.
TaskController
)
.
UpdateTask
),
web
.
NSCtrlP
os
t
(
"/delete"
,
(
*
controllers
.
TaskController
)
.
DeleteTask
),
web
.
NSCtrlP
u
t
(
"/delete"
,
(
*
controllers
.
TaskController
)
.
DeleteTask
),
web
.
NSCtrlPost
(
"/run"
,
(
*
controllers
.
TaskController
)
.
RunTask
),
web
.
NSCtrlPost
(
"/stop"
,
(
*
controllers
.
TaskController
)
.
StopTask
),
web
.
NSCtrlPost
(
"/list"
,
(
*
controllers
.
TaskController
)
.
ListTask
),
...
...
请
注册
或
登录
后发表评论