作者 tangxvhui

更新

@@ -6,6 +6,7 @@ type AssessTaskDescQuery struct { @@ -6,6 +6,7 @@ type AssessTaskDescQuery struct {
6 CompanyId int `json:"companyId"` //当前登录的公司 6 CompanyId int `json:"companyId"` //当前登录的公司
7 } 7 }
8 8
  9 +//获取我的项目周期进度描述
9 type AssessTaskDescV2Query struct { 10 type AssessTaskDescV2Query struct {
10 CycleId int `json:"cycle"` 11 CycleId int `json:"cycle"`
11 BeginDay string `json:"beginDay"` 12 BeginDay string `json:"beginDay"`
  1 +package query
  2 +
  3 +// 根据周期和日期,获取员工的自评内容
  4 +type GetExecutorSelfAssessQuery struct {
  5 + CompanyId int `json:"companyId"` //
  6 + ExecutorId int `json:"executorId,string"` //评估的执行人,必填
  7 + CycleId int `json:"cycleId"` //评估周期id 必填
  8 + BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
  9 +}
1 -package query  
2 -  
3 -type ListAssessInviteUserQuery struct {  
4 - CompanyId int `json:"companyId"` //对公司  
5 - UserId int `json:"userId"` //被评估的员工id  
6 - CycleId int `json:"CycleId"` //评估任务的周期id  
7 - BeginDay string `json:"beginDay"` //日期  
8 -}  
1 package query 1 package query
2 2
  3 +// 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
3 type ListExecutorAssessQuery struct { 4 type ListExecutorAssessQuery struct {
4 PageNumber int `json:"pageNumber"` 5 PageNumber int `json:"pageNumber"`
5 PageSize int `json:"pageSize"` 6 PageSize int `json:"pageSize"`
  1 +package query
  2 +
  3 +//根据周期和日期,获取员工邀请评估的人员
  4 +type ListInviteUserQuery struct {
  5 + CompanyId int `json:"companyId"` //对公司
  6 + TargetUserId int `json:"userId,string"` //被评估的员工id
  7 + CycleId int `json:"CycleId"` //评估任务的周期id
  8 + BeginDay string `json:"beginDay"` //日期
  9 +}
1 package query 1 package query
2 2
  3 +// 获取我的项目周期列表
3 type SearchAssessMeQuery struct { 4 type SearchAssessMeQuery struct {
4 UserId int `json:"userId"` // 当前登录人的用户id 5 UserId int `json:"userId"` // 当前登录人的用户id
5 CompanyId int `json:"companyId"` //当前登录人的公司Id 6 CompanyId int `json:"companyId"` //当前登录人的公司Id
@@ -218,7 +218,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que @@ -218,7 +218,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
218 } 218 }
219 219
220 //根据周期获取,我的自评任务添加的邀请人 220 //根据周期获取,我的自评任务添加的邀请人
221 -func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) { 221 +func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
222 transactionContext, err := factory.CreateTransactionContext(nil) 222 transactionContext, err := factory.CreateTransactionContext(nil)
223 if err != nil { 223 if err != nil {
224 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 224 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -240,7 +240,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi @@ -240,7 +240,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi
240 _, myAssessTask, err := assessTaskRepo.Find(map[string]interface{}{ 240 _, myAssessTask, err := assessTaskRepo.Find(map[string]interface{}{
241 "cycleId": param.CycleId, 241 "cycleId": param.CycleId,
242 "beginDay": param.BeginDay, 242 "beginDay": param.BeginDay,
243 - "executorId": param.UserId, 243 + "executorId": param.TargetUserId,
244 "limit": 1, 244 "limit": 1,
245 }) 245 })
246 if err != nil { 246 if err != nil {
@@ -256,7 +256,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi @@ -256,7 +256,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi
256 _, assessList, err := assessReps.Find(map[string]interface{}{ 256 _, assessList, err := assessReps.Find(map[string]interface{}{
257 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)}, 257 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
258 "staffAssessTaskId": assessTaskData.Id, 258 "staffAssessTaskId": assessTaskData.Id,
259 - "targetUserId": param.UserId, 259 + "targetUserId": param.TargetUserId,
260 }) 260 })
261 if err != nil { 261 if err != nil {
262 return nil, application.ThrowError(application.ARG_ERROR, "获取个人邀请列表"+err.Error()) 262 return nil, application.ThrowError(application.ARG_ERROR, "获取个人邀请列表"+err.Error())
@@ -292,7 +292,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi @@ -292,7 +292,7 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param query.ListAssessInvi
292 } 292 }
293 293
294 // 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值 294 // 根据周期和日期获取我要执行的的360评估,用户列表和评估填写的值
295 -func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExecutorAssessQuery) ( 295 +func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecutorAssessQuery) (
296 *adapter.ListInviteUserAssessResp, error) { 296 *adapter.ListInviteUserAssessResp, error) {
297 transactionContext, err := factory.CreateTransactionContext(nil) 297 transactionContext, err := factory.CreateTransactionContext(nil)
298 if err != nil { 298 if err != nil {
@@ -459,7 +459,7 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec @@ -459,7 +459,7 @@ func (srv StaffAssessServeice) ListExecutorDayInviteAssess(param *query.ListExec
459 } 459 }
460 460
461 //根据周期和日期获取我需要执行的上级评估成员列表 461 //根据周期和日期获取我需要执行的上级评估成员列表
462 -func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) { 462 +func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecutorAssessQuery) (map[string]interface{}, error) {
463 transactionContext, err := factory.CreateTransactionContext(nil) 463 transactionContext, err := factory.CreateTransactionContext(nil)
464 if err != nil { 464 if err != nil {
465 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 465 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -605,3 +605,87 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec @@ -605,3 +605,87 @@ func (srv StaffAssessServeice) ListExecutorDaySupperAssess(param *query.ListExec
605 } 605 }
606 return result, nil 606 return result, nil
607 } 607 }
  608 +
  609 +//根据周期和日期,获取员工的自评内容
  610 +func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfAssessQuery) (*adapter.AssessInfoResp, error) {
  611 + transactionContext, err := factory.CreateTransactionContext(nil)
  612 + if err != nil {
  613 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  614 + }
  615 + if err := transactionContext.StartTransaction(); err != nil {
  616 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  617 + }
  618 + defer func() {
  619 + _ = transactionContext.RollbackTransaction()
  620 + }()
  621 + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
  622 + "transactionContext": transactionContext,
  623 + })
  624 + // 获取员工的评估
  625 + _, assessList, err := assessReps.Find(map[string]interface{}{
  626 + "companyId": param.CompanyId,
  627 + "executorId": param.ExecutorId,
  628 + "cycleId": param.CycleId,
  629 + "beginDay": param.BeginDay,
  630 + "typesList": []string{string(domain.AssessSelf)},
  631 + "limit": 1,
  632 + })
  633 + if err != nil {
  634 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
  635 + }
  636 + if len(assessList) == 0 {
  637 + return &adapter.AssessInfoResp{}, nil
  638 + }
  639 + assessData := assessList[0]
  640 +
  641 + assessContentList := []*domain.StaffAssessContent{}
  642 + if assessData.Status == domain.StaffAssessCompleted {
  643 + //已完成
  644 + assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
  645 + "transactionContext": transactionContext,
  646 + })
  647 + _, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
  648 + "staffAssessId": assessData.Id,
  649 + })
  650 + if err != nil {
  651 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  652 + }
  653 + } else if assessData.Status == domain.StaffAssessUncompleted {
  654 + //未完成
  655 + assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)
  656 + if err != nil {
  657 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  658 + }
  659 + }
  660 +
  661 + //获取员工描述
  662 + staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.ExecutorId))
  663 + if err := transactionContext.CommitTransaction(); err != nil {
  664 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  665 + }
  666 + result := adapter.AssessInfoResp{
  667 + AssessId: assessData.Id,
  668 + CycleId: assessData.CycleId,
  669 + CycleName: assessData.CycleName,
  670 + LinkNodeId: assessData.LinkNodeId,
  671 + LinkNodeName: assessData.LinkNodeName,
  672 + EvaluationProjectId: assessData.EvaluationProjectId,
  673 + EvaluationProjectName: assessData.EvaluationProjectName,
  674 + BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
  675 + EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
  676 + Status: string(assessData.Status),
  677 + TargetUserId: assessData.TargetUser.UserId,
  678 + TargetUserName: assessData.TargetUser.UserName,
  679 + CompanyId: assessData.CompanyId,
  680 + CompanyName: "",
  681 + SupperUser: "",
  682 + DutyTime: "",
  683 + AssessContent: assessContentList,
  684 + }
  685 + if staffDesc != nil {
  686 + result.CompanyName = staffDesc.CompanyName
  687 + result.SupperUser = staffDesc.SupperUserName
  688 + result.DutyTime = staffDesc.DutyTime
  689 + }
  690 + return &result, nil
  691 +}