作者 Your Name

更新

package adapter
type ListSupperAssessResp struct {
AssessId int `json:"assessId"` //
UserName string `json:"userName"` //用户名称
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteCompleted"` //邀请总数
InviteUncompleted int `json:"inviteUncompleted"` //邀请未完成
Department string `json:"department"` //部门
Position string `json:"position"` //职位
DutyTime string `json:"dutyTime"` //入职时间
AssessId int `json:"assessId"` //
UserName string `json:"userName"` //用户名称
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteTota"` //邀请总数
InviteCompleted int `json:"inviteCompleted"` //邀请未完成
Department string `json:"department"` //部门
Position string `json:"position"` //职位
DutyTime string `json:"dutyTime"` //入职时间
}
... ...
package command
//保存员工填写评估内容
type SaveAssessInfoCommand struct {
AssessId int `json:"assessId"`
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 query
type ListSupperAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
UserName string `json:"userName"` //查询条件 员工的名称
CompanyId int `json:"companyId"` //
ExecutorId int `json:"executorId"` //评估的执行人
AssessTaskId int `json:"assessTaskId"` //评估任务id
}
... ...
... ... @@ -2,7 +2,7 @@ package query
//获取员工自评填写详情
type AssessSelfInfoQuery struct {
AssessTaskId int `json:"assessTaskId"` //StaffAssess 的id
AssessTaskId int `json:"assessTaskId"` //assessTaskId 的id
TargetUserId int `json:"targetUserId"` //被评估的人id
CompanyId int `json:"companyId"` //公司id
... ...
package query
type ListSupperAssessQuery struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
UserName string `json:"userName"` //查询条件 员工的名称
CompanyId int `json:"companyId"` //
ExecutorId int `json:"executorId"` //评估的执行人
AssessTaskkId int `json:"assessTaskId"` //评估任务id
}
... ... @@ -5,6 +5,6 @@ type ListInviteUserAssessQuery struct {
PageSize int `json:"pageSize"`
UserName string `json:"userName"` //查询条件 员工的名称
CompanyId int `json:"companyId"` //
ExecutorId int `json:"executorId"` //评估的执行人
AssessTaskkId int `json:"assessTaskId"` //评估任务id
ExecutorId int `json:"executorId"` //评估的执行人,必填
AssessTaskkId int `json:"assessTaskId"` //评估任务id 必填
}
... ...
package query
//获取员工 被评估的列表
type ListTargetUserAssessQuery struct {
AssessTaskId int `json:"assessTaskId"`
TargetUserId int `json:"targetUserId"`
CompanyId int `json:"companyId"`
Types []string `json:"tyspes"`
}
... ...
... ... @@ -12,6 +12,7 @@ import (
"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/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
)
... ... @@ -321,16 +322,15 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
DutyTime: userData.CreatedAt.Local().Format("2006-01-02 15:04:05"),
}
for _, v := range supperUserList {
userInfo.SupperUserName = userInfo.SupperUserName + v.Name + ";"
userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " "
}
result := tool_funs.SimpleWrapGridMap(int64(cnt), listData)
result["userInfo"] = userInfo
return result, nil
}
// 更具项目评估的配置,创建员工的评估任务
// 根据项目评估的配置,创建员工的评估任务
func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -546,7 +546,7 @@ func (srv StaffAssessServeice) createStaffAssessSupper(
return nil, nil
}
// 获取某个员工360邀请的人员
// 获取某个员工360评估邀请的人员
func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -877,10 +877,12 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuer
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
}
}
//获取员工描述
staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
result := adapter.AssessInfoResp{
AssessId: assessData.Id,
CycleId: assessData.CycleId,
... ... @@ -892,8 +894,17 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuer
Status: string(assessData.Status),
TargetUserId: assessData.TargetUser.UserId,
TargetUserName: assessData.TargetUser.UserName,
CompanyId: assessData.CompanyId,
CompanyName: "",
SupperUser: "",
DutyTime: "",
AssessContent: assessContentList,
}
if staffDesc != nil {
result.CompanyName = staffDesc.CompanyName
result.SupperUser = staffDesc.SupperUserName
result.DutyTime = staffDesc.DutyTime
}
return &result, nil
}
... ... @@ -998,13 +1009,14 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, targetUserDepartment, err := departmentRepo.Find(map[string]interface{}{
"ids": targetUser.DepartmentId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
var targetUserDepartment []*domain.Department
if len(targetUser.DepartmentId) > 0 {
_, targetUserDepartment, err = departmentRepo.Find(map[string]interface{}{
"ids": targetUser.DepartmentId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
}
}
//获取部门主管的id
targetUserCharge := map[int64]struct{}{}
... ... @@ -1060,8 +1072,8 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil
}
// 获取我的360评估,用户列表和评估填写的值
func (srv StaffAssessServeice) ListInviteUserAssess(param *query.ListInviteUserAssessQuery) (
// 获取我要执行的的360评估,用户列表和评估填写的值
func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteUserAssessQuery) (
*adapter.ListInviteUserAssessResp, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -1118,8 +1130,8 @@ func (srv StaffAssessServeice) ListInviteUserAssess(param *query.ListInviteUserA
return &result, nil
}
// 获取上级评估成员列表
func (srv StaffAssessServeice) ListSupperAssess(param *query.ListSupperAssessQuery) (map[string]interface{}, error) {
// 获取我需要执行的上级评估成员列表
func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperAssessQuery) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -1134,15 +1146,70 @@ func (srv StaffAssessServeice) ListSupperAssess(param *query.ListSupperAssessQue
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//获取 executorId 对应的上级评估列表
cnt, assessList, err := assessRepo.Find(map[string]interface{}{
"staffAssessTaskId": param.AssessTaskkId,
limit := 20
if param.PageSize > 0 {
limit = param.PageSize
}
condition := map[string]interface{}{
"staffAssessTaskId": param.AssessTaskId,
"executorId": param.ExecutorId,
"typesList": []string{string(domain.AssessSuper)},
})
"limit": limit,
"targetUserName": param.UserName,
}
offset := (param.PageNumber - 1) * param.PageSize
if offset > 0 {
condition["offset"] = offset
}
//获取 executorId 对应的上级评估列表
cnt, assessList, err := assessRepo.Find(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
userIds := []int{}
for _, v := range assessList {
userIds = append(userIds, v.TargetUser.UserId)
}
//获取员工信息
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
var targetUserList []*domain.User
if len(userIds) > 0 {
_, targetUserList, _ = userRepo.Find(map[string]interface{}{
"ids": userIds,
})
}
//获取职位信息
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//获取员工的职位
userPositionMap := map[int64][]*domain.Position{}
for _, v := range targetUserList {
if len(v.PositionId) == 0 {
continue
}
_, positionList, _ := positionRepo.Find(map[string]interface{}{
"ids": v.PositionId,
})
userPositionMap[v.Id] = positionList
}
//获取员工邀请的人完成360评估的数量
var inviteCompletedCount []dao.CountData
if len(userIds) > 0 {
d := dao.NewStaffAssessDao(map[string]interface{}{
"transactionContext": transactionContext,
})
inviteCompletedCount, err = d.CountInviteAssessByTargetUser(userIds, param.AssessTaskId)
if err != nil {
log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -1150,19 +1217,39 @@ func (srv StaffAssessServeice) ListSupperAssess(param *query.ListSupperAssessQue
resultList := []adapter.ListSupperAssessResp{}
for _, v := range assessList {
item := adapter.ListSupperAssessResp{
AssessId: v.Id,
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteUncompleted: 0,
InviteTotal: 5,
Department: "",
Position: "",
DutyTime: "",
AssessId: v.Id,
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteCompleted: 0,
InviteTotal: 5,
Department: "",
Position: "",
DutyTime: "",
}
//填入部门
for _, vv := range v.TargetDepartment {
item.Department += vv.DepartmentName + " "
}
for _, vv := range targetUserList {
if vv.Id != int64(v.TargetUser.UserId) {
continue
}
//填入入职时间
item.DutyTime = vv.CreatedAt.Local().Format("2006-01-02 15:04:05")
//填入职位
for _, vvv := range userPositionMap[vv.Id] {
item.Position += vvv.Name + " "
}
break
}
//
for _, vv := range inviteCompletedCount {
if v.TargetUser.UserId == vv.TargetUserId {
item.InviteCompleted = vv.InviteCompleted
item.InviteTotal = vv.InviteTotal
break
}
}
resultList = append(resultList, item)
}
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
... ... @@ -1214,6 +1301,11 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
}
}
targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId))
if err != nil {
log.Logger.Error("获取员工描述" + err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -1229,8 +1321,17 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
Status: string(assessData.Status),
TargetUserId: assessData.TargetUser.UserId,
TargetUserName: assessData.TargetUser.UserName,
CompanyId: assessData.CompanyId,
CompanyName: "",
SupperUser: "",
DutyTime: "",
AssessContent: assessContentList,
}
if targetUserDesc != nil {
result.CompanyName = targetUserDesc.CompanyName
result.SupperUser = targetUserDesc.SupperUserName
result.DutyTime = targetUserDesc.DutyTime
}
return &result, nil
}
... ... @@ -1239,3 +1340,175 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada
func (srv StaffAssessServeice) AssessInviteList() error {
return nil
}
// 获取员工信息描述
func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.TransactionContext, userid int64) (*adapter.StaffInfo, error) {
//获取用户数据
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
userData, err := userRepo.FindOne(map[string]interface{}{
"id": userid,
})
if err != nil {
log.Logger.Error("获取用户信息," + err.Error())
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error())
}
//获取公司数据
companyRep := factory.CreateCompanyRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
companyData, err := companyRep.FindOne(map[string]interface{}{
"id": userData.CompanyId,
})
if err != nil {
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())
}
}
}
userInfo := adapter.StaffInfo{
UserName: userData.Name,
CompanyName: companyData.Name,
SupperUserName: "",
DutyTime: userData.CreatedAt.Local().Format("2006-01-02 15:04:05"),
}
for _, v := range supperUserList {
userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " "
}
return &userInfo, nil
}
// 提交评估数据
func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoCommand) (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,
})
//获取员工的评估
assessData, err := assessReps.FindOne(map[string]interface{}{
"id": param.AssessId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
}
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
//待更新的评估填写信息
assessContentList := []*domain.StaffAssessContent{}
if assessData.Status == domain.StaffAssessCompleted {
//已完成
_, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
"staffAssessId": assessData.Id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
}
} else if assessData.Status == domain.StaffAssessUncompleted {
//未完成
assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
}
}
//处理提交上来的数据
paramContentMap := map[string]command.AssesssContent{}
for i, v := range param.AssessContent {
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
paramContentMap[key] = param.AssessContent[i]
}
//更新的评估填写信息
for _, v := range assessContentList {
key := fmt.Sprintf("%s-%s", v.Category, v.Name)
item, ok := paramContentMap[key]
if !ok {
continue
}
v.Value = item.Value
for ii := range v.Remark {
for _, vvv := range item.Remark {
if v.Remark[ii].Title == vvv.Title {
v.Remark[ii].RemarkText = vvv.RemarkText
break
}
}
}
}
//保存信息
for i := range assessContentList {
_, err = assessContentRepo.Save(assessContentList[i])
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())
}
return map[string]interface{}{
"assessId": assessData.Id,
}, nil
}
// 获取员工被评估的列表 ,类型是360邀请的
func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserAssessQuery) (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{}{
"assessTaskId": param.AssessTaskId,
"companyId": param.CompanyId,
"targetUserId": param.TargetUserId,
})
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())
}
return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
}
... ...
... ... @@ -20,4 +20,5 @@ type PositionRepository interface {
Update(position *Position) (*Position, error)
Remove(ids []int64) error
FindOne(queryOption map[string]interface{}) (*Position, error)
Find(queryOptions map[string]interface{}) (int, []*Position, error)
}
... ...
... ... @@ -12,3 +12,8 @@ type StaffDepartment struct {
DepartmentId int `json:"departmentId"` //部门id
DepartmentName string `json:"departmentName"` //部门名称
}
type StaffPosition struct {
PositionId int `json:"positionId"`
PositionName string `json:"positionName"`
}
... ...
package dao
import (
"strconv"
"github.com/go-pg/pg/v10"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
)
type StaffAssessDao struct {
transactionContext *pgTransaction.TransactionContext
}
func NewStaffAssessDao(options map[string]interface{}) *StaffAssessDao {
var transactionContext *pgTransaction.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pgTransaction.TransactionContext)
}
return &StaffAssessDao{
transactionContext: transactionContext,
}
}
type CountData struct {
TargetUserId int
InviteTotal int
InviteCompleted int
}
// 获取员工邀请的人完成360评估的数量
func (d *StaffAssessDao) CountInviteAssessByTargetUser(userIds []int, assessTaskId int) ([]CountData, error) {
sqlStr := `SELECT staff_assess.target_user->>'userId' as target_user_id,
count(staff_assess."id") AS invite_total,
sum(
case WHEN staff_assess.status='completed' THEN 1
ELSE 0 END
) as invite_completed
FROM staff_assess
WHERE staff_assess.target_user->>'userId' IN(?)
AND staff_assess.types IN ('invite_same_super','invite_diff_super')
AND staff_assess.staff_assess_task_id = ?
GROUP BY userId`
userIdList := []string{}
for _, v := range userIds {
uid := strconv.Itoa(v)
userIdList = append(userIdList, uid)
}
condition := []interface{}{
pg.In(userIdList), assessTaskId,
}
tx := d.transactionContext.PgTx
result := []CountData{}
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
... ...
package repository
import (
"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"
"time"
)
type PositionRepository struct {
... ... @@ -66,6 +67,37 @@ func (repository *PositionRepository) FindOne(queryOption map[string]interface{}
return repository.transferToDomain(position), nil
}
func (repo *PositionRepository) Find(queryOptions map[string]interface{}) (int, []*domain.Position, error) {
tx := repo.transactionContext.PgTx
positionModel := []models.Position{}
query := tx.Model(&positionModel)
if v, ok := queryOptions["id"]; ok {
query.Where("id=?", v)
}
if v, ok := queryOptions["ids"]; ok {
query.Where("id in(?)", pg.In(v))
}
if v, ok := queryOptions["companyId"]; ok {
query.Where("company_id=?", v)
}
if v, ok := queryOptions["offset"]; ok {
query.Offset(v.(int))
}
if v, ok := queryOptions["limit"]; ok {
query.Limit(v.(int))
}
cnt, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
}
var resultList []*domain.Position
for i := range positionModel {
result := repo.transferToDomain(&positionModel[i])
resultList = append(resultList, result)
}
return cnt, resultList, nil
}
func (repository *PositionRepository) transferToDomain(model *models.Position) *domain.Position {
return &domain.Position{
Id: model.Id,
... ...
... ... @@ -130,6 +130,10 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in
if v, ok := queryOptions["targetUserId"].(int); ok && v > 0 {
query.Where(`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["executorId"].(int); ok && v > 0 {
query.Where(`executor->>'userId'='?'`, v)
}
... ...
... ... @@ -149,7 +149,7 @@ func (c *StaffAssessController) SelectAssessInviteUser() {
}
// 获取我要执行360评估,用户列表和评估填写的值
func (c *StaffAssessController) ListInviteUserAssess() {
func (c *StaffAssessController) ListMeInviteUserAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListInviteUserAssessQuery{}
err := c.BindJSON(paramReq)
... ... @@ -161,12 +161,12 @@ func (c *StaffAssessController) ListInviteUserAssess() {
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.ExecutorId = 1
data, err := srv.ListInviteUserAssess(paramReq)
data, err := srv.ListExecutorInviteAssess(paramReq)
c.Response(data, err)
}
// 获取上级评估成员列表
func (c *StaffAssessController) ListSupperAssess() {
// 获取我要执行的上级评估成员列表
func (c *StaffAssessController) ListMeSupperAssess() {
srv := service.NewStaffAssessServeice()
paramReq := &query.ListSupperAssessQuery{}
err := c.BindJSON(paramReq)
... ... @@ -178,7 +178,7 @@ func (c *StaffAssessController) ListSupperAssess() {
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.ExecutorId = 1
data, err := srv.ListSupperAssess(paramReq)
data, err := srv.ListExecutorSupperAssess(paramReq)
c.Response(data, err)
}
... ... @@ -211,3 +211,17 @@ func (c *StaffAssessController) GetAssessInfo() {
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
}
data, err := srv.SaveAssessInfo(paramReq)
c.Response(data, err)
}
... ...
... ... @@ -15,13 +15,17 @@ func init() {
// /v1/staff-assess/self/me/list
assessNS := web.NewNamespace("/v1/staff-assess",
// web.NSBefore(filters.AllowCors(), middlewares.CheckToken()),
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessInviteUser), //保存我邀请的员工
web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
web.NSCtrlPost("/self/info", (*controllers.StaffAssessController).GetAssessSelfInfo), //获取我的自评反馈详情
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //获取我的自评反馈详情
web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessInviteUser), //获取邀请的员工
web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessInviteUser), //保存我邀请的员工
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("/self/info", (*controllers.StaffAssessController).GetAssessSelfInfo), //获取员工的自评反馈详情
web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //获取员工评估的详情
web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //保存员工评估的详情
)
web.AddNamespace(assessTaskNS)
web.AddNamespace(assessNS)
... ...