作者 tangxvhui
... ... @@ -416,6 +416,11 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter
_, users, _ := userRepository.Find(map[string]interface{}{"ids": pmpUserIds, "limit": len(pmpUserIds)})
pmpUsers = users
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
projectAdapters := adapter.TransformProjectListAdapter(projects, pmpUsers)
return tool_funs.SimpleWrapGridMap(total, projectAdapters), nil
}
... ... @@ -568,13 +573,7 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo
repeatNum++
}
}
//if repeatNum > 0 {
// return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("有%d人已经在本周期其他项目内,需要将他们移除", repeatNum))
//}
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -162,23 +162,6 @@ func (rs *EvaluationRuleService) Remove(in *command.DeleteRuleCommand) (interfac
return rule, nil
}
//func (rs *EvaluationRuleService) List(in *command.QueryRuleCommand) (interface{}, error) {
// transactionContext, err := factory.StartTransaction()
// if err != nil {
// return nil, err
// }
// defer func() {
// transactionContext.RollbackTransaction()
// }()
// ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext})
//
// total, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in))
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// return tool_funs.SimpleWrapGridMap(total, rules), nil
//}
func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (interface{}, error) {
transactionContext, err := factory.ValidateStartTransaction(in)
if err != nil {
... ... @@ -220,6 +203,8 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i
ra := &adapter.RuleAdapter{}
ra.EvaluationRule = rule
ras = append(ras, ra)
total += 1
}
_, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)})
... ... @@ -234,6 +219,11 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i
ras[i].CreatorName = v
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return tool_funs.SimpleWrapGridMap(total, ras), nil
}
... ... @@ -271,5 +261,9 @@ func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (i
}
cas = append(cas, ca)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{"list": cas}, nil
}
... ...
... ... @@ -145,7 +145,7 @@ func GenerateSysRule(companyId int64) *EvaluationRule {
newRule := &EvaluationRule{
Id: 0,
Name: "评级(默认)",
Name: "评级",
Remark: "",
CompanyId: companyId,
CreatorId: 0,
... ...