作者 tangxvhui

更新

  1 +package notify
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  4 +
  5 +// 个人信息提示
  6 +
  7 +// 周期综合自评下发时 ,添加一条消息用于页面展示
  8 +func AddMessageSummaryEvaluation(param []*domain.SummaryEvaluation) error {
  9 + return nil
  10 +}
  11 +
  12 +type MessageService struct {
  13 +}
  14 +
  15 +func NewSummaryEvaluationService() *MessageService {
  16 + newService := &MessageService{}
  17 + return newService
  18 +}
@@ -2,6 +2,7 @@ package notify @@ -2,6 +2,7 @@ package notify
2 2
3 import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 3 import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
4 4
  5 +// 执行定时任务检查是否发送短信通知
5 var taskSmsNotify *notifySms 6 var taskSmsNotify *notifySms
6 7
7 // 检查并发送短信通知 8 // 检查并发送短信通知
@@ -11,7 +12,6 @@ func RunTaskSmsNotify() { @@ -11,7 +12,6 @@ func RunTaskSmsNotify() {
11 taskSmsNotify.regist(notifyStaffAssess{}) 12 taskSmsNotify.regist(notifyStaffAssess{})
12 taskSmsNotify.regist(notifySummaryEvaluation{}) 13 taskSmsNotify.regist(notifySummaryEvaluation{})
13 taskSmsNotify.runTask() 14 taskSmsNotify.runTask()
14 -  
15 } 15 }
16 16
17 // 每日自评短信通知 ,预创建待发送的短信消息 17 // 每日自评短信通知 ,预创建待发送的短信消息
@@ -502,7 +502,6 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app @@ -502,7 +502,6 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app
502 502
503 // 编辑综合自评详情 503 // 编辑综合自评详情
504 func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { 504 func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
505 - // xredis.NewLockSummaryEvaluation(param.SummaryEvaluationId)  
506 505
507 transactionContext, err := factory.CreateTransactionContext(nil) 506 transactionContext, err := factory.CreateTransactionContext(nil)
508 if err != nil { 507 if err != nil {
@@ -803,3 +803,45 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -803,3 +803,45 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
803 "evaluationItems": itemValueAdapter, 803 "evaluationItems": itemValueAdapter,
804 }, nil 804 }, nil
805 } 805 }
  806 +
  807 +func (srv *SummaryEvaluationService) SummaryEvaluationFinishNotUseSuper(
  808 + evaluation domain.SummaryEvaluation,
  809 + items []*domain.EvaluationItemUsed,
  810 + itemValue []*domain.SummaryEvaluationValue,
  811 +) []*domain.SummaryEvaluationValue {
  812 + typeSelf := map[int]*domain.SummaryEvaluationValue{}
  813 + typeHrbp360 := map[int]*domain.SummaryEvaluationValue{}
  814 + for _, v := range itemValue {
  815 + switch v.Types {
  816 + case domain.EvaluationSelf:
  817 + typeSelf[v.EvaluationItemId] = v
  818 + case domain.Evaluation360, domain.EvaluationHrbp:
  819 + typeHrbp360[v.EvaluationItemId] = v
  820 + }
  821 + }
  822 + newItemValue := []*domain.SummaryEvaluationValue{}
  823 + nowTime := time.Now()
  824 + for _, v := range items {
  825 + var itemValueTemp domain.SummaryEvaluationValue
  826 + if v.EvaluatorId == 0 {
  827 + if v2, ok := typeSelf[v.Id]; ok {
  828 + itemValueTemp = *v2
  829 + }
  830 + } else {
  831 + if v2, ok := typeHrbp360[v.Id]; ok {
  832 + itemValueTemp = *v2
  833 + }
  834 + }
  835 +
  836 + if itemValueTemp.Id == 0 {
  837 + //360 hrbp,或者自评 都没有填写过
  838 + itemValueTemp.SetBlankValue(&evaluation, v)
  839 + }
  840 + //清理id信息
  841 + itemValueTemp.Id = 0
  842 + itemValueTemp.CreatedAt = nowTime
  843 + itemValueTemp.UpdatedAt = nowTime
  844 + newItemValue = append(newItemValue, &itemValueTemp)
  845 + }
  846 + return newItemValue
  847 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +// MessagePersonal 个人的消息提示
  6 +type MessagePersonal struct {
  7 + Id int //
  8 + Types string //消息类型
  9 + TargetUserId int //消息指向的用户
  10 + ReadFlag MessageReadFlag //1:已读、2:未读
  11 + Title string //消息的标题
  12 + Content string //消息的内容
  13 + CreatedAt time.Time
  14 + UpdatedAt time.Time
  15 + //Payload string //消息的额外承载的数据
  16 +}
  17 +
  18 +type MessageTypes string
  19 +
  20 +const (
  21 + MessageTypesOther MessageTypes = "other"
  22 +)
  23 +
  24 +type MessageReadFlag string
  25 +
  26 +const (
  27 + MessageIsRead MessageReadFlag = "read"
  28 + MessageUnread MessageReadFlag = "unread"
  29 +)
@@ -37,7 +37,7 @@ func (itemValue *SummaryEvaluationValue) SetBlankValue(evaluation *SummaryEvalua @@ -37,7 +37,7 @@ func (itemValue *SummaryEvaluationValue) SetBlankValue(evaluation *SummaryEvalua
37 itemValue.EvaluationItemId = item.Id 37 itemValue.EvaluationItemId = item.Id
38 itemValue.SummaryEvaluationId = evaluation.Id 38 itemValue.SummaryEvaluationId = evaluation.Id
39 itemValue.Value = "" 39 itemValue.Value = ""
40 - itemValue.Score = "" 40 + itemValue.Score = "0"
41 itemValue.Remark = "" 41 itemValue.Remark = ""
42 itemValue.Weight = item.Weight 42 itemValue.Weight = item.Weight
43 itemValue.CreatedAt = time.Now() 43 itemValue.CreatedAt = time.Now()