...
|
...
|
@@ -8,6 +8,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -179,9 +180,8 @@ func sendSummaryEvaluation(project *domain.EvaluationProject, |
|
|
}
|
|
|
}
|
|
|
//回填 项目的状态
|
|
|
evaluationProjectRepo := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
project.SummaryState = domain.ProjectSummaryStateYes
|
|
|
_, err = evaluationProjectRepo.Insert(project)
|
|
|
projectDao := dao.NewEvaluationProjectDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
err = projectDao.UpdateSummaryState(project.Id, domain.ProjectSummaryStateYes)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
...
|
...
|
@@ -275,55 +275,10 @@ func TaskSendSummaryEvaluation() error { |
|
|
return err
|
|
|
}
|
|
|
|
|
|
// 发送短信通知
|
|
|
// 添加待发送的短信通知
|
|
|
func sendSmsEvalation(param []domain.SummaryEvaluation) error {
|
|
|
for i := range param {
|
|
|
notify.AddNotifySummaryEvaluation(¶m[i])
|
|
|
}
|
|
|
|
|
|
//处理短信发送
|
|
|
//过滤去重 处理需要发送改执行人的消息 执行人id=>domain.LogSms
|
|
|
// noticeMap := map[string]*domain.LogSms{}
|
|
|
// for _, v := range param {
|
|
|
// phone := v.Executor.Account
|
|
|
// name := v.Executor.UserName
|
|
|
// if _, ok := noticeMap[phone]; ok {
|
|
|
// continue
|
|
|
// }
|
|
|
// if phone == "" {
|
|
|
// continue
|
|
|
// }
|
|
|
// smsMessage := domain.LogSms{}
|
|
|
// smsMessage.SummaryEvaluationMessage(phone, name)
|
|
|
// noticeMap[phone] = &smsMessage
|
|
|
// }
|
|
|
|
|
|
// sms := serviceGateway.SmsService{}
|
|
|
// for _, v := range noticeMap {
|
|
|
// err := sms.SendNoticeSms(v.Phone, v.TemplateId, v.Value)
|
|
|
// if err != nil {
|
|
|
// v.Result = err.Error()
|
|
|
// }
|
|
|
// }
|
|
|
// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
// if err != nil {
|
|
|
// return err
|
|
|
// }
|
|
|
// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return err
|
|
|
// }
|
|
|
// defer func() {
|
|
|
// _ = transactionContext.RollbackTransaction()
|
|
|
// }()
|
|
|
// logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// for _, v := range noticeMap {
|
|
|
// err = logSmsRepo.Insert(v)
|
|
|
// if err != nil {
|
|
|
// log.Logger.Error("TaskSendSummaryEvaluation 发送短信通知:" + err.Error())
|
|
|
// }
|
|
|
// }
|
|
|
// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return err
|
|
|
// }
|
|
|
return nil
|
|
|
} |
...
|
...
|
|