作者 郑周

1. 修改提交分数

@@ -390,30 +390,39 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua @@ -390,30 +390,39 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua
390 } 390 }
391 391
392 evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} 392 evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
393 - for _, v := range itemList { 393 + evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
  394 + for i, v := range itemList {
394 newValue := &domain.SummaryEvaluationValue{} 395 newValue := &domain.SummaryEvaluationValue{}
395 newValue.SetBlankValue(summaryEvaluation, v) 396 newValue.SetBlankValue(summaryEvaluation, v)
396 evaluationValueMap[v.Id] = newValue 397 evaluationValueMap[v.Id] = newValue
  398 + evaluationItemMap[v.Id] = itemList[i]
397 } 399 }
398 for _, v := range itemValueList { 400 for _, v := range itemValueList {
399 if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok { 401 if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
400 mValue.Id = v.Id 402 mValue.Id = v.Id
401 } 403 }
402 } 404 }
403 - nowTime := time.Now() 405 + //nowTime := time.Now()
404 for _, v := range param.EvaluationItems { 406 for _, v := range param.EvaluationItems {
405 updatedData, ok := evaluationValueMap[v.EvaluationItemId] 407 updatedData, ok := evaluationValueMap[v.EvaluationItemId]
406 if !ok { 408 if !ok {
407 continue 409 continue
408 } 410 }
409 - updatedData.UpdatedAt = nowTime  
410 - updatedData.Value = v.Value  
411 - updatedData.Remark = v.Remark  
412 - //计算得分  
413 - err = updatedData.SummaryEvaluationScore()  
414 - if err != nil {  
415 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 411 + if it, ok := evaluationItemMap[v.EvaluationItemId]; ok {
  412 + err = updatedData.FillValue(it, v.Value, v.Remark)
  413 + if err != nil {
  414 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  415 + }
416 } 416 }
  417 +
  418 + //updatedData.UpdatedAt = nowTime
  419 + //updatedData.Value = v.Value
  420 + //updatedData.Remark = v.Remark
  421 + ////计算得分
  422 + //err = updatedData.SummaryEvaluationScore()
  423 + //if err != nil {
  424 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  425 + //}
417 } 426 }
418 427
419 evaluationValueList := make([]*domain.SummaryEvaluationValue, 0) 428 evaluationValueList := make([]*domain.SummaryEvaluationValue, 0)
@@ -430,7 +439,7 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua @@ -430,7 +439,7 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua
430 if err != nil { 439 if err != nil {
431 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 440 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
432 } 441 }
433 - summaryEvaluation.UpdatedAt = nowTime 442 + //summaryEvaluation.UpdatedAt = nowTime
434 //保存填写值 443 //保存填写值
435 err = evaluationRepo.Save(summaryEvaluation) 444 err = evaluationRepo.Save(summaryEvaluation)
436 if err != nil { 445 if err != nil {
@@ -729,30 +738,39 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -729,30 +738,39 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
729 } 738 }
730 739
731 evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} 740 evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
732 - for _, v := range itemList { 741 + evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
  742 +
  743 + for i, v := range itemList {
733 newValue := &domain.SummaryEvaluationValue{} 744 newValue := &domain.SummaryEvaluationValue{}
734 newValue.SetBlankValue(summaryEvaluation, v) 745 newValue.SetBlankValue(summaryEvaluation, v)
735 evaluationValueMap[v.Id] = newValue 746 evaluationValueMap[v.Id] = newValue
  747 + evaluationItemMap[v.Id] = itemList[i]
736 } 748 }
737 for _, v := range itemValueList { 749 for _, v := range itemValueList {
738 if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok { 750 if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
739 mValue.Id = v.Id 751 mValue.Id = v.Id
740 } 752 }
741 } 753 }
742 - nowTime := time.Now() 754 + //nowTime := time.Now()
743 for _, v := range param.EvaluationItems { 755 for _, v := range param.EvaluationItems {
744 updatedData, ok := evaluationValueMap[v.EvaluationItemId] 756 updatedData, ok := evaluationValueMap[v.EvaluationItemId]
745 if !ok { 757 if !ok {
746 continue 758 continue
747 } 759 }
748 - updatedData.UpdatedAt = nowTime  
749 - updatedData.Value = v.Value  
750 - updatedData.Remark = v.Remark  
751 - //计算得分  
752 - err = updatedData.SummaryEvaluationScore()  
753 - if err != nil {  
754 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 760 + if it, ok := evaluationItemMap[v.EvaluationItemId]; ok {
  761 + err = updatedData.FillValue(it, v.Value, v.Remark)
  762 + if err != nil {
  763 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  764 + }
755 } 765 }
  766 + //updatedData.UpdatedAt = nowTime
  767 + //updatedData.Value = v.Value
  768 + //updatedData.Remark = v.Remark
  769 + ////计算得分
  770 + //err = updatedData.SummaryEvaluationScore()
  771 + //if err != nil {
  772 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  773 + //}
756 } 774 }
757 775
758 evaluationValueList := make([]*domain.SummaryEvaluationValue, 0) 776 evaluationValueList := make([]*domain.SummaryEvaluationValue, 0)
@@ -780,7 +798,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -780,7 +798,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
780 summaryEvaluation.Executor.UserName = user.Name 798 summaryEvaluation.Executor.UserName = user.Name
781 summaryEvaluation.Executor.CompanyName = "" // 暂时无用 799 summaryEvaluation.Executor.CompanyName = "" // 暂时无用
782 800
783 - summaryEvaluation.UpdatedAt = nowTime 801 + //summaryEvaluation.UpdatedAt = nowTime
784 802
785 //保存填写值 803 //保存填写值
786 err = evaluationRepo.Save(summaryEvaluation) 804 err = evaluationRepo.Save(summaryEvaluation)