作者 tangxvhui

调整sql

... ... @@ -46,6 +46,7 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
continue
}
//通知相关人员
// 【您关注的【%s】里程碑未按时完成,请知晓。】
//通知负责人
for _, val2 := range userList {
... ... @@ -54,16 +55,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
content = fmt.Sprintf("【您负责的项目【%s】里程碑未按时完成,请重点关注,积极寻找上级辅导。】", val.TaskName)
} else if val2.Level == 2 {
content = fmt.Sprintf("【您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.TaskName)
} else if val2.Level == 3 {
} else if val2.Level >= 3 {
content = fmt.Sprintf("【您下级%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,
"taskId": strconv.Itoa(val.TaskId),
"taskAlias": val.TaskAlias,
"taskName": val.TaskName,
}
payloadStr, _ := json.Marshal(payload)
newMessage := domain.MessagePersonal{
... ... @@ -88,16 +89,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
// 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()
// }()
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()
... ... @@ -152,9 +153,9 @@ func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) {
// allMessage = append(allMessage, &newMessage)
// }
// }
// if err := transactionContext.CommitTransaction(); err != nil {
// return nil, err
// }
if err := transactionContext.CommitTransaction(); err != nil {
return nil, err
}
// return allMessage, nil
return nil, nil
}
... ...
... ... @@ -755,9 +755,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
strSql := withsql + `
,t_task as (
select
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,
cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,
cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at,
cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) as c_plan_completed_at,
cast(COALESCE(task.last_stage ->>'planCompletedAt','0') as int) as l_plan_completed_at,
cast(COALESCE(task.last_stage ->>'realCompletedAt','0') as int) as l_real_completed_at,
floor(extract(epoch from now())) as now_time,
task.id ,
task.alias ,
... ...