作者 tangxvhui

更新

@@ -691,12 +691,17 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU @@ -691,12 +691,17 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU
691 // 保存某个员工360邀请的人员 691 // 保存某个员工360邀请的人员
692 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (map[string]interface{}, error) { 692 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (map[string]interface{}, error) {
693 inviteSameSuperId := []int{} 693 inviteSameSuperId := []int{}
  694 + userIdMap := map[int]struct{}{} //过滤重复的id
694 InviteDiffSuperId := []int{} 695 InviteDiffSuperId := []int{}
695 for _, v := range param.InviteDiffSuper { 696 for _, v := range param.InviteDiffSuper {
696 id, err := strconv.Atoi(v) 697 id, err := strconv.Atoi(v)
697 if err != nil { 698 if err != nil {
698 return nil, application.ThrowError(application.ARG_ERROR, "用户填写错误") 699 return nil, application.ThrowError(application.ARG_ERROR, "用户填写错误")
699 } 700 }
  701 + if _, ok := userIdMap[id]; ok {
  702 + continue
  703 + }
  704 + userIdMap[id] = struct{}{}
700 InviteDiffSuperId = append(InviteDiffSuperId, id) 705 InviteDiffSuperId = append(InviteDiffSuperId, id)
701 } 706 }
702 for _, v := range param.InviteSameSuper { 707 for _, v := range param.InviteSameSuper {
@@ -704,6 +709,10 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv @@ -704,6 +709,10 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv
704 if err != nil { 709 if err != nil {
705 return nil, application.ThrowError(application.ARG_ERROR, "用户填写错误") 710 return nil, application.ThrowError(application.ARG_ERROR, "用户填写错误")
706 } 711 }
  712 + if _, ok := userIdMap[id]; ok {
  713 + continue
  714 + }
  715 + userIdMap[id] = struct{}{}
707 inviteSameSuperId = append(inviteSameSuperId, id) 716 inviteSameSuperId = append(inviteSameSuperId, id)
708 } 717 }
709 transactionContext, err := factory.CreateTransactionContext(nil) 718 transactionContext, err := factory.CreateTransactionContext(nil)
  1 +package service
  2 +
  3 +//员工绩效-项目管理
  4 +
  5 +//获取已被执行的周期列表
  6 +func (srv StaffAssessServeice) GetAllAssessCycleName() {
  7 +
  8 +}
  9 +
  10 +//获取周期内的考核日期
@@ -99,5 +99,57 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int, @@ -99,5 +99,57 @@ func (d *StaffAssessDao) CountAssessTaskMe(executorId int, companyId int) (int,
99 result := 0 99 result := 0
100 _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...) 100 _, err := tx.QueryOne(pg.Scan(&result), sqlStr, condition...)
101 return result, err 101 return result, err
  102 +}
  103 +
  104 +//获取所以已经执行的评估周期
  105 +type AssessCycle struct {
  106 + CycleId string `json:"cycleId"` //周期id
  107 + CompanyId string `json:"companyId"`
  108 + CycleName string `json:"cycleName"` //周期名称
  109 +}
  110 +
  111 +//获取所以已经执行的评估周期
  112 +func (d *StaffAssessDao) AllAssessCycleList(companyId int) ([]AssessCycle, error) {
  113 + sqlStr := `select
  114 + distinct
  115 + staff_assess_task.cycle_id ,
  116 + staff_assess_task.company_id ,
  117 + staff_assess_task.cycle_name
  118 + from staff_assess_task
  119 + where staff_assess_task.company_id = ?`
  120 +
  121 + tx := d.transactionContext.PgTx
  122 + condition := []interface{}{
  123 + companyId,
  124 + }
  125 + result := []AssessCycle{}
  126 + _, err := tx.QueryOne(&result, sqlStr, condition...)
  127 + return result, err
  128 +}
102 129
  130 +//获取评估周期中的绩效考核日期
  131 +type AssessCycleDay struct {
  132 + BeginDay string `json:"beginDay"`
  133 + CycleId string `json:"cycleId"`
  134 + CompanyId string `json:"companyId"`
103 } 135 }
  136 +
  137 +//获取评估周期中的绩效考核日期
  138 +func (d *StaffAssessDao) AllAssessCycleDayList(companyId int, cycleId int) ([]AssessCycleDay, error) {
  139 + sqlStr := `select distinct staff_assess_task.begin_day ,
  140 + staff_assess_task.cycle_id ,
  141 + staff_assess_task.company_id
  142 + from staff_assess_task
  143 + where staff_assess_task.cycle_id = ?
  144 + and company_id =? `
  145 +
  146 + tx := d.transactionContext.PgTx
  147 + condition := []interface{}{
  148 + cycleId, companyId,
  149 + }
  150 + result := []AssessCycleDay{}
  151 + _, err := tx.QueryOne(&result, sqlStr, condition...)
  152 + return result, err
  153 +}
  154 +
  155 +//根据周期的id和日期获取员工填写的评估内容