作者 tangxvhui

Merge branch 'test'

正在显示 52 个修改的文件 包含 1219 行增加644 行删除
不能预览此文件类型
... ... @@ -155,68 +155,28 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
if end.After(maxTime) {
return nil, application.ThrowError(application.BUSINESS_ERROR, "评估截至时间不能超出周期截至时间")
}
// 更新项目模板中的环节时间
if project.Template != nil {
for i := range project.Template.LinkNodes {
node := project.Template.LinkNodes[i]
node.TimeEnd = &end
}
}
// 项目起始截止时间(暂时环节中的时间未分开)
// 更新项目截止时间(暂时环节中的时间未分开)
project.EndTime = end
project, err = projectRepository.Insert(project)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 查看任务过程,重新日计算任务截至期
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
tasks, err := taskRepository.Find(map[string]interface{}{"projectId": in.Id})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
now := time.Now().Local()
year, month, day := now.Date()
nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
for i := range tasks {
task := tasks[i]
task.TimeEnd = &end
// 重新计算
if task.NextSentAt == nil {
// 环节起始和截止本地时间
startLocal := task.TimeStart.Local()
sYear, sMonth, sDay := startLocal.Date()
startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
endLocal := task.TimeEnd.Local()
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(nowO) {
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
task.NextSentAt = &nextTime
} else {
task.NextSentAt = &startLocal
}
// 如果超出截至时间,则周期置空
if task.NextSentAt.After(endLocal) {
task.NextSentAt = nil
}
} else {
// 新的截止时间在下一次发送周期任务之前,则结束
if end.Before(task.NextSentAt.Local()) {
task.NextSentAt = nil
} else {
// do nothing
}
}
// 项目调整截止时间,同步更新任务时间
if err := rs.updateTaskTime(transactionContext, in.Id, end); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return project, nil
} else {
_, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "template")
if err != nil {
... ... @@ -303,6 +263,62 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
}
}
// 更新项目截止时间,同步任务截止时间
func (rs *EvaluationProjectService) updateTaskTime(context application.TransactionContext, projectId int64, end time.Time) error {
// 查看任务过程,重新日计算任务截至期
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": context})
tasks, err := taskRepository.Find(map[string]interface{}{"projectId": projectId})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
now := time.Now().Local()
year, month, day := now.Date()
nowO := time.Date(year, month, day, 0, 0, 0, 0, time.Local) // 当前时间0点0分0秒时刻
for i := range tasks {
task := tasks[i]
task.TimeEnd = &end // 先赋值
if task.NextSentAt == nil { // 重新计算
// 环节起始和截止本地时间
startLocal := task.TimeStart.Local()
sY, sM, sD := startLocal.Date()
startLocal = time.Date(sY, sM, sD, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
// 在当前时间之前,则计算下一个周期时间
if startLocal.Before(nowO) {
nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
task.NextSentAt = &nextTime
} else {
task.NextSentAt = &startLocal
}
// 注.最后一次发送时间和重新计算后的时间相同时,继续获取下一个周期
if task.LastSentAt != nil {
nextY, nextM, nextD := task.NextSentAt.Local().Date()
lastY, lastM, lastD := task.LastSentAt.Local().Date()
if nextY == lastY && nextM == lastM && nextD == lastD {
nextTime := utils.NextTimeInc(task.NextSentAt.Local(), task.KpiCycle)
task.NextSentAt = &nextTime
}
}
}
// 如果超出截至时间,则周期置空
if task.NextSentAt.Local().After(task.TimeEnd.Local()) {
task.NextSentAt = nil
}
// 更新任务
task, err := taskRepository.Insert(task)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
return nil
}
func (rs *EvaluationProjectService) Get(in *command.GetProjectCommand) (interface{}, error) {
transactionContext, err := factory.ValidateStartTransaction(in)
if err != nil {
... ... @@ -483,8 +499,8 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
// 环节起始和截止本地时间
startLocal := task.TimeStart.Local()
sYear, sMonth, sDay := startLocal.Date()
startLocal = time.Date(sYear, sMonth, sDay, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
sY, sM, sD := startLocal.Date()
startLocal = time.Date(sY, sM, sD, 0, 0, 0, 0, time.Local) // 开始时间以0点开始计算
endLocal := task.TimeEnd.Local()
// 在当前时间之前,则计算下一个周期时间
... ...
... ... @@ -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)
}
... ...
... ... @@ -79,6 +79,8 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
}
staffAssessService := service.NewStaffAssessServeice()
now := time.Now().Local()
for i := range tasks {
task := tasks[i]
project, ok := projectIdsMap[task.ProjectId] // 项目
... ... @@ -86,6 +88,9 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
// 环节截止时间
maxTime := task.TimeEnd.Local()
// 更新任务最后一次的发送时间(取当前时间)
task.LastSentAt = &now
// 当前周起始时间和截止时间
var cycleTimeStart = task.NextSentAt.Local()
var cycleTimeEnd time.Time
... ... @@ -99,11 +104,12 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
task.NextSentAt = &nextTime
}
// 周期的截至时间=下一个周期的开始时间-1秒
// 周期的截至时间=下一个周期的开始时间-1秒(需求方要求提交数据时间延长到第二天8点30分截止)
if task.NextSentAt == nil {
cycleTimeEnd = maxTime
} else {
cycleTimeEnd = task.NextSentAt.Local().Add(-1 * time.Second)
//cycleTimeEnd = task.NextSentAt.Local().Add(-1 * time.Second) // 周期截至时间=下一个周期起始时间-1秒
cycleTimeEnd = task.NextSentAt.Local().Add(8*time.Hour + 30*time.Minute) // 注.延长8.5小时
}
// 格式化周期的起始和截止时间
... ...
... ... @@ -5,8 +5,8 @@ import "github.com/beego/beego/v2/core/validation"
// QueryRoleUserCommand 查询角色列表(关联用户)
type QueryRoleUserCommand struct {
CompanyId int64 `cname:"公司ID" json:"companyId"`
PageNumber int64 `cname:"分页页码" json:"pageNumber" valid:"Required"`
PageSize int64 `cname:"分页数量" json:"pageSize" valid:"Required"`
PageNumber int64 `cname:"分页页码" json:"pageNumber"`
PageSize int64 `cname:"分页数量" json:"pageSize"`
}
func (in *QueryRoleUserCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -6,8 +6,8 @@ import "github.com/beego/beego/v2/core/validation"
type UserRoleQueryCommand struct {
CompanyId int64 `cname:"公司ID" json:"companyId"`
RoleId int64 `cname:"角色ID" json:"roleId,string" valid:"Required"`
PageNumber int64 `cname:"分页页码" json:"pageNumber"`
PageSize int64 `cname:"分页数量" json:"pageSize"`
PageNumber int `cname:"分页页码" json:"pageNumber"`
PageSize int `cname:"分页数量" json:"pageSize"`
}
func (in *UserRoleQueryCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -190,7 +190,7 @@ func (rs *RoleService) ListForUser(in *command.QueryRoleUserCommand) (interface{
for i := range roles {
v := roles[i]
tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, v.Id)
_, tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, v.Id)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
... ... @@ -104,15 +104,12 @@ func (rs *RoleUserService) ListRole(in *command.UserRoleQueryCommand) (interface
}()
ruRepository := factory.CreateRoleUserRepository(map[string]interface{}{"transactionContext": transactionContext})
in.PageNumber = 1
in.PageSize = 9999999
tempList, err := ruRepository.FindAllContainUser(1, 10, in.CompanyId, in.RoleId)
total, tempList, err := ruRepository.FindAllContainUser(in.PageNumber, in.PageSize, in.CompanyId, in.RoleId)
if 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 tool_funs.SimpleWrapGridMap(int64(len(tempList)), tempList), nil
return tool_funs.SimpleWrapGridMap(total, tempList), nil
}
... ...
package adapter
type AssessCycleDayResp struct {
CycleId int `json:"cycleId"`
CycleId string `json:"cycleId"`
CycleName string `json:"cycleName"`
BeginDay string `json:"beginDay"`
EndTime string `json:"endTime"`
BeginTime string `json:"beginTime"`
}
... ...
package adapter
type ListInviteUserAssessResp struct {
LinkNodeName string `json:"linkNodeName"`
LinkNodeId int `json:"linkNodeId"`
LintNodeDesc string `json:"lintNodeDesc"`
BeginDay string `json:"beginDay"`
CycleId int `json:"cycleId"`
TableHeader []ListTableHeader `json:"tableHeader"`
List []map[string]string `json:"list"`
Total int `json:"total"`
LinkNodeName string `json:"linkNodeName"`
LinkNodeId int `json:"linkNodeId"`
LintNodeDesc string `json:"lintNodeDesc"`
BeginDay string `json:"beginDay"`
CycleId int `json:"cycleId"`
TableHeader []ListTableHeader `json:"tableHeader"`
List []map[string]interface{} `json:"list"`
Total int `json:"total"`
}
type ListTableHeader struct {
Key string `json:"key"`
... ...
package adapter
type ListSupperAssessResp struct {
AssessId int `json:"assessId"` //
CycleId int `json:"cycleId"` //周期id
BeginDay string `json:"beginDay"` //开始的日期
UserId int `json:"userId,string"` //用户id
UserName string `json:"userName"` //用户名称
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteTota"` //邀请总数
InviteCompleted int `json:"inviteCompleted"` //邀请未完成
Status string `json:"status"` //评估任务是否填写完成
Department string `json:"department"` //部门
Position string `json:"position"` //职位
DutyTime string `json:"dutyTime"` //入职时间
StaffAssessTaskId int `json:"staffAssessTaskId"`
AssessId int `json:"assessId"` //
CycleId int `json:"cycleId"` //周期id
BeginDay string `json:"beginDay"` //开始的日期
UserId int `json:"userId,string"` //用户id
UserName string `json:"userName"` //用户名称
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteTota"` //邀请总数
InviteCompleted int `json:"inviteCompleted"` //邀请未完成
Status string `json:"status"` //评估任务是否填写完成
Department string `json:"department"` //部门
Position string `json:"position"` //职位
DutyTime string `json:"dutyTime"` //入职时间
}
... ...
package adapter
type ListUserAssessContent struct {
TableHeader []ListTableHeader `json:"tableHeader"`
List []map[string]string `json:"list"`
Total int `json:"total"`
TableHeader []ListTableHeader `json:"tableHeader"`
List []map[string]interface{} `json:"list"`
Total int `json:"total"`
}
... ...
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 ListSupperAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
... ...
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获取缓存数据
}
... ...
... ... @@ -8,7 +8,7 @@ type AssessTaskDescQuery struct {
//获取我的项目周期进度描述
type AssessTaskDescV2Query struct {
CycleId int `json:"cycleId"`
CycleId int `json:"cycleId,string"`
BeginDay string `json:"beginDay"`
UserId int `json:"userId"` //当前登录人的id
CompanyId int `json:"companyId"` //当前登录的公司
... ...
... ... @@ -4,6 +4,7 @@ package query
type GetExecutorSelfAssessQuery struct {
CompanyId int `json:"companyId"` //
TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填
CycleId int `json:"cycleId"` //评估周期id 必填
CycleId int `json:"cycleId,string"` //评估周期id 必填
BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
AcquireCache int `json:"acquireCache"` // 0不获取缓存数据,1获取缓存数据
}
... ...
package query
//根据周期id和日期获取 员工填写评估内容
type ListAssessContentCycleDay struct {
CompanyId int `json:"companyId"`
OperaterId int `json:"operaterId"`
... ...
package query
//获取周期内的考核日期
type ListAssessCycleDay struct {
CompanyId int `json:"companyId"`
CycleId int `json:"cycleId,string"`
... ...
package query
// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
// 根据周期和日期获取我要执行的的评估,用户列表和评估填写的值
type ListExecutorAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
UserName string `json:"userName"` //查询条件 员工的名称
CompanyId int `json:"companyId"` //
ExecutorId int `json:"executorId,string"` //评估的执行人,必填
CycleId int `json:"cycleId"` //评估周期id 必填
CycleId int `json:"cycleId,string"` //评估周期id 必填
BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
}
... ...
... ... @@ -4,6 +4,6 @@ package query
type ListInviteUserQuery struct {
CompanyId int `json:"companyId"` //对公司
TargetUserId int `json:"targetUserId,string"` //被评估的员工id
CycleId int `json:"CycleId"` //评估任务的周期id
CycleId int `json:"CycleId,string"` //评估任务的周期id
BeginDay string `json:"beginDay"` //日期
}
... ...
package query
//获取我要执行的的360评估,用户列表和评估填写的值
type ListInviteUserAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
... ...
package query
//获取员工被其他人评估的列表
type ListTargetAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CompanyId int `json:"companyId"` //
TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填
CycleId int `json:"cycleId,string"` //评估周期id 必填
BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
}
... ...
... ... @@ -5,5 +5,5 @@ type ListTargetUserAssessQuery struct {
AssessTaskId int `json:"assessTaskId"`
TargetUserId int `json:"targetUserId,string"`
CompanyId int `json:"companyId"`
Types []string `json:"tyspes"`
Types []string `json:"types"`
}
... ...
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
}
... ...
... ... @@ -279,30 +279,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
log.Logger.Error("获取用户信息," + err.Error())
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error())
}
// departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// var supperUserList []*domain.User
// if len(userData.DepartmentId) > 0 {
// _, departmentList, err := departmentRepo.Find(map[string]interface{}{
// "ids": userData.DepartmentId,
// })
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
// }
// var chargeUserIds []int64
// for _, v := range departmentList {
// chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
// }
// if len(chargeUserIds) > 0 {
// _, supperUserList, err = userRepo.Find(map[string]interface{}{
// "ids": chargeUserIds,
// })
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
// }
// }
// }
supperUserList, _ := srv.getStaffSuper(transactionContext, *userData)
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -971,6 +948,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 {
... ... @@ -1299,9 +1281,9 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU
{Key: "endTime", Name: "360°评估截止日期"},
}
tableHeader = append(tableHeader, changeableHeader...)
listData := []map[string]string{}
listData := []map[string]interface{}{}
for _, v := range assessList {
m := map[string]string{
m := map[string]interface{}{
"userName": v.TargetUser.UserName,
"userId": strconv.Itoa(v.TargetUser.UserId),
"status": string(v.Status),
... ... @@ -1551,6 +1533,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 +1700,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 +1713,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 +1742,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())
}
... ... @@ -1780,10 +1780,10 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA
})
//获取员工的评估
cnt, assessList, err := assessReps.Find(map[string]interface{}{
"assessTaskId": param.AssessTaskId,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
"typesList": param.Types,
"staffAssessTaskId": param.AssessTaskId,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
"typesList": param.Types,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
... ... @@ -1884,3 +1884,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 // 评估填写文本内容
}
}
}
}
}
... ...
... ... @@ -163,11 +163,11 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
//过滤重复的列
headerMap := map[string]string{}
// 获取已经填报的内容
changeableRows := map[string]map[string]string{}
changeableRows := map[string]map[string]interface{}{}
tableSort := []string{} //确定列表行数据的顺序
for i, v := range contentList {
if _, ok := changeableRows[v.TargetUserId]; !ok {
changeableRows[v.TargetUserId] = map[string]string{}
changeableRows[v.TargetUserId] = map[string]interface{}{}
tableSort = append(tableSort, v.TargetUserId)
}
changeableRows[v.TargetUserId]["targetUserName"] = v.TargetUserName
... ... @@ -186,7 +186,7 @@ func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAs
changeableRows[v.TargetUserId][key] = v.Value
}
}
list := []map[string]string{}
list := []map[string]interface{}{}
for _, v := range tableSort {
for _, v2 := range changeableHeader {
if _, ok := changeableRows[v][v2.Key]; ok {
... ...
... ... @@ -30,7 +30,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ
staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{
"transactionContext": transactionContext,
})
var limit int = 200
var limit int = 360
var offset int = 0
if param.PageSize > 0 {
limit = param.PageSize
... ... @@ -55,6 +55,8 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ
CycleId: v.CycleId,
CycleName: v.CycleName,
BeginDay: v.BeginDay,
BeginTime: v.BeginTime,
EndTime: v.EndTime,
}
listData = append(listData, temp)
}
... ... @@ -409,17 +411,18 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
{Key: "endTime", Name: "360°评估截止日期"},
}
tableHeader = append(tableHeader, changeableHeader...)
listData := []map[string]string{}
listData := []map[string]interface{}{}
for _, v := range assessList {
m := map[string]string{
"userName": v.TargetUser.UserName,
"userId": strconv.Itoa(v.TargetUser.UserId),
"status": string(v.Status),
"cycleId": strconv.FormatInt(v.CycleId, 10),
"beginDay": v.BeginTime.Local().Format("2006-01-02"),
"types": string(v.Types),
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
"assessId": strconv.Itoa(v.Id),
m := map[string]interface{}{
"staffAssessTaskId": v.StaffAssessTaskId,
"userName": v.TargetUser.UserName,
"userId": strconv.Itoa(v.TargetUser.UserId),
"status": string(v.Status),
"cycleId": strconv.FormatInt(v.CycleId, 10),
"beginDay": v.BeginTime.Local().Format("2006-01-02"),
"types": string(v.Types),
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
"assessId": strconv.Itoa(v.Id),
}
switch v.Status {
case domain.StaffAssessCompleted:
... ... @@ -459,7 +462,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
return &result, nil
}
//根据周期和日期获取我需要执行的上级评估成员列表
// 根据周期和日期获取我需要执行的上级评估成员列表
func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -560,18 +563,19 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu
resultList := []adapter.ListSupperAssessResp{}
for _, v := range assessList {
item := adapter.ListSupperAssessResp{
AssessId: v.Id,
CycleId: int(v.CycleId),
BeginDay: v.BeginTime.Local().Format("2006-01-02"),
UserId: v.TargetUser.UserId,
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteCompleted: 0,
Status: string(v.Status),
InviteTotal: 5,
Department: "",
Position: "",
DutyTime: "",
StaffAssessTaskId: v.StaffAssessTaskId,
AssessId: v.Id,
CycleId: int(v.CycleId),
BeginDay: v.BeginTime.Local().Format("2006-01-02"),
UserId: v.TargetUser.UserId,
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteCompleted: 0,
Status: string(v.Status),
InviteTotal: 5,
Department: "",
Position: "",
DutyTime: "",
}
//填入部门
for _, vv := range v.TargetDepartment {
... ... @@ -609,7 +613,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu
return result, nil
}
//根据周期和日期,获取员工的自评内容
// 根据周期和日期,获取员工的自评内容
func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfAssessQuery) (*adapter.AssessInfoResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -661,6 +665,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 {
... ... @@ -692,3 +701,87 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
}
return &result, nil
}
//根据周期和日期。获取360评估的列表,员工的被其他人评估
func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (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()
}()
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//获取员工的评估
cnt, assessList, err := assessReps.Find(map[string]interface{}{
"cycleId": param.CycleId,
"beginDay": param.BeginDay,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
"typesList": []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)},
})
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())
}
var resultList []map[string]interface{}
for _, v := range assessList {
item := map[string]interface{}{
"id": v.Id,
"targetUser": v.TargetUser,
"executor": v.Executor,
}
resultList = append(resultList, item)
}
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
}
//根据周期和日期。获取上级评估的列表,员工的被其他人评估
func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTargetAssessQuery) (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()
}()
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//获取员工的评估
cnt, assessList, err := assessReps.Find(map[string]interface{}{
"cycleId": param.CycleId,
"beginDay": param.BeginDay,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
"typesList": []string{string(domain.AssessSuper)},
})
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())
}
var resultList []map[string]interface{}
for _, v := range assessList {
item := map[string]interface{}{
"id": v.Id,
"targetUser": v.TargetUser,
"executor": v.Executor,
}
resultList = append(resultList, item)
}
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
}
... ...
... ... @@ -18,6 +18,7 @@ type NodeTask struct {
TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"`
KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
NextSentAt *time.Time `json:"nextSentAt" comment:"下一次发送时间"`
LastSentAt *time.Time `json:"lastSentAt" comment:"最后一次发送时间"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
... ...
... ... @@ -12,6 +12,7 @@ type PerformanceApplicationForm struct {
Standard string //标准
Task string //任务、指标
Definition string //定义
Required string // 是否必填 是 否
}
type PerformanceDimension struct {
... ... @@ -24,6 +25,7 @@ type PerformanceModule struct {
Weight string `json:"weight"` //权重
Standard string `json:"standard"` //标准(结构化的成果描述)
Target []*PerformanceTarget `json:"performanceTarget"` //任务\指标
Required int `json:"required"` // 是否必填
}
type PerformanceTarget struct {
... ... @@ -34,6 +36,7 @@ type PerformanceTarget struct {
func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) {
formRows := make([]*PerformanceApplicationForm, 0)
var dimensionName, moduleName, taskName, weightName, standardName string
required := "是"
for key, item := range rows {
if key < 3 {
continue
... ... @@ -80,6 +83,11 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error)
}
}
form.Standard = standardName
//是否必填
if len(item) > 9 && item[9] != "" {
required = strings.TrimSpace(item[9])
}
form.Required = required
formRows = append(formRows, form)
}
dimensions := make([]*PerformanceDimension, 0)
... ... @@ -144,11 +152,16 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM
if err != nil {
return modules, err
}
required, err := getRequired(item)
if err != nil {
return modules, err
}
module := &PerformanceModule{
ModuleName: moduleName,
Weight: weightName,
Standard: standardName,
Target: tasks,
Required: required,
}
modules = append(modules, module)
}
... ... @@ -201,6 +214,27 @@ func getStandard(items []*PerformanceApplicationForm) (string, error) {
return name, nil
}
// 获取是否必填
func getRequired(items []*PerformanceApplicationForm) (int, error) {
if len(items) <= 0 {
return NodeRequiredYes, nil
}
var name string
for _, item := range items {
if name == "" {
name = item.Required
}
if name != item.Required {
return NodeRequiredYes, errors.New(item.ModuleName + " 对应的是否必填不一致")
}
}
if name == "否" {
return NodeRequiredNo, nil
} else {
return NodeRequiredYes, nil
}
}
// 获取任务
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
tasks := make([]*PerformanceTarget, 0)
... ...
... ... @@ -28,5 +28,5 @@ type RoleUserRepository interface {
Find(queryOptions map[string]interface{}) (int64, []*RoleUser, error)
Count(queryOptions map[string]interface{}) (int64, error)
BatchDeleteById(ids []int64) error
FindAllContainUser(pageSize int, pageNumber int, companyId int64, roleId int64) ([]*RoleContainUser, error)
FindAllContainUser(pageSize int, pageNumber int, companyId int64, roleId int64) (int64, []*RoleContainUser, error)
}
... ...
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
... ...
package domain
import "testing"
func TestGenerateToken(t *testing.T) {
ut := UserAuth{
CompanyId: 526,
UserId: 3330346066045952,
Phone: "15980201153",
PlatformId: 29,
AdminType: 1,
}
tk, _ := ut.CreateAccessToken()
t.Log(tk)
}
... ...
... ... @@ -145,7 +145,10 @@ func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error
staff_assess_task.company_id ,
staff_assess_task.cycle_name
from staff_assess_task
where staff_assess_task.company_id = ?`
where staff_assess_task.company_id = ?
and staff_assess_task.deleted_at isnull
order by staff_assess_task.cycle_id desc
`
tx := d.transactionContext.PgTx
condition := []interface{}{
... ... @@ -172,7 +175,9 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As
staff_assess_task.company_id
from staff_assess_task
where staff_assess_task.cycle_id = ?
and company_id =? `
and company_id =?
and staff_assess_task.deleted_at isnull
order by staff_assess_task.begin_day desc `
tx := d.transactionContext.PgTx
condition := []interface{}{
... ... @@ -185,17 +190,17 @@ func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]As
//获取员工填写评估内容
type UserAssessContent struct {
AssessId string `json:"assessId"`
ContentId int `json:"contentId"`
TargetUserId string `json:"targetUserId"` //被评估人的id
TargetUserName string `json:"targetUserName"` //被评估人的名称
BeginDay string `json:"beginDay"` //评估的日期
EvaluationProjectId string `json:"evaluationProjectId"` //项目id
Value string `json:"value"` //评估填写的值
SortBy int `json:"sortBy"` //评估项顺序
Category string `json:"category"` //评估项分类
ContentName string `json:"contentName"` //评估项名称
Weight int `json:"weight"` //权重
AssessId string `json:"assessId"`
ContentId int `json:"contentId"`
TargetUserId string `json:"targetUserId"` //被评估人的id
TargetUserName string `json:"targetUserName"` //被评估人的名称
BeginDay string `json:"beginDay"` //评估的日期
EvaluationProjectId string `json:"evaluationProjectId"` //项目id
Value string `json:"value"` //评估填写的值
SortBy int `json:"sortBy"` //评估项顺序
Category string `json:"category"` //评估项分类
ContentName string `json:"contentName"` //评估项名称
Weight float64 `json:"weight"` //权重
}
type SearchConditin1 struct {
... ... @@ -292,33 +297,41 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
set time zone 'PRC';
with t_user_department as (
select "user".id as user_id ,jsonb_array_elements_text ("user".department_id) as depart_id from "user"
where "user".company_id= %d
where "user".company_id= %d and "user".deleted_at isnull
),
t_department as (
select department.id::text as depart_id from department where charge_user_ids @>'[%d]'
select department.id::text as depart_id from department where charge_user_ids @>'[%d]'
and "department".deleted_at isnull
),
-- 部门主管
t_user_1 as (
select t_user_department.user_id::text from t_user_department
join t_department on t_user_department.depart_id = t_department.depart_id
),
-- 如果是hrbp
t_project_1 as(
select evaluation_project.id as project_id
from evaluation_project
where evaluation_project.cycle_id =%d
and evaluation_project.hr_bp = %d
and evaluation_project.deleted_at isnull
),
-- 如果的项目管理员
t_project_2 as(
select evaluation_project.id as project_id
from evaluation_project
where evaluation_project.cycle_id =%d
and evaluation_project.pmp =1
and evaluation_project.pmp_ids @>'["%d"]'
and evaluation_project.deleted_at isnull
),
-- 合并数据
t_project_3 as (
select t_project_2.project_id from t_project_2
union
select t_project_1.project_id from t_project_1
),
-- 初步过滤数据
t_staff_assess_0 as (
select staff_assess.id as assess_id,
staff_assess.target_user->>'userId' as target_user_id,
... ... @@ -326,10 +339,13 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
to_char(staff_assess.begin_time,'YYYY-MM-DD') as begin_day,
staff_assess.evaluation_project_id
from staff_assess
join staff_assess_task on staff_assess.staff_assess_task_id = staff_assess_task.id
and staff_assess_task.deleted_at isnull
where staff_assess.cycle_id = %d
and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s'
and staff_assess."types" ='self'
),
-- 根据查看权限过滤合并数据
t_staff_assess_1 as (
(select t_staff_assess_0.assess_id,
t_staff_assess_0.target_user_id,
... ... @@ -358,16 +374,16 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
type ExportData1 struct {
AssessId string
ContentId int
TargetUserId string //被评估人的id
TargetUserName string //被评估人的名称
BeginDay string //评估的日期
EvaluationProjectId string //项目id
Value string //评估填写的值
SortBy int //评估项顺序
Category string //评估项分类
ContentName string //评估项名称
Weight int //权重
PromptText string //评估标准
TargetUserId string //被评估人的id
TargetUserName string //被评估人的名称
BeginDay string //评估的日期
EvaluationProjectId string //项目id
Value string //评估填写的值
SortBy int //评估项顺序
Category string //评估项分类
ContentName string //评估项名称
Weight float64 //权重
PromptText string //评估标准
Remark []domain.AssessContemtRemark
}
... ... @@ -410,9 +426,11 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa
}
type AssessCycleDayMe struct {
BeginDay string `json:"beginDay"`
CycleId int `json:"cycleId"`
CycleName string `json:"cycleName"`
BeginDay string
CycleId string
CycleName string
EndTime string
BeginTime string
}
// 根据评估的人执行人id,搜索 executorId参与的评估周期
... ... @@ -425,13 +443,16 @@ func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limi
}
sqlStr := `
SELECT
staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day
distinct on(staff_assess_task.cycle_id,staff_assess_task.begin_day)
staff_assess_task.cycle_id,staff_assess_task.cycle_name ,
staff_assess_task.begin_day,
to_char(staff_assess_task.end_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as end_time,
to_char(staff_assess_task.begin_time at time zone 'PRC','YYYY-MM-DD HH24:MI:SS') as begin_time
FROM staff_assess_task
JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
WHERE staff_assess.company_id=?
and staff_assess_task.deleted_at isnull
and staff_assess.executor->>'userId'='?'
group by staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day
order by staff_assess_task.begin_day desc
limit ? offset ?
`
... ...
... ... @@ -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{
... ...
... ... @@ -19,6 +19,7 @@ type NodeTask struct {
TimeEnd *time.Time `comment:"截至时间"`
KpiCycle int `comment:"考核周期(1日、2周、3月)"`
NextSentAt *time.Time `comment:"下一次发送时间"`
LastSentAt *time.Time `comment:"最后一次发送时间"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
... ...
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:"删除时间"`
}
... ...
... ... @@ -35,6 +35,7 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod
TimeEnd: m.TimeEnd,
KpiCycle: m.KpiCycle,
NextSentAt: m.NextSentAt,
LastSentAt: m.LastSentAt,
CreatedAt: m.CreatedAt.Local(),
UpdatedAt: m.UpdatedAt.Local(),
DeletedAt: m.DeletedAt,
... ... @@ -56,6 +57,7 @@ func (repo *NodeTaskRepository) TransformToModel(d *domain.NodeTask) models.Node
TimeEnd: d.TimeEnd,
KpiCycle: d.KpiCycle,
NextSentAt: d.NextSentAt,
LastSentAt: d.LastSentAt,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
DeletedAt: d.DeletedAt,
... ...
... ... @@ -182,7 +182,7 @@ func (repo *RoleUserRepository) BatchDeleteById(ids []int64) error {
return err
}
func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) ([]*domain.RoleContainUser, error) {
func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int, companyId int64, roleId int64) (int64, []*domain.RoleContainUser, error) {
limit := pageSize
offset := limit * (pageNumber - 1)
if offset < 0 {
... ... @@ -210,9 +210,15 @@ func (repo *RoleUserRepository) FindAllContainUser(pageNumber int, pageSize int,
}
dataSql += whereFrom
dataSql = fmt.Sprintf("%s limit %d offset %d", dataSql, limit, offset)
countSql := ` SELECT COUNT(*) ` + whereFrom
tx := repo.transactionContext.PgTx
var total int64
var dataList = make([]*domain.RoleContainUser, 0)
_, err := tx.Query(&dataList, dataSql, param...)
return dataList, err
// 获取总数量
_, _ = tx.QueryOne(pg.Scan(&total), countSql, param...)
return total, dataList, err
}
... ...
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
... ...
... ... @@ -117,9 +117,10 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in
tx := repo.transactionContext.PgTx
var m []*models.StaffAssess
query := tx.Model(&m).
Where("deleted_at isnull")
Where("staff_assess.deleted_at isnull").
Join(`JOIN staff_assess_task ON staff_assess_task."id" = staff_assess."staff_assess_task_id" and staff_assess_task."deleted_at" isnull`)
if companyId, ok := queryOptions["companyId"]; ok {
query.Where("company_id = ?", companyId)
query.Where("staff_assess.company_id = ?", companyId)
}
if v, ok := queryOptions["limit"].(int); ok {
query.Limit(v)
... ... @@ -127,35 +128,35 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in
if v, ok := queryOptions["offset"].(int); ok {
query.Offset(v)
}
if v, ok := queryOptions["targetUserId"].(int); ok && v > 0 {
query.Where(`target_user->>'userId'='?'`, v)
if v, ok := queryOptions["targetUserId"]; ok {
query.Where(`staff_assess.target_user->>'userId'='?'`, v)
}
if v, ok := queryOptions["targetUserName"].(int); ok && v > 0 {
query.Where(`target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v))
if v, ok := queryOptions["targetUserName"].(string); ok {
query.Where(`staff_assess.target_user->>'userName' like ?`, fmt.Sprintf("%%%v%%", v))
}
if v, ok := queryOptions["executorId"].(int); ok && v > 0 {
query.Where(`executor->>'userId'='?'`, v)
if v, ok := queryOptions["executorId"]; ok {
query.Where(`staff_assess.executor->>'userId'='?'`, v)
}
if v, ok := queryOptions["cycleId"].(int64); ok && v > 0 {
query.Where(`cycle_id=?`, v)
if v, ok := queryOptions["cycleId"]; ok {
query.Where(`staff_assess.cycle_id=?`, v)
}
if v, ok := queryOptions["staffAssessTaskId"]; ok {
query.Where(`staff_assess_task_id=?`, v)
query.Where(`staff_assess.staff_assess_task_id=?`, v)
}
if v, ok := queryOptions["id"]; ok {
query.Where("id=?", v)
query.Where("staff_assess.id=?", v)
}
if v, ok := queryOptions["typesList"].([]string); ok {
query.Where("types in(?)", pg.In(v))
query.Where("staff_assess.types in(?)", pg.In(v))
}
if v, ok := queryOptions["status"].(string); ok {
query.Where("status=?", v)
if v, ok := queryOptions["status"]; ok {
query.Where("staff_assess.status=?", v)
}
if v, ok := queryOptions["endTime"]; ok {
query.Where("end_time<=?", v)
query.Where("staff_assess.end_time<=?", v)
}
if v, ok := queryOptions["beginDay"]; ok {
query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v)
... ...
... ... @@ -123,7 +123,7 @@ func (repo *StaffAssessTaskRepository) Find(queryOptions map[string]interface{})
if v, ok := queryOptions["cycleId"]; ok {
query.Where("cycle_id=?", v)
}
if v, ok := queryOptions["executorId"].(int); ok && v > 0 {
if v, ok := queryOptions["executorId"]; ok {
query.Where(`executor_id @>'[?]'`, v)
}
if v, ok := queryOptions["evaluationProjectId"]; ok {
... ...
... ... @@ -121,7 +121,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
}
// 必填项
nc.Required = domain.NodeRequiredYes
nc.Required = module.Required
nodeContents = append(nodeContents, nc)
}
}
... ...
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))
}
}
... ...
... ... @@ -110,9 +110,60 @@ func (c *StaffAssessControllerV2) GetAssessTargetUserSelfInfo() {
c.Response(nil, e)
return
}
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessSelfInfoV2(paramReq)
c.Response(data, err)
}
// 获取当前登录员工自评详情
func (c *StaffAssessControllerV2) GetAssessSelfMeInfo() {
srv := service.NewStaffAssessServeice()
paramReq := &query.GetExecutorSelfAssessQuery{}
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.GetAssessSelfInfoV2(paramReq)
c.Response(data, err)
}
// 被评估的员工的评估列表-360评估
func (c *StaffAssessControllerV2) ListTargetUserInviteAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetAssessQuery{}
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.ListTargetUserInviteAssess(paramReq)
c.Response(data, err)
}
// 被评估的员工的评估列表-上级评估
func (c *StaffAssessControllerV2) ListTargetUserMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListTargetAssessQuery{}
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.TargetUserId = int(userReq.UserId)
data, err := srv.ListTargetUserSuperAssess(paramReq)
c.Response(data, err)
}
... ...
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), //根据周期里的考核日期,导出员工填写评估内容列表
)
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.NSCtrlPost("/self/me/info", (*controllers.StaffAssessControllerV2).GetAssessSelfMeInfo), //获取当前周期里我的自评反馈详情
web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessControllerV2).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessControllerV2).ListTargetUserMeSupperAssess), //获取我被上级评估的列表
)
web.AddNamespace(assessTaskNS)
web.AddNamespace(assessNS)
web.AddNamespace(assessTaskV2NS)
web.AddNamespace(assessV2NS)
}
... ...
ALTER TABLE "public"."node_task" ADD COLUMN "last_sent_at" timestamptz(6);
COMMENT ON COLUMN "public"."node_task"."last_sent_at" IS '最后一次发送时间';
\ No newline at end of file
... ...