From 5d3fa630c38328eeb5efb85cede99348cc1ba08e Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 19 Aug 2024 13:00:30 -0300 Subject: [PATCH 1/7] AL-4466 --- pom.xml | 6 +- .../catalogos/EditarEmpresaController.java | 153 +++++++++++++++++- .../RenderEmpresaEmpresaConfigLayout.java | 41 +++++ src/java/spring-config.xml | 1 + web/WEB-INF/i3-label_en.label | 8 + web/WEB-INF/i3-label_es_MX.label | 8 + web/WEB-INF/i3-label_fr_FR.label | 8 + web/WEB-INF/i3-label_pt_BR.label | 7 + web/gui/catalogos/editarEmpresa.zul | 56 ++++++- 9 files changed, 280 insertions(+), 8 deletions(-) create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresaEmpresaConfigLayout.java diff --git a/pom.xml b/pom.xml index 4d9003331..078872d68 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ 4.0.0 br.com.rjconsultores ventaboletosadm - 1.126.2 + 1.126.4 war - 1.96.0 - 1.84.0 + 1.96.2 + 1.85.0 UTF-8 diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java index 7730b19e2..ee9102478 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java @@ -89,6 +89,7 @@ import com.rjconsultores.ventaboletos.entidad.EmpresaAsistenciaDeViajeConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaCertificadoConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaCieloLinkConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaComprovantePassagemConfig; +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; import com.rjconsultores.ventaboletos.entidad.EmpresaCrediBancoConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; @@ -110,6 +111,7 @@ import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; import com.rjconsultores.ventaboletos.enums.EnumTipoCertificado; import com.rjconsultores.ventaboletos.enums.EnumTipoIntegracao; import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade; @@ -124,6 +126,7 @@ import com.rjconsultores.ventaboletos.service.EmpresaAsistenciaDeViajeConfigServ import com.rjconsultores.ventaboletos.service.EmpresaCertificadoConfigService; import com.rjconsultores.ventaboletos.service.EmpresaCieloLinkService; import com.rjconsultores.ventaboletos.service.EmpresaComprovantePassagemConfigService; +import com.rjconsultores.ventaboletos.service.EmpresaConfigLayoutService; import com.rjconsultores.ventaboletos.service.EmpresaCrediBancoConfigService; import com.rjconsultores.ventaboletos.service.EmpresaEmailConfigService; import com.rjconsultores.ventaboletos.service.EmpresaEmailEComerceService; @@ -143,6 +146,7 @@ import com.rjconsultores.ventaboletos.service.ImpresionLayoutConfigService; import com.rjconsultores.ventaboletos.service.InstiFinanceiraService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.service.TipoVentaService; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; @@ -163,6 +167,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderComEmpCategoria import com.rjconsultores.ventaboletos.web.utilerias.render.RenderComEmpFormapago; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderComEmpTipoEventoExtra; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaContaBancaria; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaEmpresaConfigLayout; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaImposto; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaInscricaoEstadual; @@ -229,6 +234,9 @@ public class EditarEmpresaController extends MyGenericForwardComposer { private EmpresaPMArtespConfigService empresaPMArtespConfigService; @Autowired private OrgaoConcedenteService orgaoConcedenteService; + @Autowired + private TipoVentaService tipoVentaService; + private List lsTiposVenta; private Empresa empresa; private EmpresaEmail empresaEmail; @@ -629,6 +637,15 @@ public class EditarEmpresaController extends MyGenericForwardComposer { private MyComboboxImpresionLayoutConfig cmbImpresionLayoutConfigEmail; private ImpresionLayoutConfigService impresionLayoutConfigService; + + private Combobox cmbConfigLayoutTiposVenda; + private MyComboboxImpresionLayoutConfig cmbImpresionLayoutConfig; + private MyListbox empresaLayoutConfigList; + private Checkbox chkindLayoutEmailConfig; + private List lsEmpresaConfigLayout; + + @Autowired + private EmpresaConfigLayoutService empresaConfigLayoutService; private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; @@ -650,7 +667,8 @@ public class EditarEmpresaController extends MyGenericForwardComposer { lsTodosEstados = estadoService.obtenerTodos(); lsCidades = new ArrayList(); - lsBanco = instFinanceiraService.obtenerTodos(); + lsBanco = instFinanceiraService.obtenerTodos(); + lsTiposVenta = tipoVentaService.obtenerTodos(); if (empresa != null && empresa.getEmpresaId() != null) { empresaEmail = empresaEmailService.buscarPorEmpresa(empresa); @@ -664,6 +682,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { empresaAsistenciaDeViajeConfig = empresaAsistenciaDeViajeConfigService.buscarByEmpresa(empresa.getEmpresaId()); empresaComprovantePassagemConfig = empresaComprovantePassagemConfigService.buscarByEmpresa(empresa.getEmpresaId()); empresaPMArtespConfig = empresaPMArtespConfigService.buscarPorEmpresa(empresa); + lsEmpresaConfigLayout = empresaConfigLayoutService.buscarByEmpresa(empresa.getEmpresaId()); } if (empresa != null && empresa.getEmpresaId() != null) { @@ -969,8 +988,9 @@ public class EditarEmpresaController extends MyGenericForwardComposer { txtNumInscricaoMunicipal.setValue("ISENTO"); txtNumInscricaoMunicipal.setDisabled(true); ckIsento.setChecked(true); + + empresaLayoutConfigList.setItemRenderer(new RenderEmpresaEmpresaConfigLayout()); - if (empresa.getEmpresaId() != null) { empresa = empresaService.obtenerID(empresa.getEmpresaId()); lsEmpresaImposto = empresaImpostoService.buscarByEmpresa(empresa); @@ -983,6 +1003,8 @@ public class EditarEmpresaController extends MyGenericForwardComposer { //retirar caracteres cnpj - mantis: 16363 retirarCaracteresEspeciaisCNPJ(); + + empresaLayoutConfigList.setData(lsEmpresaConfigLayout); } txtNome.focus(); @@ -1553,7 +1575,9 @@ public class EditarEmpresaController extends MyGenericForwardComposer { adicionaInformacoesCrediBanco(); adicionaInformacoesAsistenciaDeViaje(); adicionaInformacoesComprovantePassagem(); - + + salvarEmpresaConfigLayout(); + //INTEGRACAO TIPO DE PASSAGEM PM ARTESP salvarEmpresaPMArtespConfig(); @@ -1635,6 +1659,25 @@ public class EditarEmpresaController extends MyGenericForwardComposer { } } + private void salvarEmpresaConfigLayout() { + + for (EmpresaConfigLayout empresaEmpresaConfigLayoutInTheList : lsEmpresaConfigLayout) { + + if (empresaEmpresaConfigLayoutInTheList != null + && empresaEmpresaConfigLayoutInTheList.getEmpresaconfiglayoutId() != null) { + if (empresaEmpresaConfigLayoutInTheList.getActivo()) { + empresaConfigLayoutService.actualizacion(empresaEmpresaConfigLayoutInTheList); + } else { + empresaConfigLayoutService.borrar(empresaEmpresaConfigLayoutInTheList); + } + + } else { + empresaConfigLayoutService.suscribir(empresaEmpresaConfigLayoutInTheList); + } + + } + } + private Date buscarHora(Date horaEmbarque) { if (horaEmbarque != null) { GregorianCalendar gHoraSalida = new GregorianCalendar(); @@ -2953,7 +2996,85 @@ public void onClick$btnTestEmailFlexBus(Event ev) throws InterruptedException { return true; } - + + public void onClick$btnAdicionarConfigLayout(Event ev) throws InterruptedException { + + if (cmbConfigLayoutTiposVenda.getSelectedItem() == null || cmbImpresionLayoutConfig.getSelectedItem() == null) { + return; + } + + TipoVenta tipoVenta = (TipoVenta) cmbConfigLayoutTiposVenda.getSelectedItem().getValue(); + ImpresionLayoutConfig impresionLayoutConfig = (ImpresionLayoutConfig) cmbImpresionLayoutConfig.getSelectedItem() + .getValue(); + + EmpresaConfigLayout empresaConfigLayoutToAdd = new EmpresaConfigLayout(); + empresaConfigLayoutToAdd.setActivo(Boolean.TRUE); + empresaConfigLayoutToAdd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + empresaConfigLayoutToAdd.setFecmodif(Calendar.getInstance().getTime()); + empresaConfigLayoutToAdd.setEmpresa(empresa); + empresaConfigLayoutToAdd.setTipoVenta(tipoVenta); + empresaConfigLayoutToAdd.setImpresionlayoutconfigId(impresionLayoutConfig); + empresaConfigLayoutToAdd.setIndEmail(chkindLayoutEmailConfig.isChecked()); + + boolean achou = Boolean.FALSE; + for (EmpresaConfigLayout empresaEmpresaConfigLayoutInTheList : lsEmpresaConfigLayout) { + if (empresaEmpresaConfigLayoutInTheList != null && empresaEmpresaConfigLayoutInTheList.getActivo() + && empresaConfigLayoutToAdd.getTipoVenta() + .equals(empresaEmpresaConfigLayoutInTheList.getTipoVenta()) + && empresaConfigLayoutToAdd.getImpresionlayoutconfigId() + .equals(empresaEmpresaConfigLayoutInTheList.getImpresionlayoutconfigId()) + && empresaConfigLayoutToAdd.getIndEmail() + .equals(empresaEmpresaConfigLayoutInTheList.getIndEmail())) { + achou = Boolean.TRUE; + } + } + + if (!achou) { + lsEmpresaConfigLayout.add(empresaConfigLayoutToAdd); + + List tempList = new ArrayList(); + if (lsEmpresaContaBancaria != null) { + for (EmpresaConfigLayout empresaConfigLayout : lsEmpresaConfigLayout) { + if (empresaConfigLayout.getActivo()) { + tempList.add(empresaConfigLayout); + } + } + } + + empresaLayoutConfigList.setData(tempList); + + } else { + Messagebox.show(Labels.getLabel("editarEmpresaController.MSG.jaExisteConfigLayoutComAsMesmasInfoCadastradas"), + Labels.getLabel("editarEmpresaController.tabConfiguracaoLayout.value"), Messagebox.OK, + Messagebox.EXCLAMATION); + } + + + } + + public void onClick$btnRemoverConfigLayout(Event ev) { + + EmpresaConfigLayout empresaToRemove = (EmpresaConfigLayout) empresaLayoutConfigList.getSelected(); + + if (empresaToRemove != null) { + lsEmpresaConfigLayout.remove(empresaToRemove); + empresaToRemove.setFecmodif(Calendar.getInstance().getTime()); + empresaToRemove.setActivo(Boolean.FALSE); + empresaToRemove.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + lsEmpresaConfigLayout.add(empresaToRemove); + empresaLayoutConfigList.updateItem(empresaToRemove); + empresaLayoutConfigList.removeItem(empresaToRemove); + } else { + try { + Messagebox.show(Labels.getLabel("editarEmpresaController.MSG.selecioneUmItemConfigLayout"), + Labels.getLabel("editarEmpresaController.tabConfiguracaoLayout.value"), Messagebox.OK, + Messagebox.EXCLAMATION); + } catch (InterruptedException e) { + EditarEmpresaController.log.error("editarEmpresaController: " + e); + } + } + } + private void retirarCaracteresEspeciaisCNPJ() { if(empresa != null && empresa.getCnpj() != null && empresa.getCnpj().contains("-") || empresa.getCnpj().contains(".") || empresa.getCnpj().contains("/")) { @@ -3665,5 +3786,29 @@ public void onClick$btnTestEmailFlexBus(Event ev) throws InterruptedException { public void setLsTipoIntegracao(List lsTipoIntegracao) { this.lsTipoIntegracao = lsTipoIntegracao; } + + public List getLsTiposVenta() { + return lsTiposVenta; + } + + public void setLsTiposVenta(List lsTiposVenta) { + this.lsTiposVenta = lsTiposVenta; + } + + public List getLsEmpresaConfigLayout() { + return lsEmpresaConfigLayout; + } + + public void setLsEmpresaConfigLayout(List lsEmpresaConfigLayout) { + this.lsEmpresaConfigLayout = lsEmpresaConfigLayout; + } + + public MyListbox getEmpresaLayoutConfigList() { + return empresaLayoutConfigList; + } + + public void setEmpresaLayoutConfigList(MyListbox empresaLayoutConfigList) { + this.empresaLayoutConfigList = empresaLayoutConfigList; + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresaEmpresaConfigLayout.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresaEmpresaConfigLayout.java new file mode 100644 index 000000000..52d8f3a26 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEmpresaEmpresaConfigLayout.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.web.utilerias.render; + +import org.zkoss.zul.Checkbox; +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; + +import com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout; + +public class RenderEmpresaEmpresaConfigLayout implements ListitemRenderer { + + @Override + public void render(Listitem listItem, Object selected) throws Exception { + + Listcell lc = new Listcell(); + + if (selected != null) { + EmpresaConfigLayout empresaConfigLayout = (EmpresaConfigLayout) selected; + + lc = new Listcell(empresaConfigLayout.getTipoVenta() != null ? empresaConfigLayout.getTipoVenta().getDesctipoventa(): ""); + lc.setParent(listItem); + + lc = new Listcell( + empresaConfigLayout.getImpresionlayoutconfigId() != null + ? empresaConfigLayout.getImpresionlayoutconfigId().getDescricao() + " - " + + empresaConfigLayout.getImpresionlayoutconfigId().getLinguagem().name() + : ""); + lc.setParent(listItem); + + lc = new Listcell(); + boolean indEmail = empresaConfigLayout.getIndEmail() != null ? empresaConfigLayout.getIndEmail() : false; + Checkbox chk = new Checkbox(); + chk.setDisabled(Boolean.TRUE); + chk.setChecked(indEmail); + lc.appendChild(chk); + lc.setParent(listItem); + + listItem.setAttribute("data", empresaConfigLayout); + } + } +} \ No newline at end of file diff --git a/src/java/spring-config.xml b/src/java/spring-config.xml index b6ef243f5..0dae0c21b 100644 --- a/src/java/spring-config.xml +++ b/src/java/spring-config.xml @@ -483,6 +483,7 @@ com.rjconsultores.ventaboletos.entidad.DescontoContrato com.rjconsultores.ventaboletos.entidad.ConfComprovantePassagem com.rjconsultores.ventaboletos.entidad.Voucher + com.rjconsultores.ventaboletos.entidad.EmpresaConfigLayout diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label index cb0d349ce..702043396 100644 --- a/web/WEB-INF/i3-label_en.label +++ b/web/WEB-INF/i3-label_en.label @@ -10354,3 +10354,11 @@ winMovimentacionBilhetesPuntoVenta.numSerie.label = Series winMovimentacionBilhetesPuntoVenta.origem.label = Origin winMovimentacionBilhetesPuntoVenta.puntoventa.label = Ag. winMovimentacionBilhetesPuntoVenta.tipoMovimentacion.label = Nature + +editarEmpresaController.tabConfiguracaoLayout.value = Layout Configuration +editarEmpresaController.cmbConfigLayoutTiposVenda = Type Sale +editarEmpresaController.cmbImpresionLayoutConfig = Layout +editarEmpresaController.lblLayoutEmail = Email Layout +editarEmpresaController.MSG.jaExisteConfigLayoutComAsMesmasInfoCadastradas = There is already a layout configuration with the same information registered +editarEmpresaController.MSG.selecioneUmItemConfigLayout = Select the layout configuration to be removed + diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 5647eb372..764ca71fe 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -10378,3 +10378,11 @@ winMovimentacionBilhetesPuntoVenta.numSerie.label = Série winMovimentacionBilhetesPuntoVenta.origem.label = Origen winMovimentacionBilhetesPuntoVenta.puntoventa.label = Ag. winMovimentacionBilhetesPuntoVenta.tipoMovimentacion.label = Naturaleza + +editarEmpresaController.tabConfiguracaoLayout.value = Configuración de Layout +editarEmpresaController.cmbConfigLayoutTiposVenda = Tipo de venta +editarEmpresaController.cmbImpresionLayoutConfig = Layout +editarEmpresaController.lblLayoutEmail = Layout de correo electrónico +editarEmpresaController.MSG.jaExisteConfigLayoutComAsMesmasInfoCadastradas = Ya existe una configuración de Layout con la misma información registrada. +editarEmpresaController.MSG.selecioneUmItemConfigLayout = Seleccione la configuración de Layout para eliminar + diff --git a/web/WEB-INF/i3-label_fr_FR.label b/web/WEB-INF/i3-label_fr_FR.label index 04b2dcb78..1c3858870 100644 --- a/web/WEB-INF/i3-label_fr_FR.label +++ b/web/WEB-INF/i3-label_fr_FR.label @@ -10347,3 +10347,11 @@ winMovimentacionBilhetesPuntoVenta.numSerie.label = Série winMovimentacionBilhetesPuntoVenta.origem.label = Origine winMovimentacionBilhetesPuntoVenta.puntoventa.label = Ag. winMovimentacionBilhetesPuntoVenta.tipoMovimentacion.label = Nature + +editarEmpresaController.tabConfiguracaoLayout.value = Configuration de la mise en page +editarEmpresaController.cmbConfigLayoutTiposVenda = Type de vente +editarEmpresaController.cmbImpresionLayoutConfig = Mise en page +editarEmpresaController.lblLayoutEmail = Disposition des e-mails +editarEmpresaController.MSG.jaExisteConfigLayoutComAsMesmasInfoCadastradas = Il existe déjà une configuration de mise en page avec les mêmes informations enregistrées +editarEmpresaController.MSG.selecioneUmItemConfigLayout = Sélectionnez le paramètre de mise en page à supprimer + diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 31a2f3d9d..bbb7ba530 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -10340,3 +10340,10 @@ winMovimentacionBilhetesPuntoVenta.numSerie.label = Série winMovimentacionBilhetesPuntoVenta.origem.label = Origem winMovimentacionBilhetesPuntoVenta.puntoventa.label = Ag. winMovimentacionBilhetesPuntoVenta.tipoMovimentacion.label = Natureza + +editarEmpresaController.tabConfiguracaoLayout.value = Configuração Layout +editarEmpresaController.cmbConfigLayoutTiposVenda = Tipo Venda +editarEmpresaController.cmbImpresionLayoutConfig = Layout +editarEmpresaController.lblLayoutEmail = Layout para e-mail +editarEmpresaController.MSG.jaExisteConfigLayoutComAsMesmasInfoCadastradas = Já existe uma configuração de layout com as mesmas informações cadastrada +editarEmpresaController.MSG.selecioneUmItemConfigLayout = Selecione a configuração de layout a ser removida diff --git a/web/gui/catalogos/editarEmpresa.zul b/web/gui/catalogos/editarEmpresa.zul index 981d45a9e..adb769303 100644 --- a/web/gui/catalogos/editarEmpresa.zul +++ b/web/gui/catalogos/editarEmpresa.zul @@ -55,6 +55,7 @@ + @@ -3093,7 +3094,60 @@ - + + + + + + + + + + + + + + + + + +