...
|
...
|
@@ -354,19 +354,15 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
err = srv.SaveTaskLevel(param.LevelName, param.CompanyId)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存任务等级"+err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"id": param.Id,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error {
|
|
|
func (srv TaskService) SaveTaskLevel(param *command.CreateTaskLevelCommand) error {
|
|
|
defalutLevel := domain.DefaultTaskLevel()
|
|
|
for _, val := range defalutLevel {
|
|
|
if val.LevelName == levelName {
|
|
|
if val.LevelName == param.LevelName {
|
|
|
return nil
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -384,8 +380,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
cnt, _, err := taskLevelRepo.Find(map[string]interface{}{
|
|
|
"companyId": companyId,
|
|
|
"levelName": levelName,
|
|
|
"companyId": param.CompanyId,
|
|
|
"levelName": param.LevelName,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
...
|
...
|
@@ -396,8 +392,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
|
|
}
|
|
|
newTaskLevel := domain.TaskLevel{
|
|
|
Id: 0,
|
|
|
LevelName: levelName,
|
|
|
CompanyId: companyId,
|
|
|
LevelName: param.LevelName,
|
|
|
CompanyId: param.CompanyId,
|
|
|
}
|
|
|
err = taskLevelRepo.Save(&newTaskLevel)
|
|
|
if err != nil {
|
...
|
...
|
|