作者 tangxvhui

更新执行人的 周期列表输出

package service
import (
"strconv"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"strconv"
)
type RoleUserService struct {
... ... @@ -115,6 +116,8 @@ func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface
}
// GetHRBP 当前操作人是否拥有HRBP权限
// 返回 1 是 表示具有hrbp 权限
func GetHRBP(transactionContext application.TransactionContext, companyId int, operatorId int) (int, error) {
roleRepo := factory.CreateRoleRepository(map[string]interface{}{"transactionContext": transactionContext})
roleUserRepo := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext})
... ...
... ... @@ -3,6 +3,7 @@ package command
// 获取周期列表
type QueryCycleList struct {
UserId int `json:"userId,string"`
CompanyId int `json:"-"`
Types int `json:"types"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
... ...
... ... @@ -38,6 +38,15 @@ func (srv *SummaryEvaluationService) GetExecutorCycleList(param *command.QueryCy
evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
"transactionContext": transactionContext,
})
flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
var isHrbp bool
if flagHrbp == 1 {
isHrbp = true
}
limit := 300
offset := 0
if param.PageSize > 0 {
... ... @@ -47,7 +56,7 @@ func (srv *SummaryEvaluationService) GetExecutorCycleList(param *command.QueryCy
offset = (param.PageNumber - 1) * param.PageSize
}
cycleData, err := evaluationDao.GetExecutorCycleList(param.UserId, offset, limit, domain.EvaluationSelf)
cycleData, err := evaluationDao.GetExecutorCycleList(param.UserId, offset, limit, isHrbp)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
}
... ... @@ -237,7 +246,9 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri
}
}
menu1.Child = append(menu1.Child, menu1_1, menu1_2)
menuList = append(menuList, menu1)
if len(selfEvaluation) > 0 {
menuList = append(menuList, menu1)
}
menu2 := adapter.MenuListAdapter{
CycleId: 0,
NodeName: "给他人评估",
... ...
... ... @@ -30,7 +30,7 @@ type ExecutorCycle struct {
// GetExecutorCycleList 获取执行人拥有的周期列表
// executorId 执行人id
// offset,limit 分页
func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, evaluationType domain.EvaluationType) ([]ExecutorCycle, error) {
func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int, limit int, isHrbp bool) ([]ExecutorCycle, error) {
sqlStr := `select
distinct
summary_evaluation.cycle_id ,
... ... @@ -42,12 +42,9 @@ func (d *SummaryEvaluationDao) GetExecutorCycleList(executorId int, offset int,
condition := []interface{}{
executorId,
}
if evaluationType > 0 {
sqlStr += ` and summary_evaluation."types"=? `
condition = append(condition, int(evaluationType))
if isHrbp {
sqlStr += ` or summary_evaluation."types"=4 `
}
condition = append(condition, offset, limit)
sqlStr += ` order by summary_evaluation.cycle_id desc offset ? limit ? `
result := []ExecutorCycle{}
... ...