作者 郑周

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

... ... @@ -326,7 +326,8 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
}
adapterList := make([]*adapter.PerformanceIndicatorAdapter, 0)
categoryMap := map[string]int{} // 内容分类
categoryMap := map[string]int{} // 内容分类
categoryNameMap := map[string]int{} // 内容名称
for i := range userIds {
userId := userIds[i]
userIdInt, err := strconv.Atoi(userId)
... ... @@ -365,11 +366,15 @@ func (srv StaffAssessServeice) QueryMemberPerformanceIndicator(in *query.MemberP
// 内容名称有值合并到数组
if len(item.Name) > 0 {
for index := range pia.PIContents {
piContent := &pia.PIContents[index]
if piContent.Category == item.Category {
piContent.Names = append(piContent.Names, item.Name)
break
onlyKey2 := userId + item.Category + item.Name
if _, ok := categoryNameMap[onlyKey2]; !ok {
categoryNameMap[onlyKey2] = 0
for index := range pia.PIContents {
piContent := &pia.PIContents[index]
if piContent.Category == item.Category {
piContent.Names = append(piContent.Names, item.Name)
break
}
}
}
}
... ...
... ... @@ -249,7 +249,6 @@ func (c *StaffAssessController) QueryMemberPerformanceIndicator() {
if user := middlewares.GetUser(c.Ctx); user != nil {
in.CompanyId = int(user.CompanyId)
in.OperatorId = int(user.UserId)
}
c.Response(srv.QueryMemberPerformanceIndicator(in))
}
... ...