作者 tangxvhui

Merge branch 'test'

  1 +package notify
  2 +
  3 +import "testing"
  4 +
  5 +func TestXxx(t *testing.T) {
  6 + err := appMessageSend()
  7 + if err != nil {
  8 + t.Error(err)
  9 + }
  10 +}
1 package notify 1 package notify
2 2
3 -import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  5 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  6 +)
4 7
5 // 执行定时任务检查是否发送短信通知 8 // 执行定时任务检查是否发送短信通知
6 var taskSmsNotify *notifySms 9 var taskSmsNotify *notifySms
@@ -11,6 +14,7 @@ func RunTaskSmsNotify() { @@ -11,6 +14,7 @@ func RunTaskSmsNotify() {
11 taskSmsNotify.init() 14 taskSmsNotify.init()
12 taskSmsNotify.regist(notifyStaffAssess{}) 15 taskSmsNotify.regist(notifyStaffAssess{})
13 taskSmsNotify.regist(notifySummaryEvaluation{}) 16 taskSmsNotify.regist(notifySummaryEvaluation{})
  17 + taskSmsNotify.regist(notifyConfirmEvaluationScore{})
14 taskSmsNotify.runTask() 18 taskSmsNotify.runTask()
15 } 19 }
16 20
@@ -27,3 +31,33 @@ func AddNotifySummaryEvaluation(param *domain.SummaryEvaluation) { @@ -27,3 +31,33 @@ func AddNotifySummaryEvaluation(param *domain.SummaryEvaluation) {
27 newSms := newNotify.makeNotify(param) 31 newSms := newNotify.makeNotify(param)
28 taskSmsNotify.addTask(newSms) 32 taskSmsNotify.addTask(newSms)
29 } 33 }
  34 +
  35 +// 确认周期评估短信提醒 ,预创建待发送的短信消息
  36 +func AddNotifyConfirmEvaluationScore(param *domain.SummaryEvaluation) error {
  37 + newNotify := notifyConfirmEvaluationScore{}
  38 + transactionContext, err := factory.CreateTransactionContext(nil)
  39 + if err != nil {
  40 + return err
  41 + }
  42 + if err := transactionContext.StartTransaction(); err != nil {
  43 + return err
  44 + }
  45 + defer func() {
  46 + _ = transactionContext.RollbackTransaction()
  47 + }()
  48 + logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
  49 +
  50 + cnt, _, err := logSmsRepo.Find(map[string]interface{}{"from": newNotify.from(), "index": param.Id, "limit": 1})
  51 + if err != nil {
  52 + return err
  53 + }
  54 + if cnt > 0 {
  55 + return nil
  56 + }
  57 + if err := transactionContext.CommitTransaction(); err != nil {
  58 + return err
  59 + }
  60 +
  61 + newSms := newNotify.makeNotify(param)
  62 + return taskSmsNotify.addTask(newSms)
  63 +}
@@ -36,17 +36,22 @@ func (notices *notifySms) regist(ifsend notifySendOrNot) { @@ -36,17 +36,22 @@ func (notices *notifySms) regist(ifsend notifySendOrNot) {
36 notices.sendOrNot[ifsend.from()] = ifsend 36 notices.sendOrNot[ifsend.from()] = ifsend
37 } 37 }
38 38
39 -func (notices *notifySms) addTask(task *domain.LogSms) { 39 +func (notices *notifySms) addTask(task *domain.LogSms) error {
40 // notices.newSms <- task 40 // notices.newSms <- task
41 err := notices.addNewSms(task) 41 err := notices.addNewSms(task)
42 if err != nil { 42 if err != nil {
43 e := fmt.Sprintf("添加短信通知任务:%+v %s", task, err) 43 e := fmt.Sprintf("添加短信通知任务:%+v %s", task, err)
44 log.Logger.Error(e) 44 log.Logger.Error(e)
  45 + return fmt.Errorf("添加短信通知任务:%s", err)
45 } 46 }
  47 + return nil
46 } 48 }
47 49
48 // RunTask 执行短信通知任务 50 // RunTask 执行短信通知任务
49 func (notices *notifySms) runTask() { 51 func (notices *notifySms) runTask() {
  52 + if constant.Env != "prd" {
  53 + return
  54 + }
50 timer := time.NewTimer(notices.interval) 55 timer := time.NewTimer(notices.interval)
51 for { 56 for {
52 select { 57 select {
@@ -108,8 +113,9 @@ func (notices *notifySms) checkSendSms() error { @@ -108,8 +113,9 @@ func (notices *notifySms) checkSendSms() error {
108 nowDay := dayZeroTime(nowTime) 113 nowDay := dayZeroTime(nowTime)
109 _, logSmsList, err := logSmsRepo.Find(map[string]interface{}{ 114 _, logSmsList, err := logSmsRepo.Find(map[string]interface{}{
110 "status": string(domain.SmsWait), 115 "status": string(domain.SmsWait),
111 - "executeAtBegin": nowDay,  
112 "executeAtEnd": nowTime, 116 "executeAtEnd": nowTime,
  117 + "executeAtBegin": nowDay,
  118 + "limit": 1000,
113 }) 119 })
114 if err != nil { 120 if err != nil {
115 return err 121 return err
@@ -130,9 +136,7 @@ func (notices *notifySms) checkSendSms() error { @@ -130,9 +136,7 @@ func (notices *notifySms) checkSendSms() error {
130 136
131 // sendSms 发送短信消息 137 // sendSms 发送短信消息
132 func (notices *notifySms) sendSms(param *domain.LogSms) error { 138 func (notices *notifySms) sendSms(param *domain.LogSms) error {
133 - if constant.Env != "prd" {  
134 - return nil  
135 - } 139 +
136 //单开处理 数据保存操作,发一条短信更新一条数据 140 //单开处理 数据保存操作,发一条短信更新一条数据
137 transactionContext, err := factory.CreateTransactionContext(nil) 141 transactionContext, err := factory.CreateTransactionContext(nil)
138 if err != nil { 142 if err != nil {
@@ -151,6 +155,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error { @@ -151,6 +155,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error {
151 if ok { 155 if ok {
152 ok, err := sendOrNot.ifSend(param.Index) 156 ok, err := sendOrNot.ifSend(param.Index)
153 if err != nil { 157 if err != nil {
  158 + log.Logger.Error("检查短信是否发送" + err.Error())
154 param.Result = err.Error() 159 param.Result = err.Error()
155 } 160 }
156 sendOk = ok 161 sendOk = ok
@@ -163,6 +168,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error { @@ -163,6 +168,7 @@ func (notices *notifySms) sendSms(param *domain.LogSms) error {
163 sms := serviceGateway.SmsService{} 168 sms := serviceGateway.SmsService{}
164 err = sms.SendNoticeSms(param.Phone, param.TemplateId, param.Value) 169 err = sms.SendNoticeSms(param.Phone, param.TemplateId, param.Value)
165 if err != nil { 170 if err != nil {
  171 + log.Logger.Error("短信发送出错" + err.Error())
166 param.Result = err.Error() 172 param.Result = err.Error()
167 param.Status = domain.SmsSuccess 173 param.Status = domain.SmsSuccess
168 } else { 174 } else {
  1 +package notify
  2 +
  3 +import (
  4 + "time"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  7 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  8 +)
  9 +
  10 +// 短信提醒确认周期评估成绩
  11 +// 条件:上级提交评估后 到10号晚23:59前,对未确认的被评估人每隔6个小时进行提醒(23:00-7:00期间不提醒),直到确认
  12 +type notifyConfirmEvaluationScore struct {
  13 +}
  14 +
  15 +var _ notifySendOrNot = (*notifyConfirmEvaluationScore)(nil)
  16 +
  17 +func (notices notifyConfirmEvaluationScore) from() string {
  18 + return "ConfirmEvaluationScore"
  19 +}
  20 +
  21 +func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEvaluation) *domain.LogSms {
  22 + newSms := domain.LogSms{
  23 + Id: 0,
  24 + Phone: param.Executor.Account,
  25 + TemplateId: 5634326,
  26 + Template: "您好,#name#,#periodName#成绩已出,请前往绩效系统PC端进行确认哦,超时未确认可能会影响当月绩效工资哦~ ",
  27 + Value: map[string]string{
  28 + "name": param.Executor.UserName,
  29 + "periodName": param.CycleName,
  30 + },
  31 + Result: "",
  32 + Status: domain.SmsWait,
  33 + From: notices.from(),
  34 + Index: param.Id,
  35 + ExecuteAt: notices.getTimeExecuteAt(time.Now()),
  36 + CreatedAt: time.Now(),
  37 + }
  38 + return &newSms
  39 +}
  40 +
  41 +// 适配规则:上级提交评估后 到10号晚23:59前,可以发送
  42 +// 适配规则 对未确认的被评估人每隔6个小时进行提醒(23:00-7:00期间不提醒),直到确认
  43 +func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
  44 +
  45 + //检查时间
  46 + nowTime := time.Now()
  47 + if nowTime.Day() > 10 {
  48 + return false, nil
  49 + }
  50 +
  51 + transactionContext, err := factory.CreateTransactionContext(nil)
  52 + if err != nil {
  53 + return false, err
  54 + }
  55 + if err := transactionContext.StartTransaction(); err != nil {
  56 + return false, err
  57 + }
  58 + defer func() {
  59 + _ = transactionContext.RollbackTransaction()
  60 + }()
  61 + summaryEvaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
  62 + summaryEvaluationData, err := summaryEvaluationRepo.FindOne(map[string]interface{}{"id": index})
  63 + if err != nil {
  64 + return false, err
  65 + }
  66 + if summaryEvaluationData.Types == domain.EvaluationFinish {
  67 + return false, nil
  68 + }
  69 + //已确认 成绩,不在发送成绩
  70 + if summaryEvaluationData.CheckResult == domain.EvaluationCheckCompleted {
  71 + return false, nil
  72 + }
  73 +
  74 + //检查数据 SummaryEvaluation ,types=5,并添加短信数据
  75 + //计算下一条短信
  76 + smsMessage := notices.makeNotify(summaryEvaluationData)
  77 +
  78 + nextTime := nowTime.Add(6 * time.Hour)
  79 + smsMessage.ExecuteAt = notices.getTimeExecuteAt(nextTime)
  80 + logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
  81 + err = logSmsRepo.Save(smsMessage)
  82 + if err != nil {
  83 + return true, err
  84 + }
  85 + if err := transactionContext.CommitTransaction(); err != nil {
  86 + return false, err
  87 + }
  88 +
  89 + return true, nil
  90 +}
  91 +
  92 +// 输入的时间为基础微调短信的执行时间
  93 +// 适配规则 :每隔6个小时进行提醒(23:00-7:00期间不提醒)
  94 +func (notices notifyConfirmEvaluationScore) getTimeExecuteAt(nowTime time.Time) time.Time {
  95 + nowHour := nowTime.Local().Hour()
  96 + if nowHour < 23 && nowHour >= 7 {
  97 + return nowTime
  98 + }
  99 + t1 := nowTime.Add(6 * time.Hour)
  100 + hour1 := t1.Local().Hour()
  101 + if hour1 < 23 && hour1 >= 7 {
  102 + return t1
  103 + }
  104 +
  105 + return t1.Add(6 * time.Hour)
  106 +
  107 +}
@@ -11,6 +11,8 @@ import ( @@ -11,6 +11,8 @@ import (
11 type notifyStaffAssess struct { 11 type notifyStaffAssess struct {
12 } 12 }
13 13
  14 +var _ notifySendOrNot = (*notifyStaffAssess)(nil)
  15 +
14 func (notices notifyStaffAssess) from() string { 16 func (notices notifyStaffAssess) from() string {
15 return "StaffAssess" 17 return "StaffAssess"
16 } 18 }
@@ -12,6 +12,8 @@ import ( @@ -12,6 +12,8 @@ import (
12 type notifySummaryEvaluation struct { 12 type notifySummaryEvaluation struct {
13 } 13 }
14 14
  15 +var _ notifySendOrNot = (*notifySummaryEvaluation)(nil)
  16 +
15 func (notices notifySummaryEvaluation) from() string { 17 func (notices notifySummaryEvaluation) from() string {
16 return "SummaryEvaluation" 18 return "SummaryEvaluation"
17 } 19 }
@@ -205,7 +205,10 @@ func (e *exportData3) FormatListValue(param []dao.DataStaffAssessContent2) { @@ -205,7 +205,10 @@ func (e *exportData3) FormatListValue(param []dao.DataStaffAssessContent2) {
205 e.data[key] = &strings.Builder{} 205 e.data[key] = &strings.Builder{}
206 e.data[key].WriteString(val.Value + "\n") //填写的等级 206 e.data[key].WriteString(val.Value + "\n") //填写的等级
207 for _, vv := range val.Remark { 207 for _, vv := range val.Remark {
208 - e.data[key].WriteString(vv.Title + "\n") 208 + vv.Title = strings.TrimSpace(vv.Title)
  209 + if vv.Title != "填写自评反馈" {
  210 + e.data[key].WriteString(vv.Title + "\n")
  211 + }
209 e.data[key].WriteString(vv.RemarkText + "\n") 212 e.data[key].WriteString(vv.RemarkText + "\n")
210 } 213 }
211 dayKey := val.TargetUserId + val.EvaluationProjectId + val.BeginDay 214 dayKey := val.TargetUserId + val.EvaluationProjectId + val.BeginDay
@@ -174,7 +174,10 @@ func (e *exportData2) setData(param []dao.ExportData1) { @@ -174,7 +174,10 @@ func (e *exportData2) setData(param []dao.ExportData1) {
174 e.data[key] = &strings.Builder{} 174 e.data[key] = &strings.Builder{}
175 e.data[key].WriteString(v.Value + "\n") 175 e.data[key].WriteString(v.Value + "\n")
176 for _, v2 := range v.Remark { 176 for _, v2 := range v.Remark {
177 - e.data[key].WriteString(v2.Title + "\n") 177 + v2.Title = strings.TrimSpace(v2.Title)
  178 + if v2.Title != "填写自评反馈" {
  179 + e.data[key].WriteString(v2.Title + "\n")
  180 + }
178 e.data[key].WriteString(v2.RemarkText + "\n") 181 e.data[key].WriteString(v2.RemarkText + "\n")
179 } 182 }
180 } 183 }
@@ -7,6 +7,7 @@ type EvaluationSuperListAdapter struct { @@ -7,6 +7,7 @@ type EvaluationSuperListAdapter struct {
7 EvaluationStatus string `json:"evaluationStatus"` //上级评估完成状态 7 EvaluationStatus string `json:"evaluationStatus"` //上级评估完成状态
8 EndTime string `json:"endTime"` //截止时间 8 EndTime string `json:"endTime"` //截止时间
9 TotalScoreSelf string `json:"totalScoreSelf"` //综合自评总分 9 TotalScoreSelf string `json:"totalScoreSelf"` //综合自评总分
  10 + TotalScoreSuper string `json:"totalScoreSuper"` //综合自评总分
10 Department string `json:"department"` //部门 11 Department string `json:"department"` //部门
11 Position string `json:"position"` //职位 12 Position string `json:"position"` //职位
12 EntryTime string `json:"entryTime"` //入职时间 13 EntryTime string `json:"entryTime"` //入职时间
@@ -50,18 +50,18 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -50,18 +50,18 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
50 positionRepo := factory.CreatePositionRepository(map[string]interface{}{ 50 positionRepo := factory.CreatePositionRepository(map[string]interface{}{
51 "transactionContext": transactionContext, 51 "transactionContext": transactionContext,
52 }) 52 })
53 - limit := param.PageSize  
54 - offset := (param.PageNumber - 1) * param.PageSize 53 + // limit := param.PageSize
  54 + // offset := (param.PageNumber - 1) * param.PageSize
55 55
56 //获取评估列表信息 56 //获取评估列表信息
57 condition1 := map[string]interface{}{ 57 condition1 := map[string]interface{}{
58 "cycleId": param.CycleId, 58 "cycleId": param.CycleId,
59 "types": int(domain.EvaluationFinish), 59 "types": int(domain.EvaluationFinish),
60 - "limit": limit,  
61 - }  
62 - if offset > 0 {  
63 - condition1["offset"] = offset 60 + "limit": 5000,
64 } 61 }
  62 + // if offset > 0 {
  63 + // condition1["offset"] = offset
  64 + // }
65 if len(param.TargetUserName) > 0 { 65 if len(param.TargetUserName) > 0 {
66 condition1["targetUserName"] = "%" + param.TargetUserName + "%" 66 condition1["targetUserName"] = "%" + param.TargetUserName + "%"
67 } 67 }
@@ -147,6 +147,8 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -147,6 +147,8 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
147 firstSheetName := xlsxFile.GetSheetName(sheetIndex) 147 firstSheetName := xlsxFile.GetSheetName(sheetIndex)
148 tableHead := []string{"姓名", "部门", "职位", "最终绩效得分"} 148 tableHead := []string{"姓名", "部门", "职位", "最终绩效得分"}
149 tableHead = append(tableHead, ratingHeader...) 149 tableHead = append(tableHead, ratingHeader...)
  150 + // 最后一列
  151 + tableHead = append(tableHead, "备注")
150 if len(evaluationList) > 0 { 152 if len(evaluationList) > 0 {
151 xlsxFile.SetSheetRow(firstSheetName, "A1", &[]string{evaluationList[0].CycleName + "最终成绩"}) 153 xlsxFile.SetSheetRow(firstSheetName, "A1", &[]string{evaluationList[0].CycleName + "最终成绩"})
152 if len(tableHead) > 1 { 154 if len(tableHead) > 1 {
@@ -171,7 +173,7 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -171,7 +173,7 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
171 } 173 }
172 } 174 }
173 } 175 }
174 - dataRaw := []string{ 176 + dataRow := []string{
175 v.TargetUser.UserName, 177 v.TargetUser.UserName,
176 departmentName, 178 departmentName,
177 positinName, 179 positinName,
@@ -179,12 +181,18 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -179,12 +181,18 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
179 } 181 }
180 for _, v2 := range ratingHeader { 182 for _, v2 := range ratingHeader {
181 if num, ok := evaluationRatingMap[v.Id][v2]; ok { 183 if num, ok := evaluationRatingMap[v.Id][v2]; ok {
182 - dataRaw = append(dataRaw, fmt.Sprintf("%d", num)) 184 + dataRow = append(dataRow, fmt.Sprintf("%d", num))
183 } else { 185 } else {
184 - dataRaw = append(dataRaw, "0") 186 + dataRow = append(dataRow, "0")
185 } 187 }
186 } 188 }
187 - xlsxFile.SetSheetRow(firstSheetName, fmt.Sprintf("A%d", i+firstDataRow), &dataRaw) 189 + if v.CheckResult == domain.EvaluationCheckCompleted {
  190 + dataRow = append(dataRow, "已确认")
  191 + } else {
  192 + dataRow = append(dataRow, "未确认")
  193 + }
  194 + //最后一列
  195 + xlsxFile.SetSheetRow(firstSheetName, fmt.Sprintf("A%d", i+firstDataRow), &dataRow)
188 } 196 }
189 return xlsxFile, nil 197 return xlsxFile, nil
190 } 198 }
@@ -10,6 +10,7 @@ import ( @@ -10,6 +10,7 @@ import (
10 "github.com/linmadan/egglib-go/core/application" 10 "github.com/linmadan/egglib-go/core/application"
11 "github.com/linmadan/egglib-go/utils/tool_funs" 11 "github.com/linmadan/egglib-go/utils/tool_funs"
12 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" 12 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  13 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
13 roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role" 14 roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
14 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" 15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" 16 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
@@ -647,7 +648,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. @@ -647,7 +648,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.
647 if len(evaluationList) == 0 { 648 if len(evaluationList) == 0 {
648 //没有上级评估、360评估、hrbp 评估 649 //没有上级评估、360评估、hrbp 评估
649 //直接进入考核结果阶段 650 //直接进入考核结果阶段
650 - _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ 651 + _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
651 "targetUserId": param.TargetUser.UserId, 652 "targetUserId": param.TargetUser.UserId,
652 "typesList": []int{int(domain.EvaluationFinish)}, 653 "typesList": []int{int(domain.EvaluationFinish)},
653 "cycleId": param.CycleId, 654 "cycleId": param.CycleId,
@@ -656,12 +657,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. @@ -656,12 +657,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.
656 if err != nil { 657 if err != nil {
657 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 658 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
658 } 659 }
659 - if len(evaluationList) > 0 { 660 + if len(evaluationFinishList) > 0 {
660 //进入考核结果 661 //进入考核结果
661 //自评的结束时间 662 //自评的结束时间
662 - evaluationList[0].BeginTime = param.EndTime  
663 - evaluationList[0].Status = domain.EvaluationCompleted  
664 - err = evaluationRepo.Save(evaluationList[0]) 663 + if evaluationFinishList[0].BeginTime.After(nowTime) {
  664 + evaluationFinishList[0].BeginTime = nowTime
  665 + }
  666 + evaluationFinishList[0].Status = domain.EvaluationCompleted
  667 + err = evaluationRepo.Save(evaluationFinishList[0])
665 if err != nil { 668 if err != nil {
666 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) 669 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
667 } 670 }
@@ -746,7 +749,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma @@ -746,7 +749,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma
746 if len(evaluationList) == 0 { 749 if len(evaluationList) == 0 {
747 //没有上级评估 750 //没有上级评估
748 //直接进入考核结果阶段 751 //直接进入考核结果阶段
749 - _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ 752 + _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
750 "targetUserId": param.TargetUser.UserId, 753 "targetUserId": param.TargetUser.UserId,
751 "typesList": []int{int(domain.EvaluationFinish)}, 754 "typesList": []int{int(domain.EvaluationFinish)},
752 "cycleId": param.CycleId, 755 "cycleId": param.CycleId,
@@ -755,11 +758,12 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma @@ -755,11 +758,12 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma
755 if err != nil { 758 if err != nil {
756 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 759 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
757 } 760 }
758 - if len(evaluationList) > 0 {  
759 - //360评估的结束时间  
760 - evaluationList[0].BeginTime = param.EndTime  
761 - evaluationList[0].Status = domain.EvaluationCompleted  
762 - err = evaluationRepo.Save(evaluationList[0]) 761 + if len(evaluationFinishList) > 0 {
  762 + if evaluationFinishList[0].BeginTime.After(nowTime) {
  763 + evaluationFinishList[0].BeginTime = nowTime
  764 + }
  765 + evaluationFinishList[0].Status = domain.EvaluationCompleted
  766 + err = evaluationRepo.Save(evaluationFinishList[0])
763 if err != nil { 767 if err != nil {
764 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) 768 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
765 } 769 }
@@ -810,16 +814,26 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain @@ -810,16 +814,26 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain
810 814
811 if len(evaluationList) > 0 { 815 if len(evaluationList) > 0 {
812 //上级评估的结束时间 816 //上级评估的结束时间
813 - evaluationList[0].BeginTime = param.EndTime 817 + // evaluationList[0].BeginTime = param.EndTime
  818 + nowTime := time.Now()
  819 + if evaluationList[0].BeginTime.After(nowTime) {
  820 + evaluationList[0].BeginTime = nowTime
  821 + }
814 evaluationList[0].Status = domain.EvaluationCompleted 822 evaluationList[0].Status = domain.EvaluationCompleted
815 err = evaluationRepo.Save(evaluationList[0]) 823 err = evaluationRepo.Save(evaluationList[0])
816 if err != nil { 824 if err != nil {
817 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) 825 return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
818 } 826 }
819 } 827 }
  828 +
820 if err := transactionContext.CommitTransaction(); err != nil { 829 if err := transactionContext.CommitTransaction(); err != nil {
821 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 830 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
822 } 831 }
  832 + //添加确认绩效成绩提醒短信提醒
  833 + err = notify.AddNotifyConfirmEvaluationScore(param)
  834 + if err != nil {
  835 + return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
  836 + }
823 return nil 837 return nil
824 } 838 }
825 839
@@ -907,7 +921,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que @@ -907,7 +921,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que
907 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 921 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
908 } 922 }
909 if len(evaluationList) == 0 { 923 if len(evaluationList) == 0 {
910 - return nil, nil 924 + return &adapter.EvaluationInfoCountCodeAdapter{}, nil
911 } 925 }
912 evaluationData := evaluationList[0] 926 evaluationData := evaluationList[0]
913 levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId) 927 levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId)
@@ -1007,22 +1021,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval @@ -1007,22 +1021,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
1007 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{ 1021 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
1008 "transactionContext": transactionContext, 1022 "transactionContext": transactionContext,
1009 }) 1023 })
1010 - // permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})  
1011 - // 获取权限配置  
1012 - // _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})  
1013 - // if err != nil {  
1014 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1015 - // } 1024 +
1016 permissinData, err := getPermission(int64(param.CompanyId)) 1025 permissinData, err := getPermission(int64(param.CompanyId))
1017 if err != nil { 1026 if err != nil {
1018 return nil, err 1027 return nil, err
1019 } 1028 }
1020 - evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{  
1021 - "id": param.SummaryEvaluationId, 1029 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  1030 + "id": []int{param.SummaryEvaluationId},
1022 }) 1031 })
1023 if err != nil { 1032 if err != nil {
1024 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1033 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1025 } 1034 }
  1035 + if len(evaluationList) == 0 {
  1036 + return &adapter.EvaluationInfoSuperAdapter{}, nil
  1037 + }
  1038 + evaluationData := evaluationList[0]
1026 if evaluationData.Types != domain.EvaluationSuper { 1039 if evaluationData.Types != domain.EvaluationSuper {
1027 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限") 1040 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
1028 } 1041 }
@@ -1113,10 +1126,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q @@ -1113,10 +1126,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q
1113 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) 1126 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
1114 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) 1127 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
1115 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) 1128 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
1116 - evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) 1129 + // evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
  1130 + // if err != nil {
  1131 + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1132 + // }
  1133 +
  1134 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  1135 + "id": []int{param.SummaryEvaluationId},
  1136 + })
1117 if err != nil { 1137 if err != nil {
1118 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1138 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1119 } 1139 }
  1140 + if len(evaluationList) == 0 {
  1141 + return &adapter.EvaluationInfoSuperAdapter{}, nil
  1142 + }
  1143 + evaluationData := evaluationList[0]
  1144 +
1120 if evaluationData.CompanyId != param.CompanyId { 1145 if evaluationData.CompanyId != param.CompanyId {
1121 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限") 1146 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
1122 } 1147 }
@@ -1568,6 +1593,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. @@ -1568,6 +1593,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.
1568 Department: "", 1593 Department: "",
1569 Position: "", 1594 Position: "",
1570 EntryTime: "", 1595 EntryTime: "",
  1596 + TotalScoreSuper: v.TotalScore,
1571 } 1597 }
1572 for _, dep := range v.TargetDepartment { 1598 for _, dep := range v.TargetDepartment {
1573 item.Department += dep.DepartmentName + " " 1599 item.Department += dep.DepartmentName + " "
@@ -1705,10 +1731,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1705,10 +1731,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1705 for i := range itemList { 1731 for i := range itemList {
1706 result.ResetTotalRating(itemList[i]) 1732 result.ResetTotalRating(itemList[i])
1707 } 1733 }
1708 - if err := result.EvaluationTotalScore(itemValues); err != nil {  
1709 - return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1734 + //存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
  1735 + if result.TotalScore == "0" || result.TotalScore == "" {
  1736 + if err := result.EvaluationTotalScore(itemValues); err != nil {
  1737 + return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1738 + }
1710 } 1739 }
1711 -  
1712 result.CheckResult = domain.EvaluationCheckCompleted 1740 result.CheckResult = domain.EvaluationCheckCompleted
1713 if err := evaluationRepo.Save(result); err != nil { 1741 if err := evaluationRepo.Save(result); err != nil {
1714 return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1742 return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -1791,9 +1819,6 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1791,9 +1819,6 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1791 if err != nil { 1819 if err != nil {
1792 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1820 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1793 } 1821 }
1794 - // if err := transactionContext.StartTransaction(); err != nil {  
1795 - // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1796 - // }  
1797 defer func() { 1822 defer func() {
1798 _ = transactionContext.RollbackTransaction() 1823 _ = transactionContext.RollbackTransaction()
1799 }() 1824 }()
@@ -1823,10 +1848,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1823,10 +1848,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1823 continue 1848 continue
1824 } 1849 }
1825 } 1850 }
  1851 + // if result == nil {
  1852 + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
  1853 + // }
1826 if result == nil { 1854 if result == nil {
1827 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据") 1855 + return &adapter.EvaluationInfoSuperAdapter{}, nil
1828 } 1856 }
1829 -  
1830 // 评估内容和值 1857 // 评估内容和值
1831 var itemList []*domain.EvaluationItemUsed 1858 var itemList []*domain.EvaluationItemUsed
1832 var itemValues []*domain.SummaryEvaluationValue 1859 var itemValues []*domain.SummaryEvaluationValue
@@ -1879,8 +1906,11 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1879,8 +1906,11 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1879 for i := range itemList { 1906 for i := range itemList {
1880 result.ResetTotalRating(itemList[i]) 1907 result.ResetTotalRating(itemList[i])
1881 } 1908 }
1882 - if err = result.EvaluationTotalScore(itemValues); err != nil {  
1883 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1909 + //存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
  1910 + if result.TotalScore == "0" || result.TotalScore == "" {
  1911 + if err = result.EvaluationTotalScore(itemValues); err != nil {
  1912 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1913 + }
1884 } 1914 }
1885 } 1915 }
1886 1916
@@ -371,6 +371,20 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua @@ -371,6 +371,20 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua
371 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") 371 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
372 } 372 }
373 373
  374 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  375 + "targetUserId": summaryEvaluation.TargetUser.UserId,
  376 + "typesList": []int{int(domain.EvaluationFinish)},
  377 + "cycleId": summaryEvaluation.CycleId,
  378 + "limit": 1,
  379 + })
  380 + if err != nil {
  381 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  382 + }
  383 + // 如果目标员工已经确认考核结果,就不能在进行评估编辑
  384 + if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
  385 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能在编辑!")
  386 + }
  387 +
374 // 自评评估内容(自评模板、筛选项目评估人) 388 // 自评评估内容(自评模板、筛选项目评估人)
375 _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ 389 _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
376 "evaluationProjectId": summaryEvaluation.EvaluationProjectId, 390 "evaluationProjectId": summaryEvaluation.EvaluationProjectId,
@@ -757,6 +771,20 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -757,6 +771,20 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
757 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") 771 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
758 } 772 }
759 773
  774 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  775 + "targetUserId": summaryEvaluation.TargetUser.UserId,
  776 + "typesList": []int{int(domain.EvaluationFinish)},
  777 + "cycleId": summaryEvaluation.CycleId,
  778 + "limit": 1,
  779 + })
  780 + if err != nil {
  781 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  782 + }
  783 + // 如果目标员工已经确认考核结果,就不能在进行评估编辑
  784 + if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
  785 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能在编辑!")
  786 + }
  787 +
760 // 自评评估内容(自评模板、筛选项目评估人) 788 // 自评评估内容(自评模板、筛选项目评估人)
761 _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ 789 _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
762 "evaluationProjectId": summaryEvaluation.EvaluationProjectId, 790 "evaluationProjectId": summaryEvaluation.EvaluationProjectId,
@@ -871,3 +899,31 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini @@ -871,3 +899,31 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
871 } 899 }
872 return nil 900 return nil
873 } 901 }
  902 +
  903 +// GetUnconfirmedCycleList 获取未确认绩效成绩的周期列表
  904 +func (srv *SummaryEvaluationService) GetUnconfirmedCycleList(companyId int, userId int) (map[string]interface{}, error) {
  905 + transactionContext, err := factory.StartTransaction()
  906 + if err != nil {
  907 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  908 + }
  909 + defer func() {
  910 + _ = transactionContext.RollbackTransaction()
  911 + }()
  912 + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{"transactionContext": transactionContext})
  913 +
  914 + cycles, err := evaluationDao.TargetUnconfirmedCycleList(companyId, userId)
  915 + if err != nil {
  916 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
  917 + }
  918 + if err := transactionContext.CommitTransaction(); err != nil {
  919 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  920 + }
  921 + var cycleList []adapter.CycleListAdapter
  922 + for _, v := range cycles {
  923 + cycleList = append(cycleList, adapter.CycleListAdapter{
  924 + CycleId: v.CycleId,
  925 + CycleName: v.CycleName,
  926 + })
  927 + }
  928 + return tool_funs.SimpleWrapGridMap(int64(len(cycleList)), cycleList), nil
  929 +}
@@ -50,6 +50,7 @@ const ( @@ -50,6 +50,7 @@ const (
50 type EvaluationStatus string 50 type EvaluationStatus string
51 51
52 const ( 52 const (
  53 + // EvaluationEditTotalScore EvaluationStatus = "completed_by_edit_score" //通过超级管理员直接修改分数完成的
53 EvaluationUncompleted EvaluationStatus = "uncompleted" //未提交填写的内容 54 EvaluationUncompleted EvaluationStatus = "uncompleted" //未提交填写的内容
54 EvaluationCompleted EvaluationStatus = "completed" //已提交填写的内容 55 EvaluationCompleted EvaluationStatus = "completed" //已提交填写的内容
55 ) 56 )
@@ -104,13 +104,13 @@ where 1=1 @@ -104,13 +104,13 @@ where 1=1
104 and staff_assess.cycle_id =? and "types" ='self' 104 and staff_assess.cycle_id =? and "types" ='self'
105 and staff_assess.evaluation_project_id in ( 105 and staff_assess.evaluation_project_id in (
106 select t_project_4.project_id from t_project_4 106 select t_project_4.project_id from t_project_4
107 -) ` 107 +) `
108 condition := []interface{}{cycleId} 108 condition := []interface{}{cycleId}
109 if len(exportUserIds) > 0 { 109 if len(exportUserIds) > 0 {
110 sqlStr += ` and staff_assess.target_user->>'userId' in(?) ` 110 sqlStr += ` and staff_assess.target_user->>'userId' in(?) `
111 condition = append(condition, pg.In(exportUserIds)) 111 condition = append(condition, pg.In(exportUserIds))
112 } 112 }
113 - sqlStr = withSql + sqlStr 113 + sqlStr = withSql + sqlStr + " order by evaluation_item_used.sort_by "
114 result := []DataEvaluationItemUsed2{} 114 result := []DataEvaluationItemUsed2{}
115 tx := d.transactionContext.PgTx 115 tx := d.transactionContext.PgTx
116 _, err := tx.Query(&result, sqlStr, condition...) 116 _, err := tx.Query(&result, sqlStr, condition...)
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
@@ -291,8 +291,8 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error) @@ -291,8 +291,8 @@ func (d *TaskDao) CountTaskAnomalyNotHrbp(param ListTaskCondition) (int, error)
291 from task 291 from task
292 join t_task_1 on task.id =t_task_1.id 292 join t_task_1 on task.id =t_task_1.id
293 where 1=1 293 where 1=1
294 - and task.anomaly>0 and task.deleted_at isnull `  
295 - condition := []interface{}{} 294 + and task.anomaly>0 and company_id=? and task.deleted_at isnull `
  295 + condition := []interface{}{param.CompanyId}
296 whereSql := `` 296 whereSql := ``
297 if param.OnlyMy { 297 if param.OnlyMy {
298 condition = append(condition, param.UserId) 298 condition = append(condition, param.UserId)
@@ -317,7 +317,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) { @@ -317,7 +317,7 @@ func (d *TaskDao) CountTaskAnomalyByHrbp(param ListTaskCondition) (int, error) {
317 )select count(*) 317 )select count(*)
318 from task 318 from task
319 left join t_task_ignore on t_task_ignore.task_id=task.id 319 left join t_task_ignore on t_task_ignore.task_id=task.id
320 - where 1=1 and task.anomaly>0 and task.company_id=? and task.deleted_at isnull` 320 + where 1=1 and task.anomaly>0 and task.company_id=? and t_task_ignore.id isnull and task.deleted_at isnull`
321 condition := []interface{}{param.UserId, param.CompanyId} 321 condition := []interface{}{param.UserId, param.CompanyId}
322 whereSql := `` 322 whereSql := ``
323 if param.OnlyMy { 323 if param.OnlyMy {
@@ -68,7 +68,12 @@ func (repo *LogSmsRepository) Find(queryOptions map[string]interface{}) (int, [] @@ -68,7 +68,12 @@ func (repo *LogSmsRepository) Find(queryOptions map[string]interface{}) (int, []
68 if v, ok := queryOptions["executeAtEnd"]; ok { 68 if v, ok := queryOptions["executeAtEnd"]; ok {
69 query.Where("execute_at<=?", v) 69 query.Where("execute_at<=?", v)
70 } 70 }
71 - 71 + if v, ok := queryOptions["from"]; ok {
  72 + query.Where(`"from"=?`, v)
  73 + }
  74 + if v, ok := queryOptions["index"]; ok {
  75 + query.Where("index=?", v)
  76 + }
72 count, err := query.SelectAndCount() 77 count, err := query.SelectAndCount()
73 if err != nil { 78 if err != nil {
74 return 0, nil, err 79 return 0, nil, err
@@ -5,9 +5,18 @@ import "testing" @@ -5,9 +5,18 @@ import "testing"
5 func TestPushInfo(t *testing.T) { 5 func TestPushInfo(t *testing.T) {
6 //测试消息推送 6 //测试消息推送
7 c := NewHttplibMmmOpenApiServiceGateway() 7 c := NewHttplibMmmOpenApiServiceGateway()
8 - resp, err := c.PushInfo(0, "mmm.ability.performance", []int64{3422174102828544}, "ceshi推送一个消息233", "消息内容xxxx332") 8 + //3436890424617728
  9 + //3422173870118400
  10 + resp, err := c.PushInfo(0, "mmm.ability.performance", []int64{3422173870118400}, "ceshi推送一个消息233", "消息内容xxxx332")
9 if err != nil { 11 if err != nil {
10 t.Error(err) 12 t.Error(err)
11 } 13 }
12 t.Logf("%v", resp) 14 t.Logf("%v", resp)
13 } 15 }
  16 +
  17 +func TestSms(t *testing.T) {
  18 + c := SmsService{}
  19 + err := c.SendNoticeSms("18060823798", 5475050, map[string]string{
  20 + "name": "名字1"})
  21 + t.Log(err)
  22 +}
@@ -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{}
@@ -332,7 +339,6 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() { @@ -332,7 +339,6 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() {
332 c.Response(data, err) 339 c.Response(data, err)
333 } 340 }
334 341
335 -// 按周期获取上级评估列表  
336 func (c *SummaryEvaluationController) ListAllEvaluationFinish() { 342 func (c *SummaryEvaluationController) ListAllEvaluationFinish() {
337 srv := service.NewSummaryEvaluationService() 343 srv := service.NewSummaryEvaluationService()
338 param := &command.QueryEvaluationList{} 344 param := &command.QueryEvaluationList{}
@@ -33,7 +33,7 @@ func init() { @@ -33,7 +33,7 @@ func init() {
33 web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存) 33 web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存)
34 web.NSCtrlPost("/summary", (*controllers.StaffAssessController).QuerySummary), //员工绩效-项目管理-总览 34 web.NSCtrlPost("/summary", (*controllers.StaffAssessController).QuerySummary), //员工绩效-项目管理-总览
35 web.NSCtrlPost("/summary/users", (*controllers.StaffAssessController).QueryMemberSummary), //员工绩效-综合管理-成员列表 35 web.NSCtrlPost("/summary/users", (*controllers.StaffAssessController).QueryMemberSummary), //员工绩效-综合管理-成员列表
36 - web.NSCtrlPost("/summary/users-indicator", (*controllers.StaffAssessController).QueryMemberPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 36 + web.NSCtrlPost("/summary/users-indicator", (*controllers.StaffAssessController).QueryMemberPerformanceIndicator), //员工绩效-综合管理-绩效指标
37 web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标 37 web.NSCtrlPost("/summary/export-indicator", (*controllers.StaffAssessController).ExportPerformanceIndicator), //员工绩效-综合管理-绩效导出指标
38 web.NSCtrlPost("/target_user/self/cycle", (*controllers.StaffAssessController).ListTargetUserSelfCycle), //获取员工自评的周期下拉列表 38 web.NSCtrlPost("/target_user/self/cycle", (*controllers.StaffAssessController).ListTargetUserSelfCycle), //获取员工自评的周期下拉列表
39 web.NSCtrlPost("/target_user/self/summary", (*controllers.StaffAssessController).GetStaffAsessSelfCountLevel), //获取员工每日自评小结 39 web.NSCtrlPost("/target_user/self/summary", (*controllers.StaffAssessController).GetStaffAsessSelfCountLevel), //获取员工每日自评小结
@@ -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),