作者 tangxvhui

调整,弹窗消息输出数据

... ... @@ -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
// }
... ...
... ... @@ -918,7 +918,11 @@ func (srv *SummaryEvaluationService) GetUnconfirmedCycleList(companyId int, user
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
var cycleList []adapter.CycleListAdapter
nowTime := time.Now()
for _, v := range cycles {
if nowTime.Before(v.EndTime) {
continue
}
cycleList = append(cycleList, adapter.CycleListAdapter{
CycleId: v.CycleId,
CycleName: v.CycleName,
... ...
... ... @@ -88,6 +88,7 @@ type TargetUserCycle struct {
CycleId string `pg:"cycle_id" ` //周期id
CycleName string `pg:"cycle_name"` //周期名称
BeginTime time.Time `pg:"begin_time"`
EndTime time.Time `pg:"end_time"`
}
// GetExecutorCycleList 获取被评估目标人拥有的周期列表
... ... @@ -145,6 +146,7 @@ func (d *SummaryEvaluationDao) TargetUnconfirmedCycleList(companyId int, executo
sqlStr := `select
summary_evaluation.cycle_id,
summary_evaluation.begin_time,
summary_evaluation.end_time,
summary_evaluation.cycle_name
from summary_evaluation
where summary_evaluation.deleted_at isnull
... ...
... ... @@ -49,11 +49,3 @@ func (c *MessagePersonalController) TodayMessageTaskStageModify() {
data, err := srv.TodayMessageTaskStageModifyV2(&param)
c.Response(data, err)
}
func (c *MessagePersonalController) TodayMessageSummaryEvaluationFinishScore() {
srv := service.NewMessagePersonalService()
userReq := middlewares.GetUser(c.Ctx)
userId := int(userReq.UserId)
data, err := srv.SummaartEvaluationScore(userId)
c.Response(data, err)
}
... ...
... ... @@ -14,7 +14,6 @@ func init() {
web.NSCtrlGet("/summary-evaluation/task_stage/today", (*controllers.MessagePersonalController).TodayMessageTaskStageAnomaly),
web.NSCtrlGet("/summary-evaluation/task_record/today", (*controllers.MessagePersonalController).TodayMessageTaskRecordAnomaly),
web.NSCtrlGet("/summary-evaluation/task_modify/today", (*controllers.MessagePersonalController).TodayMessageTaskStageModify),
web.NSCtrlGet("/summary-evaluation-finish/confim-score", (*controllers.MessagePersonalController).TodayMessageSummaryEvaluationFinishScore),
)
web.AddNamespace(ns)
}
... ...