作者 tangxvhui

获取员工填写评估内容 添加输出的字段

@@ -17,7 +17,7 @@ import ( @@ -17,7 +17,7 @@ import (
17 17
18 //员工绩效-项目管理 18 //员工绩效-项目管理
19 19
20 -//获取已被执行的周期列表 20 +// 获取已被执行的周期列表
21 func (srv StaffAssessServeice) ListAllAssessCycle(companyid int) (map[string]interface{}, error) { 21 func (srv StaffAssessServeice) ListAllAssessCycle(companyid int) (map[string]interface{}, error) {
22 transactionContext, err := factory.CreateTransactionContext(nil) 22 transactionContext, err := factory.CreateTransactionContext(nil)
23 if err != nil { 23 if err != nil {
@@ -46,7 +46,7 @@ func (srv StaffAssessServeice) ListAllAssessCycle(companyid int) (map[string]int @@ -46,7 +46,7 @@ func (srv StaffAssessServeice) ListAllAssessCycle(companyid int) (map[string]int
46 46
47 } 47 }
48 48
49 -//获取周期内的考核日期 49 +// 获取周期内的考核日期
50 func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycleDay) (map[string]interface{}, error) { 50 func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycleDay) (map[string]interface{}, error) {
51 transactionContext, err := factory.CreateTransactionContext(nil) 51 transactionContext, err := factory.CreateTransactionContext(nil)
52 if err != nil { 52 if err != nil {
@@ -74,8 +74,8 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl @@ -74,8 +74,8 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl
74 return result, nil 74 return result, nil
75 } 75 }
76 76
77 -//根据周期id和日期获取 员工填写评估内容  
78 -//有过滤查看权限 77 +// 根据周期id和日期获取 员工填写评估内容
  78 +// 有过滤查看权限
79 func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) { 79 func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) {
80 transactionContext, err := factory.CreateTransactionContext(nil) 80 transactionContext, err := factory.CreateTransactionContext(nil)
81 if err != nil { 81 if err != nil {
@@ -173,6 +173,8 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs @@ -173,6 +173,8 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
173 changeableRows[v.TargetUserId]["targetUserName"] = v.TargetUserName 173 changeableRows[v.TargetUserId]["targetUserName"] = v.TargetUserName
174 changeableRows[v.TargetUserId]["targetUserId"] = v.TargetUserId 174 changeableRows[v.TargetUserId]["targetUserId"] = v.TargetUserId
175 changeableRows[v.TargetUserId]["assessId"] = v.AssessId 175 changeableRows[v.TargetUserId]["assessId"] = v.AssessId
  176 + changeableRows[v.TargetUserId]["cycleId"] = v.CycleId
  177 + changeableRows[v.TargetUserId]["beginDay"] = v.BeginDay
176 if v.ContentId > 0 { 178 if v.ContentId > 0 {
177 name := fmt.Sprintf("%s-%s", v.Category, v.ContentName) 179 name := fmt.Sprintf("%s-%s", v.Category, v.ContentName)
178 key := fmt.Sprintf("k%d", i) 180 key := fmt.Sprintf("k%d", i)
@@ -130,14 +130,14 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int, @@ -130,14 +130,14 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int,
130 return result, err 130 return result, err
131 } 131 }
132 132
133 -//获取所以已经执行的评估周期 133 +// 获取所以已经执行的评估周期
134 type AssessCycle struct { 134 type AssessCycle struct {
135 CycleId string `json:"cycleId"` //周期id 135 CycleId string `json:"cycleId"` //周期id
136 CompanyId string `json:"companyId"` 136 CompanyId string `json:"companyId"`
137 CycleName string `json:"cycleName"` //周期名称 137 CycleName string `json:"cycleName"` //周期名称
138 } 138 }
139 139
140 -//获取所以已经执行的评估周期 140 +// 获取所以已经执行的评估周期
141 func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error) { 141 func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error) {
142 sqlStr := `select 142 sqlStr := `select
143 distinct 143 distinct
@@ -159,7 +159,7 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error @@ -159,7 +159,7 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error
159 return result, err 159 return result, err
160 } 160 }
161 161
162 -//获取评估周期中的绩效考核日期 162 +// 获取评估周期中的绩效考核日期
163 type AssessCycleDay struct { 163 type AssessCycleDay struct {
164 BeginDay string `json:"beginDay"` 164 BeginDay string `json:"beginDay"`
165 CycleId int `json:"cycleId"` 165 CycleId int `json:"cycleId"`
@@ -167,7 +167,7 @@ type AssessCycleDay struct { @@ -167,7 +167,7 @@ type AssessCycleDay struct {
167 CompanyId string `json:"companyId"` 167 CompanyId string `json:"companyId"`
168 } 168 }
169 169
170 -//获取评估周期中的绩效考核日期 170 +// 获取评估周期中的绩效考核日期
171 func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]AssessCycleDay, error) { 171 func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]AssessCycleDay, error) {
172 sqlStr := `select distinct staff_assess_task.begin_day , 172 sqlStr := `select distinct staff_assess_task.begin_day ,
173 staff_assess_task.cycle_id , 173 staff_assess_task.cycle_id ,
@@ -188,7 +188,7 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As @@ -188,7 +188,7 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As
188 return result, err 188 return result, err
189 } 189 }
190 190
191 -//获取员工填写评估内容 191 +// 获取员工填写评估内容
192 type UserAssessContent struct { 192 type UserAssessContent struct {
193 AssessId string `json:"assessId"` 193 AssessId string `json:"assessId"`
194 ContentId int `json:"contentId"` 194 ContentId int `json:"contentId"`
@@ -201,6 +201,7 @@ type UserAssessContent struct { @@ -201,6 +201,7 @@ type UserAssessContent struct {
201 Category string `json:"category"` //评估项分类 201 Category string `json:"category"` //评估项分类
202 ContentName string `json:"contentName"` //评估项名称 202 ContentName string `json:"contentName"` //评估项名称
203 Weight float64 `json:"weight"` //权重 203 Weight float64 `json:"weight"` //权重
  204 + CycleId string `json:"cycleId"` //周期id
204 } 205 }
205 206
206 type SearchConditin1 struct { 207 type SearchConditin1 struct {
@@ -216,14 +217,14 @@ type SearchConditin1 struct { @@ -216,14 +217,14 @@ type SearchConditin1 struct {
216 Hrbp int // 217 Hrbp int //
217 } 218 }
218 219
219 -//项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容  
220 -//companyId int 公司id  
221 -//cycleId int, 评估周期id  
222 -//userId int, 用户id,谁要查看数据  
223 -//beginDay string, 周期中执行项目的时间  
224 -//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否  
225 -//limit int, 分页条数  
226 -//offset int 分页偏移 220 +// 项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容
  221 +// companyId int 公司id
  222 +// cycleId int, 评估周期id
  223 +// userId int, 用户id,谁要查看数据
  224 +// beginDay string, 周期中执行项目的时间
  225 +// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  226 +// limit int, 分页条数
  227 +// offset int 分页偏移
227 func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserAssessContent, error) { 228 func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserAssessContent, error) {
228 if param.Offset < 0 { 229 if param.Offset < 0 {
229 param.Offset = 0 230 param.Offset = 0
@@ -234,7 +235,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -234,7 +235,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
234 sqlStr := ` select 235 sqlStr := ` select
235 t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day, 236 t_staff_assess_1.target_user_id,t_staff_assess_1.target_user_name,t_staff_assess_1.begin_day,
236 t_staff_assess_1.assess_id,staff_assess_content.id as content_id, 237 t_staff_assess_1.assess_id,staff_assess_content.id as content_id,
237 - staff_assess_content.value ,staff_assess_content.sort_by , 238 + staff_assess_content.value ,staff_assess_content.sort_by ,t_staff_assess_1.cycle_id,
238 staff_assess_content.category ,staff_assess_content."name" as content_name , 239 staff_assess_content.category ,staff_assess_content."name" as content_name ,
239 staff_assess_content.weight 240 staff_assess_content.weight
240 from t_staff_assess_1 241 from t_staff_assess_1
@@ -257,14 +258,14 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -257,14 +258,14 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
257 return result, err 258 return result, err
258 } 259 }
259 260
260 -//项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容,数量统计  
261 -//companyId int 公司id  
262 -//cycleId int, 评估周期id  
263 -//userId int, 用户id,谁要查看数据  
264 -//beginDay string, 周期中执行项目的时间  
265 -//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否  
266 -//limit int, 分页条数  
267 -//offset int 分页偏移 261 +// 项目管理-成员列表 根据周期的id和日期获取员工填写的评估内容,数量统计
  262 +// companyId int 公司id
  263 +// cycleId int, 评估周期id
  264 +// userId int, 用户id,谁要查看数据
  265 +// beginDay string, 周期中执行项目的时间
  266 +// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  267 +// limit int, 分页条数
  268 +// offset int 分页偏移
268 func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { 269 func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
269 sqlStr := ` select 270 sqlStr := ` select
270 count( distinct t_staff_assess_1.target_user_id) cnt 271 count( distinct t_staff_assess_1.target_user_id) cnt
@@ -284,14 +285,14 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { @@ -284,14 +285,14 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
284 return result, err 285 return result, err
285 } 286 }
286 287
287 -//生成的sql 根据用户的查看权限 ,获取可查看的评估任务,  
288 -//companyId int 公司id  
289 -//cycleId int, 评估周期id  
290 -//userId int, 用户id,谁要查看数据  
291 -//beginDay string, 周期中执行项目的时间  
292 -//hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否  
293 -//limit int, 分页条数  
294 -//offset int 分页偏移 288 +// 生成的sql 根据用户的查看权限 ,获取可查看的评估任务,
  289 +// companyId int 公司id
  290 +// cycleId int, 评估周期id
  291 +// userId int, 用户id,谁要查看数据
  292 +// beginDay string, 周期中执行项目的时间
  293 +// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  294 +// limit int, 分页条数
  295 +// offset int 分页偏移
295 func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int) string { 296 func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int) string {
296 sqlstr := ` 297 sqlstr := `
297 set time zone 'PRC'; 298 set time zone 'PRC';
@@ -334,6 +335,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, @@ -334,6 +335,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
334 -- 初步过滤数据 335 -- 初步过滤数据
335 t_staff_assess_0 as ( 336 t_staff_assess_0 as (
336 select staff_assess.id as assess_id, 337 select staff_assess.id as assess_id,
  338 + staff_assess.cycle_id,
337 staff_assess.target_user->>'userId' as target_user_id, 339 staff_assess.target_user->>'userId' as target_user_id,
338 staff_assess.target_user->>'userName' as target_user_name, 340 staff_assess.target_user->>'userName' as target_user_name,
339 to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day, 341 to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day,
@@ -350,13 +352,15 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, @@ -350,13 +352,15 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
350 (select t_staff_assess_0.assess_id, 352 (select t_staff_assess_0.assess_id,
351 t_staff_assess_0.target_user_id, 353 t_staff_assess_0.target_user_id,
352 t_staff_assess_0.target_user_name, 354 t_staff_assess_0.target_user_name,
353 - t_staff_assess_0.begin_day 355 + t_staff_assess_0.begin_day,
  356 + t_staff_assess_0.cycle_id
354 from t_staff_assess_0 357 from t_staff_assess_0
355 join t_project_3 on t_staff_assess_0.evaluation_project_id = t_project_3.project_id 358 join t_project_3 on t_staff_assess_0.evaluation_project_id = t_project_3.project_id
356 ) union (select t_staff_assess_0.assess_id, 359 ) union (select t_staff_assess_0.assess_id,
357 t_staff_assess_0.target_user_id, 360 t_staff_assess_0.target_user_id,
358 t_staff_assess_0.target_user_name, 361 t_staff_assess_0.target_user_name,
359 - t_staff_assess_0.begin_day 362 + t_staff_assess_0.begin_day,
  363 + t_staff_assess_0.cycle_id
360 from t_staff_assess_0 364 from t_staff_assess_0
361 join t_user_1 on t_staff_assess_0.target_user_id=t_user_1.user_id 365 join t_user_1 on t_staff_assess_0.target_user_id=t_user_1.user_id
362 ) 366 )
@@ -387,7 +391,7 @@ type ExportData1 struct { @@ -387,7 +391,7 @@ type ExportData1 struct {
387 Remark []domain.AssessContemtRemark 391 Remark []domain.AssessContemtRemark
388 } 392 }
389 393
390 -//项目管理-成员列表 导出数据 394 +// 项目管理-成员列表 导出数据
391 func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportData1, error) { 395 func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportData1, error) {
392 if param.Offset < 0 { 396 if param.Offset < 0 {
393 param.Offset = 0 397 param.Offset = 0
@@ -48,8 +48,8 @@ func init() { @@ -48,8 +48,8 @@ func init() {
48 web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表 48 web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表
49 web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工 49 web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工
50 web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessControllerV2).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 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评估的列表 51 web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessControllerV2).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
  52 + web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessControllerV2).GetAssessSelfMeInfo), //获取当前周期里我的自评反馈详情
53 web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessControllerV2).ListTargetUserMeSupperAssess), //获取我被上级评估的列表 53 web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessControllerV2).ListTargetUserMeSupperAssess), //获取我被上级评估的列表
54 ) 54 )
55 55