作者 郑周

Merge remote-tracking branch 'origin/test' into test

... ... @@ -524,7 +524,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application.
// TargetUser: domain.StaffDesc{},
// TargetDepartment: nil,
// Executor: domain.StaffDesc{},
Types: domain.AssessSelf,
Types: "",
// LinkNodeId: v.LinkNodeId,
Status: domain.StaffAssessUncompleted,
// BeginTime: time.Time{},
... ... @@ -540,6 +540,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application.
stepSelfTemp.EndTime = v.EndTime
stepSelfTemp.LinkNodeId = v.LinkNodeId
stepSelfTemp.LinkNodeName = v.LinkNodeName
stepSelfTemp.Types = domain.AssessSelf
assessListTemp := srv.createStaffAssessSelf(stepSelfTemp, userList, userDepartmentMap)
assessList = append(assessList, assessListTemp...)
}
... ... @@ -549,6 +550,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application.
stepSelfTemp.EndTime = v.EndTime
stepSelfTemp.LinkNodeId = v.LinkNodeId
stepSelfTemp.LinkNodeName = v.LinkNodeName
stepSelfTemp.Types = domain.AssessSuper
assessListTemp, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap)
if err != nil {
return nil, err
... ... @@ -564,15 +566,16 @@ func (srv StaffAssessServeice) createStaffAssessSelf(assessTemp domain.StaffAsse
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department) []domain.StaffAssess {
result := []domain.StaffAssess{}
for _, usr := range userList {
assessTemp.TargetUser = domain.StaffDesc{
UserId: int(usr.Id),
Account: usr.Account,
UserName: usr.Account,
UserName: usr.Name,
}
assessTemp.Executor = domain.StaffDesc{
UserId: int(usr.Id),
Account: usr.Account,
UserName: usr.Account,
UserName: usr.Name,
}
if depList, ok := userDepartmentMap[usr.Id]; ok {
for _, dep := range depList {
... ...
... ... @@ -2,18 +2,18 @@ package domain
//员工基本信息描述
type StaffDesc struct {
UserId int `json:"userId"` //用户id
Account string `json:"account"` //用户的账号
UserName string `json:"userName"` //用户的名称
UserId int `json:"userId,string"` //用户id
Account string `json:"account"` //用户的账号
UserName string `json:"userName"` //用户的名称
}
//员工的部门
type StaffDepartment struct {
DepartmentId int `json:"departmentId"` //部门id
DepartmentName string `json:"departmentName"` //部门名称
DepartmentId int `json:"departmentId,string"` //部门id
DepartmentName string `json:"departmentName"` //部门名称
}
type StaffPosition struct {
PositionId int `json:"positionId"`
PositionId int `json:"positionId,string"`
PositionName string `json:"positionName"`
}
... ...
... ... @@ -28,12 +28,14 @@ func (repo *UserRepository) Insert(user *domain.User) (*domain.User, error) {
AvatarUrl: user.AvatarUrl,
CompanyId: user.CompanyId,
AdminType: user.AdminType,
DepartmentId: user.DepartmentId,
PositionId: user.PositionId,
Name: user.Name,
Email: user.Email,
Status: user.Status,
UpdatedAt: user.UpdatedAt,
DepartmentId: user.DepartmentId,
PositionId: user.PositionId,
EntryTime: user.EntryTime,
CreatedAt: user.CreatedAt,
UpdatedAt: user.UpdatedAt,
DeletedAt: user.DeletedAt,
}
tx := repo.transactionContext.PgTx
... ... @@ -52,13 +54,14 @@ func (repo *UserRepository) Update(user *domain.User) (*domain.User, error) {
AvatarUrl: user.AvatarUrl,
CompanyId: user.CompanyId,
AdminType: user.AdminType,
DepartmentId: user.DepartmentId,
PositionId: user.PositionId,
Name: user.Name,
Email: user.Email,
Status: user.Status,
UpdatedAt: user.UpdatedAt,
DepartmentId: user.DepartmentId,
PositionId: user.PositionId,
EntryTime: user.EntryTime,
CreatedAt: user.CreatedAt,
UpdatedAt: user.UpdatedAt,
DeletedAt: user.DeletedAt,
}
tx := repo.transactionContext.PgTx
... ... @@ -139,16 +142,19 @@ func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int, []*d
func (repo *UserRepository) TransformToUserDomain(user *models.User) *domain.User {
return &domain.User{
Id: user.Id,
Account: user.Account,
AvatarUrl: user.AvatarUrl,
CompanyId: user.CompanyId,
AdminType: user.AdminType,
Name: user.Name,
Email: user.Email,
Status: user.Status,
UpdatedAt: user.UpdatedAt,
CreatedAt: user.CreatedAt,
DeletedAt: user.DeletedAt,
Id: user.Id,
Account: user.Account,
AvatarUrl: user.AvatarUrl,
CompanyId: user.CompanyId,
AdminType: user.AdminType,
Name: user.Name,
Email: user.Email,
Status: user.Status,
DepartmentId: user.DepartmentId,
PositionId: user.PositionId,
EntryTime: user.EntryTime,
UpdatedAt: user.UpdatedAt,
DeletedAt: user.DeletedAt,
CreatedAt: user.CreatedAt,
}
}
... ...