作者 tangxvhui

更新

package command
// 查询执行人的上级评估列表
// 查询执行人的评估列表
type QueryExecutorEvaluationList struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
... ...
... ... @@ -3,6 +3,7 @@ package service
import (
"errors"
"fmt"
"strconv"
"strings"
"time"
... ... @@ -1676,3 +1677,51 @@ func (srv *SummaryEvaluationService) editEvaluationValue(
}
return nil
}
// 获取现在待执行的综合自评
func (srv *SummaryEvaluationService) ListExecutorNowEvaluationSelf(param *command.QueryExecutorEvaluationList) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
condition1 := map[string]interface{}{
"types": int(domain.EvaluationSelf),
"targetUserId": param.ExecutorId,
"limit": 20,
"beginTime": time.Now(),
"endTime": time.Now(),
"status": string(domain.EvaluationUncompleted),
}
//获取评估列表信息
cnt, evaluationList, err := evaluationRepo.Find(condition1)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
listResult := []map[string]string{}
for _, v := range evaluationList {
item := map[string]string{
"summaryEvaluationId": strconv.Itoa(v.Id),
"cycleId": strconv.Itoa(int(v.CycleId)),
"cycleName": v.CycleName,
"evaluationStatus": string(v.Status),
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
"beginTime": v.BeginTime.Local().Format("2006-01-02 15:04:05"),
}
listResult = append(listResult, item)
}
result := tool_funs.SimpleWrapGridMap(int64(cnt), listResult)
return result, nil
}
... ...
... ... @@ -39,11 +39,11 @@ type RatingCodeNumber struct {
type EvaluationType int //综合评估类型
const (
EvaluationSelf EvaluationType = 1 //自评
Evaluation360 EvaluationType = 2 //360评估
EvaluationSuper EvaluationType = 3 //上级评估
EvaluationHrbp EvaluationType = 4 //人资评估
EvaluationFinish EvaluationType = 5 //评估考核结果 TODO
EvaluationSelf EvaluationType = 1 //自评
Evaluation360 EvaluationType = 2 //360评估
EvaluationSuper EvaluationType = 3 //上级评估
EvaluationHrbp EvaluationType = 4 //人资评估
)
// 评估的填写状态
... ...
... ... @@ -362,3 +362,20 @@ func (c *SummaryEvaluationController) ExportAllEvaluationSuper() {
c.Ctx.Output.Header("Expires", "0")
data.Write(c.Ctx.ResponseWriter)
}
// 按周期获取上级评估列表
func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() {
srv := service.NewSummaryEvaluationService()
param := &command.QueryExecutorEvaluationList{}
err := c.BindJSON(param)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
param.CompanyId = int(userReq.CompanyId)
param.ExecutorId = int(userReq.UserId)
data, err := srv.ListExecutorNowEvaluationSelf(param)
c.Response(data, err)
}
... ...
... ... @@ -31,7 +31,7 @@ func init() {
web.NSCtrlPost("/target_user/evaluation-super", (*controllers.SummaryEvaluationController).GetTargetUserEvaluationSuper),
web.NSCtrlPost("/evaluation-super/all", (*controllers.SummaryEvaluationController).ListAllEvaluationSuper),
web.NSCtrlPost("/evaluation-super/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationSuper),
web.NSCtrlPost("/evaluation-self/now", (*controllers.SummaryEvaluationController).ListExecutorEvaluationSelf),
//
)
web.AddNamespace(summaryNS)
... ...