切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
about a year ago
提交
90219b7fa5cf404edda9e26ad1f279a6d35d19a9
1 个父辈
c7d34f1c
调整 统计
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
56 行增加
和
19 行删除
README.md
pkg/application/notify/run.go
pkg/application/notify/sms_staff_assess.go
pkg/infrastructure/dao/staff_assess_dao.go
README.md
查看文件 @
90219b7
...
...
@@ -11,4 +11,5 @@ test环境 https://enterprise-platform-dev.fjmaimaimai.com/#/login
测试账号 17708397664 密码 123456
短信模板ID:5475050 短信内容: 您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦
\ No newline at end of file
短信模板ID:5475050 短信内容:您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦
短信模板ID:5824230 短信内容:您好,#name#,百忙之中不要忘记填写#date#的绩效自评反馈哦
\ No newline at end of file
...
...
pkg/application/notify/run.go
查看文件 @
90219b7
...
...
@@ -20,8 +20,12 @@ func RunTaskSmsNotify() {
// 每日自评短信通知 ,预创建待发送的短信消息
func
AddNotifyStaffAssess
(
param
*
domain
.
StaffAssess
)
{
newNotify
:=
notifyStaffAssess
{}
newSms
:=
newNotify
.
makeNotify
(
param
)
if
newSms
==
nil
{
return
}
taskSmsNotify
.
addTask
(
newSms
)
}
...
...
@@ -29,6 +33,9 @@ func AddNotifyStaffAssess(param *domain.StaffAssess) {
func
AddNotifySummaryEvaluation
(
param
*
domain
.
SummaryEvaluation
)
{
newNotify
:=
notifySummaryEvaluation
{}
newSms
:=
newNotify
.
makeNotify
(
param
)
if
newSms
==
nil
{
return
}
taskSmsNotify
.
addTask
(
newSms
)
}
...
...
@@ -59,5 +66,8 @@ func AddNotifyConfirmEvaluationScore(param *domain.SummaryEvaluation) error {
}
newSms
:=
newNotify
.
makeNotify
(
param
)
if
newSms
==
nil
{
return
nil
}
return
taskSmsNotify
.
addTask
(
newSms
)
}
...
...
pkg/application/notify/sms_staff_assess.go
查看文件 @
90219b7
...
...
@@ -19,28 +19,57 @@ func (notices notifyStaffAssess) from() string {
}
// makeNotify 生成待执行的短信通知内容
// func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.LogSms {
// newSms := domain.LogSms{
// Id: 0,
// Phone: param.Executor.Account,
// TemplateId: 5475050,
// Template: "您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦",
// Value: map[string]string{
// "name": param.Executor.UserName,
// },
// Result: "",
// Status: domain.SmsWait,
// From: notices.from(),
// Index: param.Id,
// // ExecuteAt: executeAt,
// CreatedAt: time.Now(),
// }
// // 每日自评 结束前30 分钟
// // newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second)
// //改为 固定在截止时间 那天的 前一天晚上10
// y, m, d := param.EndTime.Local().Date()
// dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local)
// newSms.ExecuteAt = dayTime.Add(-2 * time.Hour)
// return &newSms
// }
//
// makeNotify 生成待执行的短信通知内容
func
(
notices
notifyStaffAssess
)
makeNotify
(
param
*
domain
.
StaffAssess
)
*
domain
.
LogSms
{
year
,
month
,
dayNumber
:=
param
.
BeginTime
.
Local
()
.
Date
()
// 限制只有 在每月的15号进行每日评估填报时,才进行短信消息提醒
if
dayNumber
!=
15
{
return
nil
}
// 每月15日的每日评估必做,未填写的在晚上10点下发短信提醒
dayTime
:=
time
.
Date
(
year
,
month
,
dayNumber
,
22
,
0
,
0
,
0
,
time
.
Local
)
newSms
:=
domain
.
LogSms
{
Id
:
0
,
Phone
:
param
.
Executor
.
Account
,
TemplateId
:
5475050
,
Template
:
"您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦"
,
TemplateId
:
5824230
,
Template
:
"您好,#name#,百忙之中不要忘记填写#date#的绩效自评反馈哦"
,
Value
:
map
[
string
]
string
{
"name"
:
param
.
Executor
.
UserName
,
"data"
:
"本月15日"
,
},
Result
:
""
,
Status
:
domain
.
SmsWait
,
From
:
notices
.
from
(),
Index
:
param
.
Id
,
// ExecuteAt: executeAt,
Result
:
""
,
Status
:
domain
.
SmsWait
,
From
:
notices
.
from
(),
Index
:
param
.
Id
,
ExecuteAt
:
dayTime
,
CreatedAt
:
time
.
Now
(),
}
// 每日自评 结束前30 分钟
// newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second)
//改为 固定在截止时间 那天的 前一天晚上10
y
,
m
,
d
:=
param
.
EndTime
.
Local
()
.
Date
()
dayTime
:=
time
.
Date
(
y
,
m
,
d
,
0
,
0
,
0
,
0
,
time
.
Local
)
newSms
.
ExecuteAt
=
dayTime
.
Add
(
-
2
*
time
.
Hour
)
return
&
newSms
}
...
...
@@ -49,11 +78,6 @@ func (notices notifyStaffAssess) ifSend(index int) (bool, error) {
if
constant
.
Env
!=
"prd"
{
return
false
,
nil
}
nowDay
:=
time
.
Now
()
.
Weekday
()
if
nowDay
==
time
.
Sunday
||
nowDay
==
time
.
Saturday
{
//周末不发
return
false
,
nil
}
transactionContext
,
err
:=
factory
.
CreateTransactionContext
(
nil
)
if
err
!=
nil
{
return
false
,
err
...
...
pkg/infrastructure/dao/staff_assess_dao.go
查看文件 @
90219b7
...
...
@@ -1191,6 +1191,7 @@ type CountUncompletedSelfAssess struct {
}
// CountUncompletedSelfAssess 统计整个项目周期内,相关人自评未完成数量
// 按照 每月15日自评完成情况 统计自评未完成数量
func
(
d
*
StaffAssessDao
)
CountUncompletedSelfAssess
(
companyId
int
,
projectIds
[]
int
)
([]
CountUncompletedSelfAssess
,
error
)
{
sqlStr
:=
`
SELECT
...
...
@@ -1205,6 +1206,7 @@ func (d *StaffAssessDao) CountUncompletedSelfAssess(companyId int, projectIds []
AND staff_assess.evaluation_project_id IN (?)
AND staff_assess.status = 'uncompleted'
AND staff_assess.end_time < now()
AND date_part('day',staff_assess.created_at) = 15
GROUP BY
evaluation_project_id, target_user_id`
...
...
请
注册
或
登录
后发表评论