作者 郑周

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

@@ -8,6 +8,7 @@ COPY ./go.mod go.mod @@ -8,6 +8,7 @@ COPY ./go.mod go.mod
8 COPY ./go.sum go.sum 8 COPY ./go.sum go.sum
9 COPY ./main.go main.go 9 COPY ./main.go main.go
10 COPY ./key key 10 COPY ./key key
  11 +COPY ./templates templates
11 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 12 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
12 ENV GO111MODULE on 13 ENV GO111MODULE on
13 ENV GOPROXY https://goproxy.io 14 ENV GOPROXY https://goproxy.io
1 package main 1 package main
2 2
3 import ( 3 import (
  4 + "time"
  5 +
4 "github.com/beego/beego/v2/server/web" 6 "github.com/beego/beego/v2/server/web"
5 serviceTask "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/node_task" 7 serviceTask "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/node_task"
6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
7 _ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego" 9 _ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego"
8 - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/consumer"  
9 - "time"  
10 ) 10 )
11 11
12 func main() { 12 func main() {
@@ -17,7 +17,7 @@ func main() { @@ -17,7 +17,7 @@ func main() {
17 // for k, v := range methods { 17 // for k, v := range methods {
18 // fmt.Printf("%s => %v \n", k, v) 18 // fmt.Printf("%s => %v \n", k, v)
19 // } 19 // }
20 - go consumer.Run() 20 + // go consumer.Run()
21 web.Run() 21 web.Run()
22 } 22 }
23 23
@@ -2,8 +2,8 @@ package query @@ -2,8 +2,8 @@ package query
2 2
3 //获取员工自评填写详情 3 //获取员工自评填写详情
4 type AssessSelfInfoQuery struct { 4 type AssessSelfInfoQuery struct {
5 - AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id  
6 - TargetUserId int `json:"targetUserId"` //被评估的人id  
7 - CompanyId int `json:"companyId"` //公司id 5 + AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
  6 + TargetUserId int `json:"targetUserId,string"` //被评估的人id
  7 + CompanyId int `json:"companyId"` //公司id
8 8
9 } 9 }
@@ -3,7 +3,7 @@ package query @@ -3,7 +3,7 @@ package query
3 //获取员工 被评估的列表 3 //获取员工 被评估的列表
4 type ListTargetUserAssessQuery struct { 4 type ListTargetUserAssessQuery struct {
5 AssessTaskId int `json:"assessTaskId"` 5 AssessTaskId int `json:"assessTaskId"`
6 - TargetUserId int `json:"targetUserId"` 6 + TargetUserId int `json:"targetUserId,string"`
7 CompanyId int `json:"companyId"` 7 CompanyId int `json:"companyId"`
8 Types []string `json:"tyspes"` 8 Types []string `json:"tyspes"`
9 } 9 }
@@ -164,10 +164,12 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) @@ -164,10 +164,12 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
164 if err != nil { 164 if err != nil {
165 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) 165 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
166 } 166 }
  167 + if len(assessInviteData) > 0 {
  168 + stepItem.Status = string(domain.StaffAssessCompleted)
  169 + }
167 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可 170 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
168 if len(assessInviteData) > 5 { 171 if len(assessInviteData) > 5 {
169 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) 172 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
170 - stepItem.Status = string(domain.StaffAssessCompleted)  
171 } else { 173 } else {
172 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData)) 174 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
173 stepItem.Status = string(domain.StaffAssessUncompleted) 175 stepItem.Status = string(domain.StaffAssessUncompleted)
@@ -1300,6 +1302,19 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU @@ -1300,6 +1302,19 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
1300 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), 1302 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
1301 "assessId": strconv.Itoa(v.Id), 1303 "assessId": strconv.Itoa(v.Id),
1302 } 1304 }
  1305 + switch v.Status {
  1306 + case domain.StaffAssessCompleted:
  1307 + m["status"] = "已经完成"
  1308 + case domain.StaffAssessUncompleted:
  1309 + m["status"] = "未完成"
  1310 + }
  1311 +
  1312 + switch v.Types {
  1313 + case domain.AssessInviteDiffSuper:
  1314 + m["typs"] = "不同上级同事"
  1315 + case domain.AssessInviteSameSuper:
  1316 + m["types"] = "相同上级同事"
  1317 + }
1303 if row, ok := changeableRows[v.TargetUser.UserId]; ok { 1318 if row, ok := changeableRows[v.TargetUser.UserId]; ok {
1304 for k, v := range row { 1319 for k, v := range row {
1305 m[k] = v 1320 m[k] = v
@@ -1405,7 +1420,25 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA @@ -1405,7 +1420,25 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
1405 log.Logger.Error("获取员工邀请的人完成情况" + err.Error()) 1420 log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
1406 } 1421 }
1407 } 1422 }
1408 - 1423 + assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  1424 + "transactionContext": transactionContext,
  1425 + })
  1426 + assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
  1427 + "id": param.AssessTaskId,
  1428 + })
  1429 + if err != nil {
  1430 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
  1431 + }
  1432 + //我评估别人,被邀请评估
  1433 + cnnt, _, err := assessRepo.Find(map[string]interface{}{
  1434 + "staffAssessTaskId": param.AssessTaskId,
  1435 + "executorId": param.ExecutorId,
  1436 + "typesList": []string{string(domain.AssessSuper)},
  1437 + "status": string(domain.StaffAssessUncompleted),
  1438 + })
  1439 + if err != nil {
  1440 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  1441 + }
1409 if err := transactionContext.CommitTransaction(); err != nil { 1442 if err := transactionContext.CommitTransaction(); err != nil {
1410 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1443 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1411 } 1444 }
@@ -1450,7 +1483,18 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA @@ -1450,7 +1483,18 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
1450 } 1483 }
1451 resultList = append(resultList, item) 1484 resultList = append(resultList, item)
1452 } 1485 }
1453 - return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil 1486 + result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
  1487 + result["linkNodeName"] = ""
  1488 + result["linkNodeId"] = ""
  1489 + result["lintNodeDesc"] = ""
  1490 + for _, v := range assessTaskData.StepList {
  1491 + if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
  1492 + result["linkNodeName"] = v.LinkNodeName
  1493 + result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)
  1494 + result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
  1495 + }
  1496 + }
  1497 + return result, nil
1454 } 1498 }
1455 1499
1456 // 根据staffAssessId 获取评估的填写信息 1500 // 根据staffAssessId 获取评估的填写信息
@@ -1707,6 +1751,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA @@ -1707,6 +1751,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA
1707 "assessTaskId": param.AssessTaskId, 1751 "assessTaskId": param.AssessTaskId,
1708 "companyId": param.CompanyId, 1752 "companyId": param.CompanyId,
1709 "targetUserId": param.TargetUserId, 1753 "targetUserId": param.TargetUserId,
  1754 + "typesList": param.Types,
1710 }) 1755 })
1711 if err != nil { 1756 if err != nil {
1712 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) 1757 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
@@ -40,7 +40,7 @@ func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTask @@ -40,7 +40,7 @@ func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTask
40 WHERE staff_assess.target_user->>'userId' IN(?) 40 WHERE staff_assess.target_user->>'userId' IN(?)
41 AND staff_assess.types IN ('invite_same_super','invite_diff_super') 41 AND staff_assess.types IN ('invite_same_super','invite_diff_super')
42 AND staff_assess.staff_assess_task_id = ? 42 AND staff_assess.staff_assess_task_id = ?
43 - GROUP BY userId` 43 + GROUP BY target_user_id`
44 44
45 userIdList := []string{} 45 userIdList := []string{}
46 for _, v := range userIds { 46 for _, v := range userIds {
@@ -258,3 +258,21 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() { @@ -258,3 +258,21 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() {
258 data, err := srv.ListTargetUserAssess(paramReq) 258 data, err := srv.ListTargetUserAssess(paramReq)
259 c.Response(data, err) 259 c.Response(data, err)
260 } 260 }
  261 +
  262 +func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
  263 + srv := service.NewStaffAssessServeice()
  264 + paramReq := &query.ListTargetUserAssessQuery{}
  265 + err := c.BindJSON(paramReq)
  266 + if err != nil {
  267 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  268 + c.Response(nil, e)
  269 + return
  270 + }
  271 + // paramReq.CompanyId = 1
  272 + userReq := middlewares.GetUser(c.Ctx)
  273 + paramReq.CompanyId = int(userReq.CompanyId)
  274 + paramReq.Types = []string{string(domain.AssessSuper)}
  275 + paramReq.TargetUserId = int(userReq.UserId)
  276 + data, err := srv.ListTargetUserAssess(paramReq)
  277 + c.Response(data, err)
  278 +}
@@ -17,17 +17,18 @@ func init() { @@ -17,17 +17,18 @@ func init() {
17 // /v1/staff-assess/self/me/list 17 // /v1/staff-assess/self/me/list
18 assessNS := web.NewNamespace("/v1/staff-assess", 18 assessNS := web.NewNamespace("/v1/staff-assess",
19 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 19 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
20 - web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表  
21 - web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情  
22 - web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工  
23 - web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工  
24 - web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工  
25 - web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表  
26 - web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表  
27 - web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情  
28 - web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情  
29 - web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工评估的详情  
30 - web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 20 + web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
  21 + web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
  22 + web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
  23 + web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
  24 + web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
  25 + web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
  26 + web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
  27 + web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
  28 + web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
  29 + web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
  30 + web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我的上级评估的列表
  31 + web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
31 32
32 ) 33 )
33 web.AddNamespace(assessTaskNS) 34 web.AddNamespace(assessTaskNS)