切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
576a0dc91ca2071c8962d2aa404ed9c72cd82c3d
1 个父辈
d9f9ab45
提交 项目更新
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
51 行增加
和
11 行删除
pkg/application/evaluation_project/project_service.go
pkg/application/node_task/node_task_service.go
pkg/application/evaluation_project/project_service.go
查看文件 @
576a0dc
...
...
@@ -198,13 +198,14 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
minTime
:=
cycle
.
TimeStart
maxTime
:=
cycle
.
TimeEnd
if
start
.
Before
(
*
minTime
)
{
minTime
:=
time
.
Date
(
cycle
.
TimeStart
.
Year
(),
cycle
.
TimeStart
.
Month
(),
cycle
.
TimeStart
.
Day
(),
cycle
.
TimeStart
.
Hour
(),
cycle
.
TimeStart
.
Minute
(),
0
,
0
,
time
.
Local
)
maxTime
:=
time
.
Date
(
cycle
.
TimeEnd
.
Year
(),
cycle
.
TimeEnd
.
Month
(),
cycle
.
TimeEnd
.
Day
(),
cycle
.
TimeEnd
.
Hour
(),
cycle
.
TimeEnd
.
Minute
(),
0
,
0
,
time
.
Local
)
if
start
.
Before
(
minTime
)
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"评估起始时间不能超出周期起始时间"
)
}
if
end
.
After
(
*
maxTime
)
{
if
end
.
After
(
maxTime
)
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"评估截至时间不能超出周期截至时间"
)
}
...
...
pkg/application/node_task/node_task_service.go
查看文件 @
576a0dc
...
...
@@ -3,6 +3,7 @@ package service
import
(
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils"
"time"
)
...
...
@@ -25,6 +26,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
transactionContext
.
RollbackTransaction
()
}()
taskRepository
:=
factory
.
CreateNodeTaskRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
//cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext})
tasks
,
err
:=
taskRepository
.
Find
(
map
[
string
]
interface
{}{
"now"
:
time
.
Now
()
.
Local
()})
if
err
!=
nil
{
...
...
@@ -33,17 +36,53 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
//ttaffAssessRepository := factory.CreateStaffAssessTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
//
//for i := range tasks {
//
// staffAssessService := service.NewStaffAssessServeice()
// //staffAssessService.CreateStaffAssessTask()
//
// //task := tasks[i]
//
projectIdsMap
:=
map
[
int64
]
*
domain
.
EvaluationProject
{}
cycleIdsMap
:=
map
[
int64
]
*
domain
.
EvaluationCycle
{}
for
i
:=
range
tasks
{
task
:=
tasks
[
i
]
projectIdsMap
[
task
.
ProjectId
]
=
nil
cycleIdsMap
[
task
.
CycleId
]
=
nil
}
projectIds
:=
make
([]
int64
,
0
)
cycleIds
:=
make
([]
int64
,
0
)
for
k
:=
range
projectIdsMap
{
projectIds
=
append
(
projectIds
,
k
)
}
for
k
:=
range
cycleIdsMap
{
cycleIds
=
append
(
cycleIds
,
k
)
}
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
projectIds
})
if
err
!=
nil
{
return
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
//_, cycles, err := cycleRepository.Find(map[string]interface{}{"ids": cycleIds})
//if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//}
for
i
:=
range
projects
{
projectIdsMap
[
projects
[
i
]
.
Id
]
=
projects
[
i
]
}
//staffAssessService := service.NewStaffAssessServeice()
for
i
:=
range
tasks
{
task
:=
tasks
[
i
]
//if project, ok := projectIdsMap[task.ProjectId]; ok {
//csat := &command.CreateStaffAssessTask{
// CompanyId: project.CompanyId,
// EvaluationProjectId: project.Id,
// EvaluationProjectName: project.Name,
// CycleId: project.CycleId,
//}
//
//staffAssessService.CreateStaffAssessTask(csat)
//}
// 下一次发送时间
nextTime
:=
utils
.
NextTimeInc
(
task
.
NextSentAt
,
task
.
KpiCycle
)
task
.
NextSentAt
=
&
nextTime
...
...
请
注册
或
登录
后发表评论