...
|
...
|
@@ -239,8 +239,107 @@ func (srv *SummaryEvaluationServeice) GetMenu(param *command.QueryMenu) (map[str |
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// buildSummaryItemValue 将填写值填充进评估项
|
|
|
func (srv *SummaryEvaluationServeice) buildSummaryItemValue(itemList []*domain.EvaluationItemUsed, valueList []*domain.SummaryEvaluationValue) (
|
|
|
itemValues []adapter.EvaluationItemAdapter) {
|
|
|
itemValues = []adapter.EvaluationItemAdapter{}
|
|
|
valueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
for _, v := range valueList {
|
|
|
valueMap[v.EvaluationItemId] = v
|
|
|
}
|
|
|
for _, v := range itemList {
|
|
|
item := adapter.EvaluationItemAdapter{
|
|
|
EvaluationItemId: v.Id,
|
|
|
SortBy: v.SortBy,
|
|
|
Category: v.Category,
|
|
|
Name: v.Name,
|
|
|
PromptTitle: v.PromptTitle,
|
|
|
PromptText: v.PromptText,
|
|
|
EntryItems: v.EntryItems,
|
|
|
RuleType: v.RuleType,
|
|
|
Rule: v.Rule,
|
|
|
Weight: v.Weight,
|
|
|
Required: v.Required,
|
|
|
Value: "",
|
|
|
Score: "",
|
|
|
Remark: "",
|
|
|
}
|
|
|
value, ok := valueMap[v.Id]
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
item.Score = value.Score
|
|
|
item.Value = value.Value
|
|
|
item.Remark = value.Remark
|
|
|
itemValues = append(itemValues, item)
|
|
|
}
|
|
|
return itemValues
|
|
|
}
|
|
|
|
|
|
// 获取综合自评详情
|
|
|
func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEvaluationInfo) {}
|
|
|
func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEvaluationInfo) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"cycleId": param.CompanyId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"types": domain.EvaluationSelf,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
evaluationData := evaluationList[0]
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": evaluationData.EvaluationProjectId,
|
|
|
"nodeType": int(domain.LinkNodeSelfAssessment),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
_ = itemList
|
|
|
_ = itemValueRepo
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// 编辑综合自评详情
|
|
|
func (srv *SummaryEvaluationServeice) EditEvaluationSelf() {} |
|
|
func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter.EvaluationItemAdapter, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|