...
|
...
|
@@ -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 {
|
...
|
...
|
|