正在显示
6 个修改的文件
包含
136 行增加
和
73 行删除
1 | package service | 1 | package service |
2 | 2 | ||
3 | -//定时扫描评估项目表,确认是否下发评估任务 | 3 | +import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
6 | +) | ||
4 | 7 | ||
5 | -func SendSummaryEvaluationTask() {} | 8 | +// sendSummaryEvaluafionTask 根据评估项目设置,确认是否下发评估任务 |
9 | +func sendSummaryEvaluafionTask(param *domain.EvaluationProject) error { | ||
10 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
11 | + if err != nil { | ||
12 | + return err | ||
13 | + } | ||
14 | + if err := transactionContext.StartTransaction(); err != nil { | ||
15 | + return err | ||
16 | + } | ||
17 | + defer func() { | ||
18 | + _ = transactionContext.RollbackTransaction() | ||
19 | + }() | ||
20 | + //确定 被评估的人 | ||
21 | + | ||
22 | + //确定 被评估人的 上级评估 | ||
23 | + | ||
24 | + //确定 被评估人的 人资评估 | ||
25 | + | ||
26 | + //确定 被评估人的 360 评估 | ||
27 | + | ||
28 | + //回填 项目的状态 | ||
29 | + | ||
30 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
31 | + return err | ||
32 | + } | ||
33 | + return nil | ||
34 | +} |
@@ -13,25 +13,33 @@ const ( | @@ -13,25 +13,33 @@ const ( | ||
13 | 13 | ||
14 | // 项目的评估内容配置 | 14 | // 项目的评估内容配置 |
15 | type EvaluationProject struct { | 15 | type EvaluationProject struct { |
16 | - Id int64 `json:"id,string" comment:"ID"` | ||
17 | - Name string `json:"name" comment:"名称"` | ||
18 | - Describe string `json:"describe" comment:"描述"` | ||
19 | - CompanyId int64 `json:"companyId,string" comment:"公司ID"` | ||
20 | - CycleId int64 `json:"cycleId,string" comment:"周期ID"` | ||
21 | - CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | ||
22 | - State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` | ||
23 | - HrBp int `json:"hrBp" comment:"HR角色权限"` | ||
24 | - Pmp int `json:"pmp" comment:"PM角色权限"` | ||
25 | - PmpIds []string `json:"pmpIds" comment:"项目管理员ID"` | ||
26 | - Recipients []string `json:"recipients" comment:"被评估人ID"` | ||
27 | - Template *EvaluationTemplate `json:"template" comment:"评估模板"` | ||
28 | - BeginTime time.Time `json:"beginTime" comment:"项目起始时间"` | ||
29 | - EndTime time.Time `json:"endTime" comment:"项目截至时间"` | ||
30 | - CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | ||
31 | - UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | ||
32 | - DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | 16 | + Id int64 `json:"id,string" comment:"ID"` |
17 | + Name string `json:"name" comment:"名称"` | ||
18 | + Describe string `json:"describe" comment:"描述"` | ||
19 | + CompanyId int64 `json:"companyId,string" comment:"公司ID"` | ||
20 | + CycleId int64 `json:"cycleId,string" comment:"周期ID"` | ||
21 | + CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | ||
22 | + State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` | ||
23 | + SummaryState ProjectSummaryState `json:"summaryState" comment:"周期评估是否下发"` | ||
24 | + HrBp int `json:"hrBp" comment:"HR角色权限"` | ||
25 | + Pmp int `json:"pmp" comment:"PM角色权限"` | ||
26 | + PmpIds []string `json:"pmpIds" comment:"项目管理员ID"` | ||
27 | + Recipients []string `json:"recipients" comment:"被评估人ID"` | ||
28 | + Template *EvaluationTemplate `json:"template" comment:"评估模板"` | ||
29 | + BeginTime time.Time `json:"beginTime" comment:"项目起始时间"` | ||
30 | + EndTime time.Time `json:"endTime" comment:"项目截至时间"` | ||
31 | + CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | ||
32 | + UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | ||
33 | + DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | ||
33 | } | 34 | } |
34 | 35 | ||
36 | +type ProjectSummaryState int | ||
37 | + | ||
38 | +const ( | ||
39 | + ProjectSummaryStateNo int = 0 //未下发 | ||
40 | + ProjectSummaryStateYes int = 1 //已经下发 | ||
41 | +) | ||
42 | + | ||
35 | type EvaluationProjectRepository interface { | 43 | type EvaluationProjectRepository interface { |
36 | Insert(project *EvaluationProject) (*EvaluationProject, error) | 44 | Insert(project *EvaluationProject) (*EvaluationProject, error) |
37 | Remove(project *EvaluationProject) (*EvaluationProject, error) | 45 | Remove(project *EvaluationProject) (*EvaluationProject, error) |
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
5 | "time" | 4 | "time" |
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
6 | ) | 7 | ) |
7 | 8 | ||
8 | type EvaluationProject struct { | 9 | type EvaluationProject struct { |
9 | - tableName struct{} `comment:"评估项目" pg:"evaluation_project"` | ||
10 | - Id int64 `comment:"ID" pg:"pk:id"` | ||
11 | - Name string `comment:"名称"` | ||
12 | - Describe string `comment:"描述"` | ||
13 | - CompanyId int64 `comment:"公司ID"` | ||
14 | - CycleId int64 `comment:"周期ID"` | ||
15 | - CreatorId int64 `comment:"创建人ID"` | ||
16 | - State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` | ||
17 | - HrBp int `comment:"HR角色权限" pg:",use_zero"` | ||
18 | - Pmp int `comment:"PM角色权限" pg:",use_zero"` | ||
19 | - PmpIds []string `comment:"项目管理员ID"` | ||
20 | - Recipients []string `comment:"被评估人ID"` | ||
21 | - Template *domain.EvaluationTemplate `comment:"评估模板"` | ||
22 | - BeginTime time.Time `comment:"项目起始时间"` | ||
23 | - EndTime time.Time `comment:"项目截至时间 "` | ||
24 | - CreatedAt time.Time `comment:"创建时间"` | ||
25 | - UpdatedAt time.Time `comment:"更新时间"` | ||
26 | - DeletedAt *time.Time `comment:"删除时间"` | 10 | + tableName struct{} `comment:"评估项目" pg:"evaluation_project"` |
11 | + Id int64 `comment:"ID" pg:"pk:id"` | ||
12 | + Name string `comment:"名称"` | ||
13 | + Describe string `comment:"描述"` | ||
14 | + CompanyId int64 `comment:"公司ID"` | ||
15 | + CycleId int64 `comment:"周期ID"` | ||
16 | + CreatorId int64 `comment:"创建人ID"` | ||
17 | + State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` | ||
18 | + SummaryState int `comment:"周期评估是否下发" pg:",use_zero"` | ||
19 | + HrBp int `comment:"HR角色权限" pg:",use_zero"` | ||
20 | + Pmp int `comment:"PM角色权限" pg:",use_zero"` | ||
21 | + PmpIds []string `comment:"项目管理员ID"` | ||
22 | + Recipients []string `comment:"被评估人ID"` | ||
23 | + Template *domain.EvaluationTemplate `comment:"评估模板"` | ||
24 | + BeginTime time.Time `comment:"项目起始时间"` | ||
25 | + EndTime time.Time `comment:"项目截至时间 "` | ||
26 | + CreatedAt time.Time `comment:"创建时间"` | ||
27 | + UpdatedAt time.Time `comment:"更新时间"` | ||
28 | + DeletedAt *time.Time `comment:"删除时间"` | ||
27 | } | 29 | } |
@@ -3,13 +3,14 @@ package repository | @@ -3,13 +3,14 @@ package repository | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | "fmt" | 5 | "fmt" |
6 | + "time" | ||
7 | + | ||
6 | "github.com/go-pg/pg/v10" | 8 | "github.com/go-pg/pg/v10" |
7 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" | 9 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" |
8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 10 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" |
11 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | 13 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" |
12 | - "time" | ||
13 | ) | 14 | ) |
14 | 15 | ||
15 | type EvaluationProjectRepository struct { | 16 | type EvaluationProjectRepository struct { |
@@ -34,45 +35,47 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | @@ -34,45 +35,47 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | ||
34 | } | 35 | } |
35 | 36 | ||
36 | return domain.EvaluationProject{ | 37 | return domain.EvaluationProject{ |
37 | - Id: m.Id, | ||
38 | - Name: m.Name, | ||
39 | - Describe: m.Describe, | ||
40 | - CompanyId: m.CompanyId, | ||
41 | - CycleId: m.CycleId, | ||
42 | - CreatorId: m.CreatorId, | ||
43 | - State: m.State, | ||
44 | - HrBp: m.HrBp, | ||
45 | - Pmp: m.Pmp, | ||
46 | - PmpIds: m.PmpIds, | ||
47 | - Recipients: m.Recipients, | ||
48 | - Template: m.Template, | ||
49 | - BeginTime: m.BeginTime, | ||
50 | - EndTime: m.EndTime, | ||
51 | - CreatedAt: m.CreatedAt.Local(), | ||
52 | - UpdatedAt: m.UpdatedAt.Local(), | ||
53 | - DeletedAt: m.DeletedAt, | 38 | + Id: m.Id, |
39 | + Name: m.Name, | ||
40 | + Describe: m.Describe, | ||
41 | + CompanyId: m.CompanyId, | ||
42 | + CycleId: m.CycleId, | ||
43 | + CreatorId: m.CreatorId, | ||
44 | + State: m.State, | ||
45 | + SummaryState: domain.ProjectSummaryState(m.SummaryState), | ||
46 | + HrBp: m.HrBp, | ||
47 | + Pmp: m.Pmp, | ||
48 | + PmpIds: m.PmpIds, | ||
49 | + Recipients: m.Recipients, | ||
50 | + Template: m.Template, | ||
51 | + BeginTime: m.BeginTime, | ||
52 | + EndTime: m.EndTime, | ||
53 | + CreatedAt: m.CreatedAt.Local(), | ||
54 | + UpdatedAt: m.UpdatedAt.Local(), | ||
55 | + DeletedAt: m.DeletedAt, | ||
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
57 | func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationProject) models.EvaluationProject { | 59 | func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationProject) models.EvaluationProject { |
58 | return models.EvaluationProject{ | 60 | return models.EvaluationProject{ |
59 | - Id: d.Id, | ||
60 | - Name: d.Name, | ||
61 | - Describe: d.Describe, | ||
62 | - CompanyId: d.CompanyId, | ||
63 | - CycleId: d.CycleId, | ||
64 | - CreatorId: d.CreatorId, | ||
65 | - State: d.State, | ||
66 | - HrBp: d.HrBp, | ||
67 | - Pmp: d.Pmp, | ||
68 | - PmpIds: d.PmpIds, | ||
69 | - Recipients: d.Recipients, | ||
70 | - Template: d.Template, | ||
71 | - BeginTime: d.BeginTime, | ||
72 | - EndTime: d.EndTime, | ||
73 | - CreatedAt: d.CreatedAt, | ||
74 | - UpdatedAt: d.UpdatedAt, | ||
75 | - DeletedAt: d.DeletedAt, | 61 | + Id: d.Id, |
62 | + Name: d.Name, | ||
63 | + Describe: d.Describe, | ||
64 | + CompanyId: d.CompanyId, | ||
65 | + CycleId: d.CycleId, | ||
66 | + CreatorId: d.CreatorId, | ||
67 | + State: d.State, | ||
68 | + SummaryState: int(d.SummaryState), | ||
69 | + HrBp: d.HrBp, | ||
70 | + Pmp: d.Pmp, | ||
71 | + PmpIds: d.PmpIds, | ||
72 | + Recipients: d.Recipients, | ||
73 | + Template: d.Template, | ||
74 | + BeginTime: d.BeginTime, | ||
75 | + EndTime: d.EndTime, | ||
76 | + CreatedAt: d.CreatedAt, | ||
77 | + UpdatedAt: d.UpdatedAt, | ||
78 | + DeletedAt: d.DeletedAt, | ||
76 | } | 79 | } |
77 | } | 80 | } |
78 | 81 |
@@ -175,6 +175,7 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() { | @@ -175,6 +175,7 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() { | ||
175 | c.Response(data, err) | 175 | c.Response(data, err) |
176 | } | 176 | } |
177 | 177 | ||
178 | +// 获取上级评估 | ||
178 | func (c *SummaryEvaluationController) GetEvaluationSuper() { | 179 | func (c *SummaryEvaluationController) GetEvaluationSuper() { |
179 | srv := service.NewSummaryEvaluationService() | 180 | srv := service.NewSummaryEvaluationService() |
180 | param := &command.QueryEvaluationSuper{} | 181 | param := &command.QueryEvaluationSuper{} |
@@ -190,6 +191,7 @@ func (c *SummaryEvaluationController) GetEvaluationSuper() { | @@ -190,6 +191,7 @@ func (c *SummaryEvaluationController) GetEvaluationSuper() { | ||
190 | c.Response(data, err) | 191 | c.Response(data, err) |
191 | } | 192 | } |
192 | 193 | ||
194 | +// 编辑上级评估 | ||
193 | func (c *SummaryEvaluationController) EditEvaluationSuper() { | 195 | func (c *SummaryEvaluationController) EditEvaluationSuper() { |
194 | srv := service.NewSummaryEvaluationService() | 196 | srv := service.NewSummaryEvaluationService() |
195 | param := &command.EditEvaluationValue{} | 197 | param := &command.EditEvaluationValue{} |
@@ -206,6 +208,7 @@ func (c *SummaryEvaluationController) EditEvaluationSuper() { | @@ -206,6 +208,7 @@ func (c *SummaryEvaluationController) EditEvaluationSuper() { | ||
206 | c.Response(data, err) | 208 | c.Response(data, err) |
207 | } | 209 | } |
208 | 210 | ||
211 | +// 上级评估列表 | ||
209 | func (c *SummaryEvaluationController) ListEvaluationSuper() { | 212 | func (c *SummaryEvaluationController) ListEvaluationSuper() { |
210 | srv := service.NewSummaryEvaluationService() | 213 | srv := service.NewSummaryEvaluationService() |
211 | param := &command.QueryEvaluationList{} | 214 | param := &command.QueryEvaluationList{} |
@@ -221,3 +224,19 @@ func (c *SummaryEvaluationController) ListEvaluationSuper() { | @@ -221,3 +224,19 @@ func (c *SummaryEvaluationController) ListEvaluationSuper() { | ||
221 | data, err := srv.ListEvaluationSuper(param) | 224 | data, err := srv.ListEvaluationSuper(param) |
222 | c.Response(data, err) | 225 | c.Response(data, err) |
223 | } | 226 | } |
227 | + | ||
228 | +// 员工确认评估分数 | ||
229 | +func (c *SummaryEvaluationController) ConfirmScoreSuperEvaluation() { | ||
230 | + srv := service.NewSummaryEvaluationService() | ||
231 | + param := &command.ConfirmScore{} | ||
232 | + err := c.BindJSON(param) | ||
233 | + if err != nil { | ||
234 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
235 | + c.Response(nil, e) | ||
236 | + return | ||
237 | + } | ||
238 | + userReq := middlewares.GetUser(c.Ctx) | ||
239 | + param.UserId = int(userReq.UserId) | ||
240 | + err = srv.ConfirmScoreSuperEvaluation(param) | ||
241 | + c.Response(nil, err) | ||
242 | +} |
@@ -23,6 +23,8 @@ func init() { | @@ -23,6 +23,8 @@ func init() { | ||
23 | web.NSCtrlPost("/evaluation-super", (*controllers.SummaryEvaluationController).GetEvaluationSuper), | 23 | web.NSCtrlPost("/evaluation-super", (*controllers.SummaryEvaluationController).GetEvaluationSuper), |
24 | web.NSCtrlPost("/evaluation-super/edit", (*controllers.SummaryEvaluationController).EditEvaluationSuper), | 24 | web.NSCtrlPost("/evaluation-super/edit", (*controllers.SummaryEvaluationController).EditEvaluationSuper), |
25 | web.NSCtrlPost("/evaluation-super/list", (*controllers.SummaryEvaluationController).ListEvaluationSuper), | 25 | web.NSCtrlPost("/evaluation-super/list", (*controllers.SummaryEvaluationController).ListEvaluationSuper), |
26 | + web.NSCtrlPost("/evaluation-super/confirm", (*controllers.SummaryEvaluationController).ConfirmScoreSuperEvaluation), | ||
27 | + // | ||
26 | ) | 28 | ) |
27 | web.AddNamespace(summaryNS) | 29 | web.AddNamespace(summaryNS) |
28 | } | 30 | } |
-
请 注册 或 登录 后发表评论