作者 tangxvhui

调整sql

@@ -46,6 +46,7 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { @@ -46,6 +46,7 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
46 continue 46 continue
47 } 47 }
48 //通知相关人员 48 //通知相关人员
  49 + // 【您关注的【%s】里程碑未按时完成,请知晓。】
49 50
50 //通知负责人 51 //通知负责人
51 for _, val2 := range userList { 52 for _, val2 := range userList {
@@ -54,16 +55,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { @@ -54,16 +55,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
54 content = fmt.Sprintf("【您负责的项目【%s】里程碑未按时完成,请重点关注,积极寻找上级辅导。】", val.TaskName) 55 content = fmt.Sprintf("【您负责的项目【%s】里程碑未按时完成,请重点关注,积极寻找上级辅导。】", val.TaskName)
55 } else if val2.Level == 2 { 56 } else if val2.Level == 2 {
56 content = fmt.Sprintf("【您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.TaskName) 57 content = fmt.Sprintf("【您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.TaskName)
57 - } else if val2.Level == 3 { 58 + } else if val2.Level >= 3 {
58 content = fmt.Sprintf("【您下级%s关注的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.TaskName) 59 content = fmt.Sprintf("【您下级%s关注的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.TaskName)
59 } 60 }
60 if content == "" { 61 if content == "" {
61 continue 62 continue
62 } 63 }
63 payload := map[string]string{ 64 payload := map[string]string{
64 - "task_id": strconv.Itoa(val.TaskId),  
65 - "task_alias": val.TaskAlias,  
66 - "task_name": val.TaskName, 65 + "taskId": strconv.Itoa(val.TaskId),
  66 + "taskAlias": val.TaskAlias,
  67 + "taskName": val.TaskName,
67 } 68 }
68 payloadStr, _ := json.Marshal(payload) 69 payloadStr, _ := json.Marshal(payload)
69 newMessage := domain.MessagePersonal{ 70 newMessage := domain.MessagePersonal{
@@ -88,16 +89,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) { @@ -88,16 +89,16 @@ func messageTaskStageAnomaly() ([]*domain.MessagePersonal, error) {
88 89
89 // messageTaskRecordAnomaly 反馈异常 90 // messageTaskRecordAnomaly 反馈异常
90 func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) { 91 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 - // }() 92 + transactionContext, err := factory.CreateTransactionContext(nil)
  93 + if err != nil {
  94 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  95 + }
  96 + if err := transactionContext.StartTransaction(); err != nil {
  97 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  98 + }
  99 + defer func() {
  100 + _ = transactionContext.RollbackTransaction()
  101 + }()
101 // taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext}) 102 // taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
102 // userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext}) 103 // userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
103 // taskData, err := taskDao.TaskRecordAnomalyAll() 104 // taskData, err := taskDao.TaskRecordAnomalyAll()
@@ -152,9 +153,9 @@ func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) { @@ -152,9 +153,9 @@ func messageTaskRecordAnomaly() ([]*domain.MessagePersonal, error) {
152 // allMessage = append(allMessage, &newMessage) 153 // allMessage = append(allMessage, &newMessage)
153 // } 154 // }
154 // } 155 // }
155 - // if err := transactionContext.CommitTransaction(); err != nil {  
156 - // return nil, err  
157 - // } 156 + if err := transactionContext.CommitTransaction(); err != nil {
  157 + return nil, err
  158 + }
158 // return allMessage, nil 159 // return allMessage, nil
159 return nil, nil 160 return nil, nil
160 } 161 }
@@ -755,9 +755,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -755,9 +755,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
755 strSql := withsql + ` 755 strSql := withsql + `
756 ,t_task as ( 756 ,t_task as (
757 select 757 select
758 - cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,  
759 - cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,  
760 - cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at, 758 + cast(COALESCE(task.current_stage ->>'planCompletedAt','0') as int) as c_plan_completed_at,
  759 + cast(COALESCE(task.last_stage ->>'planCompletedAt','0') as int) as l_plan_completed_at,
  760 + cast(COALESCE(task.last_stage ->>'realCompletedAt','0') as int) as l_real_completed_at,
761 floor(extract(epoch from now())) as now_time, 761 floor(extract(epoch from now())) as now_time,
762 task.id , 762 task.id ,
763 task.alias , 763 task.alias ,