...
|
...
|
@@ -11,6 +11,7 @@ import ( |
|
|
"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"
|
|
|
)
|
|
|
|
|
|
//获取我的项目周期列表
|
...
|
...
|
@@ -51,10 +52,9 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ |
|
|
var temp adapter.AssessCycleDayResp
|
|
|
for _, v := range assessCycleList {
|
|
|
temp = adapter.AssessCycleDayResp{
|
|
|
CycleId: v.CycleId,
|
|
|
CycleName: v.CycleName,
|
|
|
BeginDay: v.BeginDay,
|
|
|
AssessTaskId: v.AssessTaskId,
|
|
|
CycleId: v.CycleId,
|
|
|
CycleName: v.CycleName,
|
|
|
BeginDay: v.BeginDay,
|
|
|
}
|
|
|
listData = append(listData, temp)
|
|
|
}
|
...
|
...
|
@@ -217,7 +217,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que |
|
|
}
|
|
|
|
|
|
//根据周期获取,我的自评任务添加的邀请人
|
|
|
func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
|
|
|
func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -239,7 +239,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi |
|
|
_, myAssessTask, err := assessTaskRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"executorId": param.TargetUserId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
...
|
...
|
@@ -255,7 +255,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi |
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"staffAssessTaskId": assessTaskData.Id,
|
|
|
"targetUserId": param.UserId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取个人邀请列表"+err.Error())
|
...
|
...
|
@@ -291,7 +291,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi |
|
|
}
|
|
|
|
|
|
// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
|
|
|
func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExecutorAssessQuery) (
|
|
|
func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecutorAssessQuery) (
|
|
|
*adapter.ListInviteUserAssessResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -307,9 +307,7 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
//获取 executorId 对应的360评估任务 用户
|
|
|
condition := map[string]interface{}{
|
|
|
"beginDay": param.BeginDay,
|
...
|
...
|
@@ -399,15 +397,6 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
|
|
|
_, myAssessTaskData, err := assessTaskRepo.Find(map[string]interface{}{
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -426,6 +415,8 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
"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),
|
...
|
...
|
@@ -458,20 +449,18 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
List: listData,
|
|
|
Total: cnt,
|
|
|
}
|
|
|
if len(myAssessTaskData) > 0 {
|
|
|
for _, v := range myAssessTaskData[0].StepList {
|
|
|
if v.LinkNodeType == domain.LinkNodeAllAssessment {
|
|
|
result.LinkNodeId = v.LinkNodeId
|
|
|
result.LinkNodeName = v.LinkNodeName
|
|
|
result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if len(assessList) > 0 {
|
|
|
result.BeginDay = assessList[0].BeginTime.Local().Format("2006-01-02")
|
|
|
result.CycleId = int(assessList[0].CycleId)
|
|
|
result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", assessList[0].EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
//根据周期和日期获取我需要执行的上级评估成员列表
|
|
|
func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) {
|
|
|
func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -510,7 +499,7 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec |
|
|
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)
|
...
|
...
|
@@ -540,33 +529,26 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec |
|
|
})
|
|
|
userPositionMap[v.Id] = positionList
|
|
|
}
|
|
|
|
|
|
//获取员工邀请的人完成360评估的数量
|
|
|
//获取目标员工邀请的人完成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())
|
|
|
// }
|
|
|
}
|
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
d := dao.NewStaffAssessDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
|
|
|
// "id": param.AssessTaskId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
|
|
|
if len(userIds) > 0 {
|
|
|
inviteCompletedCount, err = d.CountTargetUserInviteAssess1(userIds, param.CycleId, param.BeginDay)
|
|
|
if err != nil {
|
|
|
log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//我评估别人,被邀请评估
|
|
|
cnnt, _, err := assessRepo.Find(map[string]interface{}{
|
|
|
// "staffAssessTaskId": param.AssessTaskId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": string(domain.StaffAssessUncompleted),
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
...
|
...
|
@@ -579,7 +561,9 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec |
|
|
for _, v := range assessList {
|
|
|
item := adapter.ListSupperAssessResp{
|
|
|
AssessId: v.Id,
|
|
|
UsrId: v.TargetUser.UserId,
|
|
|
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,
|
...
|
...
|
@@ -616,15 +600,95 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec |
|
|
resultList = append(resultList, item)
|
|
|
}
|
|
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
|
|
|
result["linkNodeName"] = ""
|
|
|
result["linkNodeId"] = ""
|
|
|
result["lintNodeDesc"] = ""
|
|
|
for _, v := range assessTaskData.StepList {
|
|
|
if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
|
|
|
result["linkNodeName"] = v.LinkNodeName
|
|
|
result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)
|
|
|
result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
if len(assessList) > 0 {
|
|
|
result["cycleId"] = assessList[0].CycleId
|
|
|
result["beginDay"] = assessList[0].BeginTime.Local().Format("2006-01-02")
|
|
|
result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", assessList[0].EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
//根据周期和日期,获取员工的自评内容
|
|
|
func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfAssessQuery) (*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,
|
|
|
"executorId": param.TargetUserId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
|
|
if len(assessList) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "不存在员工的自评内容")
|
|
|
}
|
|
|
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.getAssessSelfInfoUncompleted(transactionContext, assessData)
|
|
|
if err != nil {
|
|
|
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,
|
|
|
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 staffDesc != nil {
|
|
|
result.CompanyName = staffDesc.CompanyName
|
|
|
result.SupperUser = staffDesc.SupperUserName
|
|
|
result.DutyTime = staffDesc.DutyTime
|
|
|
}
|
|
|
return &result, nil
|
|
|
} |
...
|
...
|
|