作者 郑周

1. 增加评估提交项 填写内容数据缓存

2. 获取【通用评估详情】和【自评详情】请求增加参数标记是否优先获取缓存
3. 通用评估数据提交后,删除缓存
4. 优化评估数据排序
... ... @@ -168,3 +168,11 @@ func CreateStaffAssessContentTempRepository(options map[string]interface{}) doma
}
return repository.NewStaffAssessContentTempRepository(transactionContext)
}
func CreateStaffAssessCacheRepository(options map[string]interface{}) domain.StaffAssessCacheRepository {
var transactionContext *pg.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pg.TransactionContext)
}
return repository.NewStaffAssessCacheRepository(transactionContext)
}
... ...
package command
import (
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// SaveAssessCacheCommand 保存待提交的评估数据(缓存)
type SaveAssessCacheCommand struct {
AssessId int64 `cname:"评估项ID" json:"assessId,string"`
AssessContent []domain.AssessContent `cname:"评估数据" json:"assessContent"`
}
func (in *SaveAssessCacheCommand) Valid(validation *validation.Validation) {
if in.AssessId == 0 {
validation.SetError("assessId", "ID无效")
return
}
}
... ...
package command
//保存员工填写评估内容
type SaveAssessInfoCommand struct {
AssessId int `json:"assessId"` //
ExecutorId int `json:"executorId"` //填写人的id
CompanyId int `json:"companyId"` //公司id
AssessContent []AssesssContent `json:"assessContent"`
}
type AssesssContent struct {
Category string `json:"category"`
Name string `json:"name"`
Value string `json:"value"`
Remark []RemarkText `json:"remark"`
}
type RemarkText struct {
Title string `json:"title"`
RemarkText string `json:"remarkText"`
}
package command
import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
//保存员工填写评估内容
type SaveAssessInfoCommand struct {
AssessId int `json:"assessId"` //
ExecutorId int `json:"executorId"` //填写人的id
CompanyId int `json:"companyId"` //公司id
AssessContent []domain.AssessContent `json:"assessContent"`
}
//type AssessContent struct {
// Category string `json:"category"`
// Name string `json:"name"`
// Value string `json:"value"`
// Remark []RemarkText `json:"remark"`
//}
//
//type RemarkText struct {
// Title string `json:"title"`
// RemarkText string `json:"remarkText"`
//}
... ...
package query
//获取评估任务详情
type AssessInfoQuery struct {
AssessId int `json:"assessId"` //
CompanyId int `json:"companyId"` //
}
package query
//获取评估任务详情
type AssessInfoQuery struct {
AssessId int `json:"assessId"` // 评估项ID
CompanyId int `json:"companyId"` // 公司ID
AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据
}
... ...
package query
//获取员工自评填写详情
type AssessSelfInfoQuery struct {
AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
TargetUserId int `json:"targetUserId,string"` //被评估的人id
CompanyId int `json:"companyId"` //公司id
}
package query
//获取员工自评填写详情
type AssessSelfInfoQuery struct {
AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
TargetUserId int `json:"targetUserId,string"` //被评估的人id
CompanyId int `json:"companyId"` //公司id
AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据
}
... ...
... ... @@ -6,4 +6,5 @@ type GetExecutorSelfAssessQuery struct {
TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填
CycleId int `json:"cycleId"` //评估周期id 必填
BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// StaffAssessCacheService 保存待提交的评估数据(缓存)
type StaffAssessCacheService struct{}
func NewStaffAssessCacheService() *StaffAssessCacheService {
newService := &StaffAssessCacheService{}
return newService
}
func (srv StaffAssessCacheService) SaveAssessCache(in *command.SaveAssessCacheCommand) (map[string]interface{}, error) {
transactionContext, err := factory.ValidateStartTransaction(in)
if err != nil {
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": transactionContext})
_, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": in.AssessId, "limit": 1})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
var cache *domain.StaffAssessCache
if len(caches) == 0 {
cache = &domain.StaffAssessCache{}
cache.Id = 0
cache.AssessId = in.AssessId
cache.AssessContent = in.AssessContent
} else {
cache = caches[0]
cache.AssessContent = in.AssessContent
}
if _, err = cacheRepository.Save(cache); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{"assessId": cache.Id}, nil
}
... ...
... ... @@ -971,6 +971,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuer
}
}
// 恢复缓存数据
if param.AcquireCache != 0 {
srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
}
//获取员工描述
staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))
if err := transactionContext.CommitTransaction(); err != nil {
... ... @@ -1551,6 +1556,11 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
}
}
// 恢复缓存数据
if param.AcquireCache != 0 {
srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
}
targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId))
if err != nil {
log.Logger.Error("获取员工描述" + err.Error())
... ... @@ -1713,7 +1723,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
}
}
//处理提交上来的数据
paramContentMap := map[string]command.AssesssContent{}
paramContentMap := map[string]domain.AssessContent{}
for i, v := range param.AssessContent {
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
paramContentMap[key] = param.AssessContent[i]
... ... @@ -1726,7 +1736,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
continue
}
v.Value = item.Value
if v.Required == 1 {
if v.Required == domain.NodeRequiredYes {
//转换填入的评估值
err = v.TransformValue()
if err != nil {
... ... @@ -1755,6 +1765,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error())
}
// 删除缓存
cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": transactionContext})
if _, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": assessData.Id, "limit": 1}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
for i := range caches {
if err = cacheRepository.Remove(caches[i].Id); 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())
}
... ... @@ -1884,3 +1907,29 @@ loop:
}
return chargeUserList, nil
}
func (srv StaffAssessServeice) recoverAssessCache(context application.TransactionContext, assessId int, dataArray []*domain.StaffAssessContent) {
cacheRepository := factory.CreateStaffAssessCacheRepository(map[string]interface{}{"transactionContext": context})
_, caches, err := cacheRepository.Find(map[string]interface{}{"assessId": assessId, "limit": 1})
if err != nil || len(caches) == 0 {
return
}
cacheArray := caches[0].AssessContent
cacheLen := len(cacheArray)
for i := range dataArray {
if cacheLen > i { // 避免数组越界
data := dataArray[i]
cache := cacheArray[i]
data.Value = cache.Value // 评估填写的值
cacheRemarkLen := len(cache.Remark)
for j := range data.Remark {
if cacheRemarkLen > j {
data.Remark[j].RemarkText = cache.Remark[j].RemarkText // 评估填写文本内容
}
}
}
}
}
... ...
... ... @@ -661,6 +661,11 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
}
}
// 恢复缓存数据
if param.AcquireCache != 0 {
srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
}
//获取员工描述
staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))
if err := transactionContext.CommitTransaction(); err != nil {
... ...
package domain
import "time"
// StaffAssessCache 填写评估数据(缓存暂未提交)
type StaffAssessCache struct {
Id int64 `json:"id,string" comment:"ID"`
AssessId int64 `json:"assessId,string" comment:"评估项ID"`
AssessContent []AssessContent `json:"assessContent" comment:"评估项提交数据"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
type AssessContent struct {
Category string `json:"category"`
Name string `json:"name"`
Value string `json:"value"`
Remark []RemarkText `json:"remark"`
}
type RemarkText struct {
Title string `json:"title"`
RemarkText string `json:"remarkText"`
}
type StaffAssessCacheRepository interface {
Save(param *StaffAssessCache) (*StaffAssessCache, error)
Remove(id int64) error
FindOne(queryOptions map[string]interface{}) (*StaffAssessCache, error)
Find(queryOptions map[string]interface{}) (int, []*StaffAssessCache, error)
}
... ...
... ... @@ -93,6 +93,12 @@ func (content *StaffAssessContent) scoreValue() error {
return errors.New("评分填写的值错误")
}
//type StaffAssessContentSort []*StaffAssessContent
//
//func (a StaffAssessContentSort) Len() int { return len(a) }
//func (a StaffAssessContentSort) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
//func (a StaffAssessContentSort) Less(i, j int) bool { return a[i].SortBy < a[j].SortBy }
type StaffAssessContentRepository interface {
Save(param *StaffAssessContent) (*StaffAssessContent, error)
Remove(id int) error
... ...
... ... @@ -45,6 +45,7 @@ func init() {
&models.StaffAssess{},
&models.StaffAssessTask{},
&models.StaffAssessContent{},
&models.StaffAssessCache{},
}
for _, model := range tables {
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
... ...
package models
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// StaffAssessCache 提交评估项内容缓存
type StaffAssessCache struct {
tableName struct{} `comment:"评估项填写内容缓存" pg:"staff_assess_cache"`
Id int64 `comment:"ID" pg:",pk"`
AssessId int64 `comment:"评估项ID"`
AssessContent []domain.AssessContent `comment:"评估项提交数据"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...
package repository
import (
"errors"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils"
"time"
"github.com/go-pg/pg/v10"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
)
type StaffAssessCacheRepository struct {
transactionContext *pgTransaction.TransactionContext
}
//var _ domain.StaffAssessCacheRepository = (*StaffAssessCacheRepository)(nil)
func NewStaffAssessCacheRepository(transactionContext *pgTransaction.TransactionContext) *StaffAssessCacheRepository {
return &StaffAssessCacheRepository{transactionContext: transactionContext}
}
func (repo *StaffAssessCacheRepository) TransformToDomain(m *models.StaffAssessCache) domain.StaffAssessCache {
return domain.StaffAssessCache{
Id: m.Id,
AssessId: m.AssessId,
AssessContent: m.AssessContent,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
DeletedAt: m.DeletedAt,
}
}
func (repo *StaffAssessCacheRepository) TransformToModel(d *domain.StaffAssessCache) models.StaffAssessCache {
return models.StaffAssessCache{
Id: d.Id,
AssessId: d.AssessId,
AssessContent: d.AssessContent,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
}
}
func (repo *StaffAssessCacheRepository) nextIdentify() (int64, error) {
return utils.NewSnowflakeId()
}
func (repo *StaffAssessCacheRepository) Save(d *domain.StaffAssessCache) (*domain.StaffAssessCache, error) {
var isCreate = d.Id == 0
if isCreate {
id, err := repo.nextIdentify()
if err != nil {
return d, err
}
d.Id = id
d.CreatedAt = time.Now()
d.UpdatedAt = d.CreatedAt
} else {
d.UpdatedAt = time.Now()
}
m := repo.TransformToModel(d)
tx := repo.transactionContext.PgTx
var err error
if isCreate {
_, err = tx.Model(&m).Returning("id").Insert()
} else {
_, err = tx.Model(&m).Returning("id").WherePK().Update() // 更新和删除必须增加条件
}
if err != nil {
return nil, err
}
d.Id = m.Id
return d, nil
}
func (repo *StaffAssessCacheRepository) Remove(id int64) error {
tx := repo.transactionContext.PgTx
nowTime := time.Now()
_, err := tx.Model(&models.StaffAssessCache{}).Where("id=?", id).Set("deleted_at=?", nowTime).Update()
return err
}
func (repo *StaffAssessCacheRepository) FindOne(queryOptions map[string]interface{}) (*domain.StaffAssessCache, error) {
tx := repo.transactionContext.PgTx
m := new(models.StaffAssessCache)
query := tx.Model(m)
query.Where("deleted_at isnull")
if id, ok := queryOptions["id"]; ok {
query.Where("id=?", id)
}
if err := query.First(); err != nil {
if errors.Is(err, pg.ErrNoRows) {
return nil, fmt.Errorf("没有此资源")
} else {
return nil, err
}
}
u := repo.TransformToDomain(m)
return &u, nil
}
func (repo *StaffAssessCacheRepository) Find(queryOptions map[string]interface{}) (int, []*domain.StaffAssessCache, error) {
tx := repo.transactionContext.PgTx
var m []*models.StaffAssessCache
query := tx.Model(&m).Where("deleted_at isnull")
if v, ok := queryOptions["assessId"]; ok {
query.Where("assess_id=?", v)
}
if v, ok := queryOptions["limit"].(int); ok {
query.Limit(v)
}
if v, ok := queryOptions["offset"].(int); ok {
query.Offset(v)
}
count, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
}
var arrays []*domain.StaffAssessCache
for _, v := range m {
d := repo.TransformToDomain(v)
arrays = append(arrays, &d)
}
return count, arrays, nil
}
... ...
... ... @@ -128,6 +128,8 @@ func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface
if v, ok := queryOptions["staffAssessId"]; ok {
query.Where("staff_assess_id=?", v)
}
query.Order("sort_by ASC")
count, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
... ...
package controllers
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
type StaffAssessController struct {
beego.BaseController
}
// 获取我的绩效任务列表
func (c *StaffAssessController) SearchAssessTaskMe() {
srv := service.NewStaffAssessServeice()
paramReq := &query.SearchAssessMeQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.SearchAssessTaskMe(paramReq)
c.Response(data, err)
}
// 获取我的绩效任务各环节完成情况
func (c *StaffAssessController) AssessTaskMeDesc() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessTaskDescQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessTaskDesc(paramReq)
c.Response(data, err)
}
// 获取个人的自评反馈历史记录列表
func (c *StaffAssessController) AssessSelfMeList() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfListQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessSelfList(paramReq)
c.Response(data, err)
}
// 更具项目评估的配置,创建员工的评估任务,(调试用)
func (c *StaffAssessController) CreateStaffAssessTask() {
srv := service.NewStaffAssessServeice()
paramReq := &command.CreateStaffAssessTask{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//服务调用,实际由定时任务触发
data, err := srv.InvokCreateStaffAssessTask(paramReq)
c.Response(data, err)
}
// 获取当前登录员工自评详情
func (c *StaffAssessController) GetAssessSelfMeInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
// 获取我邀请的人
func (c *StaffAssessController) GetAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &query.GetAssessInviteUserQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.GetAssessInviteUser(paramReq)
c.Response(data, err)
}
// 保存我邀请的员工
func (c *StaffAssessController) SaveAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &command.SaveAssessInvite{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.UserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.SaveAssessInviteUser(paramReq)
c.Response(data, err)
}
// 员工邀请的人选择列表
func (c *StaffAssessController) SelectAssessInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &query.SelectAssessInviteUser{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
// paramReq.TargetUserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.SelectAssessInviteUser(paramReq)
c.Response(data, err)
}
// 获取我要执行360评估,用户列表和评估填写的值
func (c *StaffAssessController) ListMeInviteUserAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListInviteUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.ExecutorId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.ExecutorId = int(userReq.UserId)
data, err := srv.ListExecutorInviteAssess(paramReq)
c.Response(data, err)
}
// 获取我要执行的上级评估成员列表
func (c *StaffAssessController) ListMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListSupperAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.ExecutorId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.ExecutorId = int(userReq.UserId)
data, err := srv.ListExecutorSupperAssess(paramReq)
c.Response(data, err)
}
// 获取员工自评详情
func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
// 获取评估内容详情
func (c *StaffAssessController) GetAssessInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessInfo(paramReq)
c.Response(data, err)
}
// 保存评估内容详情
func (c *StaffAssessController) SaveAssessInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &command.SaveAssessInfoCommand{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.ExecutorId = int(userReq.UserId)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.SaveAssessInfo(paramReq)
c.Response(data, err)
}
// 被评估的员工的评估列表-360评估
func (c *StaffAssessController) ListTargetUserInviteAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.Types = []string{string(domain.AssessSuper)}
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
//获取周期列表
func (c *StaffAssessController) ListAssessCycle() {
srv := service.NewStaffAssessServeice()
userReq := middlewares.GetUser(c.Ctx)
data, err := srv.ListAllAssessCycle(int(userReq.CompanyId))
c.Response(data, err)
}
//获取周期里的考核日期
func (c *StaffAssessController) ListAssessCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.ListAllAssessCycleDay(paramReq)
c.Response(data, err)
}
//根据周期里的考核日期,获取员工填写评估内容列表
func (c *StaffAssessController) ListAssessContentCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessContentCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.OperaterId = int(userReq.UserId)
data, err := srv.ListUserAssessContentCycleDay(paramReq)
c.Response(data, err)
}
//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件
func (c *StaffAssessController) ExportAssessContentCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessContentCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.OperaterId = int(userReq.UserId)
data, err := srv.ExportUserAssess(paramReq)
if err != nil {
c.Response(nil, err)
}
fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay)
c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName)
c.Ctx.Output.Header("Content-Description", "FileTransfer")
c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
c.Ctx.Output.Header("Content-Transfer-Encoding", "binary")
c.Ctx.Output.Header("Expires", "0")
data.Write(c.Ctx.ResponseWriter)
}
package controllers
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
type StaffAssessController struct {
beego.BaseController
}
// 获取我的绩效任务列表
func (c *StaffAssessController) SearchAssessTaskMe() {
srv := service.NewStaffAssessServeice()
paramReq := &query.SearchAssessMeQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.SearchAssessTaskMe(paramReq)
c.Response(data, err)
}
// 获取我的绩效任务各环节完成情况
func (c *StaffAssessController) AssessTaskMeDesc() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessTaskDescQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessTaskDesc(paramReq)
c.Response(data, err)
}
// 获取个人的自评反馈历史记录列表
func (c *StaffAssessController) AssessSelfMeList() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfListQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessSelfList(paramReq)
c.Response(data, err)
}
// 更具项目评估的配置,创建员工的评估任务,(调试用)
func (c *StaffAssessController) CreateStaffAssessTask() {
srv := service.NewStaffAssessServeice()
paramReq := &command.CreateStaffAssessTask{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//服务调用,实际由定时任务触发
data, err := srv.InvokCreateStaffAssessTask(paramReq)
c.Response(data, err)
}
// 获取当前登录员工自评详情
func (c *StaffAssessController) GetAssessSelfMeInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
// 获取我邀请的人
func (c *StaffAssessController) GetAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &query.GetAssessInviteUserQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.GetAssessInviteUser(paramReq)
c.Response(data, err)
}
// 保存我邀请的员工
func (c *StaffAssessController) SaveAssessMeInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &command.SaveAssessInvite{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.UserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.SaveAssessInviteUser(paramReq)
c.Response(data, err)
}
// 员工邀请的人选择列表
func (c *StaffAssessController) SelectAssessInviteUser() {
srv := service.NewStaffAssessServeice()
paramReq := &query.SelectAssessInviteUser{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
// paramReq.TargetUserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.SelectAssessInviteUser(paramReq)
c.Response(data, err)
}
// 获取我要执行360评估,用户列表和评估填写的值
func (c *StaffAssessController) ListMeInviteUserAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListInviteUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.ExecutorId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.ExecutorId = int(userReq.UserId)
data, err := srv.ListExecutorInviteAssess(paramReq)
c.Response(data, err)
}
// 获取我要执行的上级评估成员列表
func (c *StaffAssessController) ListMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListSupperAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
// paramReq.CompanyId = 1
// paramReq.ExecutorId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.ExecutorId = int(userReq.UserId)
data, err := srv.ListExecutorSupperAssess(paramReq)
c.Response(data, err)
}
// 获取员工自评详情
func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessSelfInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
// 获取评估内容详情
func (c *StaffAssessController) GetAssessInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.AssessInfoQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessInfo(paramReq)
c.Response(data, err)
}
// 保存评估内容详情
func (c *StaffAssessController) SaveAssessInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &command.SaveAssessInfoCommand{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.ExecutorId = int(userReq.UserId)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.SaveAssessInfo(paramReq)
c.Response(data, err)
}
// 被评估的员工的评估列表-360评估
func (c *StaffAssessController) ListTargetUserInviteAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetUserAssessQuery{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.Types = []string{string(domain.AssessSuper)}
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.ListTargetUserAssess(paramReq)
c.Response(data, err)
}
//获取周期列表
func (c *StaffAssessController) ListAssessCycle() {
srv := service.NewStaffAssessServeice()
userReq := middlewares.GetUser(c.Ctx)
data, err := srv.ListAllAssessCycle(int(userReq.CompanyId))
c.Response(data, err)
}
//获取周期里的考核日期
func (c *StaffAssessController) ListAssessCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.ListAllAssessCycleDay(paramReq)
c.Response(data, err)
}
//根据周期里的考核日期,获取员工填写评估内容列表
func (c *StaffAssessController) ListAssessContentCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessContentCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.OperaterId = int(userReq.UserId)
data, err := srv.ListUserAssessContentCycleDay(paramReq)
c.Response(data, err)
}
//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件
func (c *StaffAssessController) ExportAssessContentCycleDay() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListAssessContentCycleDay{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.OperaterId = int(userReq.UserId)
data, err := srv.ExportUserAssess(paramReq)
if err != nil {
c.Response(nil, err)
}
fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay)
c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName)
c.Ctx.Output.Header("Content-Description", "FileTransfer")
c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
c.Ctx.Output.Header("Content-Transfer-Encoding", "binary")
c.Ctx.Output.Header("Expires", "0")
data.Write(c.Ctx.ResponseWriter)
}
// SaveAssessCache 保存评估内容(缓存)
func (c *StaffAssessController) SaveAssessCache() {
cacheService := service.NewStaffAssessCacheService()
in := &command.SaveAssessCacheCommand{}
if err := c.Unmarshal(in); err != nil {
c.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
} else {
c.Response(cacheService.SaveAssessCache(in))
}
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
func init() {
assessTaskNS := web.NewNamespace("/v1/staff-assess-task",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
//web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表
web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期
web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表
web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表
)
// /v1/staff-assess/self/me/list
assessNS := web.NewNamespace("/v1/staff-assess",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我的上级评估的列表
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
//v2 改版
assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/search/me", (*controllers.StaffAssessControllerV2).SearchAssessTaskMe), //获取我参与过的评估项目列表
web.NSCtrlPost("/desc/me", (*controllers.StaffAssessControllerV2).AssessTaskMeDesc),
)
assessV2NS := web.NewNamespace("/v2/staff-assess",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessControllerV2).ListMeInviteUserAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessControllerV2).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
web.AddNamespace(assessTaskNS)
web.AddNamespace(assessNS)
web.AddNamespace(assessTaskV2NS)
web.AddNamespace(assessV2NS)
}
package routers
import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
func init() {
assessTaskNS := web.NewNamespace("/v1/staff-assess-task",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
//web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表
web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期
web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表
web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表
)
// /v1/staff-assess/self/me/list
assessNS := web.NewNamespace("/v1/staff-assess",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存)
web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我的上级评估的列表
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
//v2 改版
assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/search/me", (*controllers.StaffAssessControllerV2).SearchAssessTaskMe), //获取我参与过的评估项目列表
web.NSCtrlPost("/desc/me", (*controllers.StaffAssessControllerV2).AssessTaskMeDesc),
)
assessV2NS := web.NewNamespace("/v2/staff-assess",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessControllerV2).ListMeInviteUserAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessControllerV2).ListMeSupperAssess), //我要执行的360评估的用户列表
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessControllerV2).GetAssessMeInviteUser), //获取邀请的员工
web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessControllerV2).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
)
web.AddNamespace(assessTaskNS)
web.AddNamespace(assessNS)
web.AddNamespace(assessTaskV2NS)
web.AddNamespace(assessV2NS)
}
... ...