作者 tangxvhui

修复一些问题

@@ -172,7 +172,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -172,7 +172,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
172 // 针对上上级 172 // 针对上上级
173 var taskStageList3 []dao.TaskStageData 173 var taskStageList3 []dao.TaskStageData
174 if len(childUserId) == 0 { 174 if len(childUserId) == 0 {
175 - taskStageList2, err = taskDao.TaskStageAnomaly(childUserId2) 175 + taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2)
176 if err != nil { 176 if err != nil {
177 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error()) 177 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
178 } 178 }
@@ -189,7 +189,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -189,7 +189,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
189 payloadStr, _ := json.Marshal(payload) 189 payloadStr, _ := json.Marshal(payload)
190 newMessage := domain.MessagePersonal{ 190 newMessage := domain.MessagePersonal{
191 Id: 0, 191 Id: 0,
192 - Types: domain.MessageTypesOther, 192 + Types: domain.MessageTypesTaskStage,
193 TargetUserId: param.UserId, 193 TargetUserId: param.UserId,
194 ReadFlag: domain.MessageIsRead, 194 ReadFlag: domain.MessageIsRead,
195 Title: s, 195 Title: s,
@@ -214,7 +214,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -214,7 +214,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
214 payloadStr, _ := json.Marshal(payload) 214 payloadStr, _ := json.Marshal(payload)
215 newMessage := domain.MessagePersonal{ 215 newMessage := domain.MessagePersonal{
216 Id: 0, 216 Id: 0,
217 - Types: domain.MessageTypesOther, 217 + Types: domain.MessageTypesTaskStage,
218 TargetUserId: param.UserId, 218 TargetUserId: param.UserId,
219 ReadFlag: domain.MessageIsRead, 219 ReadFlag: domain.MessageIsRead,
220 Title: s, 220 Title: s,
@@ -239,7 +239,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -239,7 +239,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
239 payloadStr, _ := json.Marshal(payload) 239 payloadStr, _ := json.Marshal(payload)
240 newMessage := domain.MessagePersonal{ 240 newMessage := domain.MessagePersonal{
241 Id: 0, 241 Id: 0,
242 - Types: domain.MessageTypesOther, 242 + Types: domain.MessageTypesTaskStage,
243 TargetUserId: param.UserId, 243 TargetUserId: param.UserId,
244 ReadFlag: domain.MessageIsRead, 244 ReadFlag: domain.MessageIsRead,
245 Title: s, 245 Title: s,
@@ -320,7 +320,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -320,7 +320,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
320 } 320 }
321 } 321 }
322 // 针对上级 322 // 针对上级
323 - var taskStageList2 []dao.TaskStageData 323 + var taskStageList2 []dao.TaskData2
324 if len(childUserId) == 0 { 324 if len(childUserId) == 0 {
325 taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4) 325 taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4)
326 if err != nil { 326 if err != nil {
@@ -334,9 +334,9 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -334,9 +334,9 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
334 } 334 }
335 } 335 }
336 // 针对上上级 336 // 针对上上级
337 - var taskStageList3 []dao.TaskStageData 337 + var taskStageList3 []dao.TaskData2
338 if len(childUserId) == 0 { 338 if len(childUserId) == 0 {
339 - taskStageList2, err = taskDao.TaskAnomaly(childUserId2, 5) 339 + taskStageList3, err = taskDao.TaskAnomaly(childUserId2, 5)
340 if err != nil { 340 if err != nil {
341 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error()) 341 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
342 } 342 }
@@ -354,7 +354,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -354,7 +354,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
354 payloadStr, _ := json.Marshal(payload) 354 payloadStr, _ := json.Marshal(payload)
355 newMessage := domain.MessagePersonal{ 355 newMessage := domain.MessagePersonal{
356 Id: 0, 356 Id: 0,
357 - Types: domain.MessageTypesOther, 357 + Types: domain.MessageTypesTaskRecord,
358 TargetUserId: param.UserId, 358 TargetUserId: param.UserId,
359 ReadFlag: domain.MessageIsRead, 359 ReadFlag: domain.MessageIsRead,
360 Title: s, 360 Title: s,
@@ -379,7 +379,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -379,7 +379,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
379 payloadStr, _ := json.Marshal(payload) 379 payloadStr, _ := json.Marshal(payload)
380 newMessage := domain.MessagePersonal{ 380 newMessage := domain.MessagePersonal{
381 Id: 0, 381 Id: 0,
382 - Types: domain.MessageTypesOther, 382 + Types: domain.MessageTypesTaskRecord,
383 TargetUserId: param.UserId, 383 TargetUserId: param.UserId,
384 ReadFlag: domain.MessageIsRead, 384 ReadFlag: domain.MessageIsRead,
385 Title: s, 385 Title: s,
@@ -404,7 +404,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. @@ -404,7 +404,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
404 payloadStr, _ := json.Marshal(payload) 404 payloadStr, _ := json.Marshal(payload)
405 newMessage := domain.MessagePersonal{ 405 newMessage := domain.MessagePersonal{
406 Id: 0, 406 Id: 0,
407 - Types: domain.MessageTypesOther, 407 + Types: domain.MessageTypesTaskRecord,
408 TargetUserId: param.UserId, 408 TargetUserId: param.UserId,
409 ReadFlag: domain.MessageIsRead, 409 ReadFlag: domain.MessageIsRead,
410 Title: s, 410 Title: s,
@@ -405,16 +405,25 @@ func (d *TaskDao) TaskStageAnomaly(leaderId []string) ([]TaskStageData, error) { @@ -405,16 +405,25 @@ func (d *TaskDao) TaskStageAnomaly(leaderId []string) ([]TaskStageData, error) {
405 return result, err 405 return result, err
406 } 406 }
407 407
408 -// 异常的里程碑任务  
409 -func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData, error) { 408 +type TaskData2 struct {
  409 + Id int `pg:"id"`
  410 + Name string `pg:"name"`
  411 + Alias string `pg:"alias"`
  412 + LeaderName string `pg:"leader_name"`
  413 + Anomaly string `pg:"anomaly"`
  414 +}
  415 +
  416 +// 异常的任务
  417 +func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskData2, error) {
410 sqlStr := `select 418 sqlStr := `select
  419 + task."id",
411 task."name" , 420 task."name" ,
412 task.alias , 421 task.alias ,
413 task.leader ->>'name' as leader_name, 422 task.leader ->>'name' as leader_name,
414 task.anomaly 423 task.anomaly
415 from task 424 from task
416 where task.anomaly >=? and task.leader ->>'id' in(?) ` 425 where task.anomaly >=? and task.leader ->>'id' in(?) `
417 - result := []TaskStageData{} 426 + result := []TaskData2{}
418 tx := d.transactionContext.PgTx 427 tx := d.transactionContext.PgTx
419 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId)) 428 _, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId))
420 return result, err 429 return result, err