|
@@ -5,12 +5,11 @@ import ( |
|
@@ -5,12 +5,11 @@ import ( |
5
|
"strconv"
|
5
|
"strconv"
|
6
|
"time"
|
6
|
"time"
|
7
|
|
7
|
|
8
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
|
|
|
9
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/serviceGateway"
|
|
|
10
|
- "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
|
|
|
11
|
-
|
|
|
12
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
9
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
|
|
|
10
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
|
13
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
11
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
12
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
|
14
|
)
|
13
|
)
|
15
|
|
14
|
|
16
|
// sendSummaryEvaluafionTask 根据评估项目设置,确认是否下发评估任务
|
15
|
// sendSummaryEvaluafionTask 根据评估项目设置,确认是否下发评估任务
|
|
@@ -272,8 +271,8 @@ func TaskSendSummaryEvaluation() error { |
|
@@ -272,8 +271,8 @@ func TaskSendSummaryEvaluation() error { |
272
|
if err := transactionContext.CommitTransaction(); err != nil {
|
271
|
if err := transactionContext.CommitTransaction(); err != nil {
|
273
|
return err
|
272
|
return err
|
274
|
}
|
273
|
}
|
275
|
- //发送短信通知
|
|
|
276
|
- //err = sendSmsEvalation(createdEvalationList)
|
274
|
+ //添加待发送的短信通知
|
|
|
275
|
+ err = sendSmsEvalation(createdEvalationList)
|
277
|
return err
|
276
|
return err
|
278
|
}
|
277
|
}
|
279
|
|
278
|
|
|
@@ -282,49 +281,53 @@ func sendSmsEvalation(param []domain.SummaryEvaluation) error { |
|
@@ -282,49 +281,53 @@ func sendSmsEvalation(param []domain.SummaryEvaluation) error { |
282
|
if constant.Env != "prd" {
|
281
|
if constant.Env != "prd" {
|
283
|
return nil
|
282
|
return nil
|
284
|
}
|
283
|
}
|
|
|
284
|
+ for i := range param {
|
|
|
285
|
+ notify.AddNotifySummaryEvaluation(¶m[i])
|
|
|
286
|
+ }
|
|
|
287
|
+
|
285
|
//处理短信发送
|
288
|
//处理短信发送
|
286
|
//过滤去重 处理需要发送改执行人的消息 执行人id=>domain.LogSms
|
289
|
//过滤去重 处理需要发送改执行人的消息 执行人id=>domain.LogSms
|
287
|
- noticeMap := map[string]*domain.LogSms{}
|
|
|
288
|
- for _, v := range param {
|
|
|
289
|
- phone := v.Executor.Account
|
|
|
290
|
- name := v.Executor.UserName
|
|
|
291
|
- if _, ok := noticeMap[phone]; ok {
|
|
|
292
|
- continue
|
|
|
293
|
- }
|
|
|
294
|
- if phone == "" {
|
|
|
295
|
- continue
|
|
|
296
|
- }
|
|
|
297
|
- smsMessage := domain.LogSms{}
|
|
|
298
|
- smsMessage.SummaryEvaluationMessage(phone, name)
|
|
|
299
|
- noticeMap[phone] = &smsMessage
|
|
|
300
|
- }
|
290
|
+ // noticeMap := map[string]*domain.LogSms{}
|
|
|
291
|
+ // for _, v := range param {
|
|
|
292
|
+ // phone := v.Executor.Account
|
|
|
293
|
+ // name := v.Executor.UserName
|
|
|
294
|
+ // if _, ok := noticeMap[phone]; ok {
|
|
|
295
|
+ // continue
|
|
|
296
|
+ // }
|
|
|
297
|
+ // if phone == "" {
|
|
|
298
|
+ // continue
|
|
|
299
|
+ // }
|
|
|
300
|
+ // smsMessage := domain.LogSms{}
|
|
|
301
|
+ // smsMessage.SummaryEvaluationMessage(phone, name)
|
|
|
302
|
+ // noticeMap[phone] = &smsMessage
|
|
|
303
|
+ // }
|
301
|
|
304
|
|
302
|
- sms := serviceGateway.SmsService{}
|
|
|
303
|
- for _, v := range noticeMap {
|
|
|
304
|
- err := sms.SendNoticeSms(v.Phone, v.TemplateId, v.Value)
|
|
|
305
|
- if err != nil {
|
|
|
306
|
- v.Result = err.Error()
|
|
|
307
|
- }
|
|
|
308
|
- }
|
|
|
309
|
- transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
310
|
- if err != nil {
|
|
|
311
|
- return err
|
|
|
312
|
- }
|
|
|
313
|
- if err := transactionContext.StartTransaction(); err != nil {
|
|
|
314
|
- return err
|
|
|
315
|
- }
|
|
|
316
|
- defer func() {
|
|
|
317
|
- _ = transactionContext.RollbackTransaction()
|
|
|
318
|
- }()
|
|
|
319
|
- logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
320
|
- for _, v := range noticeMap {
|
|
|
321
|
- err = logSmsRepo.Insert(v)
|
|
|
322
|
- if err != nil {
|
|
|
323
|
- log.Logger.Error("TaskSendSummaryEvaluation 发送短信通知:" + err.Error())
|
|
|
324
|
- }
|
|
|
325
|
- }
|
|
|
326
|
- if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
327
|
- return err
|
|
|
328
|
- }
|
305
|
+ // sms := serviceGateway.SmsService{}
|
|
|
306
|
+ // for _, v := range noticeMap {
|
|
|
307
|
+ // err := sms.SendNoticeSms(v.Phone, v.TemplateId, v.Value)
|
|
|
308
|
+ // if err != nil {
|
|
|
309
|
+ // v.Result = err.Error()
|
|
|
310
|
+ // }
|
|
|
311
|
+ // }
|
|
|
312
|
+ // transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
313
|
+ // if err != nil {
|
|
|
314
|
+ // return err
|
|
|
315
|
+ // }
|
|
|
316
|
+ // if err := transactionContext.StartTransaction(); err != nil {
|
|
|
317
|
+ // return err
|
|
|
318
|
+ // }
|
|
|
319
|
+ // defer func() {
|
|
|
320
|
+ // _ = transactionContext.RollbackTransaction()
|
|
|
321
|
+ // }()
|
|
|
322
|
+ // logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
323
|
+ // for _, v := range noticeMap {
|
|
|
324
|
+ // err = logSmsRepo.Insert(v)
|
|
|
325
|
+ // if err != nil {
|
|
|
326
|
+ // log.Logger.Error("TaskSendSummaryEvaluation 发送短信通知:" + err.Error())
|
|
|
327
|
+ // }
|
|
|
328
|
+ // }
|
|
|
329
|
+ // if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
330
|
+ // return err
|
|
|
331
|
+ // }
|
329
|
return nil
|
332
|
return nil
|
330
|
} |
333
|
} |