Merge remote-tracking branch 'origin/test' into test
正在显示
6 个修改的文件
包含
86 行增加
和
23 行删除
@@ -5,16 +5,16 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | @@ -5,16 +5,16 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
5 | //评估内容详情 | 5 | //评估内容详情 |
6 | type AssessInfoResp struct { | 6 | type AssessInfoResp struct { |
7 | AssessId int `json:"assessId"` | 7 | AssessId int `json:"assessId"` |
8 | - CycleId int64 `json:"cycleId"` //周期id | 8 | + CycleId int64 `json:"cycleId,string"` //周期id |
9 | CycleName string `json:"cycleName"` //周期名称 | 9 | CycleName string `json:"cycleName"` //周期名称 |
10 | EvaluationProjectId int `json:"evaluationProjectId"` //项目id | 10 | EvaluationProjectId int `json:"evaluationProjectId"` //项目id |
11 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | 11 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 |
12 | - LinkNodeId int `json:"linkNodeId"` | 12 | + LinkNodeId int `json:"linkNodeId,string"` |
13 | LinkNodeName string `json:"linkNodeName"` | 13 | LinkNodeName string `json:"linkNodeName"` |
14 | BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | 14 | BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 |
15 | EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | 15 | EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 |
16 | Status string `json:"status"` //完成状态 | 16 | Status string `json:"status"` //完成状态 |
17 | - TargetUserId int `json:"targetUser"` //目标用户 | 17 | + TargetUserId int `json:"targetUserId,string"` //目标用户 |
18 | TargetUserName string `json:"targetUserName"` //目标用户名称 | 18 | TargetUserName string `json:"targetUserName"` //目标用户名称 |
19 | CompanyId int `json:"companyId,string,"` // | 19 | CompanyId int `json:"companyId,string,"` // |
20 | CompanyName string `json:"companyName"` //公司名称 | 20 | CompanyName string `json:"companyName"` //公司名称 |
@@ -2,7 +2,7 @@ package adapter | @@ -2,7 +2,7 @@ package adapter | ||
2 | 2 | ||
3 | type AssessTaskDescResp struct { | 3 | type AssessTaskDescResp struct { |
4 | AssessTaskId int `json:"assessTaskId"` // | 4 | AssessTaskId int `json:"assessTaskId"` // |
5 | - EvaluationProjectId int `json:"evaluationProjectId"` //项目id | 5 | + EvaluationProjectId int `json:"evaluationProjectId,string"` //项目id |
6 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | 6 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 |
7 | CycleName string `json:"cycleName"` //周期名称 | 7 | CycleName string `json:"cycleName"` //周期名称 |
8 | BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | 8 | BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 |
@@ -2,7 +2,7 @@ package adapter | @@ -2,7 +2,7 @@ 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 | + UsrId int `json:"userId,string"` |
6 | UserName string `json:"userName"` //用户名称 | 6 | UserName string `json:"userName"` //用户名称 |
7 | EndTime string `json:"endTime"` //截止时间 | 7 | EndTime string `json:"endTime"` //截止时间 |
8 | InviteTotal int `json:"inviteTota"` //邀请总数 | 8 | InviteTotal int `json:"inviteTota"` //邀请总数 |
@@ -37,27 +37,40 @@ func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQue | @@ -37,27 +37,40 @@ func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQue | ||
37 | defer func() { | 37 | defer func() { |
38 | _ = transactionContext.RollbackTransaction() | 38 | _ = transactionContext.RollbackTransaction() |
39 | }() | 39 | }() |
40 | - staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ | 40 | + // staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ |
41 | + // "transactionContext": transactionContext, | ||
42 | + // }) | ||
43 | + | ||
44 | + staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{ | ||
41 | "transactionContext": transactionContext, | 45 | "transactionContext": transactionContext, |
42 | }) | 46 | }) |
43 | - var limit int = 20 | 47 | + |
48 | + var limit int = 200 | ||
44 | var offset int = 0 | 49 | var offset int = 0 |
45 | if param.PageSize > 0 { | 50 | if param.PageSize > 0 { |
46 | limit = param.PageSize | 51 | limit = param.PageSize |
47 | } | 52 | } |
48 | offset = (param.PageNumber - 1) * param.PageSize | 53 | offset = (param.PageNumber - 1) * param.PageSize |
49 | - condition := map[string]interface{}{ | ||
50 | - "executorId": param.UserId, | ||
51 | - "companyId": param.CompanyId, | ||
52 | - "limit": limit, | ||
53 | - } | ||
54 | - if offset > 0 { | ||
55 | - condition["offset"] = offset | 54 | + assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset) |
55 | + if err != nil { | ||
56 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error()) | ||
56 | } | 57 | } |
57 | - cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition) | 58 | + cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId) |
58 | if err != nil { | 59 | if err != nil { |
59 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error()) | 60 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error()) |
60 | } | 61 | } |
62 | + // condition := map[string]interface{}{ | ||
63 | + // "executorId": param.UserId, | ||
64 | + // "companyId": param.CompanyId, | ||
65 | + // "limit": limit, | ||
66 | + // } | ||
67 | + // if offset > 0 { | ||
68 | + // condition["offset"] = offset | ||
69 | + // } | ||
70 | + // cnt, assessTaskList, err := staffAssessTaskRepo.Find(condition) | ||
71 | + // if err != nil { | ||
72 | + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询周期"+err.Error()) | ||
73 | + // } | ||
61 | if err := transactionContext.CommitTransaction(); err != nil { | 74 | if err := transactionContext.CommitTransaction(); err != nil { |
62 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 75 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
63 | } | 76 | } |
@@ -200,6 +213,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) | @@ -200,6 +213,7 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) | ||
200 | } | 213 | } |
201 | } | 214 | } |
202 | if uncompletedNum > 0 { | 215 | if uncompletedNum > 0 { |
216 | + stepItem.Status = string(domain.StaffAssessUncompleted) | ||
203 | stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum) | 217 | stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum) |
204 | } | 218 | } |
205 | } | 219 | } |
@@ -356,10 +370,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat | @@ -356,10 +370,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat | ||
356 | return nil, application.ThrowError(application.ARG_ERROR, "任务结束时间填写错误,"+param.EndTime) | 370 | return nil, application.ThrowError(application.ARG_ERROR, "任务结束时间填写错误,"+param.EndTime) |
357 | } | 371 | } |
358 | nowTime := time.Now() | 372 | nowTime := time.Now() |
359 | - // if len(assassessTaskList) > 0 { | ||
360 | - // assessTaskData = assassessTaskList[0] | ||
361 | - // assessTaskData.UpdatedAt = nowTime | ||
362 | - // } else { | ||
363 | //建立评估任务 | 373 | //建立评估任务 |
364 | assessTaskData := &domain.StaffAssessTask{ | 374 | assessTaskData := &domain.StaffAssessTask{ |
365 | Id: 0, | 375 | Id: 0, |
@@ -551,11 +561,11 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. | @@ -551,11 +561,11 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. | ||
551 | stepSelfTemp.LinkNodeId = v.LinkNodeId | 561 | stepSelfTemp.LinkNodeId = v.LinkNodeId |
552 | stepSelfTemp.LinkNodeName = v.LinkNodeName | 562 | stepSelfTemp.LinkNodeName = v.LinkNodeName |
553 | stepSelfTemp.Types = domain.AssessSuper | 563 | stepSelfTemp.Types = domain.AssessSuper |
554 | - assessListTemp, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap) | 564 | + assessListTemp2, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap) |
555 | if err != nil { | 565 | if err != nil { |
556 | return nil, err | 566 | return nil, err |
557 | } | 567 | } |
558 | - assessList = append(assessList, assessListTemp...) | 568 | + assessList = append(assessList, assessListTemp2...) |
559 | } | 569 | } |
560 | } | 570 | } |
561 | return assessList, nil | 571 | return assessList, nil |
@@ -1655,6 +1665,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1655,6 +1665,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1655 | } | 1665 | } |
1656 | } | 1666 | } |
1657 | } | 1667 | } |
1668 | + | ||
1658 | //保存信息 | 1669 | //保存信息 |
1659 | for i := range assessContentList { | 1670 | for i := range assessContentList { |
1660 | _, err = assessContentRepo.Save(assessContentList[i]) | 1671 | _, err = assessContentRepo.Save(assessContentList[i]) |
@@ -1662,6 +1673,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1662,6 +1673,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1662 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error()) | 1673 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error()) |
1663 | } | 1674 | } |
1664 | } | 1675 | } |
1676 | + assessData.Status = domain.StaffAssessCompleted | ||
1677 | + assessData.UpdatedAt = time.Now() | ||
1678 | + _, err = assessReps.Save(assessData) | ||
1679 | + if err != nil { | ||
1680 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) | ||
1681 | + } | ||
1665 | if err := transactionContext.CommitTransaction(); err != nil { | 1682 | if err := transactionContext.CommitTransaction(); err != nil { |
1666 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1683 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1667 | } | 1684 | } |
@@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
5 | 5 | ||
6 | "github.com/go-pg/pg/v10" | 6 | "github.com/go-pg/pg/v10" |
7 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 7 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type StaffAssessDao struct { | 11 | type StaffAssessDao struct { |
@@ -54,3 +55,46 @@ func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTask | @@ -54,3 +55,46 @@ func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTask | ||
54 | _, err := tx.Query(&result, sqlStr, condition...) | 55 | _, err := tx.Query(&result, sqlStr, condition...) |
55 | return result, err | 56 | return result, err |
56 | } | 57 | } |
58 | + | ||
59 | +// 搜索 executorId 参与的评估任务 | ||
60 | +func (d *StaffAssessDao) SearchAssessTaskMe(executorId int, companyId int, limit int, offset int) ([]*domain.StaffAssessTask, error) { | ||
61 | + | ||
62 | + if limit < 0 { | ||
63 | + limit = 20 | ||
64 | + } | ||
65 | + if offset < 0 { | ||
66 | + offset = 0 | ||
67 | + } | ||
68 | + | ||
69 | + sqlStr := `SELECT DISTINCT staff_assess_task.* FROM staff_assess_task | ||
70 | + JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" | ||
71 | + WHERE staff_assess.company_id=? | ||
72 | + and staff_assess.executor->>'userId'='?' | ||
73 | + limit ? offset ? | ||
74 | + ` | ||
75 | + tx := d.transactionContext.PgTx | ||
76 | + condition := []interface{}{ | ||
77 | + companyId, executorId, limit, offset, | ||
78 | + } | ||
79 | + result := []*domain.StaffAssessTask{} | ||
80 | + _, err := tx.Query(&result, sqlStr, condition...) | ||
81 | + return result, err | ||
82 | + | ||
83 | +} | ||
84 | + | ||
85 | +// 搜索 executorId 参与的评估任务 | ||
86 | +func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int, error) { | ||
87 | + sqlStr := `SELECT count( DISTINCT staff_assess_task."id") FROM staff_assess_task | ||
88 | + JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" | ||
89 | + WHERE staff_assess.company_id=? | ||
90 | + and staff_assess.executor->>'userId'='?' | ||
91 | + ` | ||
92 | + tx := d.transactionContext.PgTx | ||
93 | + condition := []interface{}{ | ||
94 | + companyId, executorId, | ||
95 | + } | ||
96 | + result := 0 | ||
97 | + _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...) | ||
98 | + return result, err | ||
99 | + | ||
100 | +} |
@@ -115,7 +115,7 @@ func (c *StaffAssessController) GetAssessMeInviteUser() { | @@ -115,7 +115,7 @@ func (c *StaffAssessController) GetAssessMeInviteUser() { | ||
115 | c.Response(data, err) | 115 | c.Response(data, err) |
116 | } | 116 | } |
117 | 117 | ||
118 | -// 保持我邀请的员工 | 118 | +// 保存我邀请的员工 |
119 | func (c *StaffAssessController) SaveAssessMeInviteUser() { | 119 | func (c *StaffAssessController) SaveAssessMeInviteUser() { |
120 | srv := service.NewStaffAssessServeice() | 120 | srv := service.NewStaffAssessServeice() |
121 | paramReq := &command.SaveAssessInvite{} | 121 | paramReq := &command.SaveAssessInvite{} |
@@ -128,6 +128,8 @@ func (c *StaffAssessController) SaveAssessMeInviteUser() { | @@ -128,6 +128,8 @@ func (c *StaffAssessController) SaveAssessMeInviteUser() { | ||
128 | //TODO 获取当前用户信息 | 128 | //TODO 获取当前用户信息 |
129 | // paramReq.CompanyId = 1 | 129 | // paramReq.CompanyId = 1 |
130 | // paramReq.UserId = 1 | 130 | // paramReq.UserId = 1 |
131 | + userReq := middlewares.GetUser(c.Ctx) | ||
132 | + paramReq.TargetUserId = int(userReq.UserId) | ||
131 | data, err := srv.SaveAssessInviteUser(paramReq) | 133 | data, err := srv.SaveAssessInviteUser(paramReq) |
132 | c.Response(data, err) | 134 | c.Response(data, err) |
133 | } | 135 | } |
-
请 注册 或 登录 后发表评论