Package ecar.pojo

Examples of ecar.pojo.TfuncacompConfigmailTfacfgm


   * @param pk
   * @return TfuncacompConfigmailTfacfgm
   * @throws ECARException
   */
  public TfuncacompConfigmailTfacfgm obter(TfuncacompConfigmailTfacfgmPK pk) throws ECARException {
    TfuncacompConfigmailTfacfgm obj;
   
    try {
      obj = (TfuncacompConfigmailTfacfgm) super.buscar(TfuncacompConfigmailTfacfgm.class, pk);
    } catch(Exception e) {
      obj = null;
View Full Code Here


            objetos.add( tipoFuncAcomp );

            // inserindo os TfuncacompConfigmailTfacfgm
            for ( Iterator it = lstTFuncAcompCfgm.iterator(  ); it.hasNext(  ); )
            {
                TfuncacompConfigmailTfacfgm tFuncAcompCfgm = (TfuncacompConfigmailTfacfgm) it.next(  );

                tFuncAcompCfgm.getComp_id(  ).setCodTpfa( tipoFuncAcomp.getCodTpfa(  ) );

                session.save( tFuncAcompCfgm );
                objetos.add( tFuncAcompCfgm );
            }
View Full Code Here

            objetos.add( tipoFuncAcomp );

            // deletando os TfuncacompConfigmailTfacfgm gravados
            for ( Iterator it = tipoFuncAcomp.getTfuncacompConfigmailTfacfgm(  ).iterator(  ); it.hasNext(  ); )
            {
                TfuncacompConfigmailTfacfgm tFuncAcompCfgm = (TfuncacompConfigmailTfacfgm) it.next(  );
                session.delete( tFuncAcompCfgm );
            }

            // inserindo os TfuncacompConfigmailTfacfgm
            for ( Iterator it = lstTFuncAcompCfgm.iterator(  ); it.hasNext(  ); )
            {
                TfuncacompConfigmailTfacfgm tFuncAcompCfgm = (TfuncacompConfigmailTfacfgm) it.next(  );
                session.save( tFuncAcompCfgm );
                objetos.add( tFuncAcompCfgm );
            }

            new ControlePermissao(  ).atualizarPermissoesPorFuncaoDeAcompanhamento( tipoFuncAcomp );
View Full Code Here

                tx = session.beginTransaction(  );

                // deletando os TfuncacompConfigmailTfacfgm gravados
                for ( Iterator it = tipoFuncAcomp.getTfuncacompConfigmailTfacfgm(  ).iterator(  ); it.hasNext(  ); )
                {
                    TfuncacompConfigmailTfacfgm tFuncAcompCfgm = (TfuncacompConfigmailTfacfgm) it.next(  );
                    session.delete( tFuncAcompCfgm );
                }

                session.delete( tipoFuncAcomp );
View Full Code Here

               
                TfuncacompConfigmailTfacfgmPK tfcfgmPK = new TfuncacompConfigmailTfacfgmPK();
                tfcfgmPK.setCodCfgm(configMailCfgm.getCodCfgm());
                tfcfgmPK.setCodTpfa(itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa().getCodTpfa());
               
                TfuncacompConfigmailTfacfgm tfcfm = (TfuncacompConfigmailTfacfgm) tfuncacompConfigmailTfacfgmDAO.buscar(TfuncacompConfigmailTfacfgm.class, tfcfgmPK);
               
                if ("S".equals(tfcfm.getEnviaMailTfacfgm())) {

                  //UsuarioUsu usu = (UsuarioUsu) usuDao.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getComp_id().getCodUsu());
                 
                  List usuarios = new ArrayList();
                  if (itemEstUsutpfacIetutfa.getUsuarioUsu() != null) {
View Full Code Here

            ItemEstUsutpfuacIettutfa itemEstUsutpfacIetutfa = (ItemEstUsutpfuacIettutfa) itList.next();
            TipoFuncAcompTpfa tipoFuncao = itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa();
            TfuncacompConfigmailTfacfgmPK tfcfgmPK = new TfuncacompConfigmailTfacfgmPK();
            tfcfgmPK.setCodCfgm(configMailCfgm.getCodCfgm());
            tfcfgmPK.setCodTpfa(tipoFuncao.getCodTpfa());
            TfuncacompConfigmailTfacfgm tfcfm = (TfuncacompConfigmailTfacfgm) tfuncacompConfigmailTfacfgmDAO.buscar(TfuncacompConfigmailTfacfgm.class, tfcfgmPK);
 
            //Verificando se j� existe posi��o liberada
            //Caso j� exista (indLiberadoArel) , n�o precisa mandar e-mail
            AcompRelatorioArel acompRelatorio = acompRelatorioDao.getAcompRelatorio(tipoFuncao, ari);
            if ( acompRelatorio != null && !"S".equals(acompRelatorio.getIndLiberadoArel()) ) {
             
              if ( itemEstUsutpfacIetutfa != null && itemEstUsutpfacIetutfa.getComp_id() != null && "S".equals(tfcfm.getEnviaMailTfacfgm()) ) {
               
                 
                //UsuarioUsu usu = (UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getComp_id().getCodUsu());
                List usuarios = new ArrayList();
                if (itemEstUsutpfacIetutfa.getUsuarioUsu() != null) {
                  usuarios.add((UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getUsuarioUsu().getCodUsu()));
                } else if (itemEstUsutpfacIetutfa.getSisAtributoSatb() != null){
                  usuarios.addAll(usuDAO.getUsuariosBySisAtributoSatb(itemEstUsutpfacIetutfa.getSisAtributoSatb()));
                }
               
                Iterator itUsu = usuarios.iterator();
               
                while (itUsu.hasNext()){
               
                  UsuarioUsu usu = (UsuarioUsu) itUsu.next()
               
                  if(!usuariosEmailEnviado.contains(usu)) {
                    usuariosEmailEnviado.add(usu);
                   
                    Long codIett = Long.valueOf(0);
                    String textoMail = "";
                    String assunto   = "";
                    String remetente = "";
                 
                    if( configMailCfgm.getTextosSiteMail() != null ) {
                      textoMail = configMailCfgm.getTextosSiteMail().getTextoTxts();
                      assunto   = configMailCfgm.getTextosSiteMail().getDescricaoUsoTxts();
                      remetente = configMailCfgm.getTextosSiteMail().getEmailResponsavelTxts();
                    }
                 
                    if( ari.getItemEstruturaIett() != null )
                      codIett = ari.getItemEstruturaIett().getCodIett();
                         
                    try{
                     
                      Evento evento = null;
                      evento = new EventoVencimentoLimiteParecer();
                      ConfiguracaoCfg configCfg = new ConfiguracaoDao(null).getConfiguracao();
                        String contextPath = configCfg.getContextPath();
                        String[] valores = new String[3];
                       
                        //"codTipoAcompanhamento",
                        valores[0] = ari.getAcompReferenciaAref().getTipoAcompanhamentoTa().getCodTa().toString();
                        // "referencia_hidden",
                        valores[1] = ari.getAcompReferenciaAref().getCodAref().toString();
                        // "codAri"
                        valores[2] = ari.getCodAri().toString();

                        link = URLEvento.montaURLEventoSemRequest(evento, contextPath, valores);
                     
                       
                      String html = "";
                      if(descricaoEvento != null && !"".equals(descricaoEvento)){
                        html = this.montaEmailComLinkDescricao(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link, descricaoEvento).toString();
                      } else{
                        html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link).toString();
                      }
                      //String html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), codIett, dataLimStr, acompRelatorio.getAcompReferenciaItemAri().getAcompReferenciaAref().getTipoAcompanhamentoTa().getDescricaoTa(), link).toString();
                     
                      if ((usu.getEmail1Usu() != null) && (!"".equals(usu.getEmail1Usu()))) {
                        Util.enviarEmail(assunto, this.nomeSistema, remetente, html, usu.getEmail1Usu(),"", "", usu);
                                       
                          org.apache.log4j.Logger.getLogger(this.getClass()).info(
                              "E-mail enviado (" +
                              Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                              " assunto: " + assunto +
                              " - remetente: " + remetente +
                              " - destinatarioPara: " + usu.getEmail1Usu()
                              );
                      } else {
                        String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                        Util.enviarEmail("[" + this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                          org.apache.log4j.Logger.getLogger(this.getClass()).info(
                              "E-mail enviado (" +
                              Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                              " assunto: " + assunto +
                              " - remetente: " + remetente +
                              " - destinatarioPara: " + remetente
                              );
                      }         
                    } catch (Exception e) {
                      org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
                      String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                      erro = erro + "<br>" + e.toString();
                      Util.enviarEmail("[" + this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "",usu);
                        org.apache.log4j.Logger.getLogger(this.getClass()).info(
                            "E-mail enviado (" +
                            Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                            " assunto: " + assunto +
                            " - remetente: " + remetente +
                            " - destinatarioPara: " + remetente
                            );
                      this.enviarEmailExcecao("AgendadorEmail.eMailVenctoParecer() (1)", e);
                    }
                  }
                }
              }
             
              if ("S".equals(tfcfm.getEnviaSms())) {
                // envia sms
              }
            }
          }
         
View Full Code Here

            ItemEstUsutpfuacIettutfa itemEstUsutpfacIetutfa = (ItemEstUsutpfuacIettutfa) itList.next();
            TfuncacompConfigmailTfacfgmPK tfcfgmPK = new TfuncacompConfigmailTfacfgmPK();
            tfcfgmPK.setCodCfgm(configMailCfgm.getCodCfgm());
            tfcfgmPK.setCodTpfa(itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa().getCodTpfa());
           
            TfuncacompConfigmailTfacfgm tfcfm = (TfuncacompConfigmailTfacfgm) tfuncacompConfigmailTfacfgmDAO.buscar(TfuncacompConfigmailTfacfgm.class, tfcfgmPK);
 
            List acompRealFisicoList = acompRealFisicoDao.getIndResulByAcompRefItemBySituacao(ari, Dominios.TODOS, false);
            Iterator itArf = acompRealFisicoList.iterator();
            boolean faltaArf = false;
            while (itArf.hasNext())
            {
              AcompRealFisicoArf arf = (AcompRealFisicoArf) itArf.next();
              if (arf.getQtdRealizadaArf() == null)
                faltaArf = true;
            }
           
            List novosIndicadores = ariDAO.getNovosIndicadores(ari);
            Iterator itIndicadores = novosIndicadores.iterator();
            if(itIndicadores.hasNext()){
              faltaArf = true;
            }
           
           
            //depois apagar o item
            if (("S".equals(tfcfm.getEnviaMailTfacfgm())) && (faltaArf)) {

              //UsuarioUsu usu = (UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getComp_id().getCodUsu());
                           
              List usuarios = new ArrayList();
              if (itemEstUsutpfacIetutfa.getUsuarioUsu() != null) {
                usuarios.add((UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getUsuarioUsu().getCodUsu()));
              } else if (itemEstUsutpfacIetutfa.getSisAtributoSatb() != null){
                usuarios.addAll(usuDAO.getUsuariosBySisAtributoSatb(itemEstUsutpfacIetutfa.getSisAtributoSatb()));
              }
             
              Iterator itUsu = usuarios.iterator();
             
              while (itUsu.hasNext()){
             
                UsuarioUsu usu = (UsuarioUsu) itUsu.next();
             
           
                if(!usuariosEmailEnviado.contains(usu)) {
                  usuariosEmailEnviado.add(usu);
 
                  Long   codIett   = Long.valueOf(0);
                  String textoMail = "";
                  String assunto   = "";
                  String remetente = "";
               
                  if( configMailCfgm.getTextosSiteMail() != null ) {
                    textoMail = configMailCfgm.getTextosSiteMail().getTextoTxts();
                    assunto   = configMailCfgm.getTextosSiteMail().getDescricaoUsoTxts();
                    remetente = configMailCfgm.getTextosSiteMail().getEmailResponsavelTxts();
                  }
               
                  if( ari.getItemEstruturaIett() != null )
                    codIett = ari.getItemEstruturaIett().getCodIett();
                       
                  try {
                   
                    Evento evento = null;
                    evento = new EventoVencimentoLimiteFisico();
                    ConfiguracaoCfg configCfg = new ConfiguracaoDao(null).getConfiguracao();
                      String contextPath = configCfg.getContextPath();
                      String[] valores = new String[3];//codAri, codTipoAcompanhamento
                     // "codTipoAcompanhamento",
                      valores[0] = ari.getAcompReferenciaAref().getTipoAcompanhamentoTa().getCodTa().toString();
                      //"referencia_hidden",
                      valores[1] = ari.getAcompReferenciaAref().getCodAref().toString();
                                  //"codAri"
                      valores[2] = ari.getCodAri().toString();
                     
                     
                     
                 
                      link = URLEvento.montaURLEventoSemRequest(evento, contextPath, valores);
                   
                    String html = "";
                    if(descricaoEvento != null && !"".equals(descricaoEvento)){
                      html = this.montaEmailComLinkDescricao(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link, descricaoEvento).toString();
                    } else{
                      html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link).toString();
                    }
                    //String html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), codIett, dataLimStr, ari.getAcompReferenciaAref().getTipoAcompanhamentoTa().getDescricaoTa(), link).toString();
                    if ((usu.getEmail1Usu() != null) && (!"".equals(usu.getEmail1Usu()))) {
                      Util.enviarEmail(assunto, this.nomeSistema, remetente, html, usu.getEmail1Usu(),"", "", usu);
                                   
                        org.apache.log4j.Logger.getLogger(this.getClass()).info(
                            "E-mail enviado (" +
                            Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                            " assunto: " + assunto +
                            " - remetente: " + remetente +
                            " - destinatarioPara: " + usu.getEmail1Usu()
                            );
                    } else {
                      String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                      Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                        org.apache.log4j.Logger.getLogger(this.getClass()).info(
                            "E-mail enviado (" +
                            Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                            " assunto: " + assunto +
                            " - remetente: " + remetente +
                            " - destinatarioPara: " + remetente
                            );
                    }
                  }catch (Exception e) {
                    org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
                    String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                    erro = erro + "<br>" + e.toString();
                    Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                      org.apache.log4j.Logger.getLogger(this.getClass()).info(
                          "E-mail enviado (" +
                          Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                          " assunto: " + assunto +
                          " - remetente: " + remetente +
                          " - destinatarioPara: " + remetente
                          );
                    this.enviarEmailExcecao("AgendadorEmail.eMailVenctoLimiteFisico() (1)", e);
                  }
                }
              }
            }
           
            if ("S".equals(tfcfm.getEnviaSms())) {
              // envia sms
            }
          }
        }
      }
View Full Code Here

              tfcfgmPK.setCodCfgm(configMailCfgm.getCodCfgm());
             
              if(itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa() != null)
                tfcfgmPK.setCodTpfa(itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa().getCodTpfa());
             
              TfuncacompConfigmailTfacfgm tfcfm = null;
             
              try {
                tfcfm = (TfuncacompConfigmailTfacfgm) tfuncacompConfigmailTfacfgmDAO.buscar(TfuncacompConfigmailTfacfgm.class, tfcfgmPK);
              catch(Exception e) {
                tfcfm = null;
              }
               
              if (tfcfm != null && "S".equals(tfcfm.getEnviaMailTfacfgm())) {
               
                //UsuarioUsu usu = (UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getComp_id().getCodUsu());
                List usuarios = new ArrayList();
                if (itemEstUsutpfacIetutfa.getUsuarioUsu() != null) {
                  usuarios.add((UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getUsuarioUsu().getCodUsu()));
                } else if (itemEstUsutpfacIetutfa.getSisAtributoSatb() != null){
                  usuarios.addAll(usuDAO.getUsuariosBySisAtributoSatb(itemEstUsutpfacIetutfa.getSisAtributoSatb()));
                }
               
                Iterator itUsu = usuarios.iterator();
               
                while (itUsu.hasNext()){
               
                  UsuarioUsu usu = (UsuarioUsu) itUsu.next();
               
                  if(!usuariosEmailEnviado.contains(usu)) {
                    usuariosEmailEnviado.add(usu);
   
                    Long   codIett = Long.valueOf(0);
                    String textoMail = "";
                    String assunto   = "";
                    String remetente = "";
                 
                    if( configMailCfgm.getTextosSiteMail() != null ) {
                      textoMail = configMailCfgm.getTextosSiteMail().getTextoTxts();
                      assunto   = configMailCfgm.getTextosSiteMail().getDescricaoUsoTxts();
                      remetente = configMailCfgm.getTextosSiteMail().getEmailResponsavelTxts();
                    }
                 
                    codIett = iett.getCodIett();
                             
                    try {
                     
                      Evento evento = null;
                      evento = new EventoVencimentoLimitePontoCritico();
                      ConfiguracaoCfg configCfg = new ConfiguracaoDao(null).getConfiguracao();
                        String contextPath = configCfg.getContextPath();
                        String[] valores = new String[3];//codIett, codAba
                       
                        valores[0] = iett.getCodIett().toString();
                       
                       EstruturaFuncaoDao estruturaFuncaoDao = new EstruturaFuncaoDao(null);
                      boolean existeAbaPontosCriticos = estruturaFuncaoDao.existeFuncaoPontosCriticos(iett.getEstruturaEtt());
                     
       
                       //S� envia email se existir Aba Pontos Criticos para a Estrutura
                      if(existeAbaPontosCriticos) {
                       
                        FuncaoDao funcaoDao = new FuncaoDao(null);
                        long codPontosCriticos = funcaoDao.getCodFuncaoPontosCriticos();
                        valores[1] = String.valueOf(codPontosCriticos);
                     
                          if(iett.getEstruturaEtt() != null) {
                          Long codEttSelecionado = iett.getEstruturaEtt().getCodEtt();
                          if(codEttSelecionado != null) {
                            valores[2] = codEttSelecionado.toString();
                          }
                        }
                         
                        // monta a url
                          link = URLEvento.montaURLEventoSemRequest(evento, contextPath, valores);
                        String html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), null, codIett,
                                "Alerta de criticidade de data: <img src=\""+this.contextPath+"/images/pc"+corRelogio+"1.png\">",
                                dataCompStr, null, null, null, link).toString();
                        if ((usu.getEmail1Usu() != null) && (!"".equals(usu.getEmail1Usu())))
                        {
                          if ((assunto == null) || (assunto.length() <= 0)) {
                            assunto = "Alerta de criticidade de data";
                          }
                                       
                          Util.enviarEmail(assunto, this.nomeSistema, remetente, html, usu.getEmail1Usu(),"", "", usu);
                          org.apache.log4j.Logger.getLogger(this.getClass()).info(
                                "E-mail enviado (" +
                                Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                                " assunto: " + assunto +
                                " - remetente: " + remetente +
                                " - destinatarioPara: " + usu.getEmail1Usu()
                                );
                       
                        else
                        {
                          String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                          Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                            org.apache.log4j.Logger.getLogger(this.getClass()).info(
                                "E-mail enviado (" +
                                Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                                " assunto: " + assunto +
                                " - remetente: " + remetente +
                                " - destinatarioPara: " + remetente
                                );
                        }
                       
                      }
                   
                       
                       
                    }catch (Exception e) {
                      org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
                      String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                      erro = erro + "<br>" + e.toString();
                      Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                        org.apache.log4j.Logger.getLogger(this.getClass()).info(
                            "E-mail enviado (" +
                            Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                            " assunto: " + assunto +
                            " - remetente: " + remetente +
                            " - destinatarioPara: " + remetente
                            );
                      this.enviarEmailExcecao("AgendadorEmail.eMailVenctoPontoCritico() (1)", e);
                    }             
                  }
                }
              }
             
              if ("S".equals(tfcfm.getEnviaSms())) {
                // envia sms
              }
            }
          }
        }
View Full Code Here

         
          TfuncacompConfigmailTfacfgmPK tfcfgmPK = new TfuncacompConfigmailTfacfgmPK();
          tfcfgmPK.setCodCfgm(configMailCfgm.getCodCfgm());
          tfcfgmPK.setCodTpfa(itemEstUsutpfacIetutfa.getTipoFuncAcompTpfa().getCodTpfa());
         
          TfuncacompConfigmailTfacfgm tfcfm = (TfuncacompConfigmailTfacfgm) tfuncacompConfigmailTfacfgmDAO.
                buscar(TfuncacompConfigmailTfacfgm.class, tfcfgmPK);
         
          // se a funcao de acompanhamento estiver configurada para receber email (configura��o estrutura/funcao acompanhamento)
          if ("S".equals(tfcfm.getEnviaMailTfacfgm())) {
           
            //UsuarioUsu usu = (UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getComp_id().getCodUsu());
            List usuarios = new ArrayList();
            if (itemEstUsutpfacIetutfa.getUsuarioUsu() != null) {
              usuarios.add((UsuarioUsu) usuDAO.buscar(UsuarioUsu.class, itemEstUsutpfacIetutfa.getUsuarioUsu().getCodUsu()));
            } else if (itemEstUsutpfacIetutfa.getSisAtributoSatb() != null){
              usuarios.addAll(usuDAO.getUsuariosBySisAtributoSatb(itemEstUsutpfacIetutfa.getSisAtributoSatb()));
            }
           
            Iterator itUsu = usuarios.iterator();
           
            while (itUsu.hasNext()){
           
              UsuarioUsu usu = (UsuarioUsu) itUsu.next();
         
              if(!usuariosEmailEnviado.contains(usu)) {
                usuariosEmailEnviado.add(usu);
                Long codIett = Long.valueOf(0);
                String textoMail = "";
                String assunto   = "";
                String remetente = "";
             
                if( configMailCfgm.getTextosSiteMail() != null ) {
                  textoMail = configMailCfgm.getTextosSiteMail().getTextoTxts();
                  assunto   = configMailCfgm.getTextosSiteMail().getDescricaoUsoTxts();
                  remetente = configMailCfgm.getTextosSiteMail().getEmailResponsavelTxts();
                }
             
                codIett = iett.getCodIett();
                   
                try {
                 
                  String html = "";
                  if(eventDesc != null && !"".equals(eventDesc)){
                    switch(configMailCfgm.getCodCfgm().intValue()) {
                      case 7: // data termino item   
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataTerminoIett());
                        break;
                      case 8: // data inicio item         
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataInicioIett());
                        break;
                      case 9: // data reserva 1         
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR1());
                        //Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR1());;
                        break;
                      case 10: // data reserva 2         
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR2());
                        break;
                      case 11: // data reserva 3         
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR3());
                        break;
                      case 12: // data reserva 4         
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR4());
                        break;
                      case 13: // data reserva 5
                        eventDesc += Data.parseDate(itemEstUsutpfacIetutfa.getItemEstruturaIett().getDataR5());
                        break;
                    }
                   
                    html = this.montaEmailComLinkDescricao(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link, eventDesc).toString();
                  } else{
                    html = this.montaEmailComLink(textoMail, usu.getNomeUsu(), codIett, dataLimStr, null, link).toString();
                  }
                   
                  if ((usu.getEmail1Usu() != null) && (!"".equals(usu.getEmail1Usu()))) {
                    Util.enviarEmail(assunto, this.nomeSistema, remetente, html, usu.getEmail1Usu(),"", "", usu);
                     
                    org.apache.log4j.Logger.getLogger(this.getClass()).info(
                          "E-mail enviado (" +
                          Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                          " assunto: " + assunto +
                          " - remetente: " + remetente +
                          " - destinatarioPara: " + usu.getEmail1Usu()
                          );
                  } else {
                    String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                    Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                      org.apache.log4j.Logger.getLogger(this.getClass()).info(
                          "E-mail enviado (" +
                          Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                          " assunto: " + assunto +
                          " - remetente: " + remetente +
                          " - destinatarioPara: " + remetente
                          );
                  }     
                }catch (Exception e) {
                  org.apache.log4j.Logger.getLogger(this.getClass()).error(e);
                  String erro = "Erro na tentativa de enviar e-mail para o usuario " + usu.getNomeUsu() + "(Cod: " + usu.getCodUsu() + ")<br> Verifique o e-mail e o nome do mesmo no cadastro de usuarios";
                  erro = erro + "<br>" + e.toString();
                  Util.enviarEmail("["+ this.nomeSistema + "] Erro de Envio de Email", this.nomeSistema, remetente, erro, remetente, "", "", usu);
                    org.apache.log4j.Logger.getLogger(this.getClass()).info(
                        "E-mail enviado (" +
                        Data.getDataAtual() + " " + Data.getHoraAtual(true) + "): " +
                        " assunto: " + assunto +
                        " - remetente: " + remetente +
                        " - destinatarioPara: " + remetente
                        );
                  this.enviarEmailExcecao("AgendadorEmail.eMailGenerico() (1)", e);
                }
              }
            }
          }
         
          if ("S".equals(tfcfm.getEnviaSms())) {
            // envia sms
          }
        }
      }
    } catch(Exception e) {
View Full Code Here

TOP

Related Classes of ecar.pojo.TfuncacompConfigmailTfacfgm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.