作者 Your Name

更新

1 package adapter 1 package adapter
2 2
3 type ListInviteUserAssessResp struct { 3 type ListInviteUserAssessResp struct {
4 - TableHeader []ListTableHeader  
5 - List []map[string]string  
6 - Total int 4 + LinkNodeName string `json:"linkNodeName"`
  5 + LinkNodeId int `json:"linkNodeId"`
  6 + LintNodeDesc string `json:"lintNodeDesc"`
  7 + TableHeader []ListTableHeader `json:"tableHeader"`
  8 + List []map[string]string `json:"list"`
  9 + Total int `json:"total"`
7 } 10 }
8 type ListTableHeader struct { 11 type ListTableHeader struct {
9 - Key string  
10 - Name string 12 + Key string `json:"key"`
  13 + Name string `json:"name"`
11 } 14 }
@@ -6,7 +6,8 @@ type ListSupperAssessResp struct { @@ -6,7 +6,8 @@ type ListSupperAssessResp struct {
6 EndTime string `json:"endTime"` //截止时间 6 EndTime string `json:"endTime"` //截止时间
7 InviteTotal int `json:"inviteTota"` //邀请总数 7 InviteTotal int `json:"inviteTota"` //邀请总数
8 InviteCompleted int `json:"inviteCompleted"` //邀请未完成 8 InviteCompleted int `json:"inviteCompleted"` //邀请未完成
9 - Department string `json:"department"` //部门  
10 - Position string `json:"position"` //职位  
11 - DutyTime string `json:"dutyTime"` //入职时间 9 + Status string `json:"status"`
  10 + Department string `json:"department"` //部门
  11 + Position string `json:"position"` //职位
  12 + DutyTime string `json:"dutyTime"` //入职时间
12 } 13 }
@@ -1091,16 +1091,26 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU @@ -1091,16 +1091,26 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
1091 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ 1091 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
1092 "transactionContext": transactionContext, 1092 "transactionContext": transactionContext,
1093 }) 1093 })
  1094 + assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  1095 + "transactionContext": transactionContext,
  1096 + })
1094 1097
1095 - // assessTaskkRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
1096 - // "transactionContext": transactionContext,  
1097 - // })  
1098 //获取 executorId 对应的360评估任务 用户 1098 //获取 executorId 对应的360评估任务 用户
1099 - cnt, assessList, err := assessRepo.Find(map[string]interface{}{ 1099 + condition := map[string]interface{}{
1100 "staffAssessTaskId": param.AssessTaskId, 1100 "staffAssessTaskId": param.AssessTaskId,
1101 "executorId": param.ExecutorId, 1101 "executorId": param.ExecutorId,
1102 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)}, 1102 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
1103 - }) 1103 + "limit": 20,
  1104 + }
  1105 + if param.PageSize > 0 {
  1106 + condition["limit"] = param.PageSize
  1107 + }
  1108 + offset := (param.PageNumber - 1) * param.PageSize
  1109 + if offset > 0 {
  1110 + condition["offset"] = offset
  1111 + }
  1112 +
  1113 + cnt, assessList, err := assessRepo.Find(condition)
1104 if err != nil { 1114 if err != nil {
1105 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1115 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1106 } 1116 }
@@ -1125,13 +1135,51 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU @@ -1125,13 +1135,51 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
1125 Name: name, 1135 Name: name,
1126 }) 1136 })
1127 } 1137 }
1128 - 1138 + assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
  1139 + "transactionContext": transactionContext,
  1140 + })
1129 // 获取已经填报的内容 1141 // 获取已经填报的内容
  1142 + changeableRows := map[int]map[string]string{}
  1143 + for _, v := range assessList {
  1144 + _, contentList, err := assessContentRepo.Find(map[string]interface{}{
  1145 + "staffAssessId": v.Id,
  1146 + })
  1147 + if err != nil {
  1148 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())
  1149 + }
  1150 + row := map[string]string{}
  1151 + for _, vv := range contentList {
  1152 + name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)
  1153 + if kk, ok := keyMap[name]; ok {
  1154 + row[kk] = vv.Value
  1155 + }
  1156 + }
  1157 + changeableRows[v.TargetUser.UserId] = row
  1158 + }
  1159 +
  1160 + //获取360邀请评估完成情况
  1161 + //我评估别人,被邀请评估
  1162 + cnnt, _, err := assessRepo.Find(map[string]interface{}{
  1163 + "staffAssessTaskId": param.AssessTaskId,
  1164 + "executorId": param.ExecutorId,
  1165 + "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  1166 + "status": domain.StaffAssessUncompleted,
  1167 + })
  1168 + if err != nil {
  1169 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  1170 + }
  1171 +
  1172 + assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
  1173 + "id": param.AssessTaskId,
  1174 + })
  1175 + if err != nil {
  1176 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
  1177 + }
1130 if err := transactionContext.CommitTransaction(); err != nil { 1178 if err := transactionContext.CommitTransaction(); err != nil {
1131 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1179 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1132 } 1180 }
1133 1181
1134 - //TODO 评估填写数据行转列 1182 + //评估填写数据行转列
1135 tableHeader := []adapter.ListTableHeader{ 1183 tableHeader := []adapter.ListTableHeader{
1136 {Key: "userName", Name: "姓名"}, 1184 {Key: "userName", Name: "姓名"},
1137 {Key: "status", Name: "状态"}, 1185 {Key: "status", Name: "状态"},
@@ -1143,20 +1191,35 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU @@ -1143,20 +1191,35 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
1143 for _, v := range assessList { 1191 for _, v := range assessList {
1144 m := map[string]string{ 1192 m := map[string]string{
1145 "userName": v.TargetUser.UserName, 1193 "userName": v.TargetUser.UserName,
  1194 + "userId": strconv.Itoa(v.TargetUser.UserId),
1146 "status": string(v.Status), 1195 "status": string(v.Status),
1147 "types": string(v.Types), 1196 "types": string(v.Types),
1148 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), 1197 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
1149 "assessId": strconv.Itoa(v.Id), 1198 "assessId": strconv.Itoa(v.Id),
1150 } 1199 }
  1200 + if row, ok := changeableRows[v.TargetUser.UserId]; ok {
  1201 + for k, v := range row {
  1202 + m[k] = v
  1203 + }
  1204 + } else {
  1205 + for _, v := range changeableHeader {
  1206 + m[v.Key] = ""
  1207 + }
  1208 + }
1151 listData = append(listData, m) 1209 listData = append(listData, m)
1152 } 1210 }
1153 - _ = tableHeader  
1154 -  
1155 result := adapter.ListInviteUserAssessResp{ 1211 result := adapter.ListInviteUserAssessResp{
1156 TableHeader: tableHeader, 1212 TableHeader: tableHeader,
1157 List: listData, 1213 List: listData,
1158 Total: cnt, 1214 Total: cnt,
1159 } 1215 }
  1216 + for _, v := range assessTaskData.StepList {
  1217 + if v.LinkNodeType == domain.LinkNodeAllAssessment {
  1218 + result.LinkNodeId = v.LinkNodeId
  1219 + result.LinkNodeName = v.LinkNodeName
  1220 + result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
  1221 + }
  1222 + }
1160 return &result, nil 1223 return &result, nil
1161 } 1224 }
1162 1225
@@ -1251,6 +1314,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA @@ -1251,6 +1314,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
1251 UserName: v.TargetUser.UserName, 1314 UserName: v.TargetUser.UserName,
1252 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), 1315 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
1253 InviteCompleted: 0, 1316 InviteCompleted: 0,
  1317 + Status: string(v.Status),
1254 InviteTotal: 5, 1318 InviteTotal: 5,
1255 Department: "", 1319 Department: "",
1256 Position: "", 1320 Position: "",
@@ -96,10 +96,8 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() { @@ -96,10 +96,8 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() {
96 c.Response(data, err) 96 c.Response(data, err)
97 } 97 }
98 98
99 -//保存员工自评填写内容  
100 -  
101 -// 获取员工邀请的人  
102 -func (c *StaffAssessController) GetAssessInviteUser() { 99 +// 获取我邀请的人
  100 +func (c *StaffAssessController) GetAssessMeInviteUser() {
103 srv := service.NewStaffAssessServeice() 101 srv := service.NewStaffAssessServeice()
104 paramReq := &query.GetAssessInviteUserQuery{} 102 paramReq := &query.GetAssessInviteUserQuery{}
105 err := c.BindJSON(paramReq) 103 err := c.BindJSON(paramReq)
@@ -116,7 +114,7 @@ func (c *StaffAssessController) GetAssessInviteUser() { @@ -116,7 +114,7 @@ func (c *StaffAssessController) GetAssessInviteUser() {
116 } 114 }
117 115
118 // 保持员工邀请的人 116 // 保持员工邀请的人
119 -func (c *StaffAssessController) SaveAssessInviteUser() { 117 +func (c *StaffAssessController) SaveAssessMeInviteUser() {
120 srv := service.NewStaffAssessServeice() 118 srv := service.NewStaffAssessServeice()
121 paramReq := &command.SaveAssessInvite{} 119 paramReq := &command.SaveAssessInvite{}
122 err := c.BindJSON(paramReq) 120 err := c.BindJSON(paramReq)
@@ -184,7 +182,7 @@ func (c *StaffAssessController) ListMeSupperAssess() { @@ -184,7 +182,7 @@ func (c *StaffAssessController) ListMeSupperAssess() {
184 } 182 }
185 183
186 // 获取员工自评详情 184 // 获取员工自评详情
187 -func (c *StaffAssessController) GetAssessSelfInfo() { 185 +func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
188 srv := service.NewStaffAssessServeice() 186 srv := service.NewStaffAssessServeice()
189 paramReq := &query.AssessSelfInfoQuery{} 187 paramReq := &query.AssessSelfInfoQuery{}
190 err := c.BindJSON(paramReq) 188 err := c.BindJSON(paramReq)
@@ -17,15 +17,15 @@ func init() { @@ -17,15 +17,15 @@ func init() {
17 // web.NSBefore(filters.AllowCors(), middlewares.CheckToken()), 17 // web.NSBefore(filters.AllowCors(), middlewares.CheckToken()),
18 web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 18 web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
19 web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情 19 web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
20 - web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessInviteUser), //获取邀请的员工  
21 - web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessInviteUser), //保存我邀请的员工 20 + web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
  21 + web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
22 web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工 22 web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
23 web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表 23 web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
24 web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表 24 web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
25 - web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessSelfInfo), //获取员工的自评反馈详情  
26 - web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //获取员工评估的详情  
27 - web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //保存员工评估的详情 25 + web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
  26 + web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
28 web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工评估的详情 27 web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工评估的详情
  28 + web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
29 29
30 ) 30 )
31 web.AddNamespace(assessTaskNS) 31 web.AddNamespace(assessTaskNS)