作者 tangxvhui
... ... @@ -390,30 +390,39 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua
}
evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
for _, v := range itemList {
evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
for i, v := range itemList {
newValue := &domain.SummaryEvaluationValue{}
newValue.SetBlankValue(summaryEvaluation, v)
evaluationValueMap[v.Id] = newValue
evaluationItemMap[v.Id] = itemList[i]
}
for _, v := range itemValueList {
if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
mValue.Id = v.Id
}
}
nowTime := time.Now()
//nowTime := time.Now()
for _, v := range param.EvaluationItems {
updatedData, ok := evaluationValueMap[v.EvaluationItemId]
if !ok {
continue
}
updatedData.UpdatedAt = nowTime
updatedData.Value = v.Value
updatedData.Remark = v.Remark
//计算得分
err = updatedData.SummaryEvaluationScore()
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
if it, ok := evaluationItemMap[v.EvaluationItemId]; ok {
err = updatedData.FillValue(it, v.Value, v.Remark)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
}
//updatedData.UpdatedAt = nowTime
//updatedData.Value = v.Value
//updatedData.Remark = v.Remark
////计算得分
//err = updatedData.SummaryEvaluationScore()
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
}
evaluationValueList := make([]*domain.SummaryEvaluationValue, 0)
... ... @@ -430,7 +439,7 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
summaryEvaluation.UpdatedAt = nowTime
//summaryEvaluation.UpdatedAt = nowTime
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
if err != nil {
... ... @@ -729,30 +738,39 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
}
evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
for _, v := range itemList {
evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
for i, v := range itemList {
newValue := &domain.SummaryEvaluationValue{}
newValue.SetBlankValue(summaryEvaluation, v)
evaluationValueMap[v.Id] = newValue
evaluationItemMap[v.Id] = itemList[i]
}
for _, v := range itemValueList {
if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
mValue.Id = v.Id
}
}
nowTime := time.Now()
//nowTime := time.Now()
for _, v := range param.EvaluationItems {
updatedData, ok := evaluationValueMap[v.EvaluationItemId]
if !ok {
continue
}
updatedData.UpdatedAt = nowTime
updatedData.Value = v.Value
updatedData.Remark = v.Remark
//计算得分
err = updatedData.SummaryEvaluationScore()
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
if it, ok := evaluationItemMap[v.EvaluationItemId]; ok {
err = updatedData.FillValue(it, v.Value, v.Remark)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
}
//updatedData.UpdatedAt = nowTime
//updatedData.Value = v.Value
//updatedData.Remark = v.Remark
////计算得分
//err = updatedData.SummaryEvaluationScore()
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
}
evaluationValueList := make([]*domain.SummaryEvaluationValue, 0)
... ... @@ -780,7 +798,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
summaryEvaluation.Executor.UserName = user.Name
summaryEvaluation.Executor.CompanyName = "" // 暂时无用
summaryEvaluation.UpdatedAt = nowTime
//summaryEvaluation.UpdatedAt = nowTime
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
... ...