|
@@ -86,6 +86,79 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { |
|
@@ -86,6 +86,79 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { |
86
|
return allMessage, nil
|
86
|
return allMessage, nil
|
87
|
}
|
87
|
}
|
88
|
|
88
|
|
|
|
89
|
+// messageTaskRecordAnomaly 反馈异常
|
|
|
90
|
+func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) {
|
|
|
91
|
+ // transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
92
|
+ // if err != nil {
|
|
|
93
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
94
|
+ // }
|
|
|
95
|
+ // if err := transactionContext.StartTransaction(); err != nil {
|
|
|
96
|
+ // return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
97
|
+ // }
|
|
|
98
|
+ // defer func() {
|
|
|
99
|
+ // _ = transactionContext.RollbackTransaction()
|
|
|
100
|
+ // }()
|
|
|
101
|
+ // taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
102
|
+ // userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
103
|
+ // taskData, err := taskDao.TaskRecordAnomalyAll()
|
|
|
104
|
+ // if err != nil {
|
|
|
105
|
+ // return nil, fmt.Errorf("获取任务信息%s", err)
|
|
|
106
|
+ // }
|
|
|
107
|
+ // if len(taskData) == 0 {
|
|
|
108
|
+ // return nil, nil
|
|
|
109
|
+ // }
|
|
|
110
|
+ // var allMessage []*domain.MessagePersonal
|
|
|
111
|
+ // for _, val := range taskData {
|
|
|
112
|
+ // //获取我全上级
|
|
|
113
|
+ // userList, err := userDao.AllParentUser(val.LeaderId)
|
|
|
114
|
+ // if err != nil {
|
|
|
115
|
+ // return nil, fmt.Errorf("获取上级人员信息%s", err)
|
|
|
116
|
+ // }
|
|
|
117
|
+ // if len(userList) == 0 {
|
|
|
118
|
+ // continue
|
|
|
119
|
+ // }
|
|
|
120
|
+ // //通知相关人员
|
|
|
121
|
+
|
|
|
122
|
+ // //通知负责人
|
|
|
123
|
+ // for _, val2 := range userList {
|
|
|
124
|
+ // content := ""
|
|
|
125
|
+ // if val2.Level == 1 {
|
|
|
126
|
+ // content = fmt.Sprintf("【您负责的项目【%s】已超过%s日未反馈进度,请前往该战略任务进行反馈。】", val.TaskName)
|
|
|
127
|
+ // } else if val2.Level == 2 {
|
|
|
128
|
+ // content = fmt.Sprintf("【您下级%s负责的项目【%s】已超过%s日未反馈进度,请前往辅导。】", val.LeaderName, val.TaskName)
|
|
|
129
|
+ // } else if val2.Level == 3 {
|
|
|
130
|
+ // content = fmt.Sprintf("【您下级%s关注的项目【%s】已超过%s日未反馈进度,请前往辅导。】", val.LeaderName, val.TaskName)
|
|
|
131
|
+ // }
|
|
|
132
|
+ // if content == "" {
|
|
|
133
|
+ // continue
|
|
|
134
|
+ // }
|
|
|
135
|
+ // payload := map[string]string{
|
|
|
136
|
+ // "task_id": strconv.Itoa(val.TaskId),
|
|
|
137
|
+ // "task_alias": val.TaskAlias,
|
|
|
138
|
+ // "task_name": val.TaskName,
|
|
|
139
|
+ // }
|
|
|
140
|
+ // payloadStr, _ := json.Marshal(payload)
|
|
|
141
|
+ // newMessage := domain.MessagePersonal{
|
|
|
142
|
+ // Id: 0,
|
|
|
143
|
+ // Types: domain.MessageTypesTaskStageApp,
|
|
|
144
|
+ // TargetUserId: val2.Id,
|
|
|
145
|
+ // ReadFlag: domain.MessageIsRead,
|
|
|
146
|
+ // Title: content,
|
|
|
147
|
+ // Content: content,
|
|
|
148
|
+ // CreatedAt: time.Time{},
|
|
|
149
|
+ // UpdatedAt: time.Time{},
|
|
|
150
|
+ // Payload: string(payloadStr),
|
|
|
151
|
+ // }
|
|
|
152
|
+ // allMessage = append(allMessage, &newMessage)
|
|
|
153
|
+ // }
|
|
|
154
|
+ // }
|
|
|
155
|
+ // if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
156
|
+ // return nil, err
|
|
|
157
|
+ // }
|
|
|
158
|
+ // return allMessage, nil
|
|
|
159
|
+ return nil, nil
|
|
|
160
|
+}
|
|
|
161
|
+
|
89
|
func saveAllMessagePersonal(msgList []*domain.MessagePersonal) error {
|
162
|
func saveAllMessagePersonal(msgList []*domain.MessagePersonal) error {
|
90
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
163
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
91
|
if err != nil {
|
164
|
if err != nil {
|