切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
f62e8af98ce3859971a5008ca4df537cd084f600
1 个父辈
4f078839
时间格式化
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
37 行增加
和
15 行删除
pkg/application/evaluation_project/command/project_update.go
pkg/application/evaluation_project/project_service.go
pkg/application/evaluation_project/command/project_update.go
查看文件 @
f62e8af
...
...
@@ -2,7 +2,6 @@ package command
import
(
"github.com/beego/beego/v2/core/validation"
"time"
)
type
UpdateProjectCommand
struct
{
...
...
@@ -17,16 +16,16 @@ 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
*
time
.
Time
`cname:"自评起始时间" json:"timeStart" valid:"Required"`
TimeEnd
*
time
.
Time
`cname:"自评截止时间" json:"timeEnd" valid:"Required"`
KpiCycle
int
`cname:"评估周期" json:"kpiCycle" valid:"Required"`
KpiResultStart
*
time
.
Time
`cname:"绩效结果开始查看时间" json:"kpiResultStart"`
Activate
int
`cname:"启动项目" json:"activate"`
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"`
KpiResultStart
string
`cname:"绩效结果开始查看时间" json:"kpiResultStart"`
Activate
int
`cname:"启动项目" json:"activate"`
}
type
CheckRecipientCommand
struct
{
...
...
@@ -48,4 +47,13 @@ func (in *UpdateProjectTemplateCommand) Valid(validation *validation.Validation)
validation
.
SetError
(
"recipients"
,
"请添加被评估人"
)
return
}
if
len
(
in
.
TimeStart
)
==
0
{
validation
.
SetError
(
"timeEnd"
,
"请选择开始时间"
)
return
}
if
len
(
in
.
TimeEnd
)
==
0
{
validation
.
SetError
(
"timeEnd"
,
"请选择结束时间"
)
return
}
}
...
...
pkg/application/evaluation_project/project_service.go
查看文件 @
f62e8af
...
...
@@ -9,6 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"strconv"
"time"
)
type
EvaluationProjectService
struct
{
...
...
@@ -177,18 +178,31 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
project
.
State
=
domain
.
ProjectStateEnable
}
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
())
}
end
,
err
:=
time
.
ParseInLocation
(
"2006-01-02 15:04:05"
,
in
.
TimeEnd
,
time
.
Local
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
kpiStart
,
err
:=
time
.
ParseInLocation
(
"2006-01-02 15:04:05"
,
in
.
KpiResultStart
,
time
.
Local
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
project
.
Recipients
=
in
.
Recipients
project
.
Template
=
cycleTemplate
.
Template
for
i
:=
range
project
.
Template
.
LinkNodes
{
node
:=
project
.
Template
.
LinkNodes
[
i
]
node
.
KpiCycle
=
in
.
KpiCycle
// 设置周期
if
node
.
Type
==
domain
.
LinkNodeViewResult
{
if
in
.
KpiResultStart
!=
nil
{
node
.
TimeStart
=
in
.
KpiResultStart
if
len
(
in
.
KpiResultStart
)
>
0
{
node
.
TimeStart
=
&
kpiStart
}
}
else
{
node
.
TimeStart
=
in
.
TimeStart
node
.
TimeEnd
=
in
.
TimeEnd
node
.
TimeStart
=
&
start
node
.
TimeEnd
=
&
end
}
}
...
...
请
注册
或
登录
后发表评论