作者 郑周

优化绩效指标,多个重叠问题

@@ -327,6 +327,7 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP @@ -327,6 +327,7 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
327 327
328 adapterList := make([]*adapter.PerformanceIndicatorAdapter, 0) 328 adapterList := make([]*adapter.PerformanceIndicatorAdapter, 0)
329 categoryMap := map[string]int{} // 内容分类 329 categoryMap := map[string]int{} // 内容分类
  330 + categoryNameMap := map[string]int{} // 内容名称
330 for i := range userIds { 331 for i := range userIds {
331 userId := userIds[i] 332 userId := userIds[i]
332 userIdInt, err := strconv.Atoi(userId) 333 userIdInt, err := strconv.Atoi(userId)
@@ -365,6 +366,9 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP @@ -365,6 +366,9 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
365 366
366 // 内容名称有值合并到数组 367 // 内容名称有值合并到数组
367 if len(item.Name) > 0 { 368 if len(item.Name) > 0 {
  369 + onlyKey2 := userId + item.Category + item.Name
  370 + if _, ok := categoryNameMap[onlyKey2]; !ok {
  371 + categoryNameMap[onlyKey2] = 0
368 for index := range pia.PIContents { 372 for index := range pia.PIContents {
369 piContent := &pia.PIContents[index] 373 piContent := &pia.PIContents[index]
370 if piContent.Category == item.Category { 374 if piContent.Category == item.Category {
@@ -376,6 +380,7 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP @@ -376,6 +380,7 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
376 } 380 }
377 } 381 }
378 } 382 }
  383 + }
379 384
380 /* 385 /*
381 // 旧版(如果未填写自评会出现数据评估项丢失的BUG) 386 // 旧版(如果未填写自评会出现数据评估项丢失的BUG)
@@ -249,7 +249,6 @@ func (c *StaffAssessController) QueryMemberPerformanceIndicator() { @@ -249,7 +249,6 @@ func (c *StaffAssessController) QueryMemberPerformanceIndicator() {
249 if user := middlewares.GetUser(c.Ctx); user != nil { 249 if user := middlewares.GetUser(c.Ctx); user != nil {
250 in.CompanyId = int(user.CompanyId) 250 in.CompanyId = int(user.CompanyId)
251 in.OperatorId = int(user.UserId) 251 in.OperatorId = int(user.UserId)
252 -  
253 } 252 }
254 c.Response(srv.QueryMemberPerformanceIndicator(in)) 253 c.Response(srv.QueryMemberPerformanceIndicator(in))
255 } 254 }