作者 tangxvhui

修复一些问题

... ... @@ -172,7 +172,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
// 针对上上级
var taskStageList3 []dao.TaskStageData
if len(childUserId) == 0 {
taskStageList2, err = taskDao.TaskStageAnomaly(childUserId2)
taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
}
... ... @@ -189,7 +189,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskStage,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ... @@ -214,7 +214,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskStage,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ... @@ -239,7 +239,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskStage,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ... @@ -320,7 +320,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
}
}
// 针对上级
var taskStageList2 []dao.TaskStageData
var taskStageList2 []dao.TaskData2
if len(childUserId) == 0 {
taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4)
if err != nil {
... ... @@ -334,9 +334,9 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
}
}
// 针对上上级
var taskStageList3 []dao.TaskStageData
var taskStageList3 []dao.TaskData2
if len(childUserId) == 0 {
taskStageList2, err = taskDao.TaskAnomaly(childUserId2, 5)
taskStageList3, err = taskDao.TaskAnomaly(childUserId2, 5)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
}
... ... @@ -354,7 +354,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskRecord,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ... @@ -379,7 +379,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskRecord,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ... @@ -404,7 +404,7 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command.
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
Id: 0,
Types: domain.MessageTypesOther,
Types: domain.MessageTypesTaskRecord,
TargetUserId: param.UserId,
ReadFlag: domain.MessageIsRead,
Title: s,
... ...
... ... @@ -405,16 +405,25 @@ func (d *TaskDao) TaskStageAnomaly(leaderId []string) ([]TaskStageData, error) {
return result, err
}
// 异常的里程碑任务
func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskStageData, error) {
type TaskData2 struct {
Id int `pg:"id"`
Name string `pg:"name"`
Alias string `pg:"alias"`
LeaderName string `pg:"leader_name"`
Anomaly string `pg:"anomaly"`
}
// 异常的任务
func (d *TaskDao) TaskAnomaly(leaderId []string, anomaly int) ([]TaskData2, error) {
sqlStr := `select
task."id",
task."name" ,
task.alias ,
task.leader ->>'name' as leader_name,
task.anomaly
from task
where task.anomaly >=? and task.leader ->>'id' in(?) `
result := []TaskStageData{}
result := []TaskData2{}
tx := d.transactionContext.PgTx
_, err := tx.Query(&result, sqlStr, anomaly, pg.In(leaderId))
return result, err
... ...