作者 郑周

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

@@ -326,7 +326,8 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP @@ -326,7 +326,8 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
326 } 326 }
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,11 +366,15 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP @@ -365,11 +366,15 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
365 366
366 // 内容名称有值合并到数组 367 // 内容名称有值合并到数组
367 if len(item.Name) > 0 { 368 if len(item.Name) > 0 {
368 - for index := range pia.PIContents {  
369 - piContent := &pia.PIContents[index]  
370 - if piContent.Category == item.Category {  
371 - piContent.Names = append(piContent.Names, item.Name)  
372 - break 369 + onlyKey2 := userId + item.Category + item.Name
  370 + if _, ok := categoryNameMap[onlyKey2]; !ok {
  371 + categoryNameMap[onlyKey2] = 0
  372 + for index := range pia.PIContents {
  373 + piContent := &pia.PIContents[index]
  374 + if piContent.Category == item.Category {
  375 + piContent.Names = append(piContent.Names, item.Name)
  376 + break
  377 + }
373 } 378 }
374 } 379 }
375 } 380 }
@@ -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 }