正在显示
8 个修改的文件
包含
92 行增加
和
6 行删除
| 1 | package service | 1 | package service |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "fmt" | ||
| 4 | "github.com/linmadan/egglib-go/core/application" | 5 | "github.com/linmadan/egglib-go/core/application" |
| 5 | "github.com/linmadan/egglib-go/utils/tool_funs" | 6 | "github.com/linmadan/egglib-go/utils/tool_funs" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/adapter" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/adapter" |
| @@ -43,6 +44,7 @@ func (rs *EvaluationProjectService) Create(in *command.CreateProjectCommand) (in | @@ -43,6 +44,7 @@ func (rs *EvaluationProjectService) Create(in *command.CreateProjectCommand) (in | ||
| 43 | Name: in.Name, | 44 | Name: in.Name, |
| 44 | Describe: in.Describe, | 45 | Describe: in.Describe, |
| 45 | CompanyId: in.CompanyId, | 46 | CompanyId: in.CompanyId, |
| 47 | + CycleId: in.CycleId, | ||
| 46 | CreatorId: in.CreatorId, | 48 | CreatorId: in.CreatorId, |
| 47 | State: domain.ProjectStateWaitConfig, | 49 | State: domain.ProjectStateWaitConfig, |
| 48 | HrBp: in.HrBp, | 50 | HrBp: in.HrBp, |
| @@ -112,6 +114,33 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | @@ -112,6 +114,33 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | ||
| 112 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 114 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 113 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 115 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 114 | 116 | ||
| 117 | + _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "linkNodes") | ||
| 118 | + if err != nil { | ||
| 119 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // 周期内的所有项目,员工不能重复被评估 | ||
| 123 | + rids := map[string]bool{} | ||
| 124 | + for i := range projects { | ||
| 125 | + // 排除当前项目 | ||
| 126 | + if in.Id != projects[i].Id { | ||
| 127 | + ids := projects[i].Recipients | ||
| 128 | + for j := range ids { | ||
| 129 | + rids[ids[j]] = true | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + repeatNum := 0 | ||
| 134 | + for i := range in.Recipients { | ||
| 135 | + id := in.Recipients[i] | ||
| 136 | + if _, ok := rids[id]; ok { | ||
| 137 | + repeatNum++ | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + if repeatNum > 0 { | ||
| 141 | + return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("有%d人已经在本周期其他项目内,需要将他们移除", repeatNum)) | ||
| 142 | + } | ||
| 143 | + | ||
| 115 | project, err := projectRepository.FindOne(map[string]interface{}{"id": in.Id}) | 144 | project, err := projectRepository.FindOne(map[string]interface{}{"id": in.Id}) |
| 116 | if err != nil { | 145 | if err != nil { |
| 117 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 146 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_template/command" | 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_template/command" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | ||
| 9 | ) | 10 | ) |
| 10 | 11 | ||
| 11 | type EvaluationTemplateService struct { | 12 | type EvaluationTemplateService struct { |
| @@ -37,27 +38,34 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) ( | @@ -37,27 +38,34 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) ( | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | linkNodes := make([]*domain.LinkNode, 0) | 40 | linkNodes := make([]*domain.LinkNode, 0) |
| 41 | + | ||
| 42 | + sid, _ := utils.NewSnowflakeId() | ||
| 40 | linkNodes = append(linkNodes, &domain.LinkNode{ | 43 | linkNodes = append(linkNodes, &domain.LinkNode{ |
| 44 | + Id: sid + 1, | ||
| 41 | Type: domain.LinkNodeSelfAssessment, | 45 | Type: domain.LinkNodeSelfAssessment, |
| 42 | Name: "填写自评反馈", | 46 | Name: "填写自评反馈", |
| 43 | KpiCycle: domain.KpiCycleDay, | 47 | KpiCycle: domain.KpiCycleDay, |
| 44 | }) | 48 | }) |
| 45 | linkNodes = append(linkNodes, &domain.LinkNode{ | 49 | linkNodes = append(linkNodes, &domain.LinkNode{ |
| 50 | + Id: sid + 2, | ||
| 46 | Type: domain.LinkNodeAllInvite, | 51 | Type: domain.LinkNodeAllInvite, |
| 47 | Name: "360°邀请", | 52 | Name: "360°邀请", |
| 48 | KpiCycle: domain.KpiCycleDay, | 53 | KpiCycle: domain.KpiCycleDay, |
| 49 | }) | 54 | }) |
| 50 | linkNodes = append(linkNodes, &domain.LinkNode{ | 55 | linkNodes = append(linkNodes, &domain.LinkNode{ |
| 56 | + Id: sid + 3, | ||
| 51 | Type: domain.LinkNodeAllAssessment, | 57 | Type: domain.LinkNodeAllAssessment, |
| 52 | Name: "360°评估", | 58 | Name: "360°评估", |
| 53 | KpiCycle: domain.KpiCycleDay, | 59 | KpiCycle: domain.KpiCycleDay, |
| 54 | }) | 60 | }) |
| 55 | linkNodes = append(linkNodes, &domain.LinkNode{ | 61 | linkNodes = append(linkNodes, &domain.LinkNode{ |
| 62 | + Id: sid + 4, | ||
| 56 | Type: domain.LinkNodeSuperiorAssessment, | 63 | Type: domain.LinkNodeSuperiorAssessment, |
| 57 | Name: "上级评估", | 64 | Name: "上级评估", |
| 58 | KpiCycle: domain.KpiCycleDay, | 65 | KpiCycle: domain.KpiCycleDay, |
| 59 | }) | 66 | }) |
| 60 | linkNodes = append(linkNodes, &domain.LinkNode{ | 67 | linkNodes = append(linkNodes, &domain.LinkNode{ |
| 68 | + Id: sid + 5, | ||
| 61 | Type: domain.LinkNodeViewResult, | 69 | Type: domain.LinkNodeViewResult, |
| 62 | Name: "绩效结果查看", | 70 | Name: "绩效结果查看", |
| 63 | KpiCycle: domain.KpiCycleDay, | 71 | KpiCycle: domain.KpiCycleDay, |
| @@ -16,6 +16,7 @@ type EvaluationProject struct { | @@ -16,6 +16,7 @@ type EvaluationProject struct { | ||
| 16 | Name string `json:"name" comment:"名称"` | 16 | Name string `json:"name" comment:"名称"` |
| 17 | Describe string `json:"describe" comment:"描述"` | 17 | Describe string `json:"describe" comment:"描述"` |
| 18 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` | 18 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` |
| 19 | + CycleId int64 `json:"cycleId,string" comment:"周期ID"` | ||
| 19 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | 20 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` |
| 20 | State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` | 21 | State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` |
| 21 | HrBp int `json:"hrBp" comment:"HR角色权限"` | 22 | HrBp int `json:"hrBp" comment:"HR角色权限"` |
| @@ -51,17 +51,17 @@ type NodeAllInvite struct { | @@ -51,17 +51,17 @@ type NodeAllInvite struct { | ||
| 51 | ParentSameIds []int64 `json:"parentSameIds" comment:"相同上级同事ID"` | 51 | ParentSameIds []int64 `json:"parentSameIds" comment:"相同上级同事ID"` |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | -// NodeKpiResult 绩效结果查看 | ||
| 55 | -type NodeKpiResult struct { | ||
| 56 | -} | 54 | +//// NodeKpiResult 绩效结果查看 |
| 55 | +//type NodeKpiResult struct { | ||
| 56 | +//} | ||
| 57 | 57 | ||
| 58 | type LinkNode struct { | 58 | type LinkNode struct { |
| 59 | - Type int `json:"type" comment:"环节类型(1评估、2邀请、3绩效结果)"` | 59 | + Id int64 `json:"id,string" comment:"环节ID"` |
| 60 | + Type int `json:"type" comment:"环节类型"` | ||
| 60 | Name string `json:"name" comment:"环节名称"` | 61 | Name string `json:"name" comment:"环节名称"` |
| 61 | Describe string `json:"describe" comment:"环节描述"` | 62 | Describe string `json:"describe" comment:"环节描述"` |
| 62 | NodeContents []*NodeContent `json:"nodeContents" comment:"环节-评估内容"` | 63 | NodeContents []*NodeContent `json:"nodeContents" comment:"环节-评估内容"` |
| 63 | - NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"环节-360°邀请"` | ||
| 64 | - NodeKpiResult *NodeKpiResult `json:"nodeKpiResult" comment:"环节-绩效结果"` | 64 | + NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"360°邀请人员"` |
| 65 | TimeStart *time.Time `json:"timeStart" comment:"起始时间"` | 65 | TimeStart *time.Time `json:"timeStart" comment:"起始时间"` |
| 66 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` | 66 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` |
| 67 | KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"` | 67 | KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"` |
pkg/domain/node_timer_task.go
0 → 100644
| 1 | +package domain | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "time" | ||
| 5 | +) | ||
| 6 | + | ||
| 7 | +type NodeTimerTask struct { | ||
| 8 | + Id int64 `json:"id,string" comment:"ID"` | ||
| 9 | + CompanyId int64 `json:"companyId,string" comment:"公司ID"` | ||
| 10 | + CycleId int64 `json:"cycleId,string" comment:"周期ID"` | ||
| 11 | + ProjectId int64 `json:"projectId,string" comment:"项目ID"` | ||
| 12 | + NodeId int64 `json:"nodeId,string" comment:"节点ID"` | ||
| 13 | + LastSentAt *time.Time `json:"lastSentAt" comment:"最后一次发送时间"` | ||
| 14 | + NextSentAt *time.Time `json:"nextSentAt" comment:"下一次发送时间"` | ||
| 15 | + CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | ||
| 16 | + UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | ||
| 17 | + DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +type NodeTimerTaskRepository interface { | ||
| 21 | + Insert(template *NodeTimerTask) (*NodeTimerTask, error) | ||
| 22 | + Remove(template *NodeTimerTask) (*NodeTimerTask, error) | ||
| 23 | + FindOne(queryOptions map[string]interface{}) (*NodeTimerTask, error) | ||
| 24 | + Find(queryOptions map[string]interface{}, excludeColumns ...string) (int64, []*NodeTimerTask, error) | ||
| 25 | + Count(queryOptions map[string]interface{}) (int64, error) | ||
| 26 | +} |
| @@ -11,6 +11,7 @@ type EvaluationProject struct { | @@ -11,6 +11,7 @@ type EvaluationProject struct { | ||
| 11 | Name string `comment:"名称"` | 11 | Name string `comment:"名称"` |
| 12 | Describe string `comment:"描述"` | 12 | Describe string `comment:"描述"` |
| 13 | CompanyId int64 `comment:"公司ID"` | 13 | CompanyId int64 `comment:"公司ID"` |
| 14 | + CycleId int64 `comment:"周期ID"` | ||
| 14 | CreatorId int64 `comment:"创建人ID"` | 15 | CreatorId int64 `comment:"创建人ID"` |
| 15 | State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)"` | 16 | State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)"` |
| 16 | HrBp int `comment:"HR角色权限"` | 17 | HrBp int `comment:"HR角色权限"` |
| 1 | +package models | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "time" | ||
| 5 | +) | ||
| 6 | + | ||
| 7 | +type NodeTimerTask struct { | ||
| 8 | + tableName struct{} `pg:"node_timer_task" comment:"流程节点定时任务"` | ||
| 9 | + Id int64 `comment:"ID"` | ||
| 10 | + CompanyId int64 `comment:"公司ID"` | ||
| 11 | + CycleId int64 `comment:"周期ID"` | ||
| 12 | + ProjectId int64 `comment:"项目ID"` | ||
| 13 | + NodeId int64 `comment:"流程ID"` | ||
| 14 | + LastSentAt *time.Time `comment:"最后一次发送时间"` | ||
| 15 | + NextSentAt *time.Time `comment:"下一次发送时间"` | ||
| 16 | + CreatedAt time.Time `comment:"创建时间"` | ||
| 17 | + UpdatedAt time.Time `comment:"更新时间"` | ||
| 18 | + DeletedAt *time.Time `comment:"删除时间"` | ||
| 19 | +} |
| @@ -26,6 +26,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | @@ -26,6 +26,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | ||
| 26 | Name: m.Name, | 26 | Name: m.Name, |
| 27 | Describe: m.Describe, | 27 | Describe: m.Describe, |
| 28 | CompanyId: m.CompanyId, | 28 | CompanyId: m.CompanyId, |
| 29 | + CycleId: m.CycleId, | ||
| 29 | CreatorId: m.CreatorId, | 30 | CreatorId: m.CreatorId, |
| 30 | State: m.State, | 31 | State: m.State, |
| 31 | HrBp: m.HrBp, | 32 | HrBp: m.HrBp, |
| @@ -45,6 +46,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr | @@ -45,6 +46,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr | ||
| 45 | Name: d.Name, | 46 | Name: d.Name, |
| 46 | Describe: d.Describe, | 47 | Describe: d.Describe, |
| 47 | CompanyId: d.CompanyId, | 48 | CompanyId: d.CompanyId, |
| 49 | + CycleId: d.CycleId, | ||
| 48 | CreatorId: d.CreatorId, | 50 | CreatorId: d.CreatorId, |
| 49 | State: d.State, | 51 | State: d.State, |
| 50 | HrBp: d.HrBp, | 52 | HrBp: d.HrBp, |
-
请 注册 或 登录 后发表评论