我有脑力劳动但在这种情况下不知道该怎么做:
process.flatMap({ case (..., processSteps, ...) =>
Future.sequence {
processSteps.map { step =>
val prerequisiteFuture = processStepPrerequisitesDTO.getProcessStepPrerequisiteProcessTemplateIds(step.id.get)
prerequisiteFuture.map(prereqTemplates => {
Future.successful{
processTemplateDTO.getProessTemplatesForStepPreqrequsites(prereqTemplates).map(pres => {
println("Returning something", pres) // they are printed
step.stepPrerequisites = Some(pres)
})
}
println("Obviously empty", step.stepPrerequisites)
step // line x
})
}
}.map { stepTemplates =>
Ok(Json.obj(
...
"steps" -> stepTemplates,
...
))
}
})
我怎样才能让第x行的step.prerequisites
不再为空?谢谢!