作者 Your Name

暂存

package adapter
type ListSupperAssessResp struct {
AssessId int `json:"assessId"` //
AssessId int `json:"assessId"` //
UsrId int `json:"userId"`
UserName string `json:"userName"` //用户名称
EndTime string `json:"endTime"` //截止时间
InviteTotal int `json:"inviteTota"` //邀请总数
... ...
... ... @@ -419,7 +419,7 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA
}, nil
}
// 添加自评节点任务
// 添加节点任务
func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) {
//评估的参与人
selfUserId := []int{}
... ... @@ -540,9 +540,37 @@ func (srv StaffAssessServeice) createStaffAssessSupper(
assessTemp domain.StaffAssess,
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
) ([]domain.StaffAssess, error) {
var assessList []domain.StaffAssess
// 获取员工的上级用户
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
for _, v := range userList {
departmentList, ok := userDepartmentMap[v.Id]
if !ok {
continue
}
targetDepartment := []domain.StaffDepartment{}
for _, vv2 := range departmentList {
if len(vv2.ChargeUserIds) == 0 {
continue
}
_, chargeUserList, err := userRepo.Find(map[string]interface{}{
"ids": vv2.ChargeUserIds,
"limit": 40,
})
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取部门主管信息"+err.Error())
}
for _, vvv3 := range chargeUserList {
assessTemp.TargetDepartment = []domain.StaffDepartment{
domain.StaffDepartment{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
}
}
}
}
return nil, nil
}
... ... @@ -1311,6 +1339,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
for _, v := range assessList {
item := adapter.ListSupperAssessResp{
AssessId: v.Id,
UsrId: v.TargetUser.UserId,
UserName: v.TargetUser.UserName,
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
InviteCompleted: 0,
... ...
... ... @@ -7,6 +7,7 @@ import (
"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 {
... ... @@ -23,9 +24,10 @@ func (c *StaffAssessController) SearchAssessTaskMe() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.UserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.SearchAssessTaskMe(paramReq)
c.Response(data, err)
}
... ... @@ -40,9 +42,9 @@ func (c *StaffAssessController) AssessTaskMeDesc() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.UserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessTaskDesc(paramReq)
c.Response(data, err)
}
... ... @@ -57,9 +59,9 @@ func (c *StaffAssessController) AssessSelfMeList() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.UserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.UserId = int(userReq.UserId)
data, err := srv.AssessSelfList(paramReq)
c.Response(data, err)
}
... ... @@ -89,9 +91,9 @@ func (c *StaffAssessController) GetAssessSelfMeInfo() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.TargetUserId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
paramReq.TargetUserId = int(userReq.UserId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
... ... @@ -106,14 +108,14 @@ func (c *StaffAssessController) GetAssessMeInviteUser() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.UserId = 1
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{}
... ... @@ -140,9 +142,11 @@ func (c *StaffAssessController) SelectAssessInviteUser() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.TargetUserId = 1
// 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)
}
... ... @@ -157,9 +161,12 @@ func (c *StaffAssessController) ListMeInviteUserAssess() {
c.Response(nil, e)
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.ExecutorId = 1
//获取当前用户信息
// 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)
}
... ... @@ -175,8 +182,11 @@ func (c *StaffAssessController) ListMeSupperAssess() {
return
}
//TODO 获取当前用户信息
paramReq.CompanyId = 1
paramReq.ExecutorId = 1
// 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)
}
... ... @@ -191,7 +201,9 @@ func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
c.Response(nil, e)
return
}
paramReq.CompanyId = 1
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessSelfInfo(paramReq)
c.Response(data, err)
}
... ... @@ -206,7 +218,9 @@ func (c *StaffAssessController) GetAssessInfo() {
c.Response(nil, e)
return
}
paramReq.CompanyId = 1
// paramReq.CompanyId = 1
userReq := middlewares.GetUser(c.Ctx)
paramReq.CompanyId = int(userReq.CompanyId)
data, err := srv.GetAssessInfo(paramReq)
c.Response(data, err)
}
... ... @@ -235,7 +249,9 @@ func (c *StaffAssessController) ListTargetUserInviteAssess() {
c.Response(nil, e)
return
}
paramReq.CompanyId = 1
// 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)
... ...