...
|
...
|
@@ -86,6 +86,79 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { |
|
|
return allMessage, nil
|
|
|
}
|
|
|
|
|
|
// messageTaskRecordAnomaly 反馈异常
|
|
|
func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) {
|
|
|
// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// defer func() {
|
|
|
// _ = transactionContext.RollbackTransaction()
|
|
|
// }()
|
|
|
// taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// taskData, err := taskDao.TaskRecordAnomalyAll()
|
|
|
// if err != nil {
|
|
|
// return nil, fmt.Errorf("获取任务信息%s", err)
|
|
|
// }
|
|
|
// if len(taskData) == 0 {
|
|
|
// return nil, nil
|
|
|
// }
|
|
|
// var allMessage []*domain.MessagePersonal
|
|
|
// for _, val := range taskData {
|
|
|
// //获取我全上级
|
|
|
// userList, err := userDao.AllParentUser(val.LeaderId)
|
|
|
// if err != nil {
|
|
|
// return nil, fmt.Errorf("获取上级人员信息%s", err)
|
|
|
// }
|
|
|
// if len(userList) == 0 {
|
|
|
// continue
|
|
|
// }
|
|
|
// //通知相关人员
|
|
|
|
|
|
// //通知负责人
|
|
|
// for _, val2 := range userList {
|
|
|
// content := ""
|
|
|
// if val2.Level == 1 {
|
|
|
// content = fmt.Sprintf("【您负责的项目【%s】已超过%s日未反馈进度,请前往该战略任务进行反馈。】", val.TaskName)
|
|
|
// } else if val2.Level == 2 {
|
|
|
// content = fmt.Sprintf("【您下级%s负责的项目【%s】已超过%s日未反馈进度,请前往辅导。】", val.LeaderName, val.TaskName)
|
|
|
// } else if val2.Level == 3 {
|
|
|
// content = fmt.Sprintf("【您下级%s关注的项目【%s】已超过%s日未反馈进度,请前往辅导。】", val.LeaderName, val.TaskName)
|
|
|
// }
|
|
|
// if content == "" {
|
|
|
// continue
|
|
|
// }
|
|
|
// payload := map[string]string{
|
|
|
// "task_id": strconv.Itoa(val.TaskId),
|
|
|
// "task_alias": val.TaskAlias,
|
|
|
// "task_name": val.TaskName,
|
|
|
// }
|
|
|
// payloadStr, _ := json.Marshal(payload)
|
|
|
// newMessage := domain.MessagePersonal{
|
|
|
// Id: 0,
|
|
|
// Types: domain.MessageTypesTaskStageApp,
|
|
|
// TargetUserId: val2.Id,
|
|
|
// ReadFlag: domain.MessageIsRead,
|
|
|
// Title: content,
|
|
|
// Content: content,
|
|
|
// CreatedAt: time.Time{},
|
|
|
// UpdatedAt: time.Time{},
|
|
|
// Payload: string(payloadStr),
|
|
|
// }
|
|
|
// allMessage = append(allMessage, &newMessage)
|
|
|
// }
|
|
|
// }
|
|
|
// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return nil, err
|
|
|
// }
|
|
|
// return allMessage, nil
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
func saveAllMessagePersonal(msgList []*domain.MessagePersonal) error {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
|