正在显示
52 个修改的文件
包含
1219 行增加
和
644 行删除
go_build_main_go
已删除
100755 → 0
不能预览此文件类型
@@ -155,68 +155,28 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | @@ -155,68 +155,28 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | ||
155 | if end.After(maxTime) { | 155 | if end.After(maxTime) { |
156 | return nil, application.ThrowError(application.BUSINESS_ERROR, "评估截至时间不能超出周期截至时间") | 156 | return nil, application.ThrowError(application.BUSINESS_ERROR, "评估截至时间不能超出周期截至时间") |
157 | } | 157 | } |
158 | + // 更新项目模板中的环节时间 | ||
158 | if project.Template != nil { | 159 | if project.Template != nil { |
159 | for i := range project.Template.LinkNodes { | 160 | for i := range project.Template.LinkNodes { |
160 | node := project.Template.LinkNodes[i] | 161 | node := project.Template.LinkNodes[i] |
161 | node.TimeEnd = &end | 162 | node.TimeEnd = &end |
162 | } | 163 | } |
163 | } | 164 | } |
164 | - // 项目起始截止时间(暂时环节中的时间未分开) | 165 | + // 更新项目截止时间(暂时环节中的时间未分开) |
165 | project.EndTime = end | 166 | project.EndTime = end |
166 | project, err = projectRepository.Insert(project) | 167 | project, err = projectRepository.Insert(project) |
167 | if err != nil { | 168 | if err != nil { |
168 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 169 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
169 | } | 170 | } |
170 | - | ||
171 | - // 查看任务过程,重新日计算任务截至期 | ||
172 | - taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
173 | - tasks, err := taskRepository.Find(map[string]interface{}{"projectId": in.Id}) | ||
174 | - if err != nil { | ||
175 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
176 | - } | ||
177 | - | ||
178 | - now := time.Now().Local() | ||
179 | - year, month, day := now.Date() | ||
180 | - nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻 | ||
181 | - | ||
182 | - for i := range tasks { | ||
183 | - task := tasks[i] | ||
184 | - task.TimeEnd = &end | ||
185 | - | ||
186 | - // 重新计算 | ||
187 | - if task.NextSentAt == nil { | ||
188 | - // 环节起始和截止本地时间 | ||
189 | - startLocal := task.TimeStart.Local() | ||
190 | - sYear, sMonth, sDay := startLocal.Date() | ||
191 | - startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算 | ||
192 | - endLocal := task.TimeEnd.Local() | ||
193 | - | ||
194 | - // 在当前时间之前,则计算下一个周期时间 | ||
195 | - if startLocal.Before(nowO) { | ||
196 | - nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle) | ||
197 | - task.NextSentAt = &nextTime | ||
198 | - } else { | ||
199 | - task.NextSentAt = &startLocal | ||
200 | - } | ||
201 | - // 如果超出截至时间,则周期置空 | ||
202 | - if task.NextSentAt.After(endLocal) { | ||
203 | - task.NextSentAt = nil | ||
204 | - } | ||
205 | - } else { | ||
206 | - // 新的截止时间在下一次发送周期任务之前,则结束 | ||
207 | - if end.Before(task.NextSentAt.Local()) { | ||
208 | - task.NextSentAt = nil | ||
209 | - } else { | ||
210 | - // do nothing | ||
211 | - } | ||
212 | - } | 171 | + // 项目调整截止时间,同步更新任务时间 |
172 | + if err := rs.updateTaskTime(transactionContext, in.Id, end); err != nil { | ||
173 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
213 | } | 174 | } |
214 | 175 | ||
215 | if err := transactionContext.CommitTransaction(); err != nil { | 176 | if err := transactionContext.CommitTransaction(); err != nil { |
216 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 177 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
217 | } | 178 | } |
218 | return project, nil | 179 | return project, nil |
219 | - | ||
220 | } else { | 180 | } else { |
221 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "template") | 181 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "template") |
222 | if err != nil { | 182 | if err != nil { |
@@ -303,6 +263,62 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | @@ -303,6 +263,62 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | ||
303 | } | 263 | } |
304 | } | 264 | } |
305 | 265 | ||
266 | +// 更新项目截止时间,同步任务截止时间 | ||
267 | +func (rs *EvaluationProjectService) updateTaskTime(context application.TransactionContext, projectId int64, end time.Time) error { | ||
268 | + // 查看任务过程,重新日计算任务截至期 | ||
269 | + taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": context}) | ||
270 | + tasks, err := taskRepository.Find(map[string]interface{}{"projectId": projectId}) | ||
271 | + if err != nil { | ||
272 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
273 | + } | ||
274 | + | ||
275 | + now := time.Now().Local() | ||
276 | + year, month, day := now.Date() | ||
277 | + nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻 | ||
278 | + | ||
279 | + for i := range tasks { | ||
280 | + task := tasks[i] | ||
281 | + task.TimeEnd = &end // 先赋值 | ||
282 | + | ||
283 | + if task.NextSentAt == nil { // 重新计算 | ||
284 | + // 环节起始和截止本地时间 | ||
285 | + startLocal := task.TimeStart.Local() | ||
286 | + sY, sM, sD := startLocal.Date() | ||
287 | + startLocal = time.Date(sY, sM, sD, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算 | ||
288 | + | ||
289 | + // 在当前时间之前,则计算下一个周期时间 | ||
290 | + if startLocal.Before(nowO) { | ||
291 | + nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle) | ||
292 | + task.NextSentAt = &nextTime | ||
293 | + } else { | ||
294 | + task.NextSentAt = &startLocal | ||
295 | + } | ||
296 | + | ||
297 | + // 注.最后一次发送时间和重新计算后的时间相同时,继续获取下一个周期 | ||
298 | + if task.LastSentAt != nil { | ||
299 | + nextY, nextM, nextD := task.NextSentAt.Local().Date() | ||
300 | + lastY, lastM, lastD := task.LastSentAt.Local().Date() | ||
301 | + if nextY == lastY && nextM == lastM && nextD == lastD { | ||
302 | + nextTime := utils.NextTimeInc(task.NextSentAt.Local(), task.KpiCycle) | ||
303 | + task.NextSentAt = &nextTime | ||
304 | + } | ||
305 | + } | ||
306 | + } | ||
307 | + | ||
308 | + // 如果超出截至时间,则周期置空 | ||
309 | + if task.NextSentAt.Local().After(task.TimeEnd.Local()) { | ||
310 | + task.NextSentAt = nil | ||
311 | + } | ||
312 | + | ||
313 | + // 更新任务 | ||
314 | + task, err := taskRepository.Insert(task) | ||
315 | + if err != nil { | ||
316 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
317 | + } | ||
318 | + } | ||
319 | + return nil | ||
320 | +} | ||
321 | + | ||
306 | func (rs *EvaluationProjectService) Get(in *command.GetProjectCommand) (interface{}, error) { | 322 | func (rs *EvaluationProjectService) Get(in *command.GetProjectCommand) (interface{}, error) { |
307 | transactionContext, err := factory.ValidateStartTransaction(in) | 323 | transactionContext, err := factory.ValidateStartTransaction(in) |
308 | if err != nil { | 324 | if err != nil { |
@@ -483,8 +499,8 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -483,8 +499,8 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
483 | 499 | ||
484 | // 环节起始和截止本地时间 | 500 | // 环节起始和截止本地时间 |
485 | startLocal := task.TimeStart.Local() | 501 | startLocal := task.TimeStart.Local() |
486 | - sYear, sMonth, sDay := startLocal.Date() | ||
487 | - startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算 | 502 | + sY, sM, sD := startLocal.Date() |
503 | + startLocal = time.Date(sY, sM, sD, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算 | ||
488 | endLocal := task.TimeEnd.Local() | 504 | endLocal := task.TimeEnd.Local() |
489 | 505 | ||
490 | // 在当前时间之前,则计算下一个周期时间 | 506 | // 在当前时间之前,则计算下一个周期时间 |
@@ -168,3 +168,11 @@ func CreateStaffAssessContentTempRepository(options map[string]interface{}) doma | @@ -168,3 +168,11 @@ func CreateStaffAssessContentTempRepository(options map[string]interface{}) doma | ||
168 | } | 168 | } |
169 | return repository.NewStaffAssessContentTempRepository(transactionContext) | 169 | return repository.NewStaffAssessContentTempRepository(transactionContext) |
170 | } | 170 | } |
171 | + | ||
172 | +func CreateStaffAssessCacheRepository(options map[string]interface{}) domain.StaffAssessCacheRepository { | ||
173 | + var transactionContext *pg.TransactionContext | ||
174 | + if value, ok := options["transactionContext"]; ok { | ||
175 | + transactionContext = value.(*pg.TransactionContext) | ||
176 | + } | ||
177 | + return repository.NewStaffAssessCacheRepository(transactionContext) | ||
178 | +} |
@@ -79,6 +79,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | @@ -79,6 +79,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | ||
79 | } | 79 | } |
80 | 80 | ||
81 | staffAssessService := service.NewStaffAssessServeice() | 81 | staffAssessService := service.NewStaffAssessServeice() |
82 | + | ||
83 | + now := time.Now().Local() | ||
82 | for i := range tasks { | 84 | for i := range tasks { |
83 | task := tasks[i] | 85 | task := tasks[i] |
84 | project, ok := projectIdsMap[task.ProjectId] // 项目 | 86 | project, ok := projectIdsMap[task.ProjectId] // 项目 |
@@ -86,6 +88,9 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | @@ -86,6 +88,9 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | ||
86 | // 环节截止时间 | 88 | // 环节截止时间 |
87 | maxTime := task.TimeEnd.Local() | 89 | maxTime := task.TimeEnd.Local() |
88 | 90 | ||
91 | + // 更新任务最后一次的发送时间(取当前时间) | ||
92 | + task.LastSentAt = &now | ||
93 | + | ||
89 | // 当前周起始时间和截止时间 | 94 | // 当前周起始时间和截止时间 |
90 | var cycleTimeStart = task.NextSentAt.Local() | 95 | var cycleTimeStart = task.NextSentAt.Local() |
91 | var cycleTimeEnd time.Time | 96 | var cycleTimeEnd time.Time |
@@ -99,11 +104,12 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | @@ -99,11 +104,12 @@ func (rs *NodeTaskService) SendEvaluationNode() error { | ||
99 | task.NextSentAt = &nextTime | 104 | task.NextSentAt = &nextTime |
100 | } | 105 | } |
101 | 106 | ||
102 | - // 周期的截至时间=下一个周期的开始时间-1秒 | 107 | + // 周期的截至时间=下一个周期的开始时间-1秒(需求方要求提交数据时间延长到第二天8点30分截止) |
103 | if task.NextSentAt == nil { | 108 | if task.NextSentAt == nil { |
104 | cycleTimeEnd = maxTime | 109 | cycleTimeEnd = maxTime |
105 | } else { | 110 | } else { |
106 | - cycleTimeEnd = task.NextSentAt.Local().Add(-1 * time.Second) | 111 | + //cycleTimeEnd = task.NextSentAt.Local().Add(-1 * time.Second) // 周期截至时间=下一个周期起始时间-1秒 |
112 | + cycleTimeEnd = task.NextSentAt.Local().Add(8*time.Hour + 30*time.Minute) // 注.延长8.5小时 | ||
107 | } | 113 | } |
108 | 114 | ||
109 | // 格式化周期的起始和截止时间 | 115 | // 格式化周期的起始和截止时间 |
@@ -5,8 +5,8 @@ import "github.com/beego/beego/v2/core/validation" | @@ -5,8 +5,8 @@ import "github.com/beego/beego/v2/core/validation" | ||
5 | // QueryRoleUserCommand 查询角色列表(关联用户) | 5 | // QueryRoleUserCommand 查询角色列表(关联用户) |
6 | type QueryRoleUserCommand struct { | 6 | type QueryRoleUserCommand struct { |
7 | CompanyId int64 `cname:"公司ID" json:"companyId"` | 7 | CompanyId int64 `cname:"公司ID" json:"companyId"` |
8 | - PageNumber int64 `cname:"分页页码" json:"pageNumber" valid:"Required"` | ||
9 | - PageSize int64 `cname:"分页数量" json:"pageSize" valid:"Required"` | 8 | + PageNumber int64 `cname:"分页页码" json:"pageNumber"` |
9 | + PageSize int64 `cname:"分页数量" json:"pageSize"` | ||
10 | } | 10 | } |
11 | 11 | ||
12 | func (in *QueryRoleUserCommand) Valid(validation *validation.Validation) { | 12 | func (in *QueryRoleUserCommand) Valid(validation *validation.Validation) { |
@@ -6,8 +6,8 @@ import "github.com/beego/beego/v2/core/validation" | @@ -6,8 +6,8 @@ import "github.com/beego/beego/v2/core/validation" | ||
6 | type UserRoleQueryCommand struct { | 6 | type UserRoleQueryCommand struct { |
7 | CompanyId int64 `cname:"公司ID" json:"companyId"` | 7 | CompanyId int64 `cname:"公司ID" json:"companyId"` |
8 | RoleId int64 `cname:"角色ID" json:"roleId,string" valid:"Required"` | 8 | RoleId int64 `cname:"角色ID" json:"roleId,string" valid:"Required"` |
9 | - PageNumber int64 `cname:"分页页码" json:"pageNumber"` | ||
10 | - PageSize int64 `cname:"分页数量" json:"pageSize"` | 9 | + PageNumber int `cname:"分页页码" json:"pageNumber"` |
10 | + PageSize int `cname:"分页数量" json:"pageSize"` | ||
11 | } | 11 | } |
12 | 12 | ||
13 | func (in *UserRoleQueryCommand) Valid(validation *validation.Validation) { | 13 | func (in *UserRoleQueryCommand) Valid(validation *validation.Validation) { |
@@ -190,7 +190,7 @@ func (rs *RoleService) ListForUser(in *command.QueryRoleUserCommand) (interface{ | @@ -190,7 +190,7 @@ func (rs *RoleService) ListForUser(in *command.QueryRoleUserCommand) (interface{ | ||
190 | 190 | ||
191 | for i := range roles { | 191 | for i := range roles { |
192 | v := roles[i] | 192 | v := roles[i] |
193 | - tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, v.Id) | 193 | + _, tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, v.Id) |
194 | if err != nil { | 194 | if err != nil { |
195 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 195 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
196 | } | 196 | } |
@@ -104,15 +104,12 @@ func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface | @@ -104,15 +104,12 @@ func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface | ||
104 | }() | 104 | }() |
105 | ruRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | 105 | ruRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext}) |
106 | 106 | ||
107 | - in.PageNumber = 1 | ||
108 | - in.PageSize = 9999999 | ||
109 | - | ||
110 | - tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, in.RoleId) | 107 | + total, tempList, err := ruRepository.FindAllContainUser(in.PageNumber, in.PageSize, in.CompanyId, in.RoleId) |
111 | if err != nil { | 108 | if err != nil { |
112 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 109 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
113 | } | 110 | } |
114 | if err := transactionContext.CommitTransaction(); err != nil { | 111 | if err := transactionContext.CommitTransaction(); err != nil { |
115 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 112 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
116 | } | 113 | } |
117 | - return tool_funs.SimpleWrapGridMap(int64(len(tempList)), tempList), nil | 114 | + return tool_funs.SimpleWrapGridMap(total, tempList), nil |
118 | } | 115 | } |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type AssessCycleDayResp struct { | 3 | type AssessCycleDayResp struct { |
4 | - CycleId int `json:"cycleId"` | 4 | + CycleId string `json:"cycleId"` |
5 | CycleName string `json:"cycleName"` | 5 | CycleName string `json:"cycleName"` |
6 | BeginDay string `json:"beginDay"` | 6 | BeginDay string `json:"beginDay"` |
7 | + EndTime string `json:"endTime"` | ||
8 | + BeginTime string `json:"beginTime"` | ||
7 | } | 9 | } |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type ListInviteUserAssessResp struct { | 3 | type ListInviteUserAssessResp struct { |
4 | - LinkNodeName string `json:"linkNodeName"` | ||
5 | - LinkNodeId int `json:"linkNodeId"` | ||
6 | - LintNodeDesc string `json:"lintNodeDesc"` | ||
7 | - BeginDay string `json:"beginDay"` | ||
8 | - CycleId int `json:"cycleId"` | ||
9 | - TableHeader []ListTableHeader `json:"tableHeader"` | ||
10 | - List []map[string]string `json:"list"` | ||
11 | - Total int `json:"total"` | 4 | + LinkNodeName string `json:"linkNodeName"` |
5 | + LinkNodeId int `json:"linkNodeId"` | ||
6 | + LintNodeDesc string `json:"lintNodeDesc"` | ||
7 | + BeginDay string `json:"beginDay"` | ||
8 | + CycleId int `json:"cycleId"` | ||
9 | + TableHeader []ListTableHeader `json:"tableHeader"` | ||
10 | + List []map[string]interface{} `json:"list"` | ||
11 | + Total int `json:"total"` | ||
12 | } | 12 | } |
13 | type ListTableHeader struct { | 13 | type ListTableHeader struct { |
14 | Key string `json:"key"` | 14 | Key string `json:"key"` |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type ListSupperAssessResp struct { | 3 | type ListSupperAssessResp struct { |
4 | - AssessId int `json:"assessId"` // | ||
5 | - CycleId int `json:"cycleId"` //周期id | ||
6 | - BeginDay string `json:"beginDay"` //开始的日期 | ||
7 | - UserId int `json:"userId,string"` //用户id | ||
8 | - UserName string `json:"userName"` //用户名称 | ||
9 | - EndTime string `json:"endTime"` //截止时间 | ||
10 | - InviteTotal int `json:"inviteTota"` //邀请总数 | ||
11 | - InviteCompleted int `json:"inviteCompleted"` //邀请未完成 | ||
12 | - Status string `json:"status"` //评估任务是否填写完成 | ||
13 | - Department string `json:"department"` //部门 | ||
14 | - Position string `json:"position"` //职位 | ||
15 | - DutyTime string `json:"dutyTime"` //入职时间 | 4 | + StaffAssessTaskId int `json:"staffAssessTaskId"` |
5 | + AssessId int `json:"assessId"` // | ||
6 | + CycleId int `json:"cycleId"` //周期id | ||
7 | + BeginDay string `json:"beginDay"` //开始的日期 | ||
8 | + UserId int `json:"userId,string"` //用户id | ||
9 | + UserName string `json:"userName"` //用户名称 | ||
10 | + EndTime string `json:"endTime"` //截止时间 | ||
11 | + InviteTotal int `json:"inviteTota"` //邀请总数 | ||
12 | + InviteCompleted int `json:"inviteCompleted"` //邀请未完成 | ||
13 | + Status string `json:"status"` //评估任务是否填写完成 | ||
14 | + Department string `json:"department"` //部门 | ||
15 | + Position string `json:"position"` //职位 | ||
16 | + DutyTime string `json:"dutyTime"` //入职时间 | ||
16 | } | 17 | } |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type ListUserAssessContent struct { | 3 | type ListUserAssessContent struct { |
4 | - TableHeader []ListTableHeader `json:"tableHeader"` | ||
5 | - List []map[string]string `json:"list"` | ||
6 | - Total int `json:"total"` | 4 | + TableHeader []ListTableHeader `json:"tableHeader"` |
5 | + List []map[string]interface{} `json:"list"` | ||
6 | + Total int `json:"total"` | ||
7 | } | 7 | } |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/core/validation" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
6 | +) | ||
7 | + | ||
8 | +// SaveAssessCacheCommand 保存待提交的评估数据(缓存) | ||
9 | +type SaveAssessCacheCommand struct { | ||
10 | + AssessId int64 `cname:"评估项ID" json:"assessId,string"` | ||
11 | + AssessContent []domain.AssessContent `cname:"评估数据" json:"assessContent"` | ||
12 | +} | ||
13 | + | ||
14 | +func (in *SaveAssessCacheCommand) Valid(validation *validation.Validation) { | ||
15 | + if in.AssessId == 0 { | ||
16 | + validation.SetError("assessId", "ID无效") | ||
17 | + return | ||
18 | + } | ||
19 | +} |
1 | -package command | ||
2 | - | ||
3 | -//保存员工填写评估内容 | ||
4 | -type SaveAssessInfoCommand struct { | ||
5 | - AssessId int `json:"assessId"` // | ||
6 | - ExecutorId int `json:"executorId"` //填写人的id | ||
7 | - CompanyId int `json:"companyId"` //公司id | ||
8 | - AssessContent []AssesssContent `json:"assessContent"` | ||
9 | -} | ||
10 | - | ||
11 | -type AssesssContent struct { | ||
12 | - Category string `json:"category"` | ||
13 | - Name string `json:"name"` | ||
14 | - Value string `json:"value"` | ||
15 | - Remark []RemarkText `json:"remark"` | ||
16 | -} | ||
17 | - | ||
18 | -type RemarkText struct { | ||
19 | - Title string `json:"title"` | ||
20 | - RemarkText string `json:"remarkText"` | ||
21 | -} | 1 | +package command |
2 | + | ||
3 | +import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
4 | + | ||
5 | +//保存员工填写评估内容 | ||
6 | +type SaveAssessInfoCommand struct { | ||
7 | + AssessId int `json:"assessId"` // | ||
8 | + ExecutorId int `json:"executorId"` //填写人的id | ||
9 | + CompanyId int `json:"companyId"` //公司id | ||
10 | + AssessContent []domain.AssessContent `json:"assessContent"` | ||
11 | +} | ||
12 | + | ||
13 | +//type AssessContent struct { | ||
14 | +// Category string `json:"category"` | ||
15 | +// Name string `json:"name"` | ||
16 | +// Value string `json:"value"` | ||
17 | +// Remark []RemarkText `json:"remark"` | ||
18 | +//} | ||
19 | +// | ||
20 | +//type RemarkText struct { | ||
21 | +// Title string `json:"title"` | ||
22 | +// RemarkText string `json:"remarkText"` | ||
23 | +//} |
1 | -package query | ||
2 | - | ||
3 | -//获取评估任务详情 | ||
4 | -type AssessInfoQuery struct { | ||
5 | - AssessId int `json:"assessId"` // | ||
6 | - CompanyId int `json:"companyId"` // | ||
7 | -} | 1 | +package query |
2 | + | ||
3 | +//获取评估任务详情 | ||
4 | +type AssessInfoQuery struct { | ||
5 | + AssessId int `json:"assessId"` // 评估项ID | ||
6 | + CompanyId int `json:"companyId"` // 公司ID | ||
7 | + AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据 | ||
8 | +} |
1 | -package query | ||
2 | - | ||
3 | -//获取员工自评填写详情 | ||
4 | -type AssessSelfInfoQuery struct { | ||
5 | - AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id | ||
6 | - TargetUserId int `json:"targetUserId,string"` //被评估的人id | ||
7 | - CompanyId int `json:"companyId"` //公司id | ||
8 | - | ||
9 | -} | 1 | +package query |
2 | + | ||
3 | +//获取员工自评填写详情 | ||
4 | +type AssessSelfInfoQuery struct { | ||
5 | + AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id | ||
6 | + TargetUserId int `json:"targetUserId,string"` //被评估的人id | ||
7 | + CompanyId int `json:"companyId"` //公司id | ||
8 | + AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据 | ||
9 | +} |
@@ -8,7 +8,7 @@ type AssessTaskDescQuery struct { | @@ -8,7 +8,7 @@ type AssessTaskDescQuery struct { | ||
8 | 8 | ||
9 | //获取我的项目周期进度描述 | 9 | //获取我的项目周期进度描述 |
10 | type AssessTaskDescV2Query struct { | 10 | type AssessTaskDescV2Query struct { |
11 | - CycleId int `json:"cycleId"` | 11 | + CycleId int `json:"cycleId,string"` |
12 | BeginDay string `json:"beginDay"` | 12 | BeginDay string `json:"beginDay"` |
13 | UserId int `json:"userId"` //当前登录人的id | 13 | UserId int `json:"userId"` //当前登录人的id |
14 | CompanyId int `json:"companyId"` //当前登录的公司 | 14 | CompanyId int `json:"companyId"` //当前登录的公司 |
@@ -4,6 +4,7 @@ package query | @@ -4,6 +4,7 @@ package query | ||
4 | type GetExecutorSelfAssessQuery struct { | 4 | type GetExecutorSelfAssessQuery struct { |
5 | CompanyId int `json:"companyId"` // | 5 | CompanyId int `json:"companyId"` // |
6 | TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 | 6 | TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 |
7 | - CycleId int `json:"cycleId"` //评估周期id 必填 | 7 | + CycleId int `json:"cycleId,string"` //评估周期id 必填 |
8 | BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 | 8 | BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 |
9 | + AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据 | ||
9 | } | 10 | } |
1 | package query | 1 | package query |
2 | 2 | ||
3 | -// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值 | 3 | +// 根据周期和日期获取我要执行的的评估,用户列表和评估填写的值 |
4 | type ListExecutorAssessQuery struct { | 4 | type ListExecutorAssessQuery struct { |
5 | PageNumber int `json:"pageNumber"` | 5 | PageNumber int `json:"pageNumber"` |
6 | PageSize int `json:"pageSize"` | 6 | PageSize int `json:"pageSize"` |
7 | UserName string `json:"userName"` //查询条件 员工的名称 | 7 | UserName string `json:"userName"` //查询条件 员工的名称 |
8 | CompanyId int `json:"companyId"` // | 8 | CompanyId int `json:"companyId"` // |
9 | ExecutorId int `json:"executorId,string"` //评估的执行人,必填 | 9 | ExecutorId int `json:"executorId,string"` //评估的执行人,必填 |
10 | - CycleId int `json:"cycleId"` //评估周期id 必填 | 10 | + CycleId int `json:"cycleId,string"` //评估周期id 必填 |
11 | BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 | 11 | BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 |
12 | } | 12 | } |
@@ -4,6 +4,6 @@ package query | @@ -4,6 +4,6 @@ package query | ||
4 | type ListInviteUserQuery struct { | 4 | type ListInviteUserQuery struct { |
5 | CompanyId int `json:"companyId"` //对公司 | 5 | CompanyId int `json:"companyId"` //对公司 |
6 | TargetUserId int `json:"targetUserId,string"` //被评估的员工id | 6 | TargetUserId int `json:"targetUserId,string"` //被评估的员工id |
7 | - CycleId int `json:"CycleId"` //评估任务的周期id | 7 | + CycleId int `json:"CycleId,string"` //评估任务的周期id |
8 | BeginDay string `json:"beginDay"` //日期 | 8 | BeginDay string `json:"beginDay"` //日期 |
9 | } | 9 | } |
1 | +package query | ||
2 | + | ||
3 | +//获取员工被其他人评估的列表 | ||
4 | +type ListTargetAssessQuery struct { | ||
5 | + PageNumber int `json:"pageNumber"` | ||
6 | + PageSize int `json:"pageSize"` | ||
7 | + CompanyId int `json:"companyId"` // | ||
8 | + TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 | ||
9 | + CycleId int `json:"cycleId,string"` //评估周期id 必填 | ||
10 | + BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 | ||
11 | +} |
@@ -5,5 +5,5 @@ type ListTargetUserAssessQuery struct { | @@ -5,5 +5,5 @@ type ListTargetUserAssessQuery struct { | ||
5 | AssessTaskId int `json:"assessTaskId"` | 5 | AssessTaskId int `json:"assessTaskId"` |
6 | TargetUserId int `json:"targetUserId,string"` | 6 | TargetUserId int `json:"targetUserId,string"` |
7 | CompanyId int `json:"companyId"` | 7 | CompanyId int `json:"companyId"` |
8 | - Types []string `json:"tyspes"` | 8 | + Types []string `json:"types"` |
9 | } | 9 | } |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +// StaffAssessCacheService 保存待提交的评估数据(缓存) | ||
11 | +type StaffAssessCacheService struct{} | ||
12 | + | ||
13 | +func NewStaffAssessCacheService() *StaffAssessCacheService { | ||
14 | + newService := &StaffAssessCacheService{} | ||
15 | + return newService | ||
16 | +} | ||
17 | + | ||
18 | +func (srv StaffAssessCacheService) SaveAssessCache(in *command.SaveAssessCacheCommand) (map[string]interface{}, error) { | ||
19 | + transactionContext, err := factory.ValidateStartTransaction(in) | ||
20 | + if err != nil { | ||
21 | + return nil, err | ||
22 | + } | ||
23 | + defer func() { | ||
24 | + transactionContext.RollbackTransaction() | ||
25 | + }() | ||
26 | + cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
27 | + _, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": in.AssessId, "limit": 1}) | ||
28 | + if err != nil { | ||
29 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
30 | + } | ||
31 | + var cache *domain.StaffAssessCache | ||
32 | + if len(caches) == 0 { | ||
33 | + cache = &domain.StaffAssessCache{} | ||
34 | + cache.Id = 0 | ||
35 | + cache.AssessId = in.AssessId | ||
36 | + cache.AssessContent = in.AssessContent | ||
37 | + } else { | ||
38 | + cache = caches[0] | ||
39 | + cache.AssessContent = in.AssessContent | ||
40 | + } | ||
41 | + if _, err = cacheRepository.Save(cache); err != nil { | ||
42 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
43 | + } | ||
44 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
45 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
46 | + } | ||
47 | + return map[string]interface{}{"assessId": cache.Id}, nil | ||
48 | +} |
@@ -279,30 +279,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) | @@ -279,30 +279,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) | ||
279 | log.Logger.Error("获取用户信息," + err.Error()) | 279 | log.Logger.Error("获取用户信息," + err.Error()) |
280 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error()) | 280 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error()) |
281 | } | 281 | } |
282 | - // departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ | ||
283 | - // "transactionContext": transactionContext, | ||
284 | - // }) | ||
285 | - // var supperUserList []*domain.User | ||
286 | - // if len(userData.DepartmentId) > 0 { | ||
287 | - // _, departmentList, err := departmentRepo.Find(map[string]interface{}{ | ||
288 | - // "ids": userData.DepartmentId, | ||
289 | - // }) | ||
290 | - // if err != nil { | ||
291 | - // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error()) | ||
292 | - // } | ||
293 | - // var chargeUserIds []int64 | ||
294 | - // for _, v := range departmentList { | ||
295 | - // chargeUserIds = append(chargeUserIds, v.ChargeUserIds...) | ||
296 | - // } | ||
297 | - // if len(chargeUserIds) > 0 { | ||
298 | - // _, supperUserList, err = userRepo.Find(map[string]interface{}{ | ||
299 | - // "ids": chargeUserIds, | ||
300 | - // }) | ||
301 | - // if err != nil { | ||
302 | - // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error()) | ||
303 | - // } | ||
304 | - // } | ||
305 | - // } | 282 | + |
306 | supperUserList, _ := srv.getStaffSuper(transactionContext, *userData) | 283 | supperUserList, _ := srv.getStaffSuper(transactionContext, *userData) |
307 | if err := transactionContext.CommitTransaction(); err != nil { | 284 | if err := transactionContext.CommitTransaction(); err != nil { |
308 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 285 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -971,6 +948,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuer | @@ -971,6 +948,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuer | ||
971 | } | 948 | } |
972 | } | 949 | } |
973 | 950 | ||
951 | + // 恢复缓存数据 | ||
952 | + if param.AcquireCache != 0 { | ||
953 | + srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList) | ||
954 | + } | ||
955 | + | ||
974 | //获取员工描述 | 956 | //获取员工描述 |
975 | staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId)) | 957 | staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId)) |
976 | if err := transactionContext.CommitTransaction(); err != nil { | 958 | if err := transactionContext.CommitTransaction(); err != nil { |
@@ -1299,9 +1281,9 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU | @@ -1299,9 +1281,9 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU | ||
1299 | {Key: "endTime", Name: "360°评估截止日期"}, | 1281 | {Key: "endTime", Name: "360°评估截止日期"}, |
1300 | } | 1282 | } |
1301 | tableHeader = append(tableHeader, changeableHeader...) | 1283 | tableHeader = append(tableHeader, changeableHeader...) |
1302 | - listData := []map[string]string{} | 1284 | + listData := []map[string]interface{}{} |
1303 | for _, v := range assessList { | 1285 | for _, v := range assessList { |
1304 | - m := map[string]string{ | 1286 | + m := map[string]interface{}{ |
1305 | "userName": v.TargetUser.UserName, | 1287 | "userName": v.TargetUser.UserName, |
1306 | "userId": strconv.Itoa(v.TargetUser.UserId), | 1288 | "userId": strconv.Itoa(v.TargetUser.UserId), |
1307 | "status": string(v.Status), | 1289 | "status": string(v.Status), |
@@ -1551,6 +1533,11 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada | @@ -1551,6 +1533,11 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada | ||
1551 | } | 1533 | } |
1552 | } | 1534 | } |
1553 | 1535 | ||
1536 | + // 恢复缓存数据 | ||
1537 | + if param.AcquireCache != 0 { | ||
1538 | + srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList) | ||
1539 | + } | ||
1540 | + | ||
1554 | targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId)) | 1541 | targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId)) |
1555 | if err != nil { | 1542 | if err != nil { |
1556 | log.Logger.Error("获取员工描述" + err.Error()) | 1543 | log.Logger.Error("获取员工描述" + err.Error()) |
@@ -1713,7 +1700,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1713,7 +1700,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1713 | } | 1700 | } |
1714 | } | 1701 | } |
1715 | //处理提交上来的数据 | 1702 | //处理提交上来的数据 |
1716 | - paramContentMap := map[string]command.AssesssContent{} | 1703 | + paramContentMap := map[string]domain.AssessContent{} |
1717 | for i, v := range param.AssessContent { | 1704 | for i, v := range param.AssessContent { |
1718 | key := fmt.Sprintf("%s-%s", v.Category, v.Name) | 1705 | key := fmt.Sprintf("%s-%s", v.Category, v.Name) |
1719 | paramContentMap[key] = param.AssessContent[i] | 1706 | paramContentMap[key] = param.AssessContent[i] |
@@ -1726,7 +1713,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1726,7 +1713,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1726 | continue | 1713 | continue |
1727 | } | 1714 | } |
1728 | v.Value = item.Value | 1715 | v.Value = item.Value |
1729 | - if v.Required == 1 { | 1716 | + if v.Required == domain.NodeRequiredYes { |
1730 | //转换填入的评估值 | 1717 | //转换填入的评估值 |
1731 | err = v.TransformValue() | 1718 | err = v.TransformValue() |
1732 | if err != nil { | 1719 | if err != nil { |
@@ -1755,6 +1742,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1755,6 +1742,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1755 | if err != nil { | 1742 | if err != nil { |
1756 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) | 1743 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) |
1757 | } | 1744 | } |
1745 | + | ||
1746 | + // 删除缓存 | ||
1747 | + cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
1748 | + if _, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": assessData.Id, "limit": 1}); err != nil { | ||
1749 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1750 | + } else { | ||
1751 | + for i := range caches { | ||
1752 | + if err = cacheRepository.Remove(caches[i].Id); err != nil { | ||
1753 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1754 | + } | ||
1755 | + } | ||
1756 | + } | ||
1757 | + | ||
1758 | if err := transactionContext.CommitTransaction(); err != nil { | 1758 | if err := transactionContext.CommitTransaction(); err != nil { |
1759 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1759 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1760 | } | 1760 | } |
@@ -1780,10 +1780,10 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA | @@ -1780,10 +1780,10 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA | ||
1780 | }) | 1780 | }) |
1781 | //获取员工的评估 | 1781 | //获取员工的评估 |
1782 | cnt, assessList, err := assessReps.Find(map[string]interface{}{ | 1782 | cnt, assessList, err := assessReps.Find(map[string]interface{}{ |
1783 | - "assessTaskId": param.AssessTaskId, | ||
1784 | - "companyId": param.CompanyId, | ||
1785 | - "targetUserId": param.TargetUserId, | ||
1786 | - "typesList": param.Types, | 1783 | + "staffAssessTaskId": param.AssessTaskId, |
1784 | + "companyId": param.CompanyId, | ||
1785 | + "targetUserId": param.TargetUserId, | ||
1786 | + "typesList": param.Types, | ||
1787 | }) | 1787 | }) |
1788 | if err != nil { | 1788 | if err != nil { |
1789 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) | 1789 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) |
@@ -1884,3 +1884,29 @@ loop: | @@ -1884,3 +1884,29 @@ loop: | ||
1884 | } | 1884 | } |
1885 | return chargeUserList, nil | 1885 | return chargeUserList, nil |
1886 | } | 1886 | } |
1887 | + | ||
1888 | +func (srv StaffAssessServeice) recoverAssessCache(context application.TransactionContext, assessId int, dataArray []*domain.StaffAssessContent) { | ||
1889 | + cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": context}) | ||
1890 | + _, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": assessId, "limit": 1}) | ||
1891 | + if err != nil || len(caches) == 0 { | ||
1892 | + return | ||
1893 | + } | ||
1894 | + cacheArray := caches[0].AssessContent | ||
1895 | + cacheLen := len(cacheArray) | ||
1896 | + | ||
1897 | + for i := range dataArray { | ||
1898 | + if cacheLen > i { // 避免数组越界 | ||
1899 | + data := dataArray[i] | ||
1900 | + cache := cacheArray[i] | ||
1901 | + | ||
1902 | + data.Value = cache.Value // 评估填写的值 | ||
1903 | + cacheRemarkLen := len(cache.Remark) | ||
1904 | + | ||
1905 | + for j := range data.Remark { | ||
1906 | + if cacheRemarkLen > j { | ||
1907 | + data.Remark[j].RemarkText = cache.Remark[j].RemarkText // 评估填写文本内容 | ||
1908 | + } | ||
1909 | + } | ||
1910 | + } | ||
1911 | + } | ||
1912 | +} |
@@ -163,11 +163,11 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs | @@ -163,11 +163,11 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs | ||
163 | //过滤重复的列 | 163 | //过滤重复的列 |
164 | headerMap := map[string]string{} | 164 | headerMap := map[string]string{} |
165 | // 获取已经填报的内容 | 165 | // 获取已经填报的内容 |
166 | - changeableRows := map[string]map[string]string{} | 166 | + changeableRows := map[string]map[string]interface{}{} |
167 | tableSort := []string{} //确定列表行数据的顺序 | 167 | tableSort := []string{} //确定列表行数据的顺序 |
168 | for i, v := range contentList { | 168 | for i, v := range contentList { |
169 | if _, ok := changeableRows[v.TargetUserId]; !ok { | 169 | if _, ok := changeableRows[v.TargetUserId]; !ok { |
170 | - changeableRows[v.TargetUserId] = map[string]string{} | 170 | + changeableRows[v.TargetUserId] = map[string]interface{}{} |
171 | tableSort = append(tableSort, v.TargetUserId) | 171 | tableSort = append(tableSort, v.TargetUserId) |
172 | } | 172 | } |
173 | changeableRows[v.TargetUserId]["targetUserName"] = v.TargetUserName | 173 | changeableRows[v.TargetUserId]["targetUserName"] = v.TargetUserName |
@@ -186,7 +186,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs | @@ -186,7 +186,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs | ||
186 | changeableRows[v.TargetUserId][key] = v.Value | 186 | changeableRows[v.TargetUserId][key] = v.Value |
187 | } | 187 | } |
188 | } | 188 | } |
189 | - list := []map[string]string{} | 189 | + list := []map[string]interface{}{} |
190 | for _, v := range tableSort { | 190 | for _, v := range tableSort { |
191 | for _, v2 := range changeableHeader { | 191 | for _, v2 := range changeableHeader { |
192 | if _, ok := changeableRows[v][v2.Key]; ok { | 192 | if _, ok := changeableRows[v][v2.Key]; ok { |
@@ -30,7 +30,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | @@ -30,7 +30,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | ||
30 | staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{ | 30 | staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{ |
31 | "transactionContext": transactionContext, | 31 | "transactionContext": transactionContext, |
32 | }) | 32 | }) |
33 | - var limit int = 200 | 33 | + var limit int = 360 |
34 | var offset int = 0 | 34 | var offset int = 0 |
35 | if param.PageSize > 0 { | 35 | if param.PageSize > 0 { |
36 | limit = param.PageSize | 36 | limit = param.PageSize |
@@ -55,6 +55,8 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | @@ -55,6 +55,8 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | ||
55 | CycleId: v.CycleId, | 55 | CycleId: v.CycleId, |
56 | CycleName: v.CycleName, | 56 | CycleName: v.CycleName, |
57 | BeginDay: v.BeginDay, | 57 | BeginDay: v.BeginDay, |
58 | + BeginTime: v.BeginTime, | ||
59 | + EndTime: v.EndTime, | ||
58 | } | 60 | } |
59 | listData = append(listData, temp) | 61 | listData = append(listData, temp) |
60 | } | 62 | } |
@@ -409,17 +411,18 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | @@ -409,17 +411,18 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | ||
409 | {Key: "endTime", Name: "360°评估截止日期"}, | 411 | {Key: "endTime", Name: "360°评估截止日期"}, |
410 | } | 412 | } |
411 | tableHeader = append(tableHeader, changeableHeader...) | 413 | tableHeader = append(tableHeader, changeableHeader...) |
412 | - listData := []map[string]string{} | 414 | + listData := []map[string]interface{}{} |
413 | for _, v := range assessList { | 415 | for _, v := range assessList { |
414 | - m := map[string]string{ | ||
415 | - "userName": v.TargetUser.UserName, | ||
416 | - "userId": strconv.Itoa(v.TargetUser.UserId), | ||
417 | - "status": string(v.Status), | ||
418 | - "cycleId": strconv.FormatInt(v.CycleId, 10), | ||
419 | - "beginDay": v.BeginTime.Local().Format("2006-01-02"), | ||
420 | - "types": string(v.Types), | ||
421 | - "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
422 | - "assessId": strconv.Itoa(v.Id), | 416 | + m := map[string]interface{}{ |
417 | + "staffAssessTaskId": v.StaffAssessTaskId, | ||
418 | + "userName": v.TargetUser.UserName, | ||
419 | + "userId": strconv.Itoa(v.TargetUser.UserId), | ||
420 | + "status": string(v.Status), | ||
421 | + "cycleId": strconv.FormatInt(v.CycleId, 10), | ||
422 | + "beginDay": v.BeginTime.Local().Format("2006-01-02"), | ||
423 | + "types": string(v.Types), | ||
424 | + "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
425 | + "assessId": strconv.Itoa(v.Id), | ||
423 | } | 426 | } |
424 | switch v.Status { | 427 | switch v.Status { |
425 | case domain.StaffAssessCompleted: | 428 | case domain.StaffAssessCompleted: |
@@ -459,7 +462,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | @@ -459,7 +462,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | ||
459 | return &result, nil | 462 | return &result, nil |
460 | } | 463 | } |
461 | 464 | ||
462 | -//根据周期和日期获取我需要执行的上级评估成员列表 | 465 | +// 根据周期和日期获取我需要执行的上级评估成员列表 |
463 | func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) { | 466 | func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) { |
464 | transactionContext, err := factory.CreateTransactionContext(nil) | 467 | transactionContext, err := factory.CreateTransactionContext(nil) |
465 | if err != nil { | 468 | if err != nil { |
@@ -560,18 +563,19 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -560,18 +563,19 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
560 | resultList := []adapter.ListSupperAssessResp{} | 563 | resultList := []adapter.ListSupperAssessResp{} |
561 | for _, v := range assessList { | 564 | for _, v := range assessList { |
562 | item := adapter.ListSupperAssessResp{ | 565 | item := adapter.ListSupperAssessResp{ |
563 | - AssessId: v.Id, | ||
564 | - CycleId: int(v.CycleId), | ||
565 | - BeginDay: v.BeginTime.Local().Format("2006-01-02"), | ||
566 | - UserId: v.TargetUser.UserId, | ||
567 | - UserName: v.TargetUser.UserName, | ||
568 | - EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
569 | - InviteCompleted: 0, | ||
570 | - Status: string(v.Status), | ||
571 | - InviteTotal: 5, | ||
572 | - Department: "", | ||
573 | - Position: "", | ||
574 | - DutyTime: "", | 566 | + StaffAssessTaskId: v.StaffAssessTaskId, |
567 | + AssessId: v.Id, | ||
568 | + CycleId: int(v.CycleId), | ||
569 | + BeginDay: v.BeginTime.Local().Format("2006-01-02"), | ||
570 | + UserId: v.TargetUser.UserId, | ||
571 | + UserName: v.TargetUser.UserName, | ||
572 | + EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
573 | + InviteCompleted: 0, | ||
574 | + Status: string(v.Status), | ||
575 | + InviteTotal: 5, | ||
576 | + Department: "", | ||
577 | + Position: "", | ||
578 | + DutyTime: "", | ||
575 | } | 579 | } |
576 | //填入部门 | 580 | //填入部门 |
577 | for _, vv := range v.TargetDepartment { | 581 | for _, vv := range v.TargetDepartment { |
@@ -609,7 +613,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -609,7 +613,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
609 | return result, nil | 613 | return result, nil |
610 | } | 614 | } |
611 | 615 | ||
612 | -//根据周期和日期,获取员工的自评内容 | 616 | +// 根据周期和日期,获取员工的自评内容 |
613 | func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfAssessQuery) (*adapter.AssessInfoResp, error) { | 617 | func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfAssessQuery) (*adapter.AssessInfoResp, error) { |
614 | transactionContext, err := factory.CreateTransactionContext(nil) | 618 | transactionContext, err := factory.CreateTransactionContext(nil) |
615 | if err != nil { | 619 | if err != nil { |
@@ -661,6 +665,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | @@ -661,6 +665,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | ||
661 | } | 665 | } |
662 | } | 666 | } |
663 | 667 | ||
668 | + // 恢复缓存数据 | ||
669 | + if param.AcquireCache != 0 { | ||
670 | + srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList) | ||
671 | + } | ||
672 | + | ||
664 | //获取员工描述 | 673 | //获取员工描述 |
665 | staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId)) | 674 | staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId)) |
666 | if err := transactionContext.CommitTransaction(); err != nil { | 675 | if err := transactionContext.CommitTransaction(); err != nil { |
@@ -692,3 +701,87 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | @@ -692,3 +701,87 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | ||
692 | } | 701 | } |
693 | return &result, nil | 702 | return &result, nil |
694 | } | 703 | } |
704 | + | ||
705 | +//根据周期和日期。获取360评估的列表,员工的被其他人评估 | ||
706 | +func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { | ||
707 | + | ||
708 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
709 | + if err != nil { | ||
710 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
711 | + } | ||
712 | + if err := transactionContext.StartTransaction(); err != nil { | ||
713 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
714 | + } | ||
715 | + defer func() { | ||
716 | + _ = transactionContext.RollbackTransaction() | ||
717 | + }() | ||
718 | + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
719 | + "transactionContext": transactionContext, | ||
720 | + }) | ||
721 | + //获取员工的评估 | ||
722 | + cnt, assessList, err := assessReps.Find(map[string]interface{}{ | ||
723 | + "cycleId": param.CycleId, | ||
724 | + "beginDay": param.BeginDay, | ||
725 | + "companyId": param.CompanyId, | ||
726 | + "targetUserId": param.TargetUserId, | ||
727 | + "typesList": []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}, | ||
728 | + }) | ||
729 | + if err != nil { | ||
730 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) | ||
731 | + } | ||
732 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
733 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
734 | + } | ||
735 | + var resultList []map[string]interface{} | ||
736 | + for _, v := range assessList { | ||
737 | + item := map[string]interface{}{ | ||
738 | + "id": v.Id, | ||
739 | + "targetUser": v.TargetUser, | ||
740 | + "executor": v.Executor, | ||
741 | + } | ||
742 | + resultList = append(resultList, item) | ||
743 | + } | ||
744 | + return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil | ||
745 | +} | ||
746 | + | ||
747 | +//根据周期和日期。获取上级评估的列表,员工的被其他人评估 | ||
748 | +func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { | ||
749 | + | ||
750 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
751 | + if err != nil { | ||
752 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
753 | + } | ||
754 | + if err := transactionContext.StartTransaction(); err != nil { | ||
755 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
756 | + } | ||
757 | + defer func() { | ||
758 | + _ = transactionContext.RollbackTransaction() | ||
759 | + }() | ||
760 | + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
761 | + "transactionContext": transactionContext, | ||
762 | + }) | ||
763 | + //获取员工的评估 | ||
764 | + cnt, assessList, err := assessReps.Find(map[string]interface{}{ | ||
765 | + "cycleId": param.CycleId, | ||
766 | + "beginDay": param.BeginDay, | ||
767 | + "companyId": param.CompanyId, | ||
768 | + "targetUserId": param.TargetUserId, | ||
769 | + "typesList": []string{string(domain.AssessSuper)}, | ||
770 | + }) | ||
771 | + if err != nil { | ||
772 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) | ||
773 | + } | ||
774 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
775 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
776 | + } | ||
777 | + var resultList []map[string]interface{} | ||
778 | + for _, v := range assessList { | ||
779 | + item := map[string]interface{}{ | ||
780 | + "id": v.Id, | ||
781 | + "targetUser": v.TargetUser, | ||
782 | + "executor": v.Executor, | ||
783 | + } | ||
784 | + resultList = append(resultList, item) | ||
785 | + } | ||
786 | + return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil | ||
787 | +} |
@@ -18,6 +18,7 @@ type NodeTask struct { | @@ -18,6 +18,7 @@ type NodeTask struct { | ||
18 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` | 18 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` |
19 | KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"` | 19 | KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"` |
20 | NextSentAt *time.Time `json:"nextSentAt" comment:"下一次发送时间"` | 20 | NextSentAt *time.Time `json:"nextSentAt" comment:"下一次发送时间"` |
21 | + LastSentAt *time.Time `json:"lastSentAt" comment:"最后一次发送时间"` | ||
21 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | 22 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` |
22 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | 23 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` |
23 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | 24 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` |
@@ -12,6 +12,7 @@ type PerformanceApplicationForm struct { | @@ -12,6 +12,7 @@ type PerformanceApplicationForm struct { | ||
12 | Standard string //标准 | 12 | Standard string //标准 |
13 | Task string //任务、指标 | 13 | Task string //任务、指标 |
14 | Definition string //定义 | 14 | Definition string //定义 |
15 | + Required string // 是否必填 是 否 | ||
15 | } | 16 | } |
16 | 17 | ||
17 | type PerformanceDimension struct { | 18 | type PerformanceDimension struct { |
@@ -24,6 +25,7 @@ type PerformanceModule struct { | @@ -24,6 +25,7 @@ type PerformanceModule struct { | ||
24 | Weight string `json:"weight"` //权重 | 25 | Weight string `json:"weight"` //权重 |
25 | Standard string `json:"standard"` //标准(结构化的成果描述) | 26 | Standard string `json:"standard"` //标准(结构化的成果描述) |
26 | Target []*PerformanceTarget `json:"performanceTarget"` //任务\指标 | 27 | Target []*PerformanceTarget `json:"performanceTarget"` //任务\指标 |
28 | + Required int `json:"required"` // 是否必填 | ||
27 | } | 29 | } |
28 | 30 | ||
29 | type PerformanceTarget struct { | 31 | type PerformanceTarget struct { |
@@ -34,6 +36,7 @@ type PerformanceTarget struct { | @@ -34,6 +36,7 @@ type PerformanceTarget struct { | ||
34 | func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) { | 36 | func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) { |
35 | formRows := make([]*PerformanceApplicationForm, 0) | 37 | formRows := make([]*PerformanceApplicationForm, 0) |
36 | var dimensionName, moduleName, taskName, weightName, standardName string | 38 | var dimensionName, moduleName, taskName, weightName, standardName string |
39 | + required := "是" | ||
37 | for key, item := range rows { | 40 | for key, item := range rows { |
38 | if key < 3 { | 41 | if key < 3 { |
39 | continue | 42 | continue |
@@ -80,6 +83,11 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) | @@ -80,6 +83,11 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) | ||
80 | } | 83 | } |
81 | } | 84 | } |
82 | form.Standard = standardName | 85 | form.Standard = standardName |
86 | + //是否必填 | ||
87 | + if len(item) > 9 && item[9] != "" { | ||
88 | + required = strings.TrimSpace(item[9]) | ||
89 | + } | ||
90 | + form.Required = required | ||
83 | formRows = append(formRows, form) | 91 | formRows = append(formRows, form) |
84 | } | 92 | } |
85 | dimensions := make([]*PerformanceDimension, 0) | 93 | dimensions := make([]*PerformanceDimension, 0) |
@@ -144,11 +152,16 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM | @@ -144,11 +152,16 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM | ||
144 | if err != nil { | 152 | if err != nil { |
145 | return modules, err | 153 | return modules, err |
146 | } | 154 | } |
155 | + required, err := getRequired(item) | ||
156 | + if err != nil { | ||
157 | + return modules, err | ||
158 | + } | ||
147 | module := &PerformanceModule{ | 159 | module := &PerformanceModule{ |
148 | ModuleName: moduleName, | 160 | ModuleName: moduleName, |
149 | Weight: weightName, | 161 | Weight: weightName, |
150 | Standard: standardName, | 162 | Standard: standardName, |
151 | Target: tasks, | 163 | Target: tasks, |
164 | + Required: required, | ||
152 | } | 165 | } |
153 | modules = append(modules, module) | 166 | modules = append(modules, module) |
154 | } | 167 | } |
@@ -201,6 +214,27 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) { | @@ -201,6 +214,27 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) { | ||
201 | return name, nil | 214 | return name, nil |
202 | } | 215 | } |
203 | 216 | ||
217 | +// 获取是否必填 | ||
218 | +func getRequired(items []*PerformanceApplicationForm) (int, error) { | ||
219 | + if len(items) <= 0 { | ||
220 | + return NodeRequiredYes, nil | ||
221 | + } | ||
222 | + var name string | ||
223 | + for _, item := range items { | ||
224 | + if name == "" { | ||
225 | + name = item.Required | ||
226 | + } | ||
227 | + if name != item.Required { | ||
228 | + return NodeRequiredYes, errors.New(item.ModuleName + " 对应的是否必填不一致") | ||
229 | + } | ||
230 | + } | ||
231 | + if name == "否" { | ||
232 | + return NodeRequiredNo, nil | ||
233 | + } else { | ||
234 | + return NodeRequiredYes, nil | ||
235 | + } | ||
236 | +} | ||
237 | + | ||
204 | // 获取任务 | 238 | // 获取任务 |
205 | func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) { | 239 | func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) { |
206 | tasks := make([]*PerformanceTarget, 0) | 240 | tasks := make([]*PerformanceTarget, 0) |
@@ -28,5 +28,5 @@ type RoleUserRepository interface { | @@ -28,5 +28,5 @@ type RoleUserRepository interface { | ||
28 | Find(queryOptions map[string]interface{}) (int64, []*RoleUser, error) | 28 | Find(queryOptions map[string]interface{}) (int64, []*RoleUser, error) |
29 | Count(queryOptions map[string]interface{}) (int64, error) | 29 | Count(queryOptions map[string]interface{}) (int64, error) |
30 | BatchDeleteById(ids []int64) error | 30 | BatchDeleteById(ids []int64) error |
31 | - FindAllContainUser(pageSize int, pageNumber int, companyId int64, roleId int64) ([]*RoleContainUser, error) | 31 | + FindAllContainUser(pageSize int, pageNumber int, companyId int64, roleId int64) (int64, []*RoleContainUser, error) |
32 | } | 32 | } |
pkg/domain/staff_assess_cache.go
0 → 100644
1 | +package domain | ||
2 | + | ||
3 | +import "time" | ||
4 | + | ||
5 | +// StaffAssessCache 填写评估数据(缓存暂未提交) | ||
6 | +type StaffAssessCache struct { | ||
7 | + Id int64 `json:"id,string" comment:"ID"` | ||
8 | + AssessId int64 `json:"assessId,string" comment:"评估项ID"` | ||
9 | + AssessContent []AssessContent `json:"assessContent" comment:"评估项提交数据"` | ||
10 | + CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | ||
11 | + UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | ||
12 | + DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | ||
13 | +} | ||
14 | + | ||
15 | +type AssessContent struct { | ||
16 | + Category string `json:"category"` | ||
17 | + Name string `json:"name"` | ||
18 | + Value string `json:"value"` | ||
19 | + Remark []RemarkText `json:"remark"` | ||
20 | +} | ||
21 | + | ||
22 | +type RemarkText struct { | ||
23 | + Title string `json:"title"` | ||
24 | + RemarkText string `json:"remarkText"` | ||
25 | +} | ||
26 | + | ||
27 | +type StaffAssessCacheRepository interface { | ||
28 | + Save(param *StaffAssessCache) (*StaffAssessCache, error) | ||
29 | + Remove(id int64) error | ||
30 | + FindOne(queryOptions map[string]interface{}) (*StaffAssessCache, error) | ||
31 | + Find(queryOptions map[string]interface{}) (int, []*StaffAssessCache, error) | ||
32 | +} |
@@ -93,6 +93,12 @@ func (content *StaffAssessContent) scoreValue() error { | @@ -93,6 +93,12 @@ func (content *StaffAssessContent) scoreValue() error { | ||
93 | return errors.New("评分填写的值错误") | 93 | return errors.New("评分填写的值错误") |
94 | } | 94 | } |
95 | 95 | ||
96 | +//type StaffAssessContentSort []*StaffAssessContent | ||
97 | +// | ||
98 | +//func (a StaffAssessContentSort) Len() int { return len(a) } | ||
99 | +//func (a StaffAssessContentSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] } | ||
100 | +//func (a StaffAssessContentSort) Less(i, j int) bool { return a[i].SortBy < a[j].SortBy } | ||
101 | + | ||
96 | type StaffAssessContentRepository interface { | 102 | type StaffAssessContentRepository interface { |
97 | Save(param *StaffAssessContent) (*StaffAssessContent, error) | 103 | Save(param *StaffAssessContent) (*StaffAssessContent, error) |
98 | Remove(id int) error | 104 | Remove(id int) error |
pkg/domain/user_auth_test.go
0 → 100644
@@ -145,7 +145,10 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error | @@ -145,7 +145,10 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error | ||
145 | staff_assess_task.company_id , | 145 | staff_assess_task.company_id , |
146 | staff_assess_task.cycle_name | 146 | staff_assess_task.cycle_name |
147 | from staff_assess_task | 147 | from staff_assess_task |
148 | - where staff_assess_task.company_id = ?` | 148 | + where staff_assess_task.company_id = ? |
149 | + and staff_assess_task.deleted_at isnull | ||
150 | + order by staff_assess_task.cycle_id desc | ||
151 | + ` | ||
149 | 152 | ||
150 | tx := d.transactionContext.PgTx | 153 | tx := d.transactionContext.PgTx |
151 | condition := []interface{}{ | 154 | condition := []interface{}{ |
@@ -172,7 +175,9 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As | @@ -172,7 +175,9 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As | ||
172 | staff_assess_task.company_id | 175 | staff_assess_task.company_id |
173 | from staff_assess_task | 176 | from staff_assess_task |
174 | where staff_assess_task.cycle_id = ? | 177 | where staff_assess_task.cycle_id = ? |
175 | - and company_id =? ` | 178 | + and company_id =? |
179 | + and staff_assess_task.deleted_at isnull | ||
180 | + order by staff_assess_task.begin_day desc ` | ||
176 | 181 | ||
177 | tx := d.transactionContext.PgTx | 182 | tx := d.transactionContext.PgTx |
178 | condition := []interface{}{ | 183 | condition := []interface{}{ |
@@ -185,17 +190,17 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As | @@ -185,17 +190,17 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As | ||
185 | 190 | ||
186 | //获取员工填写评估内容 | 191 | //获取员工填写评估内容 |
187 | type UserAssessContent struct { | 192 | type UserAssessContent struct { |
188 | - AssessId string `json:"assessId"` | ||
189 | - ContentId int `json:"contentId"` | ||
190 | - TargetUserId string `json:"targetUserId"` //被评估人的id | ||
191 | - TargetUserName string `json:"targetUserName"` //被评估人的名称 | ||
192 | - BeginDay string `json:"beginDay"` //评估的日期 | ||
193 | - EvaluationProjectId string `json:"evaluationProjectId"` //项目id | ||
194 | - Value string `json:"value"` //评估填写的值 | ||
195 | - SortBy int `json:"sortBy"` //评估项顺序 | ||
196 | - Category string `json:"category"` //评估项分类 | ||
197 | - ContentName string `json:"contentName"` //评估项名称 | ||
198 | - Weight int `json:"weight"` //权重 | 193 | + AssessId string `json:"assessId"` |
194 | + ContentId int `json:"contentId"` | ||
195 | + TargetUserId string `json:"targetUserId"` //被评估人的id | ||
196 | + TargetUserName string `json:"targetUserName"` //被评估人的名称 | ||
197 | + BeginDay string `json:"beginDay"` //评估的日期 | ||
198 | + EvaluationProjectId string `json:"evaluationProjectId"` //项目id | ||
199 | + Value string `json:"value"` //评估填写的值 | ||
200 | + SortBy int `json:"sortBy"` //评估项顺序 | ||
201 | + Category string `json:"category"` //评估项分类 | ||
202 | + ContentName string `json:"contentName"` //评估项名称 | ||
203 | + Weight float64 `json:"weight"` //权重 | ||
199 | } | 204 | } |
200 | 205 | ||
201 | type SearchConditin1 struct { | 206 | type SearchConditin1 struct { |
@@ -292,33 +297,41 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -292,33 +297,41 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
292 | set time zone 'PRC'; | 297 | set time zone 'PRC'; |
293 | with t_user_department as ( | 298 | with t_user_department as ( |
294 | select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user" | 299 | select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user" |
295 | - where "user".company_id= %d | 300 | + where "user".company_id= %d and "user".deleted_at isnull |
296 | ), | 301 | ), |
297 | t_department as ( | 302 | t_department as ( |
298 | - select department.id::text as depart_id from department where charge_user_ids @>'[%d]' | 303 | + select department.id::text as depart_id from department where charge_user_ids @>'[%d]' |
304 | + and "department".deleted_at isnull | ||
299 | ), | 305 | ), |
306 | + -- 部门主管 | ||
300 | t_user_1 as ( | 307 | t_user_1 as ( |
301 | select t_user_department.user_id::text from t_user_department | 308 | select t_user_department.user_id::text from t_user_department |
302 | join t_department on t_user_department.depart_id = t_department.depart_id | 309 | join t_department on t_user_department.depart_id = t_department.depart_id |
303 | ), | 310 | ), |
311 | + -- 如果是hrbp | ||
304 | t_project_1 as( | 312 | t_project_1 as( |
305 | select evaluation_project.id as project_id | 313 | select evaluation_project.id as project_id |
306 | from evaluation_project | 314 | from evaluation_project |
307 | where evaluation_project.cycle_id =%d | 315 | where evaluation_project.cycle_id =%d |
308 | and evaluation_project.hr_bp = %d | 316 | and evaluation_project.hr_bp = %d |
317 | + and evaluation_project.deleted_at isnull | ||
309 | ), | 318 | ), |
319 | + -- 如果的项目管理员 | ||
310 | t_project_2 as( | 320 | t_project_2 as( |
311 | select evaluation_project.id as project_id | 321 | select evaluation_project.id as project_id |
312 | from evaluation_project | 322 | from evaluation_project |
313 | where evaluation_project.cycle_id =%d | 323 | where evaluation_project.cycle_id =%d |
314 | and evaluation_project.pmp =1 | 324 | and evaluation_project.pmp =1 |
315 | and evaluation_project.pmp_ids @>'["%d"]' | 325 | and evaluation_project.pmp_ids @>'["%d"]' |
326 | + and evaluation_project.deleted_at isnull | ||
316 | ), | 327 | ), |
328 | + -- 合并数据 | ||
317 | t_project_3 as ( | 329 | t_project_3 as ( |
318 | select t_project_2.project_id from t_project_2 | 330 | select t_project_2.project_id from t_project_2 |
319 | union | 331 | union |
320 | select t_project_1.project_id from t_project_1 | 332 | select t_project_1.project_id from t_project_1 |
321 | ), | 333 | ), |
334 | + -- 初步过滤数据 | ||
322 | t_staff_assess_0 as ( | 335 | t_staff_assess_0 as ( |
323 | select staff_assess.id as assess_id, | 336 | select staff_assess.id as assess_id, |
324 | staff_assess.target_user->>'userId' as target_user_id, | 337 | staff_assess.target_user->>'userId' as target_user_id, |
@@ -326,10 +339,13 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -326,10 +339,13 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
326 | to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day, | 339 | to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day, |
327 | staff_assess.evaluation_project_id | 340 | staff_assess.evaluation_project_id |
328 | from staff_assess | 341 | from staff_assess |
342 | + join staff_assess_task on staff_assess.staff_assess_task_id = staff_assess_task.id | ||
343 | + and staff_assess_task.deleted_at isnull | ||
329 | where staff_assess.cycle_id = %d | 344 | where staff_assess.cycle_id = %d |
330 | and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s' | 345 | and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s' |
331 | and staff_assess."types" ='self' | 346 | and staff_assess."types" ='self' |
332 | ), | 347 | ), |
348 | + -- 根据查看权限过滤合并数据 | ||
333 | t_staff_assess_1 as ( | 349 | t_staff_assess_1 as ( |
334 | (select t_staff_assess_0.assess_id, | 350 | (select t_staff_assess_0.assess_id, |
335 | t_staff_assess_0.target_user_id, | 351 | t_staff_assess_0.target_user_id, |
@@ -358,16 +374,16 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -358,16 +374,16 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
358 | type ExportData1 struct { | 374 | type ExportData1 struct { |
359 | AssessId string | 375 | AssessId string |
360 | ContentId int | 376 | ContentId int |
361 | - TargetUserId string //被评估人的id | ||
362 | - TargetUserName string //被评估人的名称 | ||
363 | - BeginDay string //评估的日期 | ||
364 | - EvaluationProjectId string //项目id | ||
365 | - Value string //评估填写的值 | ||
366 | - SortBy int //评估项顺序 | ||
367 | - Category string //评估项分类 | ||
368 | - ContentName string //评估项名称 | ||
369 | - Weight int //权重 | ||
370 | - PromptText string //评估标准 | 377 | + TargetUserId string //被评估人的id |
378 | + TargetUserName string //被评估人的名称 | ||
379 | + BeginDay string //评估的日期 | ||
380 | + EvaluationProjectId string //项目id | ||
381 | + Value string //评估填写的值 | ||
382 | + SortBy int //评估项顺序 | ||
383 | + Category string //评估项分类 | ||
384 | + ContentName string //评估项名称 | ||
385 | + Weight float64 //权重 | ||
386 | + PromptText string //评估标准 | ||
371 | Remark []domain.AssessContemtRemark | 387 | Remark []domain.AssessContemtRemark |
372 | } | 388 | } |
373 | 389 | ||
@@ -410,9 +426,11 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa | @@ -410,9 +426,11 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa | ||
410 | } | 426 | } |
411 | 427 | ||
412 | type AssessCycleDayMe struct { | 428 | type AssessCycleDayMe struct { |
413 | - BeginDay string `json:"beginDay"` | ||
414 | - CycleId int `json:"cycleId"` | ||
415 | - CycleName string `json:"cycleName"` | 429 | + BeginDay string |
430 | + CycleId string | ||
431 | + CycleName string | ||
432 | + EndTime string | ||
433 | + BeginTime string | ||
416 | } | 434 | } |
417 | 435 | ||
418 | // 根据评估的人执行人id,搜索 executorId参与的评估周期 | 436 | // 根据评估的人执行人id,搜索 executorId参与的评估周期 |
@@ -425,13 +443,16 @@ func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limi | @@ -425,13 +443,16 @@ func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limi | ||
425 | } | 443 | } |
426 | sqlStr := ` | 444 | sqlStr := ` |
427 | SELECT | 445 | SELECT |
428 | - staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day | 446 | + distinct on(staff_assess_task.cycle_id,staff_assess_task.begin_day) |
447 | + staff_assess_task.cycle_id,staff_assess_task.cycle_name , | ||
448 | + staff_assess_task.begin_day, | ||
449 | + to_char(staff_assess_task.end_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as end_time, | ||
450 | + to_char(staff_assess_task.begin_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as begin_time | ||
429 | FROM staff_assess_task | 451 | FROM staff_assess_task |
430 | JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" | 452 | JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" |
431 | WHERE staff_assess.company_id=? | 453 | WHERE staff_assess.company_id=? |
432 | and staff_assess_task.deleted_at isnull | 454 | and staff_assess_task.deleted_at isnull |
433 | and staff_assess.executor->>'userId'='?' | 455 | and staff_assess.executor->>'userId'='?' |
434 | - group by staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day | ||
435 | order by staff_assess_task.begin_day desc | 456 | order by staff_assess_task.begin_day desc |
436 | limit ? offset ? | 457 | limit ? offset ? |
437 | ` | 458 | ` |
@@ -45,6 +45,7 @@ func init() { | @@ -45,6 +45,7 @@ func init() { | ||
45 | &models.StaffAssess{}, | 45 | &models.StaffAssess{}, |
46 | &models.StaffAssessTask{}, | 46 | &models.StaffAssessTask{}, |
47 | &models.StaffAssessContent{}, | 47 | &models.StaffAssessContent{}, |
48 | + &models.StaffAssessCache{}, | ||
48 | } | 49 | } |
49 | for _, model := range tables { | 50 | for _, model := range tables { |
50 | err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ | 51 | err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ |
@@ -19,6 +19,7 @@ type NodeTask struct { | @@ -19,6 +19,7 @@ type NodeTask struct { | ||
19 | TimeEnd *time.Time `comment:"截至时间"` | 19 | TimeEnd *time.Time `comment:"截至时间"` |
20 | KpiCycle int `comment:"考核周期(1日、2周、3月)"` | 20 | KpiCycle int `comment:"考核周期(1日、2周、3月)"` |
21 | NextSentAt *time.Time `comment:"下一次发送时间"` | 21 | NextSentAt *time.Time `comment:"下一次发送时间"` |
22 | + LastSentAt *time.Time `comment:"最后一次发送时间"` | ||
22 | CreatedAt time.Time `comment:"创建时间"` | 23 | CreatedAt time.Time `comment:"创建时间"` |
23 | UpdatedAt time.Time `comment:"更新时间"` | 24 | UpdatedAt time.Time `comment:"更新时间"` |
24 | DeletedAt *time.Time `comment:"删除时间"` | 25 | DeletedAt *time.Time `comment:"删除时间"` |
1 | +package models | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +// StaffAssessCache 提交评估项内容缓存 | ||
10 | +type StaffAssessCache struct { | ||
11 | + tableName struct{} `comment:"评估项填写内容缓存" pg:"staff_assess_cache"` | ||
12 | + Id int64 `comment:"ID" pg:",pk"` | ||
13 | + AssessId int64 `comment:"评估项ID"` | ||
14 | + AssessContent []domain.AssessContent `comment:"评估项提交数据"` | ||
15 | + CreatedAt time.Time `comment:"创建时间"` | ||
16 | + UpdatedAt time.Time `comment:"更新时间"` | ||
17 | + DeletedAt *time.Time `comment:"删除时间"` | ||
18 | +} |
@@ -35,6 +35,7 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod | @@ -35,6 +35,7 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod | ||
35 | TimeEnd: m.TimeEnd, | 35 | TimeEnd: m.TimeEnd, |
36 | KpiCycle: m.KpiCycle, | 36 | KpiCycle: m.KpiCycle, |
37 | NextSentAt: m.NextSentAt, | 37 | NextSentAt: m.NextSentAt, |
38 | + LastSentAt: m.LastSentAt, | ||
38 | CreatedAt: m.CreatedAt.Local(), | 39 | CreatedAt: m.CreatedAt.Local(), |
39 | UpdatedAt: m.UpdatedAt.Local(), | 40 | UpdatedAt: m.UpdatedAt.Local(), |
40 | DeletedAt: m.DeletedAt, | 41 | DeletedAt: m.DeletedAt, |
@@ -56,6 +57,7 @@ func (repo *NodeTaskRepository) TransformToModel(d *domain.NodeTask) models.Node | @@ -56,6 +57,7 @@ func (repo *NodeTaskRepository) TransformToModel(d *domain.NodeTask) models.Node | ||
56 | TimeEnd: d.TimeEnd, | 57 | TimeEnd: d.TimeEnd, |
57 | KpiCycle: d.KpiCycle, | 58 | KpiCycle: d.KpiCycle, |
58 | NextSentAt: d.NextSentAt, | 59 | NextSentAt: d.NextSentAt, |
60 | + LastSentAt: d.LastSentAt, | ||
59 | CreatedAt: d.CreatedAt, | 61 | CreatedAt: d.CreatedAt, |
60 | UpdatedAt: d.UpdatedAt, | 62 | UpdatedAt: d.UpdatedAt, |
61 | DeletedAt: d.DeletedAt, | 63 | DeletedAt: d.DeletedAt, |
@@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error { | @@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error { | ||
182 | return err | 182 | return err |
183 | } | 183 | } |
184 | 184 | ||
185 | -func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) ([]*domain.RoleContainUser, error) { | 185 | +func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) (int64, []*domain.RoleContainUser, error) { |
186 | limit := pageSize | 186 | limit := pageSize |
187 | offset := limit * (pageNumber - 1) | 187 | offset := limit * (pageNumber - 1) |
188 | if offset < 0 { | 188 | if offset < 0 { |
@@ -210,9 +210,15 @@ func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, | @@ -210,9 +210,15 @@ func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, | ||
210 | } | 210 | } |
211 | dataSql += whereFrom | 211 | dataSql += whereFrom |
212 | dataSql = fmt.Sprintf("%s limit %d offset %d", dataSql, limit, offset) | 212 | dataSql = fmt.Sprintf("%s limit %d offset %d", dataSql, limit, offset) |
213 | + countSql := ` SELECT COUNT(*) ` + whereFrom | ||
213 | 214 | ||
214 | tx := repo.transactionContext.PgTx | 215 | tx := repo.transactionContext.PgTx |
216 | + | ||
217 | + var total int64 | ||
215 | var dataList = make([]*domain.RoleContainUser, 0) | 218 | var dataList = make([]*domain.RoleContainUser, 0) |
216 | _, err := tx.Query(&dataList, dataSql, param...) | 219 | _, err := tx.Query(&dataList, dataSql, param...) |
217 | - return dataList, err | 220 | + |
221 | + // 获取总数量 | ||
222 | + _, _ = tx.QueryOne(pg.Scan(&total), countSql, param...) | ||
223 | + return total, dataList, err | ||
218 | } | 224 | } |
1 | +package repository | ||
2 | + | ||
3 | +import ( | ||
4 | + "errors" | ||
5 | + "fmt" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils" | ||
7 | + "time" | ||
8 | + | ||
9 | + "github.com/go-pg/pg/v10" | ||
10 | + pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models" | ||
13 | +) | ||
14 | + | ||
15 | +type StaffAssessCacheRepository struct { | ||
16 | + transactionContext *pgTransaction.TransactionContext | ||
17 | +} | ||
18 | + | ||
19 | +//var _ domain.StaffAssessCacheRepository = (*StaffAssessCacheRepository)(nil) | ||
20 | + | ||
21 | +func NewStaffAssessCacheRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessCacheRepository { | ||
22 | + return &StaffAssessCacheRepository{transactionContext: transactionContext} | ||
23 | +} | ||
24 | + | ||
25 | +func (repo *StaffAssessCacheRepository) TransformToDomain(m *models.StaffAssessCache) domain.StaffAssessCache { | ||
26 | + return domain.StaffAssessCache{ | ||
27 | + Id: m.Id, | ||
28 | + AssessId: m.AssessId, | ||
29 | + AssessContent: m.AssessContent, | ||
30 | + CreatedAt: m.CreatedAt, | ||
31 | + UpdatedAt: m.UpdatedAt, | ||
32 | + DeletedAt: m.DeletedAt, | ||
33 | + } | ||
34 | +} | ||
35 | + | ||
36 | +func (repo *StaffAssessCacheRepository) TransformToModel(d *domain.StaffAssessCache) models.StaffAssessCache { | ||
37 | + return models.StaffAssessCache{ | ||
38 | + Id: d.Id, | ||
39 | + AssessId: d.AssessId, | ||
40 | + AssessContent: d.AssessContent, | ||
41 | + CreatedAt: d.CreatedAt, | ||
42 | + UpdatedAt: d.UpdatedAt, | ||
43 | + DeletedAt: d.DeletedAt, | ||
44 | + } | ||
45 | +} | ||
46 | + | ||
47 | +func (repo *StaffAssessCacheRepository) nextIdentify() (int64, error) { | ||
48 | + return utils.NewSnowflakeId() | ||
49 | +} | ||
50 | + | ||
51 | +func (repo *StaffAssessCacheRepository) Save(d *domain.StaffAssessCache) (*domain.StaffAssessCache, error) { | ||
52 | + var isCreate = d.Id == 0 | ||
53 | + if isCreate { | ||
54 | + id, err := repo.nextIdentify() | ||
55 | + if err != nil { | ||
56 | + return d, err | ||
57 | + } | ||
58 | + d.Id = id | ||
59 | + d.CreatedAt = time.Now() | ||
60 | + d.UpdatedAt = d.CreatedAt | ||
61 | + } else { | ||
62 | + d.UpdatedAt = time.Now() | ||
63 | + } | ||
64 | + m := repo.TransformToModel(d) | ||
65 | + tx := repo.transactionContext.PgTx | ||
66 | + var err error | ||
67 | + if isCreate { | ||
68 | + _, err = tx.Model(&m).Returning("id").Insert() | ||
69 | + } else { | ||
70 | + _, err = tx.Model(&m).Returning("id").WherePK().Update() // 更新和删除必须增加条件 | ||
71 | + } | ||
72 | + if err != nil { | ||
73 | + return nil, err | ||
74 | + } | ||
75 | + d.Id = m.Id | ||
76 | + return d, nil | ||
77 | +} | ||
78 | + | ||
79 | +func (repo *StaffAssessCacheRepository) Remove(id int64) error { | ||
80 | + tx := repo.transactionContext.PgTx | ||
81 | + nowTime := time.Now() | ||
82 | + _, err := tx.Model(&models.StaffAssessCache{}).Where("id=?", id).Set("deleted_at=?", nowTime).Update() | ||
83 | + return err | ||
84 | +} | ||
85 | + | ||
86 | +func (repo *StaffAssessCacheRepository) FindOne(queryOptions map[string]interface{}) (*domain.StaffAssessCache, error) { | ||
87 | + tx := repo.transactionContext.PgTx | ||
88 | + m := new(models.StaffAssessCache) | ||
89 | + query := tx.Model(m) | ||
90 | + query.Where("deleted_at isnull") | ||
91 | + if id, ok := queryOptions["id"]; ok { | ||
92 | + query.Where("id=?", id) | ||
93 | + } | ||
94 | + if err := query.First(); err != nil { | ||
95 | + if errors.Is(err, pg.ErrNoRows) { | ||
96 | + return nil, fmt.Errorf("没有此资源") | ||
97 | + } else { | ||
98 | + return nil, err | ||
99 | + } | ||
100 | + } | ||
101 | + u := repo.TransformToDomain(m) | ||
102 | + return &u, nil | ||
103 | +} | ||
104 | + | ||
105 | +func (repo *StaffAssessCacheRepository) Find(queryOptions map[string]interface{}) (int, []*domain.StaffAssessCache, error) { | ||
106 | + tx := repo.transactionContext.PgTx | ||
107 | + var m []*models.StaffAssessCache | ||
108 | + query := tx.Model(&m).Where("deleted_at isnull") | ||
109 | + | ||
110 | + if v, ok := queryOptions["assessId"]; ok { | ||
111 | + query.Where("assess_id=?", v) | ||
112 | + } | ||
113 | + | ||
114 | + if v, ok := queryOptions["limit"].(int); ok { | ||
115 | + query.Limit(v) | ||
116 | + } | ||
117 | + | ||
118 | + if v, ok := queryOptions["offset"].(int); ok { | ||
119 | + query.Offset(v) | ||
120 | + } | ||
121 | + | ||
122 | + count, err := query.SelectAndCount() | ||
123 | + if err != nil { | ||
124 | + return 0, nil, err | ||
125 | + } | ||
126 | + var arrays []*domain.StaffAssessCache | ||
127 | + for _, v := range m { | ||
128 | + d := repo.TransformToDomain(v) | ||
129 | + arrays = append(arrays, &d) | ||
130 | + } | ||
131 | + return count, arrays, nil | ||
132 | +} |
@@ -128,6 +128,8 @@ func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface | @@ -128,6 +128,8 @@ func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface | ||
128 | if v, ok := queryOptions["staffAssessId"]; ok { | 128 | if v, ok := queryOptions["staffAssessId"]; ok { |
129 | query.Where("staff_assess_id=?", v) | 129 | query.Where("staff_assess_id=?", v) |
130 | } | 130 | } |
131 | + | ||
132 | + query.Order("sort_by ASC") | ||
131 | count, err := query.SelectAndCount() | 133 | count, err := query.SelectAndCount() |
132 | if err != nil { | 134 | if err != nil { |
133 | return 0, nil, err | 135 | return 0, nil, err |
@@ -117,9 +117,10 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | @@ -117,9 +117,10 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | ||
117 | tx := repo.transactionContext.PgTx | 117 | tx := repo.transactionContext.PgTx |
118 | var m []*models.StaffAssess | 118 | var m []*models.StaffAssess |
119 | query := tx.Model(&m). | 119 | query := tx.Model(&m). |
120 | - Where("deleted_at isnull") | 120 | + Where("staff_assess.deleted_at isnull"). |
121 | + Join(`JOIN staff_assess_task ON staff_assess_task."id" = staff_assess."staff_assess_task_id" and staff_assess_task."deleted_at" isnull`) | ||
121 | if companyId, ok := queryOptions["companyId"]; ok { | 122 | if companyId, ok := queryOptions["companyId"]; ok { |
122 | - query.Where("company_id = ?", companyId) | 123 | + query.Where("staff_assess.company_id = ?", companyId) |
123 | } | 124 | } |
124 | if v, ok := queryOptions["limit"].(int); ok { | 125 | if v, ok := queryOptions["limit"].(int); ok { |
125 | query.Limit(v) | 126 | query.Limit(v) |
@@ -127,35 +128,35 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | @@ -127,35 +128,35 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | ||
127 | if v, ok := queryOptions["offset"].(int); ok { | 128 | if v, ok := queryOptions["offset"].(int); ok { |
128 | query.Offset(v) | 129 | query.Offset(v) |
129 | } | 130 | } |
130 | - if v, ok := queryOptions["targetUserId"].(int); ok && v > 0 { | ||
131 | - query.Where(`target_user->>'userId'='?'`, v) | 131 | + if v, ok := queryOptions["targetUserId"]; ok { |
132 | + query.Where(`staff_assess.target_user->>'userId'='?'`, v) | ||
132 | } | 133 | } |
133 | 134 | ||
134 | - if v, ok := queryOptions["targetUserName"].(int); ok && v > 0 { | ||
135 | - query.Where(`target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v)) | 135 | + if v, ok := queryOptions["targetUserName"].(string); ok { |
136 | + query.Where(`staff_assess.target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v)) | ||
136 | } | 137 | } |
137 | - if v, ok := queryOptions["executorId"].(int); ok && v > 0 { | ||
138 | - query.Where(`executor->>'userId'='?'`, v) | 138 | + if v, ok := queryOptions["executorId"]; ok { |
139 | + query.Where(`staff_assess.executor->>'userId'='?'`, v) | ||
139 | } | 140 | } |
140 | 141 | ||
141 | - if v, ok := queryOptions["cycleId"].(int64); ok && v > 0 { | ||
142 | - query.Where(`cycle_id=?`, v) | 142 | + if v, ok := queryOptions["cycleId"]; ok { |
143 | + query.Where(`staff_assess.cycle_id=?`, v) | ||
143 | } | 144 | } |
144 | if v, ok := queryOptions["staffAssessTaskId"]; ok { | 145 | if v, ok := queryOptions["staffAssessTaskId"]; ok { |
145 | - query.Where(`staff_assess_task_id=?`, v) | 146 | + query.Where(`staff_assess.staff_assess_task_id=?`, v) |
146 | } | 147 | } |
147 | 148 | ||
148 | if v, ok := queryOptions["id"]; ok { | 149 | if v, ok := queryOptions["id"]; ok { |
149 | - query.Where("id=?", v) | 150 | + query.Where("staff_assess.id=?", v) |
150 | } | 151 | } |
151 | if v, ok := queryOptions["typesList"].([]string); ok { | 152 | if v, ok := queryOptions["typesList"].([]string); ok { |
152 | - query.Where("types in(?)", pg.In(v)) | 153 | + query.Where("staff_assess.types in(?)", pg.In(v)) |
153 | } | 154 | } |
154 | - if v, ok := queryOptions["status"].(string); ok { | ||
155 | - query.Where("status=?", v) | 155 | + if v, ok := queryOptions["status"]; ok { |
156 | + query.Where("staff_assess.status=?", v) | ||
156 | } | 157 | } |
157 | if v, ok := queryOptions["endTime"]; ok { | 158 | if v, ok := queryOptions["endTime"]; ok { |
158 | - query.Where("end_time<=?", v) | 159 | + query.Where("staff_assess.end_time<=?", v) |
159 | } | 160 | } |
160 | if v, ok := queryOptions["beginDay"]; ok { | 161 | if v, ok := queryOptions["beginDay"]; ok { |
161 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) | 162 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) |
@@ -123,7 +123,7 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{}) | @@ -123,7 +123,7 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{}) | ||
123 | if v, ok := queryOptions["cycleId"]; ok { | 123 | if v, ok := queryOptions["cycleId"]; ok { |
124 | query.Where("cycle_id=?", v) | 124 | query.Where("cycle_id=?", v) |
125 | } | 125 | } |
126 | - if v, ok := queryOptions["executorId"].(int); ok && v > 0 { | 126 | + if v, ok := queryOptions["executorId"]; ok { |
127 | query.Where(`executor_id @>'[?]'`, v) | 127 | query.Where(`executor_id @>'[?]'`, v) |
128 | } | 128 | } |
129 | if v, ok := queryOptions["evaluationProjectId"]; ok { | 129 | if v, ok := queryOptions["evaluationProjectId"]; ok { |
@@ -121,7 +121,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | @@ -121,7 +121,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf | ||
121 | } | 121 | } |
122 | 122 | ||
123 | // 必填项 | 123 | // 必填项 |
124 | - nc.Required = domain.NodeRequiredYes | 124 | + nc.Required = module.Required |
125 | nodeContents = append(nodeContents, nc) | 125 | nodeContents = append(nodeContents, nc) |
126 | } | 126 | } |
127 | } | 127 | } |
1 | -package controllers | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - | ||
6 | - "github.com/linmadan/egglib-go/core/application" | ||
7 | - "github.com/linmadan/egglib-go/web/beego" | ||
8 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" | ||
9 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" | ||
10 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service" | ||
11 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
12 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | ||
13 | -) | ||
14 | - | ||
15 | -type StaffAssessController struct { | ||
16 | - beego.BaseController | ||
17 | -} | ||
18 | - | ||
19 | -// 获取我的绩效任务列表 | ||
20 | -func (c *StaffAssessController) SearchAssessTaskMe() { | ||
21 | - srv := service.NewStaffAssessServeice() | ||
22 | - paramReq := &query.SearchAssessMeQuery{} | ||
23 | - err := c.BindJSON(paramReq) | ||
24 | - if err != nil { | ||
25 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
26 | - c.Response(nil, e) | ||
27 | - return | ||
28 | - } | ||
29 | - userReq := middlewares.GetUser(c.Ctx) | ||
30 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
31 | - paramReq.UserId = int(userReq.UserId) | ||
32 | - | ||
33 | - data, err := srv.SearchAssessTaskMe(paramReq) | ||
34 | - c.Response(data, err) | ||
35 | -} | ||
36 | - | ||
37 | -// 获取我的绩效任务各环节完成情况 | ||
38 | -func (c *StaffAssessController) AssessTaskMeDesc() { | ||
39 | - srv := service.NewStaffAssessServeice() | ||
40 | - paramReq := &query.AssessTaskDescQuery{} | ||
41 | - err := c.BindJSON(paramReq) | ||
42 | - if err != nil { | ||
43 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
44 | - c.Response(nil, e) | ||
45 | - return | ||
46 | - } | ||
47 | - userReq := middlewares.GetUser(c.Ctx) | ||
48 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
49 | - paramReq.UserId = int(userReq.UserId) | ||
50 | - data, err := srv.AssessTaskDesc(paramReq) | ||
51 | - c.Response(data, err) | ||
52 | -} | ||
53 | - | ||
54 | -// 获取个人的自评反馈历史记录列表 | ||
55 | -func (c *StaffAssessController) AssessSelfMeList() { | ||
56 | - srv := service.NewStaffAssessServeice() | ||
57 | - paramReq := &query.AssessSelfListQuery{} | ||
58 | - err := c.BindJSON(paramReq) | ||
59 | - if err != nil { | ||
60 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
61 | - c.Response(nil, e) | ||
62 | - return | ||
63 | - } | ||
64 | - userReq := middlewares.GetUser(c.Ctx) | ||
65 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
66 | - paramReq.UserId = int(userReq.UserId) | ||
67 | - data, err := srv.AssessSelfList(paramReq) | ||
68 | - c.Response(data, err) | ||
69 | -} | ||
70 | - | ||
71 | -// 更具项目评估的配置,创建员工的评估任务,(调试用) | ||
72 | -func (c *StaffAssessController) CreateStaffAssessTask() { | ||
73 | - srv := service.NewStaffAssessServeice() | ||
74 | - paramReq := &command.CreateStaffAssessTask{} | ||
75 | - err := c.BindJSON(paramReq) | ||
76 | - if err != nil { | ||
77 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
78 | - c.Response(nil, e) | ||
79 | - return | ||
80 | - } | ||
81 | - //服务调用,实际由定时任务触发 | ||
82 | - data, err := srv.InvokCreateStaffAssessTask(paramReq) | ||
83 | - c.Response(data, err) | ||
84 | -} | ||
85 | - | ||
86 | -// 获取当前登录员工自评详情 | ||
87 | -func (c *StaffAssessController) GetAssessSelfMeInfo() { | ||
88 | - srv := service.NewStaffAssessServeice() | ||
89 | - paramReq := &query.AssessSelfInfoQuery{} | ||
90 | - err := c.BindJSON(paramReq) | ||
91 | - if err != nil { | ||
92 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
93 | - c.Response(nil, e) | ||
94 | - return | ||
95 | - } | ||
96 | - userReq := middlewares.GetUser(c.Ctx) | ||
97 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
98 | - paramReq.TargetUserId = int(userReq.UserId) | ||
99 | - data, err := srv.GetAssessSelfInfo(paramReq) | ||
100 | - c.Response(data, err) | ||
101 | -} | ||
102 | - | ||
103 | -// 获取我邀请的人 | ||
104 | -func (c *StaffAssessController) GetAssessMeInviteUser() { | ||
105 | - srv := service.NewStaffAssessServeice() | ||
106 | - paramReq := &query.GetAssessInviteUserQuery{} | ||
107 | - err := c.BindJSON(paramReq) | ||
108 | - if err != nil { | ||
109 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
110 | - c.Response(nil, e) | ||
111 | - return | ||
112 | - } | ||
113 | - userReq := middlewares.GetUser(c.Ctx) | ||
114 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
115 | - paramReq.UserId = int(userReq.UserId) | ||
116 | - data, err := srv.GetAssessInviteUser(paramReq) | ||
117 | - c.Response(data, err) | ||
118 | -} | ||
119 | - | ||
120 | -// 保存我邀请的员工 | ||
121 | -func (c *StaffAssessController) SaveAssessMeInviteUser() { | ||
122 | - srv := service.NewStaffAssessServeice() | ||
123 | - paramReq := &command.SaveAssessInvite{} | ||
124 | - err := c.BindJSON(paramReq) | ||
125 | - if err != nil { | ||
126 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
127 | - c.Response(nil, e) | ||
128 | - return | ||
129 | - } | ||
130 | - //TODO 获取当前用户信息 | ||
131 | - // paramReq.CompanyId = 1 | ||
132 | - // paramReq.UserId = 1 | ||
133 | - userReq := middlewares.GetUser(c.Ctx) | ||
134 | - paramReq.TargetUserId = int(userReq.UserId) | ||
135 | - data, err := srv.SaveAssessInviteUser(paramReq) | ||
136 | - c.Response(data, err) | ||
137 | -} | ||
138 | - | ||
139 | -// 员工邀请的人选择列表 | ||
140 | -func (c *StaffAssessController) SelectAssessInviteUser() { | ||
141 | - srv := service.NewStaffAssessServeice() | ||
142 | - paramReq := &query.SelectAssessInviteUser{} | ||
143 | - err := c.BindJSON(paramReq) | ||
144 | - if err != nil { | ||
145 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
146 | - c.Response(nil, e) | ||
147 | - return | ||
148 | - } | ||
149 | - // paramReq.CompanyId = 1 | ||
150 | - // paramReq.TargetUserId = 1 | ||
151 | - userReq := middlewares.GetUser(c.Ctx) | ||
152 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
153 | - paramReq.TargetUserId = int(userReq.UserId) | ||
154 | - data, err := srv.SelectAssessInviteUser(paramReq) | ||
155 | - c.Response(data, err) | ||
156 | -} | ||
157 | - | ||
158 | -// 获取我要执行360评估,用户列表和评估填写的值 | ||
159 | -func (c *StaffAssessController) ListMeInviteUserAssess() { | ||
160 | - srv := service.NewStaffAssessServeice() | ||
161 | - paramReq := &query.ListInviteUserAssessQuery{} | ||
162 | - err := c.BindJSON(paramReq) | ||
163 | - if err != nil { | ||
164 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
165 | - c.Response(nil, e) | ||
166 | - return | ||
167 | - } | ||
168 | - //获取当前用户信息 | ||
169 | - // paramReq.CompanyId = 1 | ||
170 | - // paramReq.ExecutorId = 1 | ||
171 | - userReq := middlewares.GetUser(c.Ctx) | ||
172 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
173 | - paramReq.ExecutorId = int(userReq.UserId) | ||
174 | - data, err := srv.ListExecutorInviteAssess(paramReq) | ||
175 | - c.Response(data, err) | ||
176 | -} | ||
177 | - | ||
178 | -// 获取我要执行的上级评估成员列表 | ||
179 | -func (c *StaffAssessController) ListMeSupperAssess() { | ||
180 | - srv := service.NewStaffAssessServeice() | ||
181 | - paramReq := &query.ListSupperAssessQuery{} | ||
182 | - err := c.BindJSON(paramReq) | ||
183 | - if err != nil { | ||
184 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
185 | - c.Response(nil, e) | ||
186 | - return | ||
187 | - } | ||
188 | - //TODO 获取当前用户信息 | ||
189 | - // paramReq.CompanyId = 1 | ||
190 | - // paramReq.ExecutorId = 1 | ||
191 | - userReq := middlewares.GetUser(c.Ctx) | ||
192 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
193 | - paramReq.ExecutorId = int(userReq.UserId) | ||
194 | - data, err := srv.ListExecutorSupperAssess(paramReq) | ||
195 | - c.Response(data, err) | ||
196 | -} | ||
197 | - | ||
198 | -// 获取员工自评详情 | ||
199 | -func (c *StaffAssessController) GetAssessTargetUserSelfInfo() { | ||
200 | - srv := service.NewStaffAssessServeice() | ||
201 | - paramReq := &query.AssessSelfInfoQuery{} | ||
202 | - err := c.BindJSON(paramReq) | ||
203 | - if err != nil { | ||
204 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
205 | - c.Response(nil, e) | ||
206 | - return | ||
207 | - } | ||
208 | - // paramReq.CompanyId = 1 | ||
209 | - userReq := middlewares.GetUser(c.Ctx) | ||
210 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
211 | - data, err := srv.GetAssessSelfInfo(paramReq) | ||
212 | - c.Response(data, err) | ||
213 | -} | ||
214 | - | ||
215 | -// 获取评估内容详情 | ||
216 | -func (c *StaffAssessController) GetAssessInfo() { | ||
217 | - srv := service.NewStaffAssessServeice() | ||
218 | - paramReq := &query.AssessInfoQuery{} | ||
219 | - err := c.BindJSON(paramReq) | ||
220 | - if err != nil { | ||
221 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
222 | - c.Response(nil, e) | ||
223 | - return | ||
224 | - } | ||
225 | - // paramReq.CompanyId = 1 | ||
226 | - userReq := middlewares.GetUser(c.Ctx) | ||
227 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
228 | - data, err := srv.GetAssessInfo(paramReq) | ||
229 | - c.Response(data, err) | ||
230 | -} | ||
231 | - | ||
232 | -// 保存评估内容详情 | ||
233 | -func (c *StaffAssessController) SaveAssessInfo() { | ||
234 | - srv := service.NewStaffAssessServeice() | ||
235 | - paramReq := &command.SaveAssessInfoCommand{} | ||
236 | - err := c.BindJSON(paramReq) | ||
237 | - if err != nil { | ||
238 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
239 | - c.Response(nil, e) | ||
240 | - return | ||
241 | - } | ||
242 | - userReq := middlewares.GetUser(c.Ctx) | ||
243 | - paramReq.ExecutorId = int(userReq.UserId) | ||
244 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
245 | - data, err := srv.SaveAssessInfo(paramReq) | ||
246 | - c.Response(data, err) | ||
247 | -} | ||
248 | - | ||
249 | -// 被评估的员工的评估列表-360评估 | ||
250 | -func (c *StaffAssessController) ListTargetUserInviteAssess() { | ||
251 | - srv := service.NewStaffAssessServeice() | ||
252 | - paramReq := &query.ListTargetUserAssessQuery{} | ||
253 | - err := c.BindJSON(paramReq) | ||
254 | - if err != nil { | ||
255 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
256 | - c.Response(nil, e) | ||
257 | - return | ||
258 | - } | ||
259 | - // paramReq.CompanyId = 1 | ||
260 | - userReq := middlewares.GetUser(c.Ctx) | ||
261 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
262 | - paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)} | ||
263 | - data, err := srv.ListTargetUserAssess(paramReq) | ||
264 | - c.Response(data, err) | ||
265 | -} | ||
266 | - | ||
267 | -func (c *StaffAssessController) ListTargetUserMeSupperAssess() { | ||
268 | - srv := service.NewStaffAssessServeice() | ||
269 | - paramReq := &query.ListTargetUserAssessQuery{} | ||
270 | - err := c.BindJSON(paramReq) | ||
271 | - if err != nil { | ||
272 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
273 | - c.Response(nil, e) | ||
274 | - return | ||
275 | - } | ||
276 | - // paramReq.CompanyId = 1 | ||
277 | - userReq := middlewares.GetUser(c.Ctx) | ||
278 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
279 | - paramReq.Types = []string{string(domain.AssessSuper)} | ||
280 | - paramReq.TargetUserId = int(userReq.UserId) | ||
281 | - data, err := srv.ListTargetUserAssess(paramReq) | ||
282 | - c.Response(data, err) | ||
283 | -} | ||
284 | - | ||
285 | -//获取周期列表 | ||
286 | -func (c *StaffAssessController) ListAssessCycle() { | ||
287 | - srv := service.NewStaffAssessServeice() | ||
288 | - userReq := middlewares.GetUser(c.Ctx) | ||
289 | - data, err := srv.ListAllAssessCycle(int(userReq.CompanyId)) | ||
290 | - c.Response(data, err) | ||
291 | -} | ||
292 | - | ||
293 | -//获取周期里的考核日期 | ||
294 | -func (c *StaffAssessController) ListAssessCycleDay() { | ||
295 | - srv := service.NewStaffAssessServeice() | ||
296 | - paramReq := &query.ListAssessCycleDay{} | ||
297 | - err := c.BindJSON(paramReq) | ||
298 | - if err != nil { | ||
299 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
300 | - c.Response(nil, e) | ||
301 | - return | ||
302 | - } | ||
303 | - userReq := middlewares.GetUser(c.Ctx) | ||
304 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
305 | - data, err := srv.ListAllAssessCycleDay(paramReq) | ||
306 | - c.Response(data, err) | ||
307 | -} | ||
308 | - | ||
309 | -//根据周期里的考核日期,获取员工填写评估内容列表 | ||
310 | -func (c *StaffAssessController) ListAssessContentCycleDay() { | ||
311 | - srv := service.NewStaffAssessServeice() | ||
312 | - paramReq := &query.ListAssessContentCycleDay{} | ||
313 | - err := c.BindJSON(paramReq) | ||
314 | - if err != nil { | ||
315 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
316 | - c.Response(nil, e) | ||
317 | - return | ||
318 | - } | ||
319 | - userReq := middlewares.GetUser(c.Ctx) | ||
320 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
321 | - paramReq.OperaterId = int(userReq.UserId) | ||
322 | - data, err := srv.ListUserAssessContentCycleDay(paramReq) | ||
323 | - c.Response(data, err) | ||
324 | -} | ||
325 | - | ||
326 | -//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件 | ||
327 | -func (c *StaffAssessController) ExportAssessContentCycleDay() { | ||
328 | - srv := service.NewStaffAssessServeice() | ||
329 | - paramReq := &query.ListAssessContentCycleDay{} | ||
330 | - err := c.BindJSON(paramReq) | ||
331 | - if err != nil { | ||
332 | - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
333 | - c.Response(nil, e) | ||
334 | - return | ||
335 | - } | ||
336 | - userReq := middlewares.GetUser(c.Ctx) | ||
337 | - paramReq.CompanyId = int(userReq.CompanyId) | ||
338 | - paramReq.OperaterId = int(userReq.UserId) | ||
339 | - data, err := srv.ExportUserAssess(paramReq) | ||
340 | - if err != nil { | ||
341 | - c.Response(nil, err) | ||
342 | - } | ||
343 | - fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay) | ||
344 | - c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName) | ||
345 | - c.Ctx.Output.Header("Content-Description", "FileTransfer") | ||
346 | - c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") | ||
347 | - c.Ctx.Output.Header("Content-Transfer-Encoding", "binary") | ||
348 | - c.Ctx.Output.Header("Expires", "0") | ||
349 | - data.Write(c.Ctx.ResponseWriter) | ||
350 | -} | 1 | +package controllers |
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/core/application" | ||
7 | + "github.com/linmadan/egglib-go/web/beego" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | ||
13 | +) | ||
14 | + | ||
15 | +type StaffAssessController struct { | ||
16 | + beego.BaseController | ||
17 | +} | ||
18 | + | ||
19 | +// 获取我的绩效任务列表 | ||
20 | +func (c *StaffAssessController) SearchAssessTaskMe() { | ||
21 | + srv := service.NewStaffAssessServeice() | ||
22 | + paramReq := &query.SearchAssessMeQuery{} | ||
23 | + err := c.BindJSON(paramReq) | ||
24 | + if err != nil { | ||
25 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
26 | + c.Response(nil, e) | ||
27 | + return | ||
28 | + } | ||
29 | + userReq := middlewares.GetUser(c.Ctx) | ||
30 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
31 | + paramReq.UserId = int(userReq.UserId) | ||
32 | + | ||
33 | + data, err := srv.SearchAssessTaskMe(paramReq) | ||
34 | + c.Response(data, err) | ||
35 | +} | ||
36 | + | ||
37 | +// 获取我的绩效任务各环节完成情况 | ||
38 | +func (c *StaffAssessController) AssessTaskMeDesc() { | ||
39 | + srv := service.NewStaffAssessServeice() | ||
40 | + paramReq := &query.AssessTaskDescQuery{} | ||
41 | + err := c.BindJSON(paramReq) | ||
42 | + if err != nil { | ||
43 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
44 | + c.Response(nil, e) | ||
45 | + return | ||
46 | + } | ||
47 | + userReq := middlewares.GetUser(c.Ctx) | ||
48 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
49 | + paramReq.UserId = int(userReq.UserId) | ||
50 | + data, err := srv.AssessTaskDesc(paramReq) | ||
51 | + c.Response(data, err) | ||
52 | +} | ||
53 | + | ||
54 | +// 获取个人的自评反馈历史记录列表 | ||
55 | +func (c *StaffAssessController) AssessSelfMeList() { | ||
56 | + srv := service.NewStaffAssessServeice() | ||
57 | + paramReq := &query.AssessSelfListQuery{} | ||
58 | + err := c.BindJSON(paramReq) | ||
59 | + if err != nil { | ||
60 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
61 | + c.Response(nil, e) | ||
62 | + return | ||
63 | + } | ||
64 | + userReq := middlewares.GetUser(c.Ctx) | ||
65 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
66 | + paramReq.UserId = int(userReq.UserId) | ||
67 | + data, err := srv.AssessSelfList(paramReq) | ||
68 | + c.Response(data, err) | ||
69 | +} | ||
70 | + | ||
71 | +// 更具项目评估的配置,创建员工的评估任务,(调试用) | ||
72 | +func (c *StaffAssessController) CreateStaffAssessTask() { | ||
73 | + srv := service.NewStaffAssessServeice() | ||
74 | + paramReq := &command.CreateStaffAssessTask{} | ||
75 | + err := c.BindJSON(paramReq) | ||
76 | + if err != nil { | ||
77 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
78 | + c.Response(nil, e) | ||
79 | + return | ||
80 | + } | ||
81 | + //服务调用,实际由定时任务触发 | ||
82 | + data, err := srv.InvokCreateStaffAssessTask(paramReq) | ||
83 | + c.Response(data, err) | ||
84 | +} | ||
85 | + | ||
86 | +// 获取当前登录员工自评详情 | ||
87 | +func (c *StaffAssessController) GetAssessSelfMeInfo() { | ||
88 | + srv := service.NewStaffAssessServeice() | ||
89 | + paramReq := &query.AssessSelfInfoQuery{} | ||
90 | + err := c.BindJSON(paramReq) | ||
91 | + if err != nil { | ||
92 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
93 | + c.Response(nil, e) | ||
94 | + return | ||
95 | + } | ||
96 | + userReq := middlewares.GetUser(c.Ctx) | ||
97 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
98 | + paramReq.TargetUserId = int(userReq.UserId) | ||
99 | + data, err := srv.GetAssessSelfInfo(paramReq) | ||
100 | + c.Response(data, err) | ||
101 | +} | ||
102 | + | ||
103 | +// 获取我邀请的人 | ||
104 | +func (c *StaffAssessController) GetAssessMeInviteUser() { | ||
105 | + srv := service.NewStaffAssessServeice() | ||
106 | + paramReq := &query.GetAssessInviteUserQuery{} | ||
107 | + err := c.BindJSON(paramReq) | ||
108 | + if err != nil { | ||
109 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
110 | + c.Response(nil, e) | ||
111 | + return | ||
112 | + } | ||
113 | + userReq := middlewares.GetUser(c.Ctx) | ||
114 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
115 | + paramReq.UserId = int(userReq.UserId) | ||
116 | + data, err := srv.GetAssessInviteUser(paramReq) | ||
117 | + c.Response(data, err) | ||
118 | +} | ||
119 | + | ||
120 | +// 保存我邀请的员工 | ||
121 | +func (c *StaffAssessController) SaveAssessMeInviteUser() { | ||
122 | + srv := service.NewStaffAssessServeice() | ||
123 | + paramReq := &command.SaveAssessInvite{} | ||
124 | + err := c.BindJSON(paramReq) | ||
125 | + if err != nil { | ||
126 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
127 | + c.Response(nil, e) | ||
128 | + return | ||
129 | + } | ||
130 | + //TODO 获取当前用户信息 | ||
131 | + // paramReq.CompanyId = 1 | ||
132 | + // paramReq.UserId = 1 | ||
133 | + userReq := middlewares.GetUser(c.Ctx) | ||
134 | + paramReq.TargetUserId = int(userReq.UserId) | ||
135 | + data, err := srv.SaveAssessInviteUser(paramReq) | ||
136 | + c.Response(data, err) | ||
137 | +} | ||
138 | + | ||
139 | +// 员工邀请的人选择列表 | ||
140 | +func (c *StaffAssessController) SelectAssessInviteUser() { | ||
141 | + srv := service.NewStaffAssessServeice() | ||
142 | + paramReq := &query.SelectAssessInviteUser{} | ||
143 | + err := c.BindJSON(paramReq) | ||
144 | + if err != nil { | ||
145 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
146 | + c.Response(nil, e) | ||
147 | + return | ||
148 | + } | ||
149 | + // paramReq.CompanyId = 1 | ||
150 | + // paramReq.TargetUserId = 1 | ||
151 | + userReq := middlewares.GetUser(c.Ctx) | ||
152 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
153 | + paramReq.TargetUserId = int(userReq.UserId) | ||
154 | + data, err := srv.SelectAssessInviteUser(paramReq) | ||
155 | + c.Response(data, err) | ||
156 | +} | ||
157 | + | ||
158 | +// 获取我要执行360评估,用户列表和评估填写的值 | ||
159 | +func (c *StaffAssessController) ListMeInviteUserAssess() { | ||
160 | + srv := service.NewStaffAssessServeice() | ||
161 | + paramReq := &query.ListInviteUserAssessQuery{} | ||
162 | + err := c.BindJSON(paramReq) | ||
163 | + if err != nil { | ||
164 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
165 | + c.Response(nil, e) | ||
166 | + return | ||
167 | + } | ||
168 | + //获取当前用户信息 | ||
169 | + // paramReq.CompanyId = 1 | ||
170 | + // paramReq.ExecutorId = 1 | ||
171 | + userReq := middlewares.GetUser(c.Ctx) | ||
172 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
173 | + paramReq.ExecutorId = int(userReq.UserId) | ||
174 | + data, err := srv.ListExecutorInviteAssess(paramReq) | ||
175 | + c.Response(data, err) | ||
176 | +} | ||
177 | + | ||
178 | +// 获取我要执行的上级评估成员列表 | ||
179 | +func (c *StaffAssessController) ListMeSupperAssess() { | ||
180 | + srv := service.NewStaffAssessServeice() | ||
181 | + paramReq := &query.ListSupperAssessQuery{} | ||
182 | + err := c.BindJSON(paramReq) | ||
183 | + if err != nil { | ||
184 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
185 | + c.Response(nil, e) | ||
186 | + return | ||
187 | + } | ||
188 | + //TODO 获取当前用户信息 | ||
189 | + // paramReq.CompanyId = 1 | ||
190 | + // paramReq.ExecutorId = 1 | ||
191 | + userReq := middlewares.GetUser(c.Ctx) | ||
192 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
193 | + paramReq.ExecutorId = int(userReq.UserId) | ||
194 | + data, err := srv.ListExecutorSupperAssess(paramReq) | ||
195 | + c.Response(data, err) | ||
196 | +} | ||
197 | + | ||
198 | +// 获取员工自评详情 | ||
199 | +func (c *StaffAssessController) GetAssessTargetUserSelfInfo() { | ||
200 | + srv := service.NewStaffAssessServeice() | ||
201 | + paramReq := &query.AssessSelfInfoQuery{} | ||
202 | + err := c.BindJSON(paramReq) | ||
203 | + if err != nil { | ||
204 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
205 | + c.Response(nil, e) | ||
206 | + return | ||
207 | + } | ||
208 | + // paramReq.CompanyId = 1 | ||
209 | + userReq := middlewares.GetUser(c.Ctx) | ||
210 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
211 | + data, err := srv.GetAssessSelfInfo(paramReq) | ||
212 | + c.Response(data, err) | ||
213 | +} | ||
214 | + | ||
215 | +// 获取评估内容详情 | ||
216 | +func (c *StaffAssessController) GetAssessInfo() { | ||
217 | + srv := service.NewStaffAssessServeice() | ||
218 | + paramReq := &query.AssessInfoQuery{} | ||
219 | + err := c.BindJSON(paramReq) | ||
220 | + if err != nil { | ||
221 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
222 | + c.Response(nil, e) | ||
223 | + return | ||
224 | + } | ||
225 | + // paramReq.CompanyId = 1 | ||
226 | + userReq := middlewares.GetUser(c.Ctx) | ||
227 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
228 | + data, err := srv.GetAssessInfo(paramReq) | ||
229 | + c.Response(data, err) | ||
230 | +} | ||
231 | + | ||
232 | +// 保存评估内容详情 | ||
233 | +func (c *StaffAssessController) SaveAssessInfo() { | ||
234 | + srv := service.NewStaffAssessServeice() | ||
235 | + paramReq := &command.SaveAssessInfoCommand{} | ||
236 | + err := c.BindJSON(paramReq) | ||
237 | + if err != nil { | ||
238 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
239 | + c.Response(nil, e) | ||
240 | + return | ||
241 | + } | ||
242 | + userReq := middlewares.GetUser(c.Ctx) | ||
243 | + paramReq.ExecutorId = int(userReq.UserId) | ||
244 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
245 | + data, err := srv.SaveAssessInfo(paramReq) | ||
246 | + c.Response(data, err) | ||
247 | +} | ||
248 | + | ||
249 | +// 被评估的员工的评估列表-360评估 | ||
250 | +func (c *StaffAssessController) ListTargetUserInviteAssess() { | ||
251 | + srv := service.NewStaffAssessServeice() | ||
252 | + paramReq := &query.ListTargetUserAssessQuery{} | ||
253 | + err := c.BindJSON(paramReq) | ||
254 | + if err != nil { | ||
255 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
256 | + c.Response(nil, e) | ||
257 | + return | ||
258 | + } | ||
259 | + // paramReq.CompanyId = 1 | ||
260 | + userReq := middlewares.GetUser(c.Ctx) | ||
261 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
262 | + paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)} | ||
263 | + data, err := srv.ListTargetUserAssess(paramReq) | ||
264 | + c.Response(data, err) | ||
265 | +} | ||
266 | + | ||
267 | +func (c *StaffAssessController) ListTargetUserMeSupperAssess() { | ||
268 | + srv := service.NewStaffAssessServeice() | ||
269 | + paramReq := &query.ListTargetUserAssessQuery{} | ||
270 | + err := c.BindJSON(paramReq) | ||
271 | + if err != nil { | ||
272 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
273 | + c.Response(nil, e) | ||
274 | + return | ||
275 | + } | ||
276 | + // paramReq.CompanyId = 1 | ||
277 | + userReq := middlewares.GetUser(c.Ctx) | ||
278 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
279 | + paramReq.Types = []string{string(domain.AssessSuper)} | ||
280 | + paramReq.TargetUserId = int(userReq.UserId) | ||
281 | + data, err := srv.ListTargetUserAssess(paramReq) | ||
282 | + c.Response(data, err) | ||
283 | +} | ||
284 | + | ||
285 | +//获取周期列表 | ||
286 | +func (c *StaffAssessController) ListAssessCycle() { | ||
287 | + srv := service.NewStaffAssessServeice() | ||
288 | + userReq := middlewares.GetUser(c.Ctx) | ||
289 | + data, err := srv.ListAllAssessCycle(int(userReq.CompanyId)) | ||
290 | + c.Response(data, err) | ||
291 | +} | ||
292 | + | ||
293 | +//获取周期里的考核日期 | ||
294 | +func (c *StaffAssessController) ListAssessCycleDay() { | ||
295 | + srv := service.NewStaffAssessServeice() | ||
296 | + paramReq := &query.ListAssessCycleDay{} | ||
297 | + err := c.BindJSON(paramReq) | ||
298 | + if err != nil { | ||
299 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
300 | + c.Response(nil, e) | ||
301 | + return | ||
302 | + } | ||
303 | + userReq := middlewares.GetUser(c.Ctx) | ||
304 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
305 | + data, err := srv.ListAllAssessCycleDay(paramReq) | ||
306 | + c.Response(data, err) | ||
307 | +} | ||
308 | + | ||
309 | +//根据周期里的考核日期,获取员工填写评估内容列表 | ||
310 | +func (c *StaffAssessController) ListAssessContentCycleDay() { | ||
311 | + srv := service.NewStaffAssessServeice() | ||
312 | + paramReq := &query.ListAssessContentCycleDay{} | ||
313 | + err := c.BindJSON(paramReq) | ||
314 | + if err != nil { | ||
315 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
316 | + c.Response(nil, e) | ||
317 | + return | ||
318 | + } | ||
319 | + userReq := middlewares.GetUser(c.Ctx) | ||
320 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
321 | + paramReq.OperaterId = int(userReq.UserId) | ||
322 | + data, err := srv.ListUserAssessContentCycleDay(paramReq) | ||
323 | + c.Response(data, err) | ||
324 | +} | ||
325 | + | ||
326 | +//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件 | ||
327 | +func (c *StaffAssessController) ExportAssessContentCycleDay() { | ||
328 | + srv := service.NewStaffAssessServeice() | ||
329 | + paramReq := &query.ListAssessContentCycleDay{} | ||
330 | + err := c.BindJSON(paramReq) | ||
331 | + if err != nil { | ||
332 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
333 | + c.Response(nil, e) | ||
334 | + return | ||
335 | + } | ||
336 | + userReq := middlewares.GetUser(c.Ctx) | ||
337 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
338 | + paramReq.OperaterId = int(userReq.UserId) | ||
339 | + data, err := srv.ExportUserAssess(paramReq) | ||
340 | + if err != nil { | ||
341 | + c.Response(nil, err) | ||
342 | + } | ||
343 | + fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay) | ||
344 | + c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName) | ||
345 | + c.Ctx.Output.Header("Content-Description", "FileTransfer") | ||
346 | + c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") | ||
347 | + c.Ctx.Output.Header("Content-Transfer-Encoding", "binary") | ||
348 | + c.Ctx.Output.Header("Expires", "0") | ||
349 | + data.Write(c.Ctx.ResponseWriter) | ||
350 | +} | ||
351 | + | ||
352 | +// SaveAssessCache 保存评估内容(缓存) | ||
353 | +func (c *StaffAssessController) SaveAssessCache() { | ||
354 | + cacheService := service.NewStaffAssessCacheService() | ||
355 | + in := &command.SaveAssessCacheCommand{} | ||
356 | + if err := c.Unmarshal(in); err != nil { | ||
357 | + c.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) | ||
358 | + } else { | ||
359 | + c.Response(cacheService.SaveAssessCache(in)) | ||
360 | + } | ||
361 | +} |
@@ -110,9 +110,60 @@ func (c *StaffAssessControllerV2) GetAssessTargetUserSelfInfo() { | @@ -110,9 +110,60 @@ func (c *StaffAssessControllerV2) GetAssessTargetUserSelfInfo() { | ||
110 | c.Response(nil, e) | 110 | c.Response(nil, e) |
111 | return | 111 | return |
112 | } | 112 | } |
113 | - // paramReq.CompanyId = 1 | ||
114 | userReq := middlewares.GetUser(c.Ctx) | 113 | userReq := middlewares.GetUser(c.Ctx) |
115 | paramReq.CompanyId = int(userReq.CompanyId) | 114 | paramReq.CompanyId = int(userReq.CompanyId) |
116 | data, err := srv.GetAssessSelfInfoV2(paramReq) | 115 | data, err := srv.GetAssessSelfInfoV2(paramReq) |
117 | c.Response(data, err) | 116 | c.Response(data, err) |
118 | } | 117 | } |
118 | + | ||
119 | +// 获取当前登录员工自评详情 | ||
120 | +func (c *StaffAssessControllerV2) GetAssessSelfMeInfo() { | ||
121 | + srv := service.NewStaffAssessServeice() | ||
122 | + paramReq := &query.GetExecutorSelfAssessQuery{} | ||
123 | + err := c.BindJSON(paramReq) | ||
124 | + if err != nil { | ||
125 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
126 | + c.Response(nil, e) | ||
127 | + return | ||
128 | + } | ||
129 | + userReq := middlewares.GetUser(c.Ctx) | ||
130 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
131 | + paramReq.TargetUserId = int(userReq.UserId) | ||
132 | + data, err := srv.GetAssessSelfInfoV2(paramReq) | ||
133 | + c.Response(data, err) | ||
134 | +} | ||
135 | + | ||
136 | +// 被评估的员工的评估列表-360评估 | ||
137 | +func (c *StaffAssessControllerV2) ListTargetUserInviteAssess() { | ||
138 | + srv := service.NewStaffAssessServeice() | ||
139 | + paramReq := &query.ListTargetAssessQuery{} | ||
140 | + err := c.BindJSON(paramReq) | ||
141 | + if err != nil { | ||
142 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
143 | + c.Response(nil, e) | ||
144 | + return | ||
145 | + } | ||
146 | + | ||
147 | + userReq := middlewares.GetUser(c.Ctx) | ||
148 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
149 | + data, err := srv.ListTargetUserInviteAssess(paramReq) | ||
150 | + c.Response(data, err) | ||
151 | +} | ||
152 | + | ||
153 | +// 被评估的员工的评估列表-上级评估 | ||
154 | +func (c *StaffAssessControllerV2) ListTargetUserMeSupperAssess() { | ||
155 | + srv := service.NewStaffAssessServeice() | ||
156 | + paramReq := &query.ListTargetAssessQuery{} | ||
157 | + err := c.BindJSON(paramReq) | ||
158 | + if err != nil { | ||
159 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
160 | + c.Response(nil, e) | ||
161 | + return | ||
162 | + } | ||
163 | + paramReq.CompanyId = 1 | ||
164 | + userReq := middlewares.GetUser(c.Ctx) | ||
165 | + paramReq.CompanyId = int(userReq.CompanyId) | ||
166 | + paramReq.TargetUserId = int(userReq.UserId) | ||
167 | + data, err := srv.ListTargetUserSuperAssess(paramReq) | ||
168 | + c.Response(data, err) | ||
169 | +} |
1 | -package routers | ||
2 | - | ||
3 | -import ( | ||
4 | - "github.com/beego/beego/v2/server/web" | ||
5 | - "github.com/linmadan/egglib-go/web/beego/filters" | ||
6 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers" | ||
7 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | ||
8 | -) | ||
9 | - | ||
10 | -func init() { | ||
11 | - assessTaskNS := web.NewNamespace("/v1/staff-assess-task", | ||
12 | - web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
13 | - web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表 | ||
14 | - web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述 | ||
15 | - //web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务 | ||
16 | - web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表 | ||
17 | - web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期 | ||
18 | - web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表 | ||
19 | - web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表 | ||
20 | - ) | ||
21 | - // /v1/staff-assess/self/me/list | ||
22 | - assessNS := web.NewNamespace("/v1/staff-assess", | ||
23 | - web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
24 | - web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 | ||
25 | - web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情 | ||
26 | - web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工 | ||
27 | - web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工 | ||
28 | - web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工 | ||
29 | - web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表 | ||
30 | - web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表 | ||
31 | - web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情 | ||
32 | - web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情 | ||
33 | - web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表 | ||
34 | - web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我的上级评估的列表 | ||
35 | - web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 | ||
36 | - ) | ||
37 | - //v2 改版 | ||
38 | - assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", | ||
39 | - web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
40 | - web.NSCtrlPost("/search/me", (*controllers.StaffAssessControllerV2).SearchAssessTaskMe), //获取我参与过的评估项目列表 | ||
41 | - web.NSCtrlPost("/desc/me", (*controllers.StaffAssessControllerV2).AssessTaskMeDesc), | ||
42 | - ) | ||
43 | - | ||
44 | - assessV2NS := web.NewNamespace("/v2/staff-assess", | ||
45 | - web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
46 | - web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessControllerV2).ListMeInviteUserAssess), //我要执行的360评估的用户列表 | ||
47 | - web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表 | ||
48 | - web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工 | ||
49 | - web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessControllerV2).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 | ||
50 | - ) | ||
51 | - | ||
52 | - web.AddNamespace(assessTaskNS) | ||
53 | - web.AddNamespace(assessNS) | ||
54 | - web.AddNamespace(assessTaskV2NS) | ||
55 | - web.AddNamespace(assessV2NS) | ||
56 | -} | 1 | +package routers |
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "github.com/linmadan/egglib-go/web/beego/filters" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | ||
8 | +) | ||
9 | + | ||
10 | +func init() { | ||
11 | + assessTaskNS := web.NewNamespace("/v1/staff-assess-task", | ||
12 | + web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
13 | + web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表 | ||
14 | + web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述 | ||
15 | + //web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务 | ||
16 | + web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表 | ||
17 | + web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期 | ||
18 | + web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表 | ||
19 | + web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表 | ||
20 | + ) | ||
21 | + | ||
22 | + assessNS := web.NewNamespace("/v1/staff-assess", | ||
23 | + web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
24 | + web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 | ||
25 | + web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情 | ||
26 | + web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工 | ||
27 | + web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工 | ||
28 | + web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工 | ||
29 | + web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表 | ||
30 | + web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表 | ||
31 | + web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情 | ||
32 | + web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情 | ||
33 | + web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存) | ||
34 | + web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表 | ||
35 | + web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我被上级评估的列表 | ||
36 | + web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 | ||
37 | + ) | ||
38 | + //v2 改版 | ||
39 | + assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", | ||
40 | + web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
41 | + web.NSCtrlPost("/search/me", (*controllers.StaffAssessControllerV2).SearchAssessTaskMe), //获取我参与过的评估项目列表 | ||
42 | + web.NSCtrlPost("/desc/me", (*controllers.StaffAssessControllerV2).AssessTaskMeDesc), | ||
43 | + ) | ||
44 | + | ||
45 | + assessV2NS := web.NewNamespace("/v2/staff-assess", | ||
46 | + web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | ||
47 | + web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessControllerV2).ListMeInviteUserAssess), //我要执行的360评估的用户列表 | ||
48 | + web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表 | ||
49 | + web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工 | ||
50 | + web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessControllerV2).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 | ||
51 | + web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessControllerV2).GetAssessSelfMeInfo), //获取当前周期里我的自评反馈详情 | ||
52 | + web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessControllerV2).ListTargetUserInviteAssess), //获取被评估员工360评估的列表 | ||
53 | + web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessControllerV2).ListTargetUserMeSupperAssess), //获取我被上级评估的列表 | ||
54 | + ) | ||
55 | + | ||
56 | + web.AddNamespace(assessTaskNS) | ||
57 | + web.AddNamespace(assessNS) | ||
58 | + web.AddNamespace(assessTaskV2NS) | ||
59 | + web.AddNamespace(assessV2NS) | ||
60 | +} |
sql/2022-12-07.sql
0 → 100644
不能预览此文件类型
-
请 注册 或 登录 后发表评论