作者 庄敏学

合并分支 'test' 到 'master'

Test



查看合并请求 !10
@@ -185,18 +185,18 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp @@ -185,18 +185,18 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
185 // 重新计算 185 // 重新计算
186 if task.NextSentAt == nil { 186 if task.NextSentAt == nil {
187 // 环节起始和截止本地时间 187 // 环节起始和截止本地时间
188 - startLocal := task.TimeStart.Local()  
189 - endLocal := task.TimeEnd.Local() 188 + startLocal := task.TimeStart
  189 + endLocal := task.TimeEnd
190 190
191 // 在当前时间之前,则计算下一个周期时间 191 // 在当前时间之前,则计算下一个周期时间
192 if startLocal.Before(now) { 192 if startLocal.Before(now) {
193 nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle) 193 nextTime := utils.NextTime(nowO, startLocal, task.KpiCycle)
194 task.NextSentAt = &nextTime 194 task.NextSentAt = &nextTime
195 } else { 195 } else {
196 - task.NextSentAt = &startLocal 196 + task.NextSentAt = startLocal
197 } 197 }
198 // 如果超出截至时间,则周期置空 198 // 如果超出截至时间,则周期置空
199 - if task.NextSentAt.After(endLocal) { 199 + if task.NextSentAt.After(endLocal.Local()) {
200 task.NextSentAt = nil 200 task.NextSentAt = nil
201 } 201 }
202 } else { 202 } else {
@@ -468,18 +468,18 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) @@ -468,18 +468,18 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand)
468 } 468 }
469 469
470 // 环节起始和截止本地时间 470 // 环节起始和截止本地时间
471 - startLocal := node.TimeStart.Local()  
472 - endLocal := node.TimeEnd.Local() 471 + startLocal := node.TimeStart
  472 + endLocal := node.TimeEnd
473 473
474 // 在当前时间之前,则计算下一个周期时间 474 // 在当前时间之前,则计算下一个周期时间
475 if startLocal.Before(now) { 475 if startLocal.Before(now) {
476 nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle) 476 nextTime := utils.NextTime(nowO, startLocal, node.KpiCycle)
477 task.NextSentAt = &nextTime 477 task.NextSentAt = &nextTime
478 } else { 478 } else {
479 - task.NextSentAt = &startLocal 479 + task.NextSentAt = startLocal
480 } 480 }
481 // 如果超出截至时间,则周期置空 481 // 如果超出截至时间,则周期置空
482 - if task.NextSentAt.After(endLocal) { 482 + if task.NextSentAt.After(endLocal.Local()) {
483 task.NextSentAt = nil 483 task.NextSentAt = nil
484 } 484 }
485 485
@@ -87,7 +87,7 @@ func (rs *NodeTaskService) SendEvaluationNode() error { @@ -87,7 +87,7 @@ func (rs *NodeTaskService) SendEvaluationNode() error {
87 maxTime := task.TimeEnd.Local() 87 maxTime := task.TimeEnd.Local()
88 88
89 // 当前周起始时间和截止时间 89 // 当前周起始时间和截止时间
90 - var cycleTimeStart = task.NextSentAt.Local() 90 + var cycleTimeStart = task.NextSentAt
91 var cycleTimeEnd time.Time 91 var cycleTimeEnd time.Time
92 92
93 // 下个周期起始时间 93 // 下个周期起始时间
@@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) @@ -154,13 +154,14 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery)
154 } 154 }
155 if len(assessInviteData) > 0 { 155 if len(assessInviteData) > 0 {
156 stepItem.Status = string(domain.StaffAssessCompleted) 156 stepItem.Status = string(domain.StaffAssessCompleted)
  157 + } else {
  158 + stepItem.Status = string(domain.StaffAssessUncompleted)
157 } 159 }
158 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可 160 //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
159 if len(assessInviteData) > 5 { 161 if len(assessInviteData) > 5 {
160 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) 162 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
161 } else { 163 } else {
162 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData)) 164 stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
163 - stepItem.Status = string(domain.StaffAssessUncompleted)  
164 } 165 }
165 case domain.LinkNodeAllAssessment: 166 case domain.LinkNodeAllAssessment:
166 //我评估别人,被邀请评估 167 //我评估别人,被邀请评估
@@ -352,36 +353,21 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat @@ -352,36 +353,21 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
352 } 353 }
353 nowTime := time.Now() 354 nowTime := time.Now()
354 355
355 - _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{  
356 - "evaluationProjectId": param.EvaluationProjectId,  
357 - "beginDay": taskBeginTime.Local().Format("2006-01-02"),  
358 - })  
359 - if err != nil {  
360 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())  
361 - }  
362 - var assessTaskData *domain.StaffAssessTask  
363 - //更新旧数据或者新建数据  
364 - if len(assassessTaskList) > 0 {  
365 - assessTaskData = assassessTaskList[0]  
366 - assessTaskData.UpdatedAt = nowTime  
367 - } else {  
368 - //建立新的评估任务  
369 - assessTaskData = &domain.StaffAssessTask{  
370 - Id: 0,  
371 - CompanyId: param.CompanyId,  
372 - EvaluationProjectId: param.EvaluationProjectId,  
373 - EvaluationProjectName: param.EvaluationProjectName,  
374 - CycleId: param.CycleId,  
375 - CycleName: param.CycleName,  
376 - BeginTime: taskBeginTime,  
377 - EndTime: taskEndTime,  
378 - StepList: []domain.AssessTaskStep{},  
379 - ExecutorId: []int{},  
380 - CreatedAt: nowTime,  
381 - UpdatedAt: nowTime,  
382 - DeletedAt: nil,  
383 - BeginDay: taskBeginTime.Local().Format("2006-01-02"),  
384 - } 356 + assessTaskData := &domain.StaffAssessTask{
  357 + Id: 0,
  358 + CompanyId: param.CompanyId,
  359 + EvaluationProjectId: param.EvaluationProjectId,
  360 + EvaluationProjectName: param.EvaluationProjectName,
  361 + CycleId: param.CycleId,
  362 + CycleName: param.CycleName,
  363 + BeginTime: taskBeginTime,
  364 + EndTime: taskEndTime,
  365 + StepList: []domain.AssessTaskStep{},
  366 + ExecutorId: []int{},
  367 + CreatedAt: nowTime,
  368 + UpdatedAt: nowTime,
  369 + DeletedAt: nil,
  370 + BeginDay: taskBeginTime.Local().Format("2006-01-02"),
385 } 371 }
386 executorIds := []int{} //提取评估的参与人id 372 executorIds := []int{} //提取评估的参与人id
387 executorIdMap := map[int]struct{}{} //过滤重复的用户 373 executorIdMap := map[int]struct{}{} //过滤重复的用户
@@ -393,24 +379,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat @@ -393,24 +379,8 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
393 executorIdMap[v] = struct{}{} 379 executorIdMap[v] = struct{}{}
394 executorIds = append(executorIds, v) 380 executorIds = append(executorIds, v)
395 } 381 }
396 - //就数据中提取参与人  
397 - for _, v := range assessTaskData.ExecutorId {  
398 - if _, ok := executorIdMap[v]; ok {  
399 - continue  
400 - }  
401 - executorIdMap[v] = struct{}{}  
402 - executorIds = append(executorIds, v)  
403 - }  
404 - //填入新的参与人id  
405 assessTaskData.ExecutorId = executorIds 382 assessTaskData.ExecutorId = executorIds
406 - //填充新的评估环节  
407 -loop:  
408 for _, v := range param.StepList { 383 for _, v := range param.StepList {
409 - for _, vv := range assessTaskData.StepList {  
410 - if vv.LinkNodeId == v.LinkNodeId {  
411 - continue loop  
412 - }  
413 - }  
414 stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local) 384 stepBeginTime, err := time.ParseInLocation("2006-01-02 15:04:05", param.BeginTime, time.Local)
415 if err != nil { 385 if err != nil {
416 return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime) 386 return nil, application.ThrowError(application.ARG_ERROR, "评估环节开始时间填写错误,"+param.BeginTime)
@@ -429,20 +399,45 @@ loop: @@ -429,20 +399,45 @@ loop:
429 } 399 }
430 assessTaskData.StepList = append(assessTaskData.StepList, step) 400 assessTaskData.StepList = append(assessTaskData.StepList, step)
431 } 401 }
432 - //排序流程环节  
433 - stepList := domain.SortTaskStep(assessTaskData.StepList)  
434 - sort.Sort(stepList)  
435 - assessTaskData.StepList = stepList  
436 //添加员工的节点任务 402 //添加员工的节点任务
437 assessList, err := srv.createStaffAssess(transactionContext, assessTaskData) 403 assessList, err := srv.createStaffAssess(transactionContext, assessTaskData)
438 if err != nil { 404 if err != nil {
439 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error()) 405 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error())
440 } 406 }
  407 +
  408 + //合并项目评估的新旧数据
  409 + _, assassessTaskList, err := assessTaskRepo.Find(map[string]interface{}{
  410 + "evaluationProjectId": param.EvaluationProjectId,
  411 + "beginDay": taskBeginTime.Local().Format("2006-01-02"),
  412 + })
  413 + if err != nil {
  414 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询同日期同项目已存在的评估任务"+err.Error())
  415 + }
  416 +
  417 + if len(assassessTaskList) > 0 {
  418 + //就数据中提取参与人
  419 + for _, v := range assessTaskData.ExecutorId {
  420 + if _, ok := executorIdMap[v]; ok {
  421 + continue
  422 + }
  423 + executorIdMap[v] = struct{}{}
  424 + executorIds = append(executorIds, v)
  425 + }
  426 + assassessTaskList[0].UpdatedAt = time.Now()
  427 + assassessTaskList[0].ExecutorId = executorIds
  428 + //更新步骤
  429 + assassessTaskList[0].StepList = append(assassessTaskList[0].StepList, assessTaskData.StepList...)
  430 + assessTaskData = assassessTaskList[0]
  431 + //排序流程环节
  432 + stepList := domain.SortTaskStep(assessTaskData.StepList)
  433 + sort.Sort(stepList)
  434 + }
441 _, err = assessTaskRepo.Save(assessTaskData) 435 _, err = assessTaskRepo.Save(assessTaskData)
442 if err != nil { 436 if err != nil {
443 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) 437 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error())
444 } 438 }
445 439
  440 + //保存 员工的评估任务
446 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ 441 assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
447 "transactionContext": transactionContext, 442 "transactionContext": transactionContext,
448 }) 443 })
@@ -453,6 +448,9 @@ loop: @@ -453,6 +448,9 @@ loop:
453 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error()) 448 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error())
454 } 449 }
455 } 450 }
  451 +
  452 + //处理生成的项目评估
  453 +
456 return map[string]interface{}{ 454 return map[string]interface{}{
457 "assessTaskId": assessTaskData.Id, 455 "assessTaskId": assessTaskData.Id,
458 }, nil 456 }, nil
@@ -460,7 +458,6 @@ loop: @@ -460,7 +458,6 @@ loop:
460 458
461 // 添加节点任务 459 // 添加节点任务
462 func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) { 460 func (srv StaffAssessServeice) createStaffAssess(transactionContext application.TransactionContext, param *domain.StaffAssessTask) ([]domain.StaffAssess, error) {
463 -  
464 selfUserId := []int{} //评估的参与人 461 selfUserId := []int{} //评估的参与人
465 userIdMap := map[int]struct{}{} //过滤重复的用户 462 userIdMap := map[int]struct{}{} //过滤重复的用户
466 for _, v := range param.ExecutorId { 463 for _, v := range param.ExecutorId {
@@ -588,44 +585,39 @@ func (srv StaffAssessServeice) createStaffAssessSupper( @@ -588,44 +585,39 @@ func (srv StaffAssessServeice) createStaffAssessSupper(
588 userList []*domain.User, userDepartmentMap map[int64][]*domain.Department, 585 userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
589 ) ([]domain.StaffAssess, error) { 586 ) ([]domain.StaffAssess, error) {
590 var assessList []domain.StaffAssess 587 var assessList []domain.StaffAssess
591 - // 获取员工的上级用户  
592 - userRepo := factory.CreateUserRepository(map[string]interface{}{  
593 - "transactionContext": transactionContext,  
594 - })  
595 for _, v := range userList { 588 for _, v := range userList {
596 - departmentList, ok := userDepartmentMap[v.Id]  
597 - if !ok { 589 + //获取上级
  590 + chargeUserList, err := srv.getStaffSuper(transactionContext, *v)
  591 + if err != nil {
  592 + return nil, err
  593 + }
  594 + if len(chargeUserList) == 0 {
598 continue 595 continue
599 } 596 }
600 - for _, vv2 := range departmentList {  
601 - if len(vv2.ChargeUserIds) == 0 {  
602 - continue 597 + for _, v2 := range chargeUserList {
  598 + assessTemp.TargetUser = domain.StaffDesc{
  599 + UserId: int(v.Id),
  600 + Account: v.Account,
  601 + UserName: v.Name,
603 } 602 }
604 - //获取部门的主管  
605 - _, chargeUserList, err := userRepo.Find(map[string]interface{}{  
606 - "ids": vv2.ChargeUserIds,  
607 - "limit": 40,  
608 - })  
609 - if err != nil {  
610 - return nil, application.ThrowError(application.ARG_ERROR, "获取部门主管信息"+err.Error()) 603 + assessTemp.Executor = domain.StaffDesc{
  604 + UserId: int(v2.Id),
  605 + Account: v2.Account,
  606 + UserName: v2.Name,
611 } 607 }
612 - for _, vvv3 := range chargeUserList {  
613 - assessTemp.TargetDepartment = []domain.StaffDepartment{  
614 - {DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},  
615 - }  
616 - assessTemp.TargetUser = domain.StaffDesc{  
617 - UserId: int(v.Id),  
618 - Account: v.Account,  
619 - UserName: v.Name, 608 + targetDepartment := []domain.StaffDepartment{}
  609 + if departmentList, ok := userDepartmentMap[v.Id]; ok {
  610 + for _, department := range departmentList {
  611 + targetDepartment = append(targetDepartment, domain.StaffDepartment{
  612 + DepartmentId: int(department.Id),
  613 + DepartmentName: department.Name,
  614 + })
620 } 615 }
621 - assessTemp.Executor = domain.StaffDesc{  
622 - UserId: int(vvv3.Id),  
623 - Account: vvv3.Account,  
624 - UserName: vvv3.Name,  
625 - }  
626 - assessList = append(assessList, assessTemp)  
627 } 616 }
  617 + assessTemp.TargetDepartment = targetDepartment
  618 + assessList = append(assessList, assessTemp)
628 } 619 }
  620 +
629 } 621 }
630 return assessList, nil 622 return assessList, nil
631 } 623 }
@@ -1592,36 +1584,37 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T @@ -1592,36 +1584,37 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T
1592 log.Logger.Error("获取公司信息," + err.Error()) 1584 log.Logger.Error("获取公司信息," + err.Error())
1593 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error()) 1585 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error())
1594 } 1586 }
1595 - departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{  
1596 - "transactionContext": transactionContext,  
1597 - }) 1587 + // departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
  1588 + // "transactionContext": transactionContext,
  1589 + // })
1598 // //查找员工的部门 1590 // //查找员工的部门
1599 // var departmentList []*domain.Department 1591 // var departmentList []*domain.Department
1600 // if len(userData.DepartmentId) > 0 { 1592 // if len(userData.DepartmentId) > 0 {
1601 1593
1602 // } 1594 // }
1603 1595
1604 - var supperUserList []*domain.User  
1605 - if len(userData.DepartmentId) > 0 {  
1606 - _, departmentList, err := departmentRepo.Find(map[string]interface{}{  
1607 - "ids": userData.DepartmentId,  
1608 - })  
1609 - if err != nil {  
1610 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())  
1611 - }  
1612 - var chargeUserIds []int64  
1613 - for _, v := range departmentList {  
1614 - chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)  
1615 - }  
1616 - if len(chargeUserIds) > 0 {  
1617 - _, supperUserList, err = userRepo.Find(map[string]interface{}{  
1618 - "ids": chargeUserIds,  
1619 - })  
1620 - if err != nil {  
1621 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())  
1622 - }  
1623 - }  
1624 - } 1596 + // var supperUserList []*domain.User
  1597 + // if len(userData.DepartmentId) > 0 {
  1598 + // _, departmentList, err := departmentRepo.Find(map[string]interface{}{
  1599 + // "ids": userData.DepartmentId,
  1600 + // })
  1601 + // if err != nil {
  1602 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
  1603 + // }
  1604 + // var chargeUserIds []int64
  1605 + // for _, v := range departmentList {
  1606 + // chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
  1607 + // }
  1608 + // if len(chargeUserIds) > 0 {
  1609 + // _, supperUserList, err = userRepo.Find(map[string]interface{}{
  1610 + // "ids": chargeUserIds,
  1611 + // })
  1612 + // if err != nil {
  1613 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
  1614 + // }
  1615 + // }
  1616 + // }
  1617 + supperUserList, _ := srv.getStaffSuper(transactionContext, *userData)
1625 userInfo := adapter.StaffInfo{ 1618 userInfo := adapter.StaffInfo{
1626 UserName: userData.Name, 1619 UserName: userData.Name,
1627 CompanyName: companyData.Name, 1620 CompanyName: companyData.Name,
@@ -1703,12 +1696,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1703,12 +1696,14 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1703 continue 1696 continue
1704 } 1697 }
1705 v.Value = item.Value 1698 v.Value = item.Value
1706 - //填入评估值描述  
1707 - reteResult, err := v.Rule.ScoreOrRating(&v.Value)  
1708 - if err != nil {  
1709 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 1699 + if len(item.Value) > 0 {
  1700 + //填入评估值描述
  1701 + reteResult, err := v.Rule.ScoreOrRating(&v.Value)
  1702 + if err != nil {
  1703 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  1704 + }
  1705 + v.ReteResult = reteResult
1710 } 1706 }
1711 - v.ReteResult = reteResult  
1712 for ii := range v.Remark { 1707 for ii := range v.Remark {
1713 for _, vvv := range item.Remark { 1708 for _, vvv := range item.Remark {
1714 if v.Remark[ii].Title == vvv.Title { 1709 if v.Remark[ii].Title == vvv.Title {
@@ -1719,7 +1714,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1719,7 +1714,6 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1719 } 1714 }
1720 1715
1721 } 1716 }
1722 -  
1723 //保存信息 1717 //保存信息
1724 for i := range assessContentList { 1718 for i := range assessContentList {
1725 _, err = assessContentRepo.Save(assessContentList[i]) 1719 _, err = assessContentRepo.Save(assessContentList[i])
@@ -1774,7 +1768,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA @@ -1774,7 +1768,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA
1774 } 1768 }
1775 1769
1776 //获取员工的上级是谁 ,TODO 1770 //获取员工的上级是谁 ,TODO
1777 -func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]domain.User, error) { 1771 +func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) {
1778 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ 1772 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
1779 "transactionContext": transactionContext, 1773 "transactionContext": transactionContext,
1780 }) 1774 })
@@ -1793,6 +1787,29 @@ func (srv StaffAssessServeice) getStaffSuper(transactionContext application.Tran @@ -1793,6 +1787,29 @@ func (srv StaffAssessServeice) getStaffSuper(transactionContext application.Tran
1793 } 1787 }
1794 } 1788 }
1795 if len(departmemtList) == 0 { 1789 if len(departmemtList) == 0 {
  1790 + //找不到员工的部门
  1791 + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{
  1792 + "transactionContext": transactionContext,
  1793 + })
  1794 + companyData, err := companyRepo.FindOne(map[string]interface{}{
  1795 + "id": targetUser.CompanyId,
  1796 + })
  1797 + if err != nil {
  1798 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的公司"+err.Error())
  1799 + }
  1800 + //公司作为最顶级
  1801 + departmemtList = append(departmemtList, &domain.Department{
  1802 + Id: 0,
  1803 + CompanyId: companyData.Id,
  1804 + Level: 0,
  1805 + Name: companyData.Name,
  1806 + ParentId: 0,
  1807 + ChargeUserIds: companyData.ChargeUserIds,
  1808 + Path: "",
  1809 + CreatedAt: time.Time{},
  1810 + UpdatedAt: time.Time{},
  1811 + DeletedAt: &time.Time{},
  1812 + })
1796 1813
1797 } 1814 }
1798 //获取部门管理员 1815 //获取部门管理员
@@ -1836,14 +1853,5 @@ loop: @@ -1836,14 +1853,5 @@ loop:
1836 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error()) 1853 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
1837 } 1854 }
1838 } 1855 }
1839 - if len(chargeUserList) == 0 {  
1840 - //如果都找不到数据  
1841 -  
1842 - }  
1843 -  
1844 - // _, chargeUserList, err := userRepo.Find(map[string]interface{}{  
1845 - // "ids": chargeUserIds,  
1846 - // })  
1847 -  
1848 - return nil, nil 1856 + return chargeUserList, nil
1849 } 1857 }
@@ -17,11 +17,6 @@ const ( @@ -17,11 +17,6 @@ const (
17 LinkNodeAllAssessment int = 3 // 环节-360°评估 17 LinkNodeAllAssessment int = 3 // 环节-360°评估
18 LinkNodeSuperiorAssessment int = 4 // 环节-上级评估 18 LinkNodeSuperiorAssessment int = 4 // 环节-上级评估
19 LinkNodeViewResult int = 5 // 环节-绩效结果查看 19 LinkNodeViewResult int = 5 // 环节-绩效结果查看
20 -  
21 - //LinkNodeAssessment int = 1 // 环节-评估(自评、360°评估、上级评估)  
22 - //LinkNodeAllInvite int = 2 // 环节-360°邀请  
23 - //LinkNodeViewResult int = 3 // 环节-绩效结果查看  
24 -  
25 ) 20 )
26 21
27 type EntryItem struct { 22 type EntryItem struct {
@@ -42,17 +37,7 @@ type NodeContent struct { @@ -42,17 +37,7 @@ type NodeContent struct {
42 EntryItems []*EntryItem `json:"entryItems" comment:"填写项"` 37 EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
43 } 38 }
44 39
45 -//// NodeAllInvite 360°邀请  
46 -//type NodeAllInvite struct {  
47 -// ParentDifferentIds []string `json:"parentDifferentIds" comment:"不同上级同事ID"`  
48 -// ParentSameIds []string `json:"parentSameIds" comment:"相同上级同事ID"`  
49 -//}  
50 -  
51 -//// NodeKpiResult 绩效结果查看  
52 -//type NodeKpiResult struct {  
53 -//}  
54 -  
55 -// 评估流程、环节 40 +// LinkNode 评估流程、环节
56 type LinkNode struct { 41 type LinkNode struct {
57 Id int64 `json:"id,string" comment:"环节ID"` 42 Id int64 `json:"id,string" comment:"环节ID"`
58 Type int `json:"type" comment:"环节类型"` 43 Type int `json:"type" comment:"环节类型"`
@@ -64,7 +49,7 @@ type LinkNode struct { @@ -64,7 +49,7 @@ type LinkNode struct {
64 KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"` 49 KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
65 } 50 }
66 51
67 -// 评估模板 52 +// EvaluationTemplate 评估模板
68 type EvaluationTemplate struct { 53 type EvaluationTemplate struct {
69 Id int64 `json:"id,string" comment:"ID"` 54 Id int64 `json:"id,string" comment:"ID"`
70 Name string `json:"name" comment:"名称"` 55 Name string `json:"name" comment:"名称"`
@@ -78,14 +63,6 @@ type EvaluationTemplate struct { @@ -78,14 +63,6 @@ type EvaluationTemplate struct {
78 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 63 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
79 } 64 }
80 65
81 -//type EvaluationLink struct {  
82 -// NodeSelfAssessment *LinkNode `json:"nodeSelfAssessment" comment:"填写反馈自评"`  
83 -// NodeAllInvite *LinkNode `json:"nodeAllInvite" comment:"360°邀请"`  
84 -// NodeAllAssessment *LinkNode `json:"nodeAllAssessment" comment:"360°评估"`  
85 -// NodeSuperiorAssessment *LinkNode `json:"nodeSuperiorAssessment" comment:"上级评估"`  
86 -// NodeViewResult *LinkNode `json:"nodeViewResult" comment:"绩效结果查看"`  
87 -//}  
88 -  
89 type EvaluationTemplateRepository interface { 66 type EvaluationTemplateRepository interface {
90 Insert(template *EvaluationTemplate) (*EvaluationTemplate, error) 67 Insert(template *EvaluationTemplate) (*EvaluationTemplate, error)
91 Remove(template *EvaluationTemplate) (*EvaluationTemplate, error) 68 Remove(template *EvaluationTemplate) (*EvaluationTemplate, error)
@@ -30,8 +30,8 @@ func (repo *EvaluationCycleRepository) TransformToDomain(m *models.EvaluationCyc @@ -30,8 +30,8 @@ func (repo *EvaluationCycleRepository) TransformToDomain(m *models.EvaluationCyc
30 CompanyId: m.CompanyId, 30 CompanyId: m.CompanyId,
31 CreatorId: m.CreatorId, 31 CreatorId: m.CreatorId,
32 KpiCycle: m.KpiCycle, 32 KpiCycle: m.KpiCycle,
33 - CreatedAt: m.CreatedAt,  
34 - UpdatedAt: m.UpdatedAt, 33 + CreatedAt: m.CreatedAt.Local(),
  34 + UpdatedAt: m.UpdatedAt.Local(),
35 DeletedAt: m.DeletedAt, 35 DeletedAt: m.DeletedAt,
36 } 36 }
37 } 37 }
@@ -27,8 +27,8 @@ func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.Evalu @@ -27,8 +27,8 @@ func (repo *EvaluationCycleTemplateRepository) TransformToDomain(m *models.Evalu
27 TemplateCreatedAt: m.TemplateCreatedAt, 27 TemplateCreatedAt: m.TemplateCreatedAt,
28 Template: m.Template, 28 Template: m.Template,
29 CycleId: m.CycleId, 29 CycleId: m.CycleId,
30 - CreatedAt: m.CreatedAt,  
31 - UpdatedAt: m.UpdatedAt, 30 + CreatedAt: m.CreatedAt.Local(),
  31 + UpdatedAt: m.UpdatedAt.Local(),
32 DeletedAt: m.DeletedAt, 32 DeletedAt: m.DeletedAt,
33 } 33 }
34 } 34 }
@@ -36,8 +36,8 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP @@ -36,8 +36,8 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
36 Template: m.Template, 36 Template: m.Template,
37 BeginTime: m.BeginTime, 37 BeginTime: m.BeginTime,
38 EndTime: m.EndTime, 38 EndTime: m.EndTime,
39 - CreatedAt: m.CreatedAt,  
40 - UpdatedAt: m.UpdatedAt, 39 + CreatedAt: m.CreatedAt.Local(),
  40 + UpdatedAt: m.UpdatedAt.Local(),
41 DeletedAt: m.DeletedAt, 41 DeletedAt: m.DeletedAt,
42 } 42 }
43 } 43 }
@@ -31,8 +31,8 @@ func (repo *EvaluationRuleRepository) TransformToDomain(m *models.EvaluationRule @@ -31,8 +31,8 @@ func (repo *EvaluationRuleRepository) TransformToDomain(m *models.EvaluationRule
31 SysType: m.SysType, 31 SysType: m.SysType,
32 Rating: m.Rating, 32 Rating: m.Rating,
33 Score: m.Score, 33 Score: m.Score,
34 - CreatedAt: m.CreatedAt,  
35 - UpdatedAt: m.UpdatedAt, 34 + CreatedAt: m.CreatedAt.Local(), // PG库为UTC需要转成本地时间
  35 + UpdatedAt: m.UpdatedAt.Local(),
36 DeletedAt: m.DeletedAt, 36 DeletedAt: m.DeletedAt,
37 } 37 }
38 } 38 }
@@ -29,8 +29,8 @@ func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.Evaluation @@ -29,8 +29,8 @@ func (repo *EvaluationTemplateRepository) TransformToDomain(m *models.Evaluation
29 CreatorId: m.CreatorId, 29 CreatorId: m.CreatorId,
30 State: m.State, 30 State: m.State,
31 LinkNodes: m.LinkNodes, 31 LinkNodes: m.LinkNodes,
32 - CreatedAt: m.CreatedAt,  
33 - UpdatedAt: m.UpdatedAt, 32 + CreatedAt: m.CreatedAt.Local(),
  33 + UpdatedAt: m.UpdatedAt.Local(),
34 DeletedAt: m.DeletedAt, 34 DeletedAt: m.DeletedAt,
35 } 35 }
36 } 36 }
@@ -21,6 +21,9 @@ func NewNodeTaskRepository(transactionContext *pgTransaction.TransactionContext) @@ -21,6 +21,9 @@ func NewNodeTaskRepository(transactionContext *pgTransaction.TransactionContext)
21 } 21 }
22 22
23 func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.NodeTask { 23 func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.NodeTask {
  24 + timeStart := m.TimeStart.Local()
  25 + timeEnd := m.TimeEnd.Local()
  26 + nextSentAt := m.NextSentAt.Local()
24 return domain.NodeTask{ 27 return domain.NodeTask{
25 Id: m.Id, 28 Id: m.Id,
26 CompanyId: m.CompanyId, 29 CompanyId: m.CompanyId,
@@ -31,12 +34,12 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod @@ -31,12 +34,12 @@ func (repo *NodeTaskRepository) TransformToDomain(m *models.NodeTask) domain.Nod
31 NodeName: m.NodeName, 34 NodeName: m.NodeName,
32 NodeDescribe: m.NodeDescribe, 35 NodeDescribe: m.NodeDescribe,
33 NodeSort: m.NodeSort, 36 NodeSort: m.NodeSort,
34 - TimeStart: m.TimeStart,  
35 - TimeEnd: m.TimeEnd, 37 + TimeStart: &timeStart,
  38 + TimeEnd: &timeEnd,
36 KpiCycle: m.KpiCycle, 39 KpiCycle: m.KpiCycle,
37 - NextSentAt: m.NextSentAt,  
38 - CreatedAt: m.CreatedAt,  
39 - UpdatedAt: m.UpdatedAt, 40 + NextSentAt: &nextSentAt,
  41 + CreatedAt: m.CreatedAt.Local(),
  42 + UpdatedAt: m.UpdatedAt.Local(),
40 DeletedAt: m.DeletedAt, 43 DeletedAt: m.DeletedAt,
41 } 44 }
42 } 45 }
@@ -27,8 +27,8 @@ func (repo *RoleRepository) TransformToDomain(m *models.Role) domain.Role { @@ -27,8 +27,8 @@ func (repo *RoleRepository) TransformToDomain(m *models.Role) domain.Role {
27 Type: m.Type, 27 Type: m.Type,
28 Description: m.Description, 28 Description: m.Description,
29 CompanyId: m.CompanyId, 29 CompanyId: m.CompanyId,
30 - CreatedAt: m.CreatedAt,  
31 - UpdatedAt: m.UpdatedAt, 30 + CreatedAt: m.CreatedAt.Local(),
  31 + UpdatedAt: m.UpdatedAt.Local(),
32 DeletedAt: m.DeletedAt, 32 DeletedAt: m.DeletedAt,
33 } 33 }
34 } 34 }
@@ -26,8 +26,8 @@ func (repo *RoleUserRepository) TransformToDomain(m *models.RoleUser) domain.Rol @@ -26,8 +26,8 @@ func (repo *RoleUserRepository) TransformToDomain(m *models.RoleUser) domain.Rol
26 RoleId: m.RoleId, 26 RoleId: m.RoleId,
27 UserId: m.UserId, 27 UserId: m.UserId,
28 CompanyId: m.CompanyId, 28 CompanyId: m.CompanyId,
29 - CreatedAt: m.CreatedAt,  
30 - UpdatedAt: m.UpdatedAt, 29 + CreatedAt: m.CreatedAt.Local(),
  30 + UpdatedAt: m.UpdatedAt.Local(),
31 DeletedAt: m.DeletedAt, 31 DeletedAt: m.DeletedAt,
32 } 32 }
33 } 33 }
@@ -39,8 +39,8 @@ func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *dom @@ -39,8 +39,8 @@ func (repo *StaffAssessRepository) TransformToDomain(d *models.StaffAssess) *dom
39 Status: domain.StaffAssessStatus(d.Status), 39 Status: domain.StaffAssessStatus(d.Status),
40 BeginTime: d.BeginTime, 40 BeginTime: d.BeginTime,
41 EndTime: d.EndTime, 41 EndTime: d.EndTime,
42 - CreatedAt: d.EndTime,  
43 - UpdatedAt: d.CreatedAt, 42 + CreatedAt: d.CreatedAt,
  43 + UpdatedAt: d.UpdatedAt,
44 DeletedAt: d.DeletedAt, 44 DeletedAt: d.DeletedAt,
45 } 45 }
46 } 46 }
@@ -37,7 +37,7 @@ func ValidateCommand(commandType interface{}) error { @@ -37,7 +37,7 @@ func ValidateCommand(commandType interface{}) error {
37 } 37 }
38 38
39 // NextTime 0点时刻为标准计算 39 // NextTime 0点时刻为标准计算
40 -func NextTime(now0 time.Time, start time.Time, kpiCycle int) time.Time { 40 +func NextTime(now0 time.Time, start *time.Time, kpiCycle int) time.Time {
41 year, month, day := start.Date() 41 year, month, day := start.Date()
42 // 起始时间0点时刻 42 // 起始时间0点时刻
43 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local) 43 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
@@ -141,7 +141,7 @@ func SubMonth(t1, t2 time.Time) (month int) { @@ -141,7 +141,7 @@ func SubMonth(t1, t2 time.Time) (month int) {
141 } 141 }
142 142
143 // NextTimeInc 0点时刻为标准计算 143 // NextTimeInc 0点时刻为标准计算
144 -func NextTimeInc(start time.Time, kpiCycle int) time.Time { 144 +func NextTimeInc(start *time.Time, kpiCycle int) time.Time {
145 year, month, day := start.Date() 145 year, month, day := start.Date()
146 // 起始时间0点时刻 146 // 起始时间0点时刻
147 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local) 147 start0 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)