作者 tangxvhui

周期评估 查看限制

... ... @@ -12,9 +12,11 @@ type QueryExecutorEvaluationList struct {
// 查询上级评估列表
type QueryEvaluationList struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CycleId int `json:"cycleId,string"`
CompanyId int `json:"-"`
TargetUserName string `json:"targetUserName"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CycleId int `json:"cycleId,string"`
CompanyId int `json:"-"` //当前公司
UserId int `json:"-"` //当前操作的员工id
TargetUserName string `json:"targetUserName"` //按照目标员工的名称搜索
SummaryEvaluationId []string `json:"summaryEvaluationId"` //按照id 获取数据
}
... ...
... ... @@ -2,10 +2,12 @@ package service
import (
"fmt"
"strconv"
"github.com/linmadan/egglib-go/core/application"
"github.com/xuri/excelize/v2"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
... ... @@ -23,6 +25,13 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que
defer func() {
_ = transactionContext.RollbackTransaction()
}()
flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if flagHrbp != 1 {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "没有操作权限")
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ... @@ -47,6 +56,16 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que
if len(param.TargetUserName) > 0 {
condition1["targetUserName"] = "%" + param.TargetUserName + "%"
}
if len(param.SummaryEvaluationId) > 0 {
summaryEvaluationIds := []int{}
for _, v := range param.SummaryEvaluationId {
id, _ := strconv.Atoi(v)
summaryEvaluationIds = append(summaryEvaluationIds, id)
}
if len(summaryEvaluationIds) > 0 {
condition1["id"] = summaryEvaluationIds
}
}
//获取评估列表信息
_, evaluationList, err := evaluationRepo.Find(condition1)
if err != nil {
... ... @@ -61,7 +80,6 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que
}
userMap[int64(v.TargetUser.UserId)] = nil
targetUserIds = append(targetUserIds, v.TargetUser.UserId)
}
if len(targetUserIds) > 0 {
_, userList, err := userRepo.Find(map[string]interface{}{
... ...
... ... @@ -1458,6 +1458,7 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
// 获取周期综合评估下,周期评估列表
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -1468,6 +1469,13 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query
defer func() {
_ = transactionContext.RollbackTransaction()
}()
flagHrbp, err := roleService.GetHRBP(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if flagHrbp != 1 {
return map[string]interface{}{}, nil
}
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ...
... ... @@ -171,6 +171,9 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
t := v.(time.Time)
query.Where(`summary_evaluation.end_time>=?`, t)
}
if v, ok := queryOptions["id"]; ok {
query.Where(`summary_evaluation.id in (?)`, pg.In(v))
}
query.Order("id desc")
count, err := query.SelectAndCount()
... ...
... ... @@ -34,7 +34,6 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar
Rating: d.Rating,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
// IsTemporary: d.IsTemporary,
}
}
... ... @@ -51,7 +50,6 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
Remark: param.Remark,
CreatedAt: param.CreatedAt,
UpdatedAt: param.UpdatedAt,
// IsTemporary: param.IsTemporary,
}
db := repo.transactionContext.PgTx
if m.Id == 0 {
... ... @@ -64,6 +62,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati
} else {
m.UpdatedAt = time.Now()
_, err := db.Model(&m).WherePK().Update()
if err != nil {
return err
}
... ...
... ... @@ -332,6 +332,7 @@ func (c *SummaryEvaluationController) ListAllEvaluationSuper() {
}
userReq := middlewares.GetUser(c.Ctx)
param.CompanyId = int(userReq.CompanyId)
param.UserId = int(userReq.UserId)
data, err := srv.ListAllEvaluationSuper(param)
c.Response(data, err)
}
... ... @@ -347,6 +348,7 @@ func (c *SummaryEvaluationController) ExportAllEvaluationSuper() {
return
}
userReq := middlewares.GetUser(c.Ctx)
param.UserId = int(userReq.UserId)
param.CompanyId = int(userReq.CompanyId)
data, err := srv.ExportAllEvaluationSuper(param)
if err != nil {
... ...