作者 Your Name

更新数据

... ... @@ -331,16 +331,16 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
// 根据项目评估的配置,创建员工的评估任务
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, 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()
// }()
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()
}()
log.Logger.Debug("CreateStaffAssessTask 获取参数", map[string]interface{}{
"param": param,
})
... ... @@ -356,10 +356,6 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
return nil, application.ThrowError(application.ARG_ERROR, "任务结束时间填写错误,"+param.EndTime)
}
nowTime := time.Now()
// if len(assassessTaskList) > 0 {
// assessTaskData = assassessTaskList[0]
// assessTaskData.UpdatedAt = nowTime
// } else {
//建立评估任务
assessTaskData := &domain.StaffAssessTask{
Id: 0,
... ... @@ -458,9 +454,9 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext applicat
}
}
// if err := transactionContext.CommitTransaction(); 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())
}
return map[string]interface{}{
"assessTaskId": assessTaskData.Id,
}, nil
... ... @@ -551,11 +547,11 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application.
stepSelfTemp.LinkNodeId = v.LinkNodeId
stepSelfTemp.LinkNodeName = v.LinkNodeName
stepSelfTemp.Types = domain.AssessSuper
assessListTemp, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap)
assessListTemp2, err := srv.createStaffAssessSupper(transactionContext, stepSelfTemp, userList, userDepartmentMap)
if err != nil {
return nil, err
}
assessList = append(assessList, assessListTemp...)
assessList = append(assessList, assessListTemp2...)
}
}
return assessList, nil
... ...