...
|
...
|
@@ -51,9 +51,10 @@ func (srv StaffAssessServeice) SearchAssessCycelMe(param *query.SearchAssessMeQu |
|
|
var temp adapter.AssessCycleDayResp
|
|
|
for _, v := range assessCycleList {
|
|
|
temp = adapter.AssessCycleDayResp{
|
|
|
CycleId: v.CycleId,
|
|
|
CycleName: v.CycleName,
|
|
|
BeginDay: v.BeginDay,
|
|
|
CycleId: v.CycleId,
|
|
|
CycleName: v.CycleName,
|
|
|
BeginDay: v.BeginDay,
|
|
|
AssessTaskId: v.AssessTaskId,
|
|
|
}
|
|
|
listData = append(listData, temp)
|
|
|
}
|
...
|
...
|
@@ -80,22 +81,31 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskDataAny, err := staffAssessTaskRepo.FindOne(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"limit": 1,
|
|
|
if len(param.AssessTaskId) == 0 {
|
|
|
return &adapter.AssessCycleDescResp{}, nil
|
|
|
}
|
|
|
_, assessTaskList, err := staffAssessTaskRepo.Find(map[string]interface{}{
|
|
|
"ids": param.AssessTaskId,
|
|
|
"companyId": param.CompanyId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error())
|
|
|
}
|
|
|
_, myAssessTask, err := staffAssessTaskRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "我的评估任务不存在,"+err.Error())
|
|
|
if len(assessTaskList) == 0 {
|
|
|
return &adapter.AssessCycleDescResp{}, nil
|
|
|
}
|
|
|
assessTaskDataAny := assessTaskList[0]
|
|
|
var myAssessTask *domain.StaffAssessTask
|
|
|
for _, v := range assessTaskList {
|
|
|
if myAssessTask != nil {
|
|
|
break
|
|
|
}
|
|
|
for _, vv := range v.ExecutorId {
|
|
|
if param.UserId == vv {
|
|
|
myAssessTask = v
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//返回的数据结果
|
|
|
result := adapter.AssessCycleDescResp{
|
...
|
...
|
@@ -118,10 +128,10 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
}
|
|
|
switch v.LinkNodeType {
|
|
|
case domain.LinkNodeSelfAssessment:
|
|
|
if len(myAssessTask) > 0 {
|
|
|
if myAssessTask != nil {
|
|
|
//个人自评完成情况
|
|
|
_, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": myAssessTask[0].Id,
|
|
|
"staffAssessTaskId": myAssessTask.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
})
|
...
|
...
|
@@ -134,10 +144,10 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
}
|
|
|
case domain.LinkNodeAllInvite:
|
|
|
if len(myAssessTask) > 0 {
|
|
|
if myAssessTask != nil {
|
|
|
//邀请别人评估自己
|
|
|
_, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": myAssessTask[0].Id,
|
|
|
"staffAssessTaskId": myAssessTask.Id,
|
|
|
"targetUserId": param.UserId, //我被作为目标
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 5,
|
...
|
...
|
@@ -160,8 +170,7 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
case domain.LinkNodeAllAssessment:
|
|
|
//我评估别人,被邀请评估
|
|
|
_, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
//TODO
|
|
|
"executorId": param.UserId, //我作为执行人
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
})
|
...
|
...
|
@@ -180,24 +189,32 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
}
|
|
|
case domain.LinkNodeSuperiorAssessment:
|
|
|
//我评估别人,上级评估
|
|
|
_, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
cnnt, _, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": domain.StaffAssessUncompleted,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取未完成的评估环节"+err.Error())
|
|
|
}
|
|
|
cnnt2, _, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": domain.StaffAssessCompleted,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取已完成的评估环节"+err.Error())
|
|
|
}
|
|
|
if len(assessSupperList) > 0 {
|
|
|
if cnnt+cnnt2 > 0 {
|
|
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
uncompletedNum := 0
|
|
|
for _, v := range assessSupperList {
|
|
|
if v.Status == domain.StaffAssessUncompleted {
|
|
|
uncompletedNum += 1
|
|
|
}
|
|
|
}
|
|
|
uncompletedNum := cnnt
|
|
|
if uncompletedNum > 0 {
|
|
|
stepItem.Status = string(domain.StaffAssessUncompleted)
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)
|
...
|
...
|
@@ -287,7 +304,7 @@ func (srv StaffAssessServeice) ListAssessInviteUser(param query.ListAssessInvite |
|
|
}
|
|
|
|
|
|
// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
|
|
|
func (srv StaffAssessServeice) ListExecutorInviteAssessDay(param *query.ListInviteUserAssessQuery) (
|
|
|
func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExecutorInviteAssessQuery) (
|
|
|
*adapter.ListInviteUserAssessResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -306,13 +323,13 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessDay(param *query.ListInvi |
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
//获取 executorId 对应的360评估任务 用户
|
|
|
condition := map[string]interface{}{
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 20,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 20,
|
|
|
}
|
|
|
if param.PageSize > 0 {
|
|
|
condition["limit"] = param.PageSize
|
...
|
...
|
@@ -372,17 +389,22 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessDay(param *query.ListInvi |
|
|
//获取360邀请评估完成情况
|
|
|
//我评估别人,被邀请评估
|
|
|
cnnt, _, err := assessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"status": domain.StaffAssessUncompleted,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"status": domain.StaffAssessUncompleted,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
|
|
|
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.AssessTaskId,
|
|
|
_, 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())
|
...
|
...
|
@@ -415,7 +437,6 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessDay(param *query.ListInvi |
|
|
case domain.StaffAssessUncompleted:
|
|
|
m["status"] = "未完成"
|
|
|
}
|
|
|
|
|
|
switch v.Types {
|
|
|
case domain.AssessInviteDiffSuper:
|
|
|
m["types"] = "不同上级同事"
|
...
|
...
|
@@ -438,12 +459,19 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessDay(param *query.ListInvi |
|
|
List: listData,
|
|
|
Total: cnt,
|
|
|
}
|
|
|
for _, v := range assessTaskData.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(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)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
func (srv StaffAssessServeice) ListExecutorSupperAssessDay() (map[string]interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|