...
|
...
|
@@ -571,56 +571,56 @@ func (srv *MessagePersonalService) TodayMessageTaskAnomaly(param *command.GetUse |
|
|
}
|
|
|
|
|
|
// 提醒人员去确认周期评估的成绩
|
|
|
func (srv *MessagePersonalService) SummaartEvaluationScore(userId int) (msg map[string]interface{}, err error) {
|
|
|
msg = map[string]interface{}{
|
|
|
"needNotify": false,
|
|
|
"cycleId": "0",
|
|
|
"cycleName": "",
|
|
|
"targetUserId": "0",
|
|
|
"targetUserName": "",
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
// func (srv *MessagePersonalService) SummaartEvaluationScore(userId int) (msg map[string]interface{}, err error) {
|
|
|
// msg = map[string]interface{}{
|
|
|
// "needNotify": false,
|
|
|
// "cycleId": "0",
|
|
|
// "cycleName": "",
|
|
|
// "targetUserId": "0",
|
|
|
// "targetUserName": "",
|
|
|
// }
|
|
|
// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
// if err != nil {
|
|
|
// return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// defer func() {
|
|
|
// _ = transactionContext.RollbackTransaction()
|
|
|
// }()
|
|
|
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
// })
|
|
|
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": userId,
|
|
|
"checkResult": domain.EvaluationCheckUncompleted,
|
|
|
"types": 5,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return msg, nil
|
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
for _, val := range evaluationList {
|
|
|
if nowTime.After(val.EndTime) {
|
|
|
msg = map[string]interface{}{
|
|
|
"needNotify": true,
|
|
|
"cycleId": strconv.FormatInt(val.CycleId, 10),
|
|
|
"cycleName": val.CycleName,
|
|
|
"targetUserId": strconv.Itoa(val.TargetUser.UserId),
|
|
|
"targetUserName": val.TargetUser.UserName,
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return msg, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
// "targetUserId": userId,
|
|
|
// "checkResult": domain.EvaluationCheckUncompleted,
|
|
|
// "types": 5,
|
|
|
// })
|
|
|
// if err != nil {
|
|
|
// return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
|
|
// if len(evaluationList) == 0 {
|
|
|
// return msg, nil
|
|
|
// }
|
|
|
// nowTime := time.Now()
|
|
|
// for _, val := range evaluationList {
|
|
|
// if nowTime.After(val.EndTime) {
|
|
|
// msg = map[string]interface{}{
|
|
|
// "needNotify": true,
|
|
|
// "cycleId": strconv.FormatInt(val.CycleId, 10),
|
|
|
// "cycleName": val.CycleName,
|
|
|
// "targetUserId": strconv.Itoa(val.TargetUser.UserId),
|
|
|
// "targetUserName": val.TargetUser.UserName,
|
|
|
// }
|
|
|
// break
|
|
|
// }
|
|
|
// }
|
|
|
// if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return msg, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
|
|
|
return msg, nil
|
|
|
} |
|
|
// return msg, nil
|
|
|
// } |
...
|
...
|
|