作者 tangxvhui

优化

... ... @@ -43,7 +43,6 @@ func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEval
func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
//检查时间
//
nowTime := time.Now()
if nowTime.Day() > 10 {
return false, nil
... ... @@ -75,6 +74,7 @@ func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
//检查数据 SummaryEvaluation ,types=5,并添加短信数据
//计算下一条短信
smsMessage := notices.makeNotify(summaryEvaluationData)
nextTime := nowTime.Add(6 * time.Hour)
smsMessage.ExecuteAt = notices.getTimeExecuteAt(nextTime)
logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
... ...
... ... @@ -918,7 +918,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
return nil, nil
return &adapter.EvaluationInfoCountCodeAdapter{}, nil
}
evaluationData := evaluationList[0]
levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId)
... ... @@ -1018,22 +1018,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
// permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
// 获取权限配置
// _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
permissinData, err := getPermission(int64(param.CompanyId))
if err != nil {
return nil, err
}
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
"id": param.SummaryEvaluationId,
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"id": []int{param.SummaryEvaluationId},
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
return &adapter.EvaluationInfoSuperAdapter{}, nil
}
evaluationData := evaluationList[0]
if evaluationData.Types != domain.EvaluationSuper {
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
}
... ... @@ -1124,10 +1123,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
// evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"id": []int{param.SummaryEvaluationId},
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
return &adapter.EvaluationInfoSuperAdapter{}, nil
}
evaluationData := evaluationList[0]
if evaluationData.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
}
... ... @@ -1835,10 +1846,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
continue
}
}
// if result == nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
// }
if result == nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
return &adapter.EvaluationInfoSuperAdapter{}, nil
}
// 评估内容和值
var itemList []*domain.EvaluationItemUsed
var itemValues []*domain.SummaryEvaluationValue
... ...
... ... @@ -339,7 +339,6 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() {
c.Response(data, err)
}
// 按周期获取上级评估列表
func (c *SummaryEvaluationController) ListAllEvaluationFinish() {
srv := service.NewSummaryEvaluationService()
param := &command.QueryEvaluationList{}
... ...