作者 郑周

1. 修复 任务操作日志

... ... @@ -205,7 +205,7 @@ func compareStage(u *domain.UserAuth, id int, srcStage []*domain.TaskStage, newS
}
if it.PlanCompletedAt != v.PlanCompletedAt {
logOpt := createdLogOpt(u, taskId)
logOpt.OptField = "修改了里程碑" + it.Name + "计划完成时间"
logOpt.OptField = "修改了里程碑" + it.Name + "计划完成时间"
if it.PlanCompletedAt == 0 {
logOpt.OptValue = "未设置时间"
} else {
... ... @@ -230,15 +230,24 @@ func getUserMap(ids []int) (map[int]*domain.User, error) {
if len(ids) == 0 {
return userMap, nil
}
transactionContext, err := factory.CreateTransactionContext(nil)
transactionContext, err := factory.StartTransaction()
if err != nil {
return userMap, err
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
_, users, err := userRepo.Find(map[string]interface{}{"ids": ids, "limit": len(ids)})
if err != nil {
return userMap, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
for i := range users {
user := users[i]
userMap[int(user.Id)] = user
... ...
... ... @@ -284,7 +284,8 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand, userReq *dom
var copyTask = taskData.Copy()
var copyStageList = make([]*domain.TaskStage, 0)
for _, v := range stageList {
copyStageList = append(copyStageList, v)
c := v.Copy()
copyStageList = append(copyStageList, &c)
}
//更新任务的相关人员
... ...