Merge branch 'dev-tangxvhui' of http://gitlab.fjmaimaimai.com/allied-creation/pe…
…rformance into dev-tangxvhui
正在显示
1 个修改的文件
包含
30 行增加
和
5 行删除
@@ -2,17 +2,18 @@ package service | @@ -2,17 +2,18 @@ package service | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | - "strconv" | ||
6 | - "strings" | ||
7 | - "time" | ||
8 | - | ||
9 | "github.com/linmadan/egglib-go/core/application" | 5 | "github.com/linmadan/egglib-go/core/application" |
10 | "github.com/linmadan/egglib-go/utils/tool_funs" | 6 | "github.com/linmadan/egglib-go/utils/tool_funs" |
11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/adapter" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/adapter" |
12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/command" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/command" |
13 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
10 | + taskCommand "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/task/command" | ||
11 | + taskService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/task/service" | ||
14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | 13 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" |
14 | + "strconv" | ||
15 | + "strings" | ||
16 | + "time" | ||
16 | ) | 17 | ) |
17 | 18 | ||
18 | type EvaluationProjectService struct { | 19 | type EvaluationProjectService struct { |
@@ -577,10 +578,17 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -577,10 +578,17 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
577 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 578 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
578 | } | 579 | } |
579 | 580 | ||
581 | + // 项目中指标任务负责人 | ||
582 | + var principalId = 0 | ||
583 | + var projectTaskService = taskService.NewTaskService() | ||
584 | + if len(project.PrincipalId) > 0 { | ||
585 | + intId, _ := strconv.Atoi(project.PrincipalId) | ||
586 | + principalId = intId | ||
587 | + } | ||
588 | + | ||
580 | now := time.Now().Local() | 589 | now := time.Now().Local() |
581 | year, month, day := now.Date() | 590 | year, month, day := now.Date() |
582 | nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻 | 591 | nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻 |
583 | - | ||
584 | for i := range project.Template.LinkNodes { | 592 | for i := range project.Template.LinkNodes { |
585 | node := project.Template.LinkNodes[i] | 593 | node := project.Template.LinkNodes[i] |
586 | task := &domain.NodeTask{ | 594 | task := &domain.NodeTask{ |
@@ -620,6 +628,23 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -620,6 +628,23 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
620 | if err != nil { | 628 | if err != nil { |
621 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 629 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
622 | } | 630 | } |
631 | + | ||
632 | + // 任务指标生成任务 | ||
633 | + for j := range node.NodeContents { | ||
634 | + content := node.NodeContents[j] | ||
635 | + if content.IndicatorType == domain.IndicatorTypeTask { | ||
636 | + if principalId == 0 { | ||
637 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请选择任务负责人") | ||
638 | + } | ||
639 | + err := projectTaskService.CreateTask(transactionContext, &taskCommand.CreateTaskCommand{ | ||
640 | + Name: content.Name, | ||
641 | + LeaderId: principalId, | ||
642 | + }) | ||
643 | + if err != nil { | ||
644 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
645 | + } | ||
646 | + } | ||
647 | + } | ||
623 | } | 648 | } |
624 | 649 | ||
625 | err = rs.generateEvaluationItemUsed(transactionContext, project) | 650 | err = rs.generateEvaluationItemUsed(transactionContext, project) |
-
请 注册 或 登录 后发表评论