作者 tangxvhui
@@ -871,3 +871,31 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini @@ -871,3 +871,31 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
871 } 871 }
872 return nil 872 return nil
873 } 873 }
  874 +
  875 +// GetUnconfirmedCycleList 获取未确认绩效成绩的周期列表
  876 +func (srv *SummaryEvaluationService) GetUnconfirmedCycleList(companyId int, userId int) (map[string]interface{}, error) {
  877 + transactionContext, err := factory.StartTransaction()
  878 + if err != nil {
  879 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  880 + }
  881 + defer func() {
  882 + _ = transactionContext.RollbackTransaction()
  883 + }()
  884 + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{"transactionContext": transactionContext})
  885 +
  886 + cycles, err := evaluationDao.TargetUnconfirmedCycleList(companyId, userId)
  887 + if err != nil {
  888 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
  889 + }
  890 + if err := transactionContext.CommitTransaction(); err != nil {
  891 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  892 + }
  893 + var cycleList []adapter.CycleListAdapter
  894 + for _, v := range cycles {
  895 + cycleList = append(cycleList, adapter.CycleListAdapter{
  896 + CycleId: v.CycleId,
  897 + CycleName: v.CycleName,
  898 + })
  899 + }
  900 + return tool_funs.SimpleWrapGridMap(int64(len(cycleList)), cycleList), nil
  901 +}
1 package dao 1 package dao
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
4 "time" 5 "time"
5 6
6 "github.com/go-pg/pg/v10" 7 "github.com/go-pg/pg/v10"
@@ -138,6 +139,28 @@ func (d *SummaryEvaluationDao) CountTargetUserCycleList(executorId int, evaluati @@ -138,6 +139,28 @@ func (d *SummaryEvaluationDao) CountTargetUserCycleList(executorId int, evaluati
138 return cnt, err 139 return cnt, err
139 } 140 }
140 141
  142 +// TargetUnconfirmedCycleList 用户【未确认绩效成绩】的周期列表
  143 +func (d *SummaryEvaluationDao) TargetUnconfirmedCycleList(companyId int, executorId int) ([]TargetUserCycle, error) {
  144 + sqlStr := `select
  145 + summary_evaluation.cycle_id,
  146 + summary_evaluation.begin_time,
  147 + summary_evaluation.cycle_name
  148 + from summary_evaluation
  149 + where summary_evaluation.deleted_at isnull
  150 + and summary_evaluation.company_id='?'
  151 + and summary_evaluation.target_user ->>'userId'='?'
  152 + and summary_evaluation.types='?'
  153 + and summary_evaluation.status='?'
  154 + and summary_evaluation.check_result='?'
  155 + `
  156 + tx := d.transactionContext.PgTx
  157 + condition := []interface{}{companyId, executorId, domain.EvaluationFinish, domain.EvaluationCompleted, domain.EvaluationCheckUncompleted}
  158 + sqlStr += ` order by summary_evaluation.begin_time desc `
  159 + result := make([]TargetUserCycle, 0)
  160 + _, err := tx.Query(&result, sqlStr, condition...)
  161 + return result, err
  162 +}
  163 +
141 func (d *SummaryEvaluationDao) UpdateBeginTime(ids []int, beginTime time.Time) error { 164 func (d *SummaryEvaluationDao) UpdateBeginTime(ids []int, beginTime time.Time) error {
142 if len(ids) == 0 { 165 if len(ids) == 0 {
143 return nil 166 return nil
@@ -28,6 +28,13 @@ func (c *SummaryEvaluationController) GetExecutorCycleList() { @@ -28,6 +28,13 @@ func (c *SummaryEvaluationController) GetExecutorCycleList() {
28 c.Response(data, err) 28 c.Response(data, err)
29 } 29 }
30 30
  31 +func (c *SummaryEvaluationController) GetUnconfirmedScoreCycleList() {
  32 + srv := service.NewSummaryEvaluationService()
  33 + userReq := middlewares.GetUser(c.Ctx)
  34 + data, err := srv.GetUnconfirmedCycleList(int(userReq.CompanyId), int(userReq.UserId))
  35 + c.Response(data, err)
  36 +}
  37 +
31 func (c *SummaryEvaluationController) GetMenu() { 38 func (c *SummaryEvaluationController) GetMenu() {
32 srv := service.NewSummaryEvaluationService() 39 srv := service.NewSummaryEvaluationService()
33 paramReq := &command.QueryMenu{} 40 paramReq := &command.QueryMenu{}
@@ -11,6 +11,7 @@ func init() { @@ -11,6 +11,7 @@ func init() {
11 summaryNS := web.NewNamespace("/v1/summary-evaluation", 11 summaryNS := web.NewNamespace("/v1/summary-evaluation",
12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
13 web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList), 13 web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList),
  14 + web.NSCtrlPost("/executor/cycle/unconfirmed-score", (*controllers.SummaryEvaluationController).GetUnconfirmedScoreCycleList),
14 web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList), 15 web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList),
15 web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu), 16 web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu),
16 web.NSCtrlPost("/evaluation-self", (*controllers.SummaryEvaluationController).GetEvaluationSelf), 17 web.NSCtrlPost("/evaluation-self", (*controllers.SummaryEvaluationController).GetEvaluationSelf),