Difficulties with Logic A

Asked

Viewed 45 times

0

Well the scenario is the following I am trying to develop an electronic point through my application but I locked in the logic of authentication of the dates and hours of work following in the logic I have at the moment it authenticates the date correctly but when will authenticate the input instead of authenticating the value on the same line or using the same id it authenticates on another line he create a new record hopefully someone can help me with this issue follows the logic I’m developing.

List<Folha> findDateUser = folhaService.findByDateAndUser(data, usuario.getId());

    for (Folha listaCompleta : findDateUser) {

        if (listaCompleta.getData() == null) {

            listaCompleta.getIdFolha();
            listaCompleta.setData(data);
            listaCompleta.setUsuario(usuario);
            folhaDAO.persistir(listaCompleta);

        } else if (listaCompleta.getData() != null) {

            listaCompleta.getIdFolha();
            listaCompleta.setData(data);
            listaCompleta.setEntrada(entrada);
            listaCompleta.setUsuario(usuario);

            folhaDAO.update(listaCompleta);


        }
    }
  • Only with the posted I find it difficult to help, I can only say that this excerpt can be quite simplicate.

  • what can I do to simplify this logic ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.