作者 Your Name

更新

package adapter
type ListInviteUserAssessResp struct {
TableHeader []ListTableHeader
List []map[string]string
Total int
LinkNodeName string `json:"linkNodeName"`
LinkNodeId int `json:"linkNodeId"`
LintNodeDesc string `json:"lintNodeDesc"`
TableHeader []ListTableHeader `json:"tableHeader"`
List []map[string]string `json:"list"`
Total int `json:"total"`
}
type ListTableHeader struct {
Key string
Name string
Key string `json:"key"`
Name string `json:"name"`
}
... ...
... ... @@ -6,6 +6,7 @@ type ListSupperAssessResp struct {
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteTota"` //邀请总数
InviteCompleted int `json:"inviteCompleted"` //邀请未完成
Status string `json:"status"`
Department string `json:"department"` //部门
Position string `json:"position"` //职位
DutyTime string `json:"dutyTime"` //入职时间
... ...
... ... @@ -1091,16 +1091,26 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
// assessTaskkRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
//获取 executorId 对应的360评估任务 用户
cnt, assessList, err := assessRepo.Find(map[string]interface{}{
condition := map[string]interface{}{
"staffAssessTaskId": param.AssessTaskId,
"executorId": param.ExecutorId,
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
})
"limit": 20,
}
if param.PageSize > 0 {
condition["limit"] = param.PageSize
}
offset := (param.PageNumber - 1) * param.PageSize
if offset > 0 {
condition["offset"] = offset
}
cnt, assessList, err := assessRepo.Find(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -1125,13 +1135,51 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
Name: name,
})
}
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
// 获取已经填报的内容
changeableRows := map[int]map[string]string{}
for _, v := range assessList {
_, contentList, err := assessContentRepo.Find(map[string]interface{}{
"staffAssessId": v.Id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())
}
row := map[string]string{}
for _, vv := range contentList {
name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)
if kk, ok := keyMap[name]; ok {
row[kk] = vv.Value
}
}
changeableRows[v.TargetUser.UserId] = row
}
//获取360邀请评估完成情况
//我评估别人,被邀请评估
cnnt, _, err := assessRepo.Find(map[string]interface{}{
"staffAssessTaskId": param.AssessTaskId,
"executorId": param.ExecutorId,
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
"status": domain.StaffAssessUncompleted,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
}
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
"id": param.AssessTaskId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
//TODO 评估填写数据行转列
//评估填写数据行转列
tableHeader := []adapter.ListTableHeader{
{Key: "userName", Name: "姓名"},
{Key: "status", Name: "状态"},
... ... @@ -1143,20 +1191,35 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
for _, v := range assessList {
m := map[string]string{
"userName": v.TargetUser.UserName,
"userId": strconv.Itoa(v.TargetUser.UserId),
"status": string(v.Status),
"types": string(v.Types),
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
"assessId": strconv.Itoa(v.Id),
}
if row, ok := changeableRows[v.TargetUser.UserId]; ok {
for k, v := range row {
m[k] = v
}
} else {
for _, v := range changeableHeader {
m[v.Key] = ""
}
}
listData = append(listData, m)
}
_ = tableHeader
result := adapter.ListInviteUserAssessResp{
TableHeader: tableHeader,
List: listData,
Total: cnt,
}
for _, v := range assessTaskData.StepList {
if v.LinkNodeType == domain.LinkNodeAllAssessment {
result.LinkNodeId = v.LinkNodeId
result.LinkNodeName = v.LinkNodeName
result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
}
}
return &result, nil
}
... ... @@ -1251,6 +1314,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteCompleted: 0,
Status: string(v.Status),
InviteTotal: 5,
Department: "",
Position: "",
... ...
... ... @@ -96,10 +96,8 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() {
c.Response(data, err)
}
//保存员工自评填写内容
// 获取员工邀请的人
func (c *StaffAssessController) GetAssessInviteUser() {
// 获取我邀请的人
func (c *StaffAssessController) GetAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &query.GetAssessInviteUserQuery{}
err := c.BindJSON(paramReq)
... ... @@ -116,7 +114,7 @@ func (c *StaffAssessController) GetAssessInviteUser() {
}
// 保持员工邀请的人
func (c *StaffAssessController) SaveAssessInviteUser() {
func (c *StaffAssessController) SaveAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &command.SaveAssessInvite{}
err := c.BindJSON(paramReq)
... ... @@ -184,7 +182,7 @@ func (c *StaffAssessController) ListMeSupperAssess() {
}
// 获取员工自评详情
func (c *StaffAssessController) GetAssessSelfInfo() {
func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfInfoQuery{}
err := c.BindJSON(paramReq)
... ...
... ... @@ -17,15 +17,15 @@ func init() {
// web.NSBefore(filters.AllowCors(), middlewares.CheckToken()),
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessInviteUser), //保存我邀请的员工
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessSelfInfo), //获取员工的自评反馈详情
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //保存员工评估的详情
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工评估的详情
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
web.AddNamespace(assessTaskNS)
... ...