...
|
...
|
@@ -60,7 +60,7 @@ func (srv StaffAssessServeice) SearchAssessCycelMe(param *query.SearchAssessMeQu |
|
|
}
|
|
|
|
|
|
//获取我的项目周期进度描述
|
|
|
func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQuery) (*adapter.AssessTaskDescResp, error) {
|
|
|
func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQuery) (*adapter.AssessCycleDescResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -79,24 +79,32 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskData, err := staffAssessTaskRepo.FindOne(map[string]interface{}{
|
|
|
// "id": param.AssessTaskId,
|
|
|
assessTaskDataAny, err := staffAssessTaskRepo.FindOne(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
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())
|
|
|
}
|
|
|
//返回的数据结果
|
|
|
result := adapter.AssessTaskDescResp{
|
|
|
AssessTaskId: assessTaskData.Id,
|
|
|
EvaluationProjectId: assessTaskData.EvaluationProjectId,
|
|
|
EvaluationProjectName: assessTaskData.EvaluationProjectName,
|
|
|
CycleName: assessTaskData.CycleName,
|
|
|
BeginTime: assessTaskData.BeginTime.Local().Format("2006-01-02 15:04-05"),
|
|
|
EndTime: assessTaskData.EndTime.Local().Format("2006-01-02 15:04-05"),
|
|
|
StepList: []adapter.AssessTaskStep{},
|
|
|
result := adapter.AssessCycleDescResp{
|
|
|
CycleId: int(assessTaskDataAny.CycleId),
|
|
|
CycleName: assessTaskDataAny.CycleName,
|
|
|
BeginDay: assessTaskDataAny.BeginDay,
|
|
|
StepList: []adapter.AssessTaskStep{},
|
|
|
}
|
|
|
|
|
|
for _, v := range assessTaskData.StepList {
|
|
|
for _, v := range assessTaskDataAny.StepList {
|
|
|
stepItem := adapter.AssessTaskStep{
|
|
|
SortBy: v.SortBy,
|
|
|
LinkNodeName: v.LinkNodeName,
|
...
|
...
|
@@ -109,26 +117,31 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
}
|
|
|
switch v.LinkNodeType {
|
|
|
case domain.LinkNodeSelfAssessment:
|
|
|
//个人自评完成情况
|
|
|
_, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": assessTaskData.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
if len(assessSelfData) > 0 {
|
|
|
stepItem.Status = string(assessSelfData[0].Status)
|
|
|
if len(myAssessTask) > 0 {
|
|
|
//个人自评完成情况
|
|
|
_, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": myAssessTask[0].Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
if len(assessSelfData) > 0 {
|
|
|
stepItem.Status = string(assessSelfData[0].Status)
|
|
|
}
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
}
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
case domain.LinkNodeAllInvite:
|
|
|
if len(myAssessTask) > 0 {
|
|
|
|
|
|
}
|
|
|
//邀请别人评估自己
|
|
|
_, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": assessTaskData.Id,
|
|
|
"targetUserId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 5,
|
|
|
// "staffAssessTaskId": assessTaskData.Id,
|
|
|
"targetUserId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 5,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
...
|
...
|
@@ -147,9 +160,9 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
case domain.LinkNodeAllAssessment:
|
|
|
//我评估别人,被邀请评估
|
|
|
_, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": assessTaskData.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
// "staffAssessTaskId": assessTaskData.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
...
|
...
|
@@ -168,9 +181,9 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
case domain.LinkNodeSuperiorAssessment:
|
|
|
//我评估别人,上级评估
|
|
|
_, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": assessTaskData.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
// "staffAssessTaskId": assessTaskData.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
...
|
...
|
|