作者 tangxvhui

优化

@@ -43,7 +43,6 @@ func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEval @@ -43,7 +43,6 @@ func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEval
43 func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) { 43 func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
44 44
45 //检查时间 45 //检查时间
46 - //  
47 nowTime := time.Now() 46 nowTime := time.Now()
48 if nowTime.Day() > 10 { 47 if nowTime.Day() > 10 {
49 return false, nil 48 return false, nil
@@ -75,6 +74,7 @@ func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) { @@ -75,6 +74,7 @@ func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
75 //检查数据 SummaryEvaluation ,types=5,并添加短信数据 74 //检查数据 SummaryEvaluation ,types=5,并添加短信数据
76 //计算下一条短信 75 //计算下一条短信
77 smsMessage := notices.makeNotify(summaryEvaluationData) 76 smsMessage := notices.makeNotify(summaryEvaluationData)
  77 +
78 nextTime := nowTime.Add(6 * time.Hour) 78 nextTime := nowTime.Add(6 * time.Hour)
79 smsMessage.ExecuteAt = notices.getTimeExecuteAt(nextTime) 79 smsMessage.ExecuteAt = notices.getTimeExecuteAt(nextTime)
80 logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext}) 80 logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
@@ -918,7 +918,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que @@ -918,7 +918,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que
918 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 918 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
919 } 919 }
920 if len(evaluationList) == 0 { 920 if len(evaluationList) == 0 {
921 - return nil, nil 921 + return &adapter.EvaluationInfoCountCodeAdapter{}, nil
922 } 922 }
923 evaluationData := evaluationList[0] 923 evaluationData := evaluationList[0]
924 levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId) 924 levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId)
@@ -1018,22 +1018,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval @@ -1018,22 +1018,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
1018 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{ 1018 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
1019 "transactionContext": transactionContext, 1019 "transactionContext": transactionContext,
1020 }) 1020 })
1021 - // permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})  
1022 - // 获取权限配置  
1023 - // _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})  
1024 - // if err != nil {  
1025 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1026 - // } 1021 +
1027 permissinData, err := getPermission(int64(param.CompanyId)) 1022 permissinData, err := getPermission(int64(param.CompanyId))
1028 if err != nil { 1023 if err != nil {
1029 return nil, err 1024 return nil, err
1030 } 1025 }
1031 - evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{  
1032 - "id": param.SummaryEvaluationId, 1026 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  1027 + "id": []int{param.SummaryEvaluationId},
1033 }) 1028 })
1034 if err != nil { 1029 if err != nil {
1035 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1030 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1036 } 1031 }
  1032 + if len(evaluationList) == 0 {
  1033 + return &adapter.EvaluationInfoSuperAdapter{}, nil
  1034 + }
  1035 + evaluationData := evaluationList[0]
1037 if evaluationData.Types != domain.EvaluationSuper { 1036 if evaluationData.Types != domain.EvaluationSuper {
1038 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限") 1037 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
1039 } 1038 }
@@ -1124,10 +1123,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q @@ -1124,10 +1123,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q
1124 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) 1123 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
1125 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) 1124 evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
1126 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) 1125 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
1127 - evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) 1126 + // evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
  1127 + // if err != nil {
  1128 + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1129 + // }
  1130 +
  1131 + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
  1132 + "id": []int{param.SummaryEvaluationId},
  1133 + })
1128 if err != nil { 1134 if err != nil {
1129 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1135 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1130 } 1136 }
  1137 + if len(evaluationList) == 0 {
  1138 + return &adapter.EvaluationInfoSuperAdapter{}, nil
  1139 + }
  1140 + evaluationData := evaluationList[0]
  1141 +
1131 if evaluationData.CompanyId != param.CompanyId { 1142 if evaluationData.CompanyId != param.CompanyId {
1132 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限") 1143 return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
1133 } 1144 }
@@ -1835,10 +1846,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1835,10 +1846,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1835 continue 1846 continue
1836 } 1847 }
1837 } 1848 }
  1849 + // if result == nil {
  1850 + // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
  1851 + // }
1838 if result == nil { 1852 if result == nil {
1839 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据") 1853 + return &adapter.EvaluationInfoSuperAdapter{}, nil
1840 } 1854 }
1841 -  
1842 // 评估内容和值 1855 // 评估内容和值
1843 var itemList []*domain.EvaluationItemUsed 1856 var itemList []*domain.EvaluationItemUsed
1844 var itemValues []*domain.SummaryEvaluationValue 1857 var itemValues []*domain.SummaryEvaluationValue
@@ -339,7 +339,6 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() { @@ -339,7 +339,6 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() {
339 c.Response(data, err) 339 c.Response(data, err)
340 } 340 }
341 341
342 -// 按周期获取上级评估列表  
343 func (c *SummaryEvaluationController) ListAllEvaluationFinish() { 342 func (c *SummaryEvaluationController) ListAllEvaluationFinish() {
344 srv := service.NewSummaryEvaluationService() 343 srv := service.NewSummaryEvaluationService()
345 param := &command.QueryEvaluationList{} 344 param := &command.QueryEvaluationList{}