作者 tangxvhui

修复 excel导出错误

... ... @@ -158,19 +158,21 @@ func newExportData3() *exportData3 {
func (e *exportData3) FormatTableHead(param []dao.DataEvaluationItemUsed2) {
userNameMap := map[string]struct{}{} //员工名字过滤
projectIdMap := map[string]struct{}{} //项目id
projectIdMap := map[string]struct{}{} //项目id过滤
for _, val := range param {
//
if _, ok := userNameMap[val.TargetUserId]; !ok {
if _, ok := e.userProjcetMap[val.TargetUserId]; !ok {
e.userProjcetMap[val.TargetUserId] = []string{}
}
//处理一个员工多项目的情况
if _, ok := projectIdMap[val.EvaluationProjectId]; !ok {
e.userProjcetMap[val.TargetUserId] = append(e.userProjcetMap[val.TargetUserId], val.EvaluationProjectId)
projectIdMap[val.EvaluationProjectId] = struct{}{}
}
//处理员工的名称
if _, ok := e.userIdName[val.TargetUserId]; !ok {
if _, ok := userNameMap[val.TargetUserName]; ok {
//员工重名
uname := fmt.Sprintf("%s(%d)", val.TargetUserName, len(userNameMap))
e.userIdName[val.TargetUserId] = uname
userNameMap[uname] = struct{}{}
... ...