...
|
...
|
@@ -986,37 +986,298 @@ func (srv StaffAssessServeice) getAssessInfoUncompletedV2(transactionContext app |
|
|
return contentList, nil
|
|
|
}
|
|
|
|
|
|
// 展示360评估内容
|
|
|
func (srv StaffAssessServeice) StaffAssess360Show() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
// 展示360评估内容,未填写的评估项不展示
|
|
|
func (srv StaffAssessServeice) StaffAssess360Show(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, 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,
|
|
|
})
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"id": param.AssessId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
|
|
if len(assessList) == 0 {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
if assessList[0].Types != domain.AssessInviteSameSuper &&
|
|
|
assessList[0].Types != domain.AssessInviteDiffSuper {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
assessData := assessList[0]
|
|
|
//已完成
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, assessContentList, err := assessContentRepo.Find(map[string]interface{}{
|
|
|
"staffAssessId": assessData.Id,
|
|
|
})
|
|
|
if err != nil {
|
|
|
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())
|
|
|
}
|
|
|
result := adapter.AssessInfoResp{
|
|
|
AssessId: assessData.Id,
|
|
|
CycleId: assessData.CycleId,
|
|
|
CycleName: assessData.CycleName,
|
|
|
LinkNodeId: assessData.LinkNodeId,
|
|
|
LinkNodeName: assessData.LinkNodeName,
|
|
|
EvaluationProjectId: assessData.EvaluationProjectId,
|
|
|
EvaluationProjectName: assessData.EvaluationProjectName,
|
|
|
BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
Status: string(assessData.Status),
|
|
|
TargetUserId: assessData.TargetUser.UserId,
|
|
|
TargetUserName: assessData.TargetUser.UserName,
|
|
|
CompanyId: assessData.CompanyId,
|
|
|
CompanyName: "",
|
|
|
SupperUser: "",
|
|
|
DutyTime: "",
|
|
|
AssessContent: []*domain.StaffAssessContent{},
|
|
|
}
|
|
|
if targetUserDesc != nil {
|
|
|
result.CompanyName = targetUserDesc.CompanyName
|
|
|
result.SupperUser = targetUserDesc.SupperUserName
|
|
|
result.CompanyLogo = targetUserDesc.CompanyLogo
|
|
|
result.DutyTime = targetUserDesc.DutyTime
|
|
|
}
|
|
|
|
|
|
// 展示上级评估内容
|
|
|
func (srv StaffAssessServeice) StaffAssessSuperShow() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
for _, val := range assessContentList {
|
|
|
if len(val.Value) == 0 {
|
|
|
//跳过不展示未填写的
|
|
|
continue
|
|
|
}
|
|
|
result.AssessContent = append(result.AssessContent, val)
|
|
|
}
|
|
|
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 展示自评评估内容
|
|
|
func (srv StaffAssessServeice) StaffAssessSelfShow() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
// 展示上级评估内容,未填写的评估项不展示
|
|
|
func (srv StaffAssessServeice) StaffAssessSuperShow(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, 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,
|
|
|
})
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"id": param.AssessId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
|
|
if len(assessList) == 0 {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
if assessList[0].Types != domain.AssessSuper {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
assessData := assessList[0]
|
|
|
//已完成
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, assessContentList, err := assessContentRepo.Find(map[string]interface{}{
|
|
|
"staffAssessId": assessData.Id,
|
|
|
})
|
|
|
if err != nil {
|
|
|
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())
|
|
|
}
|
|
|
result := adapter.AssessInfoResp{
|
|
|
AssessId: assessData.Id,
|
|
|
CycleId: assessData.CycleId,
|
|
|
CycleName: assessData.CycleName,
|
|
|
LinkNodeId: assessData.LinkNodeId,
|
|
|
LinkNodeName: assessData.LinkNodeName,
|
|
|
EvaluationProjectId: assessData.EvaluationProjectId,
|
|
|
EvaluationProjectName: assessData.EvaluationProjectName,
|
|
|
BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
Status: string(assessData.Status),
|
|
|
TargetUserId: assessData.TargetUser.UserId,
|
|
|
TargetUserName: assessData.TargetUser.UserName,
|
|
|
CompanyId: assessData.CompanyId,
|
|
|
CompanyName: "",
|
|
|
SupperUser: "",
|
|
|
DutyTime: "",
|
|
|
AssessContent: []*domain.StaffAssessContent{},
|
|
|
}
|
|
|
if targetUserDesc != nil {
|
|
|
result.CompanyName = targetUserDesc.CompanyName
|
|
|
result.SupperUser = targetUserDesc.SupperUserName
|
|
|
result.CompanyLogo = targetUserDesc.CompanyLogo
|
|
|
result.DutyTime = targetUserDesc.DutyTime
|
|
|
}
|
|
|
|
|
|
for _, val := range assessContentList {
|
|
|
if len(val.Value) == 0 {
|
|
|
//跳过不展示未填写的
|
|
|
continue
|
|
|
}
|
|
|
result.AssessContent = append(result.AssessContent, val)
|
|
|
}
|
|
|
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 360评估内容编辑前
|
|
|
func (srv StaffAssessServeice) StaffAssess360BeforeEdit() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
func (srv StaffAssessServeice) StaffAssess360BeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
|
|
|
result, err := srv.getStaffAssessBeforeEdit(param)
|
|
|
if err != nil {
|
|
|
return &adapter.AssessInfoResp{}, err
|
|
|
}
|
|
|
//360评估全部是选填项
|
|
|
for i := range result.AssessContent {
|
|
|
result.AssessContent[i].Required = domain.NodeRequiredNo
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 上级评估内容编辑前
|
|
|
func (srv StaffAssessServeice) StaffAssessSuperBeforeEdit() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
func (srv StaffAssessServeice) StaffAssessSuperBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
|
|
|
result, err := srv.getStaffAssessBeforeEdit(param)
|
|
|
if err != nil {
|
|
|
return &adapter.AssessInfoResp{}, err
|
|
|
}
|
|
|
//上级评估全部是选填项
|
|
|
for i := range result.AssessContent {
|
|
|
result.AssessContent[i].Required = domain.NodeRequiredNo
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 自评评估内容编辑前
|
|
|
func (srv StaffAssessServeice) StaffAssessSelfBeforeEdit() (*adapter.AssessInfoResp, error) {
|
|
|
return nil, nil
|
|
|
// func (srv StaffAssessServeice) StaffAssessSelfBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
|
|
|
// result, err := srv.GetAssessInfo(param)
|
|
|
// if err != nil {
|
|
|
// return &adapter.AssessInfoResp{}, err
|
|
|
// }
|
|
|
// return result, nil
|
|
|
// }
|
|
|
|
|
|
func (srv StaffAssessServeice) getStaffAssessBeforeEdit(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, 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,
|
|
|
})
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"id": param.AssessId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
|
|
if len(assessList) == 0 {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
assessData := assessList[0]
|
|
|
assessContentList := []*domain.StaffAssessContent{}
|
|
|
if assessData.Status == domain.StaffAssessCompleted {
|
|
|
//已完成
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, 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.getAssessInfoUncompletedV2(transactionContext, assessData)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
// 恢复缓存数据
|
|
|
srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
result := adapter.AssessInfoResp{
|
|
|
AssessId: assessData.Id,
|
|
|
CycleId: assessData.CycleId,
|
|
|
CycleName: assessData.CycleName,
|
|
|
LinkNodeId: assessData.LinkNodeId,
|
|
|
LinkNodeName: assessData.LinkNodeName,
|
|
|
EvaluationProjectId: assessData.EvaluationProjectId,
|
|
|
EvaluationProjectName: assessData.EvaluationProjectName,
|
|
|
BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
Status: string(assessData.Status),
|
|
|
TargetUserId: assessData.TargetUser.UserId,
|
|
|
TargetUserName: assessData.TargetUser.UserName,
|
|
|
CompanyId: assessData.CompanyId,
|
|
|
CompanyName: "",
|
|
|
SupperUser: "",
|
|
|
DutyTime: "",
|
|
|
AssessContent: assessContentList,
|
|
|
}
|
|
|
if len(assessContentList) == 0 {
|
|
|
result.AssessContent = []*domain.StaffAssessContent{}
|
|
|
}
|
|
|
if targetUserDesc != nil {
|
|
|
result.CompanyName = targetUserDesc.CompanyName
|
|
|
result.SupperUser = targetUserDesc.SupperUserName
|
|
|
result.CompanyLogo = targetUserDesc.CompanyLogo
|
|
|
result.DutyTime = targetUserDesc.DutyTime
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取未完成评估任务的执行人员名单
|
|
|
func (srv StaffAssessServeice) ExcutorListUncompleted() error {
|
|
|
func (srv StaffAssessServeice) ListExcutorUncompleted() error {
|
|
|
return nil
|
|
|
} |
...
|
...
|
|