正在显示
8 个修改的文件
包含
83 行增加
和
4 行删除
@@ -11,6 +11,7 @@ func RunTaskSmsNotify() { | @@ -11,6 +11,7 @@ func RunTaskSmsNotify() { | ||
11 | taskSmsNotify.init() | 11 | taskSmsNotify.init() |
12 | taskSmsNotify.regist(notifyStaffAssess{}) | 12 | taskSmsNotify.regist(notifyStaffAssess{}) |
13 | taskSmsNotify.regist(notifySummaryEvaluation{}) | 13 | taskSmsNotify.regist(notifySummaryEvaluation{}) |
14 | + taskSmsNotify.regist(notifyConfirmEvaluationScore{}) | ||
14 | taskSmsNotify.runTask() | 15 | taskSmsNotify.runTask() |
15 | } | 16 | } |
16 | 17 |
@@ -47,6 +47,9 @@ func (notices *notifySms) addTask(task *domain.LogSms) { | @@ -47,6 +47,9 @@ func (notices *notifySms) addTask(task *domain.LogSms) { | ||
47 | 47 | ||
48 | // RunTask 执行短信通知任务 | 48 | // RunTask 执行短信通知任务 |
49 | func (notices *notifySms) runTask() { | 49 | func (notices *notifySms) runTask() { |
50 | + if constant.Env != "prd" { | ||
51 | + return | ||
52 | + } | ||
50 | timer := time.NewTimer(notices.interval) | 53 | timer := time.NewTimer(notices.interval) |
51 | for { | 54 | for { |
52 | select { | 55 | select { |
@@ -130,9 +133,7 @@ func (notices *notifySms) checkSendSms() error { | @@ -130,9 +133,7 @@ func (notices *notifySms) checkSendSms() error { | ||
130 | 133 | ||
131 | // sendSms 发送短信消息 | 134 | // sendSms 发送短信消息 |
132 | func (notices *notifySms) sendSms(param *domain.LogSms) error { | 135 | func (notices *notifySms) sendSms(param *domain.LogSms) error { |
133 | - if constant.Env != "prd" { | ||
134 | - return nil | ||
135 | - } | 136 | + |
136 | //单开处理 数据保存操作,发一条短信更新一条数据 | 137 | //单开处理 数据保存操作,发一条短信更新一条数据 |
137 | transactionContext, err := factory.CreateTransactionContext(nil) | 138 | transactionContext, err := factory.CreateTransactionContext(nil) |
138 | if err != nil { | 139 | if err != nil { |
1 | +package notify | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +// 短信提醒确认周期评估成绩 | ||
10 | +// 条件:上级提交评估后 到10号晚23:59前,对未确认的被评估人每隔6个小时进行提醒(23:00-7:00期间不提醒),直到确认 | ||
11 | +type notifyConfirmEvaluationScore struct { | ||
12 | +} | ||
13 | + | ||
14 | +var _ notifySendOrNot = (*notifyConfirmEvaluationScore)(nil) | ||
15 | + | ||
16 | +func (notices notifyConfirmEvaluationScore) from() string { | ||
17 | + return "ConfirmEvaluationScore" | ||
18 | +} | ||
19 | + | ||
20 | +func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEvaluation) *domain.LogSms { | ||
21 | + newSms := domain.LogSms{ | ||
22 | + Id: 0, | ||
23 | + Phone: param.Executor.Account, | ||
24 | + TemplateId: 5475050, | ||
25 | + Template: "您好,#name#,#periodName#成绩已出,请前往绩效系统PC端进行确认哦,逾期未确认可能会影响当月绩效工资哦~ ", | ||
26 | + Value: map[string]string{ | ||
27 | + "name": param.Executor.UserName, | ||
28 | + "periodName": param.CycleName, | ||
29 | + }, | ||
30 | + Result: "", | ||
31 | + Status: domain.SmsWait, | ||
32 | + From: notices.from(), | ||
33 | + Index: param.Id, | ||
34 | + ExecuteAt: notices.getTimeExecuteAt(time.Now()), | ||
35 | + CreatedAt: time.Now(), | ||
36 | + } | ||
37 | + return &newSms | ||
38 | +} | ||
39 | + | ||
40 | +func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) { | ||
41 | + //检查时间 | ||
42 | + //适配规则:上级提交评估后 到10号晚23:59前,可以发送 | ||
43 | + | ||
44 | + //检查数据 SummaryEvaluation ,types=5,并添加短信数据 | ||
45 | + //适配规则 对未确认的被评估人每隔6个小时进行提醒(23:00-7:00期间不提醒),直到确认 | ||
46 | + | ||
47 | + return true, nil | ||
48 | +} | ||
49 | + | ||
50 | +// 输入的时间为基础微调短信的执行时间 | ||
51 | +// 适配规则 :(23:00-7:00期间不提醒) | ||
52 | +func (notices notifyConfirmEvaluationScore) getTimeExecuteAt(nowTime time.Time) time.Time { | ||
53 | + nowHour := nowTime.Local().Hour() | ||
54 | + if nowHour < 23 && nowHour > 7 { | ||
55 | + return nowTime | ||
56 | + } | ||
57 | + year, month, day := nowTime.Local().Date() | ||
58 | + //微调执行时间 | ||
59 | + if nowHour >= 23 { | ||
60 | + //第二天:7:00 | ||
61 | + t1 := time.Date(year, month, day, 23, 59, 59, 0, time.Local) | ||
62 | + return t1.Add(7 * time.Hour) | ||
63 | + } | ||
64 | + if nowHour <= 7 { | ||
65 | + //当天 7:00 | ||
66 | + t1 := time.Date(year, month, day, 0, 0, 0, 0, time.Local) | ||
67 | + return t1.Add(7 * time.Hour) | ||
68 | + } | ||
69 | + return nowTime | ||
70 | +} |
@@ -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 | } |
@@ -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"` //入职时间 |
@@ -821,6 +821,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain | @@ -821,6 +821,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain | ||
821 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | 821 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) |
822 | } | 822 | } |
823 | } | 823 | } |
824 | + //添加确认绩效成绩提醒短信提醒 | ||
824 | if err := transactionContext.CommitTransaction(); err != nil { | 825 | if err := transactionContext.CommitTransaction(); err != nil { |
825 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 826 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
826 | } | 827 | } |
@@ -1572,6 +1573,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. | @@ -1572,6 +1573,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. | ||
1572 | Department: "", | 1573 | Department: "", |
1573 | Position: "", | 1574 | Position: "", |
1574 | EntryTime: "", | 1575 | EntryTime: "", |
1576 | + TotalScoreSuper: v.TotalScore, | ||
1575 | } | 1577 | } |
1576 | for _, dep := range v.TargetDepartment { | 1578 | for _, dep := range v.TargetDepartment { |
1577 | item.Department += dep.DepartmentName + " " | 1579 | item.Department += dep.DepartmentName + " " |
@@ -7,7 +7,7 @@ func TestPushInfo(t *testing.T) { | @@ -7,7 +7,7 @@ func TestPushInfo(t *testing.T) { | ||
7 | c := NewHttplibMmmOpenApiServiceGateway() | 7 | c := NewHttplibMmmOpenApiServiceGateway() |
8 | //3436890424617728 | 8 | //3436890424617728 |
9 | //3422173870118400 | 9 | //3422173870118400 |
10 | - resp, err := c.PushInfo(0, "mmm.ability.performance", []int64{3436890424617728}, "ceshi推送一个消息233", "消息内容xxxx332") | 10 | + resp, err := c.PushInfo(0, "mmm.ability.performance", []int64{3422173870118400}, "ceshi推送一个消息233", "消息内容xxxx332") |
11 | if err != nil { | 11 | if err != nil { |
12 | t.Error(err) | 12 | t.Error(err) |
13 | } | 13 | } |
-
请 注册 或 登录 后发表评论