正在显示
6 个修改的文件
包含
67 行增加
和
4 行删除
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 | +} |
@@ -20,6 +20,7 @@ type EvaluationProject struct { | @@ -20,6 +20,7 @@ type EvaluationProject struct { | ||
20 | CycleId int64 `json:"cycleId,string" comment:"周期ID"` | 20 | CycleId int64 `json:"cycleId,string" comment:"周期ID"` |
21 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | 21 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` |
22 | State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` | 22 | State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"` |
23 | + SummaryState ProjectSummaryState `json:"summaryState" comment:"周期评估是否下发"` | ||
23 | HrBp int `json:"hrBp" comment:"HR角色权限"` | 24 | HrBp int `json:"hrBp" comment:"HR角色权限"` |
24 | Pmp int `json:"pmp" comment:"PM角色权限"` | 25 | Pmp int `json:"pmp" comment:"PM角色权限"` |
25 | PmpIds []string `json:"pmpIds" comment:"项目管理员ID"` | 26 | PmpIds []string `json:"pmpIds" comment:"项目管理员ID"` |
@@ -32,6 +33,13 @@ type EvaluationProject struct { | @@ -32,6 +33,13 @@ type EvaluationProject struct { | ||
32 | DeletedAt *time.Time `json:"deletedAt" 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 { |
@@ -14,6 +15,7 @@ type EvaluationProject struct { | @@ -14,6 +15,7 @@ type EvaluationProject struct { | ||
14 | CycleId int64 `comment:"周期ID"` | 15 | CycleId int64 `comment:"周期ID"` |
15 | CreatorId int64 `comment:"创建人ID"` | 16 | CreatorId int64 `comment:"创建人ID"` |
16 | State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` | 17 | State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` |
18 | + SummaryState int `comment:"周期评估是否下发" pg:",use_zero"` | ||
17 | HrBp int `comment:"HR角色权限" pg:",use_zero"` | 19 | HrBp int `comment:"HR角色权限" pg:",use_zero"` |
18 | Pmp int `comment:"PM角色权限" pg:",use_zero"` | 20 | Pmp int `comment:"PM角色权限" pg:",use_zero"` |
19 | PmpIds []string `comment:"项目管理员ID"` | 21 | PmpIds []string `comment:"项目管理员ID"` |
@@ -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 { |
@@ -41,6 +42,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | @@ -41,6 +42,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP | ||
41 | CycleId: m.CycleId, | 42 | CycleId: m.CycleId, |
42 | CreatorId: m.CreatorId, | 43 | CreatorId: m.CreatorId, |
43 | State: m.State, | 44 | State: m.State, |
45 | + SummaryState: domain.ProjectSummaryState(m.SummaryState), | ||
44 | HrBp: m.HrBp, | 46 | HrBp: m.HrBp, |
45 | Pmp: m.Pmp, | 47 | Pmp: m.Pmp, |
46 | PmpIds: m.PmpIds, | 48 | PmpIds: m.PmpIds, |
@@ -63,6 +65,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr | @@ -63,6 +65,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr | ||
63 | CycleId: d.CycleId, | 65 | CycleId: d.CycleId, |
64 | CreatorId: d.CreatorId, | 66 | CreatorId: d.CreatorId, |
65 | State: d.State, | 67 | State: d.State, |
68 | + SummaryState: int(d.SummaryState), | ||
66 | HrBp: d.HrBp, | 69 | HrBp: d.HrBp, |
67 | Pmp: d.Pmp, | 70 | Pmp: d.Pmp, |
68 | PmpIds: d.PmpIds, | 71 | PmpIds: d.PmpIds, |
@@ -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 | } |
-
请 注册 或 登录 后发表评论