...
|
...
|
@@ -14,7 +14,7 @@ import ( |
|
|
)
|
|
|
|
|
|
//获取我的项目周期列表
|
|
|
func (srv StaffAssessServeice) SearchAssessCycelMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {
|
|
|
func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -62,7 +62,7 @@ func (srv StaffAssessServeice) SearchAssessCycelMe(param *query.SearchAssessMeQu |
|
|
}
|
|
|
|
|
|
//获取我的项目周期进度描述
|
|
|
func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQuery) (*adapter.AssessCycleDescResp, error) {
|
|
|
func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Query) (*adapter.AssessCycleDescResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -81,12 +81,12 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if len(param.AssessTaskId) == 0 {
|
|
|
return &adapter.AssessCycleDescResp{}, nil
|
|
|
}
|
|
|
|
|
|
_, assessTaskList, err := staffAssessTaskRepo.Find(map[string]interface{}{
|
|
|
"ids": param.AssessTaskId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"companyId": param.CompanyId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error())
|
...
|
...
|
@@ -95,18 +95,6 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
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{
|
|
|
CycleId: int(assessTaskDataAny.CycleId),
|
...
|
...
|
@@ -128,11 +116,11 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
}
|
|
|
switch v.LinkNodeType {
|
|
|
case domain.LinkNodeSelfAssessment:
|
|
|
if myAssessTask != nil {
|
|
|
//个人自评完成情况
|
|
|
_, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": myAssessTask.Id,
|
|
|
"executorId": param.UserId,
|
|
|
"cycleId": assessTaskDataAny.CycleId,
|
|
|
"beginDay": assessTaskDataAny.BeginDay,
|
|
|
"executorId": param.UserId, //我作为执行人
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
})
|
|
|
if err != nil {
|
...
|
...
|
@@ -142,12 +130,11 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
stepItem.Status = string(assessSelfData[0].Status)
|
|
|
}
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
}
|
|
|
case domain.LinkNodeAllInvite:
|
|
|
if myAssessTask != nil {
|
|
|
//邀请别人评估自己
|
|
|
_, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": myAssessTask.Id,
|
|
|
"cycleId": assessTaskDataAny.CycleId,
|
|
|
"beginDay": assessTaskDataAny.BeginDay,
|
|
|
"targetUserId": param.UserId, //我被作为目标
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 5,
|
...
|
...
|
@@ -166,11 +153,11 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
} else {
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
|
|
|
}
|
|
|
}
|
|
|
case domain.LinkNodeAllAssessment:
|
|
|
//我评估别人,被邀请评估
|
|
|
_, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
//TODO
|
|
|
"cycleId": assessTaskDataAny.CycleId,
|
|
|
"beginDay": assessTaskDataAny.BeginDay,
|
|
|
"executorId": param.UserId, //我作为执行人
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
})
|
...
|
...
|
@@ -190,8 +177,8 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
case domain.LinkNodeSuperiorAssessment:
|
|
|
//我评估别人,上级评估
|
|
|
cnnt, _, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": assessTaskDataAny.CycleId,
|
|
|
"beginDay": assessTaskDataAny.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": domain.StaffAssessUncompleted,
|
...
|
...
|
@@ -201,8 +188,8 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取未完成的评估环节"+err.Error())
|
|
|
}
|
|
|
cnnt2, _, err := staffAssessRepo.Find(map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": assessTaskDataAny.CycleId,
|
|
|
"beginDay": assessTaskDataAny.BeginDay,
|
|
|
"executorId": param.UserId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": domain.StaffAssessCompleted,
|
...
|
...
|
@@ -211,7 +198,7 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取已完成的评估环节"+err.Error())
|
|
|
}
|
|
|
if cnnt+cnnt2 > 0 {
|
|
|
if (cnnt + cnnt2) > 0 {
|
|
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
uncompletedNum := cnnt
|
...
|
...
|
@@ -229,8 +216,8 @@ func (srv StaffAssessServeice) AssessCycleMeDesc(param *query.AssessCycleDescQue |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
//根据周期获取,我的自评任务的添加的邀请人
|
|
|
func (srv StaffAssessServeice) ListAssessInviteUser(param query.ListAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
|
|
|
//根据周期获取,我的自评任务添加的邀请人
|
|
|
func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -256,7 +243,7 @@ func (srv StaffAssessServeice) ListAssessInviteUser(param query.ListAssessInvite |
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "我的评估任务不存在,"+err.Error())
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "我的自评任务不存在,"+err.Error())
|
|
|
}
|
|
|
|
|
|
if len(myAssessTask) == 0 {
|
...
|
...
|
@@ -304,7 +291,7 @@ func (srv StaffAssessServeice) ListAssessInviteUser(param query.ListAssessInvite |
|
|
}
|
|
|
|
|
|
// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
|
|
|
func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExecutorInviteAssessQuery) (
|
|
|
func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExecutorAssessQuery) (
|
|
|
*adapter.ListInviteUserAssessResp, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -331,6 +318,9 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"limit": 20,
|
|
|
}
|
|
|
if len(param.UserName) > 0 {
|
|
|
condition["targetUserName"] = param.UserName
|
|
|
}
|
|
|
if param.PageSize > 0 {
|
|
|
condition["limit"] = param.PageSize
|
|
|
}
|
...
|
...
|
@@ -344,12 +334,18 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
var assessContentList []*domain.StaffAssessContent
|
|
|
if len(assessList) > 0 {
|
|
|
projectIdMap := map[int]struct{}{}
|
|
|
//获取评估用的所有评估项
|
|
|
assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessList[0])
|
|
|
for i := range assessList {
|
|
|
if _, ok := projectIdMap[assessList[i].EvaluationProjectId]; ok {
|
|
|
continue
|
|
|
}
|
|
|
projectIdMap[assessList[i].EvaluationProjectId] = struct{}{}
|
|
|
assessContentListTemp, err := srv.getAssessSelfInfoUncompleted(transactionContext, assessList[i])
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估任务"+err.Error())
|
|
|
}
|
|
|
assessContentList = append(assessContentList, assessContentListTemp...)
|
|
|
}
|
|
|
//可变的表格列
|
|
|
changeableHeader := []adapter.ListTableHeader{}
|
...
|
...
|
@@ -358,6 +354,9 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
for i, v := range assessContentList {
|
|
|
name := fmt.Sprintf("%s-%s", v.Category, v.Name)
|
|
|
key := fmt.Sprintf("k%d", i)
|
|
|
if _, ok := keyMap[name]; ok {
|
|
|
continue
|
|
|
}
|
|
|
keyMap[name] = key
|
|
|
changeableHeader = append(changeableHeader, adapter.ListTableHeader{
|
|
|
Key: key,
|
...
|
...
|
@@ -471,7 +470,161 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
func (srv StaffAssessServeice) ListExecutorSupperAssessDay() (map[string]interface{}, error) {
|
|
|
//根据周期和日期获取我需要执行的上级评估成员列表
|
|
|
func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExecutorAssessQuery) (map[string]interface{}, 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()
|
|
|
}()
|
|
|
//获取对应的评估任务
|
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
return nil, nil
|
|
|
limit := 20
|
|
|
if param.PageSize > 0 {
|
|
|
limit = param.PageSize
|
|
|
}
|
|
|
condition := map[string]interface{}{
|
|
|
"beginDay": param.BeginDay,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"limit": limit,
|
|
|
}
|
|
|
if len(param.UserName) > 0 {
|
|
|
condition["targetUserName"] = param.UserName
|
|
|
}
|
|
|
offset := (param.PageNumber - 1) * param.PageSize
|
|
|
if offset > 0 {
|
|
|
condition["offset"] = offset
|
|
|
}
|
|
|
//获取 executorId 对应的上级评估列表
|
|
|
cnt, assessList, err := assessRepo.Find(condition)
|
|
|
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)
|
|
|
}
|
|
|
//获取员工信息
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
var targetUserList []*domain.User
|
|
|
if len(userIds) > 0 {
|
|
|
_, targetUserList, _ = userRepo.Find(map[string]interface{}{
|
|
|
"ids": userIds,
|
|
|
})
|
|
|
}
|
|
|
//获取职位信息
|
|
|
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
//获取员工的职位
|
|
|
userPositionMap := map[int64][]*domain.Position{}
|
|
|
for _, v := range targetUserList {
|
|
|
if len(v.PositionId) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
_, positionList, _ := positionRepo.Find(map[string]interface{}{
|
|
|
"ids": v.PositionId,
|
|
|
})
|
|
|
userPositionMap[v.Id] = positionList
|
|
|
}
|
|
|
|
|
|
//获取员工邀请的人完成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{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
|
|
|
// "id": param.AssessTaskId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
|
|
|
}
|
|
|
//我评估别人,被邀请评估
|
|
|
cnnt, _, err := assessRepo.Find(map[string]interface{}{
|
|
|
// "staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": string(domain.StaffAssessUncompleted),
|
|
|
})
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
resultList := []adapter.ListSupperAssessResp{}
|
|
|
for _, v := range assessList {
|
|
|
item := adapter.ListSupperAssessResp{
|
|
|
AssessId: v.Id,
|
|
|
UsrId: v.TargetUser.UserId,
|
|
|
UserName: v.TargetUser.UserName,
|
|
|
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
InviteCompleted: 0,
|
|
|
Status: string(v.Status),
|
|
|
InviteTotal: 5,
|
|
|
Department: "",
|
|
|
Position: "",
|
|
|
DutyTime: "",
|
|
|
}
|
|
|
//填入部门
|
|
|
for _, vv := range v.TargetDepartment {
|
|
|
item.Department += vv.DepartmentName + " "
|
|
|
}
|
|
|
for _, vv := range targetUserList {
|
|
|
if vv.Id != int64(v.TargetUser.UserId) {
|
|
|
continue
|
|
|
}
|
|
|
//填入入职时间
|
|
|
item.DutyTime = vv.CreatedAt.Local().Format("2006-01-02 15:04:05")
|
|
|
//填入职位
|
|
|
for _, vvv := range userPositionMap[vv.Id] {
|
|
|
item.Position += vvv.Name + " "
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
//
|
|
|
for _, vv := range inviteCompletedCount {
|
|
|
if v.TargetUser.UserId == vv.TargetUserId {
|
|
|
item.InviteCompleted = vv.InviteCompleted
|
|
|
item.InviteTotal = vv.InviteTotal
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
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)
|
|
|
}
|
|
|
}
|
|
|
return result, nil
|
|
|
} |
...
|
...
|
|