|
@@ -354,19 +354,15 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
@@ -354,19 +354,15 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
354
|
if err := transactionContext.CommitTransaction(); err != nil {
|
354
|
if err := transactionContext.CommitTransaction(); err != nil {
|
355
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
355
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
356
|
}
|
356
|
}
|
357
|
- err = srv.SaveTaskLevel(param.LevelName, param.CompanyId)
|
|
|
358
|
- if err != nil {
|
|
|
359
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存任务等级"+err.Error())
|
|
|
360
|
- }
|
|
|
361
|
return map[string]interface{}{
|
357
|
return map[string]interface{}{
|
362
|
"id": param.Id,
|
358
|
"id": param.Id,
|
363
|
}, nil
|
359
|
}, nil
|
364
|
}
|
360
|
}
|
365
|
|
361
|
|
366
|
-func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error {
|
362
|
+func (srv TaskService) SaveTaskLevel(param *command.CreateTaskLevelCommand) error {
|
367
|
defalutLevel := domain.DefaultTaskLevel()
|
363
|
defalutLevel := domain.DefaultTaskLevel()
|
368
|
for _, val := range defalutLevel {
|
364
|
for _, val := range defalutLevel {
|
369
|
- if val.LevelName == levelName {
|
365
|
+ if val.LevelName == param.LevelName {
|
370
|
return nil
|
366
|
return nil
|
371
|
}
|
367
|
}
|
372
|
}
|
368
|
}
|
|
@@ -384,8 +380,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
|
@@ -384,8 +380,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
384
|
"transactionContext": transactionContext,
|
380
|
"transactionContext": transactionContext,
|
385
|
})
|
381
|
})
|
386
|
cnt, _, err := taskLevelRepo.Find(map[string]interface{}{
|
382
|
cnt, _, err := taskLevelRepo.Find(map[string]interface{}{
|
387
|
- "companyId": companyId,
|
|
|
388
|
- "levelName": levelName,
|
383
|
+ "companyId": param.CompanyId,
|
|
|
384
|
+ "levelName": param.LevelName,
|
389
|
"limit": 1,
|
385
|
"limit": 1,
|
390
|
})
|
386
|
})
|
391
|
if err != nil {
|
387
|
if err != nil {
|
|
@@ -396,8 +392,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
|
@@ -396,8 +392,8 @@ func (srv TaskService) SaveTaskLevel(levelName string, companyId int) error { |
396
|
}
|
392
|
}
|
397
|
newTaskLevel := domain.TaskLevel{
|
393
|
newTaskLevel := domain.TaskLevel{
|
398
|
Id: 0,
|
394
|
Id: 0,
|
399
|
- LevelName: levelName,
|
|
|
400
|
- CompanyId: companyId,
|
395
|
+ LevelName: param.LevelName,
|
|
|
396
|
+ CompanyId: param.CompanyId,
|
401
|
}
|
397
|
}
|
402
|
err = taskLevelRepo.Save(&newTaskLevel)
|
398
|
err = taskLevelRepo.Save(&newTaskLevel)
|
403
|
if err != nil {
|
399
|
if err != nil {
|