切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
e246abbf3cfba5f455a21cd636b9f14e5e568be7
2 个父辈
e7ae0ad3
7e0c8277
Merge branch 'dev-tangxvhui' of
http://gitlab.fjmaimaimai.com/allied-creation/pe…
…rformance into dev-tangxvhui
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
55 行增加
和
12 行删除
pkg/application/evaluation_project/adapter/project_adapter.go
pkg/application/evaluation_project/command/project_update.go
pkg/application/evaluation_project/project_service.go
pkg/domain/evaluation_project.go
pkg/infrastructure/pg/models/evaluation_project.go
pkg/infrastructure/repository/pg_evaluation_project_repository.go
sql/2023-04-12.sql
pkg/application/evaluation_project/adapter/project_adapter.go
查看文件 @
e246abb
...
...
@@ -13,16 +13,31 @@ type UserAdapter struct {
type
EvaluationProjectAdapter
struct
{
*
domain
.
EvaluationProject
RecipientList
[]
*
UserAdapter
`json:"recipientList" comment:"被评估人"`
Principal
*
UserAdapter
`json:"principal" comment:"任务负责人"`
PmpList
[]
*
UserAdapter
`json:"pmpList" comment:"项目管理员"`
}
func
(
adapter
*
EvaluationProjectAdapter
)
TransformRecipientAdapter
(
recipients
[]
*
domain
.
User
)
{
func
(
adapter
*
EvaluationProjectAdapter
)
TransformRecipientAdapter
(
recipients
[]
*
domain
.
User
,
principalId
string
)
{
// 任务负责人ID
var
principalIdInt
=
int64
(
0
)
if
len
(
principalId
)
>
0
{
i
,
err
:=
strconv
.
ParseInt
(
principalId
,
10
,
64
)
if
err
==
nil
{
principalIdInt
=
i
}
}
adapter
.
RecipientList
=
make
([]
*
UserAdapter
,
0
)
for
i
:=
range
recipients
{
adapter
.
RecipientList
=
append
(
adapter
.
RecipientList
,
&
UserAdapter
{
ua
:=
&
UserAdapter
{
Id
:
recipients
[
i
]
.
Id
,
Name
:
recipients
[
i
]
.
Name
,
})
}
adapter
.
RecipientList
=
append
(
adapter
.
RecipientList
,
ua
)
if
ua
.
Id
==
principalIdInt
{
adapter
.
Principal
=
ua
}
}
}
...
...
pkg/application/evaluation_project/command/project_update.go
查看文件 @
e246abb
...
...
@@ -17,14 +17,15 @@ type UpdateProjectCommand struct {
}
type
UpdateProjectTemplateCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
Id
int64
`cname:"项目ID" json:"id,string" valid:"Required"`
TemplateId
int64
`cname:"模板ID" json:"templateId,string"`
Recipients
[]
string
`cname:"被评估人ID" json:"recipients"`
TimeStart
string
`cname:"自评起始时间" json:"timeStart" valid:"Required"`
TimeEnd
string
`cname:"自评截止时间" json:"timeEnd" valid:"Required"`
KpiCycle
int
`cname:"评估周期" json:"kpiCycle" valid:"Required"`
CompanyId
int64
`cname:"公司ID" json:"companyId"`
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
Id
int64
`cname:"项目ID" json:"id,string" valid:"Required"`
TemplateId
int64
`cname:"模板ID" json:"templateId,string"`
Recipients
[]
string
`cname:"被评估人ID" json:"recipients"`
PrincipalId
string
`cname:"任务负责人" json:"principalId"`
TimeStart
string
`cname:"自评起始时间" json:"timeStart" valid:"Required"`
TimeEnd
string
`cname:"自评截止时间" json:"timeEnd" valid:"Required"`
KpiCycle
int
`cname:"评估周期" json:"kpiCycle" valid:"Required"`
}
type
CheckRecipientCommand
struct
{
...
...
pkg/application/evaluation_project/project_service.go
查看文件 @
e246abb
...
...
@@ -218,6 +218,22 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"请添加模板"
)
}
// 指标任务的项目(存在一项类型为任务指标),必须添加项目负责人
var
isIndicatorTypeTask
=
false
outerLoop
:
for
i
:=
range
cycleTemplate
.
Template
.
LinkNodes
{
var
node
=
cycleTemplate
.
Template
.
LinkNodes
[
i
]
for
j
:=
range
node
.
NodeContents
{
if
node
.
NodeContents
[
j
]
.
IndicatorType
==
domain
.
IndicatorTypeTask
{
isIndicatorTypeTask
=
true
break
outerLoop
}
}
}
if
isIndicatorTypeTask
&&
len
(
in
.
PrincipalId
)
==
0
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"请选择任务负责人"
)
}
start
,
err
:=
time
.
ParseInLocation
(
"2006-01-02 15:04:05"
,
in
.
TimeStart
,
time
.
Local
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
...
...
@@ -272,6 +288,7 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
project
.
State
=
domain
.
ProjectStateWaitActive
}
project
.
Recipients
=
in
.
Recipients
project
.
PrincipalId
=
in
.
PrincipalId
project
.
Template
=
cycleTemplate
.
Template
// 项目起始截止时间(环节中的时间暂未分开计算)
...
...
@@ -378,7 +395,7 @@ func (rs *EvaluationProjectService) Get(in *command.GetProjectCommand) (interfac
if
len
(
project
.
Recipients
)
>
0
{
_
,
users
,
_
:=
userRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
project
.
Recipients
,
"limit"
:
len
(
project
.
Recipients
)})
projectAdapter
.
TransformRecipientAdapter
(
users
)
projectAdapter
.
TransformRecipientAdapter
(
users
,
project
.
PrincipalId
)
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
...
...
@@ -767,6 +784,7 @@ func (rs *EvaluationProjectService) Copy(in *command.CopyProjectCommand) (interf
project
.
Name
=
project
.
Name
+
" 副本"
project
.
CreatorId
=
in
.
CreatorId
project
.
Recipients
=
make
([]
string
,
0
)
// 重置被评估人
project
.
PrincipalId
=
""
// 重置任务负责人
// 如果拷贝已经启用的模板,默认先设置为待启用
if
project
.
State
==
domain
.
ProjectStateEnable
||
project
.
State
==
domain
.
ProjectStatePause
{
...
...
pkg/domain/evaluation_project.go
查看文件 @
e246abb
...
...
@@ -26,6 +26,7 @@ type EvaluationProject struct {
Pmp
int
`json:"pmp" comment:"PM角色权限"`
PmpIds
[]
string
`json:"pmpIds" comment:"项目管理员ID"`
Recipients
[]
string
`json:"recipients" comment:"被评估人ID"`
PrincipalId
string
`json:"principalId" comment:"任务负责人ID"`
Template
*
EvaluationTemplate
`json:"template" comment:"评估模板"`
BeginTime
time
.
Time
`json:"beginTime" comment:"项目起始时间"`
EndTime
time
.
Time
`json:"endTime" comment:"项目截至时间"`
...
...
pkg/infrastructure/pg/models/evaluation_project.go
查看文件 @
e246abb
...
...
@@ -20,6 +20,7 @@ type EvaluationProject struct {
Pmp
int
`comment:"PM角色权限" pg:",use_zero"`
PmpIds
[]
string
`comment:"项目管理员ID"`
Recipients
[]
string
`comment:"被评估人ID"`
PrincipalId
string
`comment:"任务负责人ID"`
Template
*
domain
.
EvaluationTemplate
`comment:"评估模板"`
BeginTime
time
.
Time
`comment:"项目起始时间"`
EndTime
time
.
Time
`comment:"项目截至时间 "`
...
...
pkg/infrastructure/repository/pg_evaluation_project_repository.go
查看文件 @
e246abb
...
...
@@ -47,6 +47,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
Pmp
:
m
.
Pmp
,
PmpIds
:
m
.
PmpIds
,
Recipients
:
m
.
Recipients
,
PrincipalId
:
m
.
PrincipalId
,
Template
:
m
.
Template
,
BeginTime
:
m
.
BeginTime
,
EndTime
:
m
.
EndTime
,
...
...
@@ -70,6 +71,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr
Pmp
:
d
.
Pmp
,
PmpIds
:
d
.
PmpIds
,
Recipients
:
d
.
Recipients
,
PrincipalId
:
d
.
PrincipalId
,
Template
:
d
.
Template
,
BeginTime
:
d
.
BeginTime
,
EndTime
:
d
.
EndTime
,
...
...
sql/2023-04-12.sql
查看文件 @
e246abb
-- 增加指标分类字段, 默认0
ALTER
TABLE
public
.
evaluation_item_used
ADD
indicator_type
int4
NOT
NULL
DEFAULT
0
;
COMMENT
ON
COLUMN
public
.
evaluation_item_used
.
indicator_type
IS
'指标类型'
;
-- 增加项目表-任务负责人ID
ALTER
TABLE
public
.
evaluation_project
ADD
principal_id
text
NULL
;
COMMENT
ON
COLUMN
public
.
evaluation_project
.
principal_id
IS
'任务负责人ID'
;
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论