作者 郑周

Merge remote-tracking branch 'origin/test' into test

... ... @@ -8,6 +8,7 @@ COPY ./go.mod go.mod
COPY ./go.sum go.sum
COPY ./main.go main.go
COPY ./key key
COPY ./templates templates
RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io
... ...
package main
import (
"time"
"github.com/beego/beego/v2/server/web"
serviceTask "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/node_task"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/consumer"
"time"
)
func main() {
... ... @@ -17,7 +17,7 @@ func main() {
// for k, v := range methods {
// fmt.Printf("%s => %v \n", k, v)
// }
go consumer.Run()
// go consumer.Run()
web.Run()
}
... ...
... ... @@ -2,8 +2,8 @@ package query
//获取员工自评填写详情
type AssessSelfInfoQuery struct {
AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
TargetUserId int `json:"targetUserId"` //被评估的人id
CompanyId int `json:"companyId"` //公司id
AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
TargetUserId int `json:"targetUserId,string"` //被评估的人id
CompanyId int `json:"companyId"` //公司id
}
... ...
... ... @@ -3,7 +3,7 @@ package query
//获取员工 被评估的列表
type ListTargetUserAssessQuery struct {
AssessTaskId int `json:"assessTaskId"`
TargetUserId int `json:"targetUserId"`
TargetUserId int `json:"targetUserId,string"`
CompanyId int `json:"companyId"`
Types []string `json:"tyspes"`
}
... ...
... ... @@ -164,10 +164,12 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
}
if len(assessInviteData) > 0 {
stepItem.Status = string(domain.StaffAssessCompleted)
}
//待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
if len(assessInviteData) > 5 {
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
stepItem.Status = string(domain.StaffAssessCompleted)
} else {
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
stepItem.Status = string(domain.StaffAssessUncompleted)
... ... @@ -1300,6 +1302,19 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
"assessId": strconv.Itoa(v.Id),
}
switch v.Status {
case domain.StaffAssessCompleted:
m["status"] = "已经完成"
case domain.StaffAssessUncompleted:
m["status"] = "未完成"
}
switch v.Types {
case domain.AssessInviteDiffSuper:
m["typs"] = "不同上级同事"
case domain.AssessInviteSameSuper:
m["types"] = "相同上级同事"
}
if row, ok := changeableRows[v.TargetUser.UserId]; ok {
for k, v := range row {
m[k] = v
... ... @@ -1405,7 +1420,25 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
}
}
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
"id": param.AssessTaskId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
}
//我评估别人,被邀请评估
cnnt, _, err := assessRepo.Find(map[string]interface{}{
"staffAssessTaskId": param.AssessTaskId,
"executorId": param.ExecutorId,
"typesList": []string{string(domain.AssessSuper)},
"status": string(domain.StaffAssessUncompleted),
})
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())
}
... ... @@ -1450,7 +1483,18 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
}
resultList = append(resultList, item)
}
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
result["linkNodeName"] = ""
result["linkNodeId"] = ""
result["lintNodeDesc"] = ""
for _, v := range assessTaskData.StepList {
if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
result["linkNodeName"] = v.LinkNodeName
result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)
result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
}
}
return result, nil
}
// 根据staffAssessId 获取评估的填写信息
... ... @@ -1707,6 +1751,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA
"assessTaskId": param.AssessTaskId,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
"typesList": param.Types,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
... ...
... ... @@ -40,7 +40,7 @@ func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTask
WHERE staff_assess.target_user->>'userId' IN(?)
AND staff_assess.types IN ('invite_same_super','invite_diff_super')
AND staff_assess.staff_assess_task_id = ?
GROUP BY userId`
GROUP BY target_user_id`
userIdList := []string{}
for _, v := range userIds {
... ...
... ... @@ -258,3 +258,21 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() {
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.Types = []string{string(domain.AssessSuper)}
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
... ...
... ... @@ -17,17 +17,18 @@ func init() {
// /v1/staff-assess/self/me/list
assessNS := web.NewNamespace("/v1/staff-assess",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
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("/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.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
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("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我的上级评估的列表
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
web.AddNamespace(assessTaskNS)
... ...