...
|
...
|
@@ -4,7 +4,6 @@ import ( |
|
|
"time"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -23,9 +22,9 @@ func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.L |
|
|
year, month, dayNumber := param.BeginTime.Local().Date()
|
|
|
|
|
|
// 限制只有 在每月的15号进行每日评估填报时,才进行短信消息提醒
|
|
|
if dayNumber != 15 {
|
|
|
return nil
|
|
|
}
|
|
|
// if dayNumber != 15 {
|
|
|
// return nil
|
|
|
// }
|
|
|
// 每月15日的每日评估必做,未填写的在晚上10点下发短信提醒
|
|
|
dayTime := time.Date(year, month, dayNumber, 22, 0, 0, 0, time.Local)
|
|
|
newSms := domain.LogSms{
|
...
|
...
|
@@ -49,9 +48,9 @@ func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.L |
|
|
|
|
|
// ifSend 确认是否发送通知
|
|
|
func (notices notifyStaffAssess) ifSend(index int) (bool, error) {
|
|
|
if constant.Env != "prd" {
|
|
|
return false, nil
|
|
|
}
|
|
|
// if constant.Env != "prd" {
|
|
|
// return false, nil
|
|
|
// }
|
|
|
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -98,9 +97,9 @@ func (notices notifyStaffAssess2) makeNotify(param *domain.StaffAssess) *domain. |
|
|
year, month, dayNumber := param.BeginTime.Local().Date()
|
|
|
|
|
|
// 限制只有 在每月的15号进行每日评估填报时,才进行短信消息提醒
|
|
|
if dayNumber != 15 {
|
|
|
return nil
|
|
|
}
|
|
|
// if dayNumber != 15 {
|
|
|
// return nil
|
|
|
// }
|
|
|
// 每月15日的每日评估必做,15日上午9点 发送短信提醒
|
|
|
dayTime := time.Date(year, month, dayNumber, 9, 0, 0, 0, time.Local)
|
|
|
newSms := domain.LogSms{
|
...
|
...
|
@@ -124,9 +123,31 @@ func (notices notifyStaffAssess2) makeNotify(param *domain.StaffAssess) *domain. |
|
|
|
|
|
// ifSend 确认是否发送通知
|
|
|
func (notices notifyStaffAssess2) ifSend(index int) (bool, error) {
|
|
|
if constant.Env != "prd" {
|
|
|
// if constant.Env != "prd" {
|
|
|
// return false, nil
|
|
|
// }
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return false, err
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return false, err
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
assessData, err := staffAssessRepo.FindOne(map[string]interface{}{"id": index})
|
|
|
if err != nil {
|
|
|
return false, err
|
|
|
}
|
|
|
_, _, dayNumber := assessData.BeginTime.Local().Date()
|
|
|
// 限制只有 在每月的15号进行每日评估填报时,才进行短信消息提醒
|
|
|
if dayNumber != 15 {
|
|
|
return false, nil
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return false, err
|
|
|
}
|
|
|
return true, nil
|
|
|
} |
...
|
...
|
|