作者 Your Name

暂存

1 package adapter 1 package adapter
2 2
3 type ListSupperAssessResp struct { 3 type ListSupperAssessResp struct {
4 - AssessId int `json:"assessId"` // 4 + AssessId int `json:"assessId"` //
  5 + UsrId int `json:"userId"`
5 UserName string `json:"userName"` //用户名称 6 UserName string `json:"userName"` //用户名称
6 EndTime string `json:"endTime"` //截止时间 7 EndTime string `json:"endTime"` //截止时间
7 InviteTotal int `json:"inviteTota"` //邀请总数 8 InviteTotal int `json:"inviteTota"` //邀请总数
@@ -419,7 +419,7 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA @@ -419,7 +419,7 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA
419 }, nil 419 }, nil
420 } 420 }
421 421
422 -// 添加自评节点任务 422 +// 添加节点任务
423 func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) { 423 func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) {
424 //评估的参与人 424 //评估的参与人
425 selfUserId := []int{} 425 selfUserId := []int{}
@@ -540,9 +540,37 @@ func (srv StaffAssessServeice) createStaffAssessSupper( @@ -540,9 +540,37 @@ func (srv StaffAssessServeice) createStaffAssessSupper(
540 assessTemp domain.StaffAssess, 540 assessTemp domain.StaffAssess,
541 userList []*domain.User, userDepartmentMap map[int64][]*domain.Department, 541 userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
542 ) ([]domain.StaffAssess, error) { 542 ) ([]domain.StaffAssess, error) {
543 - 543 + var assessList []domain.StaffAssess
544 // 获取员工的上级用户 544 // 获取员工的上级用户
  545 + userRepo := factory.CreateUserRepository(map[string]interface{}{
  546 + "transactionContext": transactionContext,
  547 + })
  548 + for _, v := range userList {
  549 + departmentList, ok := userDepartmentMap[v.Id]
  550 + if !ok {
  551 + continue
  552 + }
  553 + targetDepartment := []domain.StaffDepartment{}
  554 + for _, vv2 := range departmentList {
  555 + if len(vv2.ChargeUserIds) == 0 {
  556 + continue
  557 + }
  558 + _, chargeUserList, err := userRepo.Find(map[string]interface{}{
  559 + "ids": vv2.ChargeUserIds,
  560 + "limit": 40,
  561 + })
  562 + if err != nil {
  563 + return nil, application.ThrowError(application.ARG_ERROR, "获取部门主管信息"+err.Error())
  564 + }
  565 + for _, vvv3 := range chargeUserList {
  566 + assessTemp.TargetDepartment = []domain.StaffDepartment{
  567 + domain.StaffDepartment{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
  568 + }
545 569
  570 + }
  571 + }
  572 +
  573 + }
546 return nil, nil 574 return nil, nil
547 } 575 }
548 576
@@ -1311,6 +1339,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA @@ -1311,6 +1339,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
1311 for _, v := range assessList { 1339 for _, v := range assessList {
1312 item := adapter.ListSupperAssessResp{ 1340 item := adapter.ListSupperAssessResp{
1313 AssessId: v.Id, 1341 AssessId: v.Id,
  1342 + UsrId: v.TargetUser.UserId,
1314 UserName: v.TargetUser.UserName, 1343 UserName: v.TargetUser.UserName,
1315 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), 1344 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
1316 InviteCompleted: 0, 1345 InviteCompleted: 0,
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" 7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
9 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 9 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  10 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
10 ) 11 )
11 12
12 type StaffAssessController struct { 13 type StaffAssessController struct {
@@ -23,9 +24,10 @@ func (c *StaffAssessController) SearchAssessTaskMe() { @@ -23,9 +24,10 @@ func (c *StaffAssessController) SearchAssessTaskMe() {
23 c.Response(nil, e) 24 c.Response(nil, e)
24 return 25 return
25 } 26 }
26 - //TODO 获取当前用户信息  
27 - paramReq.CompanyId = 1  
28 - paramReq.UserId = 1 27 + userReq := middlewares.GetUser(c.Ctx)
  28 + paramReq.CompanyId = int(userReq.CompanyId)
  29 + paramReq.UserId = int(userReq.UserId)
  30 +
29 data, err := srv.SearchAssessTaskMe(paramReq) 31 data, err := srv.SearchAssessTaskMe(paramReq)
30 c.Response(data, err) 32 c.Response(data, err)
31 } 33 }
@@ -40,9 +42,9 @@ func (c *StaffAssessController) AssessTaskMeDesc() { @@ -40,9 +42,9 @@ func (c *StaffAssessController) AssessTaskMeDesc() {
40 c.Response(nil, e) 42 c.Response(nil, e)
41 return 43 return
42 } 44 }
43 - //TODO 获取当前用户信息  
44 - paramReq.CompanyId = 1  
45 - paramReq.UserId = 1 45 + userReq := middlewares.GetUser(c.Ctx)
  46 + paramReq.CompanyId = int(userReq.CompanyId)
  47 + paramReq.UserId = int(userReq.UserId)
46 data, err := srv.AssessTaskDesc(paramReq) 48 data, err := srv.AssessTaskDesc(paramReq)
47 c.Response(data, err) 49 c.Response(data, err)
48 } 50 }
@@ -57,9 +59,9 @@ func (c *StaffAssessController) AssessSelfMeList() { @@ -57,9 +59,9 @@ func (c *StaffAssessController) AssessSelfMeList() {
57 c.Response(nil, e) 59 c.Response(nil, e)
58 return 60 return
59 } 61 }
60 - //TODO 获取当前用户信息  
61 - paramReq.CompanyId = 1  
62 - paramReq.UserId = 1 62 + userReq := middlewares.GetUser(c.Ctx)
  63 + paramReq.CompanyId = int(userReq.CompanyId)
  64 + paramReq.UserId = int(userReq.UserId)
63 data, err := srv.AssessSelfList(paramReq) 65 data, err := srv.AssessSelfList(paramReq)
64 c.Response(data, err) 66 c.Response(data, err)
65 } 67 }
@@ -89,9 +91,9 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() { @@ -89,9 +91,9 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() {
89 c.Response(nil, e) 91 c.Response(nil, e)
90 return 92 return
91 } 93 }
92 - //TODO 获取当前用户信息  
93 - paramReq.CompanyId = 1  
94 - paramReq.TargetUserId = 1 94 + userReq := middlewares.GetUser(c.Ctx)
  95 + paramReq.CompanyId = int(userReq.CompanyId)
  96 + paramReq.TargetUserId = int(userReq.UserId)
95 data, err := srv.GetAssessSelfInfo(paramReq) 97 data, err := srv.GetAssessSelfInfo(paramReq)
96 c.Response(data, err) 98 c.Response(data, err)
97 } 99 }
@@ -106,14 +108,14 @@ func (c *StaffAssessController) GetAssessMeInviteUser() { @@ -106,14 +108,14 @@ func (c *StaffAssessController) GetAssessMeInviteUser() {
106 c.Response(nil, e) 108 c.Response(nil, e)
107 return 109 return
108 } 110 }
109 - //TODO 获取当前用户信息  
110 - paramReq.CompanyId = 1  
111 - paramReq.UserId = 1 111 + userReq := middlewares.GetUser(c.Ctx)
  112 + paramReq.CompanyId = int(userReq.CompanyId)
  113 + paramReq.UserId = int(userReq.UserId)
112 data, err := srv.GetAssessInviteUser(paramReq) 114 data, err := srv.GetAssessInviteUser(paramReq)
113 c.Response(data, err) 115 c.Response(data, err)
114 } 116 }
115 117
116 -// 保持员工邀请的人 118 +// 保持我邀请的员工
117 func (c *StaffAssessController) SaveAssessMeInviteUser() { 119 func (c *StaffAssessController) SaveAssessMeInviteUser() {
118 srv := service.NewStaffAssessServeice() 120 srv := service.NewStaffAssessServeice()
119 paramReq := &command.SaveAssessInvite{} 121 paramReq := &command.SaveAssessInvite{}
@@ -140,9 +142,11 @@ func (c *StaffAssessController) SelectAssessInviteUser() { @@ -140,9 +142,11 @@ func (c *StaffAssessController) SelectAssessInviteUser() {
140 c.Response(nil, e) 142 c.Response(nil, e)
141 return 143 return
142 } 144 }
143 - //TODO 获取当前用户信息  
144 - paramReq.CompanyId = 1  
145 - paramReq.TargetUserId = 1 145 + // paramReq.CompanyId = 1
  146 + // paramReq.TargetUserId = 1
  147 + userReq := middlewares.GetUser(c.Ctx)
  148 + paramReq.CompanyId = int(userReq.CompanyId)
  149 + paramReq.TargetUserId = int(userReq.UserId)
146 data, err := srv.SelectAssessInviteUser(paramReq) 150 data, err := srv.SelectAssessInviteUser(paramReq)
147 c.Response(data, err) 151 c.Response(data, err)
148 } 152 }
@@ -157,9 +161,12 @@ func (c *StaffAssessController) ListMeInviteUserAssess() { @@ -157,9 +161,12 @@ func (c *StaffAssessController) ListMeInviteUserAssess() {
157 c.Response(nil, e) 161 c.Response(nil, e)
158 return 162 return
159 } 163 }
160 - //TODO 获取当前用户信息  
161 - paramReq.CompanyId = 1  
162 - paramReq.ExecutorId = 1 164 + //获取当前用户信息
  165 + // paramReq.CompanyId = 1
  166 + // paramReq.ExecutorId = 1
  167 + userReq := middlewares.GetUser(c.Ctx)
  168 + paramReq.CompanyId = int(userReq.CompanyId)
  169 + paramReq.ExecutorId = int(userReq.UserId)
163 data, err := srv.ListExecutorInviteAssess(paramReq) 170 data, err := srv.ListExecutorInviteAssess(paramReq)
164 c.Response(data, err) 171 c.Response(data, err)
165 } 172 }
@@ -175,8 +182,11 @@ func (c *StaffAssessController) ListMeSupperAssess() { @@ -175,8 +182,11 @@ func (c *StaffAssessController) ListMeSupperAssess() {
175 return 182 return
176 } 183 }
177 //TODO 获取当前用户信息 184 //TODO 获取当前用户信息
178 - paramReq.CompanyId = 1  
179 - paramReq.ExecutorId = 1 185 + // paramReq.CompanyId = 1
  186 + // paramReq.ExecutorId = 1
  187 + userReq := middlewares.GetUser(c.Ctx)
  188 + paramReq.CompanyId = int(userReq.CompanyId)
  189 + paramReq.ExecutorId = int(userReq.UserId)
180 data, err := srv.ListExecutorSupperAssess(paramReq) 190 data, err := srv.ListExecutorSupperAssess(paramReq)
181 c.Response(data, err) 191 c.Response(data, err)
182 } 192 }
@@ -191,7 +201,9 @@ func (c *StaffAssessController) GetAssessTargetUserSelfInfo() { @@ -191,7 +201,9 @@ func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
191 c.Response(nil, e) 201 c.Response(nil, e)
192 return 202 return
193 } 203 }
194 - paramReq.CompanyId = 1 204 + // paramReq.CompanyId = 1
  205 + userReq := middlewares.GetUser(c.Ctx)
  206 + paramReq.CompanyId = int(userReq.CompanyId)
195 data, err := srv.GetAssessSelfInfo(paramReq) 207 data, err := srv.GetAssessSelfInfo(paramReq)
196 c.Response(data, err) 208 c.Response(data, err)
197 } 209 }
@@ -206,7 +218,9 @@ func (c *StaffAssessController) GetAssessInfo() { @@ -206,7 +218,9 @@ func (c *StaffAssessController) GetAssessInfo() {
206 c.Response(nil, e) 218 c.Response(nil, e)
207 return 219 return
208 } 220 }
209 - paramReq.CompanyId = 1 221 + // paramReq.CompanyId = 1
  222 + userReq := middlewares.GetUser(c.Ctx)
  223 + paramReq.CompanyId = int(userReq.CompanyId)
210 data, err := srv.GetAssessInfo(paramReq) 224 data, err := srv.GetAssessInfo(paramReq)
211 c.Response(data, err) 225 c.Response(data, err)
212 } 226 }
@@ -235,7 +249,9 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() { @@ -235,7 +249,9 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() {
235 c.Response(nil, e) 249 c.Response(nil, e)
236 return 250 return
237 } 251 }
238 - paramReq.CompanyId = 1 252 + // paramReq.CompanyId = 1
  253 + userReq := middlewares.GetUser(c.Ctx)
  254 + paramReq.CompanyId = int(userReq.CompanyId)
239 paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)} 255 paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
240 data, err := srv.ListTargetUserAssess(paramReq) 256 data, err := srv.ListTargetUserAssess(paramReq)
241 c.Response(data, err) 257 c.Response(data, err)