作者 tangxvhui

调整数据输出字段

1 package adapter 1 package adapter
2 2
3 type SelectInviteUser struct { 3 type SelectInviteUser struct {
4 - UserId int `json:"userId,string"`  
5 - UserName string `json:"userName"` //  
6 - IsSupper bool `json:"isSupper"` // 是否,是直属上级  
7 - Types int `json:"types"` // 1:相同上级的同事 2:不相同上级的同事 4 + UserId int `json:"userId,string"`
  5 + UserName string `json:"userName"` //
  6 + CompanyName string `json:"companyName"` //
  7 + IsSupper bool `json:"isSupper"` // 是否,是直属上级
  8 + Types int `json:"types"` // 1:相同上级的同事 2:不相同上级的同事
8 } 9 }
@@ -1121,6 +1121,13 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI @@ -1121,6 +1121,13 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
1121 userRepo := factory.CreateUserRepository(map[string]interface{}{ 1121 userRepo := factory.CreateUserRepository(map[string]interface{}{
1122 "transactionContext": transactionContext, 1122 "transactionContext": transactionContext,
1123 }) 1123 })
  1124 + //获取公司信息
  1125 + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{
  1126 + "transactionContext": transactionContext,
  1127 + })
  1128 + companyInfo, _ := companyRepo.FindOne(map[string]interface{}{
  1129 + "id": param.CompanyId,
  1130 + })
1124 targetUser, err := userRepo.FindOne(map[string]interface{}{ 1131 targetUser, err := userRepo.FindOne(map[string]interface{}{
1125 "id": param.TargetUserId, 1132 "id": param.TargetUserId,
1126 }) 1133 })
@@ -1174,12 +1181,17 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI @@ -1174,12 +1181,17 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
1174 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1181 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1175 } 1182 }
1176 listData := []adapter.SelectInviteUser{} 1183 listData := []adapter.SelectInviteUser{}
  1184 + companyName := ""
  1185 + if companyInfo != nil {
  1186 + companyName = companyInfo.Name
  1187 + }
1177 for _, v := range userList { 1188 for _, v := range userList {
1178 item := adapter.SelectInviteUser{ 1189 item := adapter.SelectInviteUser{
1179 - UserId: int(v.Id),  
1180 - UserName: v.Name,  
1181 - IsSupper: false,  
1182 - Types: 2, //默认是不同上级 1190 + UserId: int(v.Id),
  1191 + UserName: v.Name,
  1192 + CompanyName: companyName,
  1193 + IsSupper: false,
  1194 + Types: 2, //默认是不同上级
1183 } 1195 }
1184 if _, ok := targetUserCharge[v.Id]; ok { 1196 if _, ok := targetUserCharge[v.Id]; ok {
1185 item.IsSupper = true 1197 item.IsSupper = true
@@ -309,7 +309,12 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu @@ -309,7 +309,12 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
309 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ 309 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
310 "transactionContext": transactionContext, 310 "transactionContext": transactionContext,
311 }) 311 })
312 - 312 + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{
  313 + "transactionContext": transactionContext,
  314 + })
  315 + companyInfo, _ := companyRepo.FindOne(map[string]interface{}{
  316 + "id": param.CompanyId,
  317 + })
313 //获取 executorId 对应的360评估任务 用户 318 //获取 executorId 对应的360评估任务 用户
314 condition := map[string]interface{}{ 319 condition := map[string]interface{}{
315 "beginDay": param.BeginDay, 320 "beginDay": param.BeginDay,
@@ -412,6 +417,10 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu @@ -412,6 +417,10 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
412 } 417 }
413 tableHeader = append(tableHeader, changeableHeader...) 418 tableHeader = append(tableHeader, changeableHeader...)
414 listData := []map[string]interface{}{} 419 listData := []map[string]interface{}{}
  420 + companyName := ""
  421 + if companyInfo != nil {
  422 + companyName = companyInfo.Name
  423 + }
415 for _, v := range assessList { 424 for _, v := range assessList {
416 m := map[string]interface{}{ 425 m := map[string]interface{}{
417 "staffAssessTaskId": v.StaffAssessTaskId, 426 "staffAssessTaskId": v.StaffAssessTaskId,
@@ -423,6 +432,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu @@ -423,6 +432,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
423 "types": string(v.Types), 432 "types": string(v.Types),
424 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), 433 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
425 "assessId": strconv.Itoa(v.Id), 434 "assessId": strconv.Itoa(v.Id),
  435 + "companyName": companyName,
426 } 436 }
427 switch v.Status { 437 switch v.Status {
428 case domain.StaffAssessCompleted: 438 case domain.StaffAssessCompleted:
@@ -47,7 +47,7 @@ func (c *StaffAssessControllerV2) AssessTaskMeDesc() { @@ -47,7 +47,7 @@ func (c *StaffAssessControllerV2) AssessTaskMeDesc() {
47 c.Response(data, err) 47 c.Response(data, err)
48 } 48 }
49 49
50 -// 获取我要执行360评估,用户列表和评估填写的值 50 +// 获取我要执行360评估,用户列表和评估填写的值
51 func (c *StaffAssessControllerV2) ListMeInviteUserAssess() { 51 func (c *StaffAssessControllerV2) ListMeInviteUserAssess() {
52 srv := service.NewStaffAssessServeice() 52 srv := service.NewStaffAssessServeice()
53 paramReq := &query.ListExecutorAssessQuery{} 53 paramReq := &query.ListExecutorAssessQuery{}