...
|
...
|
@@ -11,6 +11,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify/adapter"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
|
|
|
)
|
|
|
|
|
|
// 个人信息提示
|
...
|
...
|
@@ -136,15 +137,75 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G |
|
|
}
|
|
|
return resp, nil
|
|
|
}
|
|
|
|
|
|
// TDOD
|
|
|
userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// 针对任务负责人
|
|
|
taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
leaderIds := []string{strconv.Itoa(param.UserId)}
|
|
|
taskStageList, err := taskDao.TaskStageAnomaly(leaderIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
childUser, err := userDao.AllChildUser(param.UserId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取下级员工"+err.Error())
|
|
|
}
|
|
|
childUserId := []string{}
|
|
|
for _, val := range childUser {
|
|
|
if val.Level == 2 {
|
|
|
childUserId = append(childUserId, strconv.Itoa(val.Id))
|
|
|
}
|
|
|
}
|
|
|
// 针对上级
|
|
|
var taskStageList2 []dao.TaskStageData
|
|
|
if len(childUserId) == 0 {
|
|
|
taskStageList2, err = taskDao.TaskStageAnomaly(childUserId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
childUserId2 := []string{}
|
|
|
for _, val := range childUser {
|
|
|
if val.Level == 3 {
|
|
|
childUserId = append(childUserId, strconv.Itoa(val.Id))
|
|
|
}
|
|
|
}
|
|
|
// 针对上上级
|
|
|
var taskStageList3 []dao.TaskStageData
|
|
|
if len(childUserId) == 0 {
|
|
|
taskStageList2, err = taskDao.TaskStageAnomaly(childUserId2)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
msgList := []adapter.MessageListAdapter{}
|
|
|
for _, val := range taskStageList {
|
|
|
s := fmt.Sprintf("【您负责的项目【%s】里程碑未按时完成,请重点关注,积极寻找上级辅导。】", val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
for _, val := range taskStageList2 {
|
|
|
s := fmt.Sprintf("您下级%s负责的项目【%s】里程碑未按时完成,请前往辅导。", val.LeaderName, val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
for _, val := range taskStageList3 {
|
|
|
s := fmt.Sprintf("【您下级%s关注的项目【%s】里程碑未按时完成,请前往辅导。】", val.LeaderName, val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
resp := map[string]interface{}{
|
|
|
"needNotify": false,
|
|
|
"list": []adapter.MessageListAdapter{},
|
|
|
"needNotify": true,
|
|
|
"list": msgList,
|
|
|
}
|
|
|
if len(msgList) == 0 {
|
|
|
resp["needNotify"] = false
|
|
|
}
|
|
|
return resp, nil
|
|
|
}
|
...
|
...
|
@@ -181,15 +242,80 @@ func (srv *MessagePersonalService) TodayMessageTaskRecordAnomaly(param *command. |
|
|
}
|
|
|
return resp, nil
|
|
|
}
|
|
|
userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
// TODO
|
|
|
taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// 针对任务负责人
|
|
|
leaderIds := []string{strconv.Itoa(param.UserId)}
|
|
|
taskStageList, err := taskDao.TaskAnomaly(leaderIds, 2)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
childUser, err := userDao.AllChildUser(param.UserId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取下级员工"+err.Error())
|
|
|
}
|
|
|
childUserId := []string{}
|
|
|
for _, val := range childUser {
|
|
|
if val.Level == 2 {
|
|
|
childUserId = append(childUserId, strconv.Itoa(val.Id))
|
|
|
}
|
|
|
}
|
|
|
// 针对上级
|
|
|
var taskStageList2 []dao.TaskStageData
|
|
|
if len(childUserId) == 0 {
|
|
|
taskStageList2, err = taskDao.TaskAnomaly(childUserId, 4)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
childUserId2 := []string{}
|
|
|
for _, val := range childUser {
|
|
|
if val.Level == 3 {
|
|
|
childUserId = append(childUserId, strconv.Itoa(val.Id))
|
|
|
}
|
|
|
}
|
|
|
// 针对上上级
|
|
|
var taskStageList3 []dao.TaskStageData
|
|
|
if len(childUserId) == 0 {
|
|
|
taskStageList2, err = taskDao.TaskAnomaly(childUserId2, 5)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "检查任务里程碑异常的消息"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
msgList := []adapter.MessageListAdapter{}
|
|
|
for _, val := range taskStageList {
|
|
|
s := fmt.Sprintf("【您负责的项目【%s】已超过N日未反馈进度,请前往该战略任务进行反馈。】", val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
for _, val := range taskStageList2 {
|
|
|
s := fmt.Sprintf("【您下级%s负责的项目【%s】已超过N日未反馈进度,请前往辅导。】", val.LeaderName, val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
for _, val := range taskStageList3 {
|
|
|
s := fmt.Sprintf("【您下级%s关注的项目【%s】已超过N日未反馈进度,请前往辅导。】", val.LeaderName, val.Name)
|
|
|
msgList = append(msgList, adapter.MessageListAdapter{
|
|
|
Content: s,
|
|
|
})
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
resp := map[string]interface{}{
|
|
|
"needNotify": false,
|
|
|
"list": []adapter.MessageListAdapter{},
|
|
|
"needNotify": true,
|
|
|
"list": msgList,
|
|
|
}
|
|
|
if len(msgList) == 0 {
|
|
|
resp["needNotify"] = false
|
|
|
}
|
|
|
return resp, nil
|
|
|
|
|
|
} |
...
|
...
|
|