fixes bug#0014278
dev: thiago qua: wallysson Implementação efetuada. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@94496 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b8f91ee1a4
commit
80d477cf47
|
@ -121,6 +121,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
private Textbox textSMTPHost;
|
||||
private Textbox textSMTPPorta;
|
||||
private Textbox textEmailDe;
|
||||
private Textbox textDestinatario;
|
||||
private Textbox textAssunto;
|
||||
private Textbox textAssuntoFiscal;
|
||||
private Textbox textEmail;
|
||||
|
@ -630,38 +631,20 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
if (empresaEmail == null) {
|
||||
empresaEmail = new EmpresaEmail();
|
||||
empresaEmail.setEmpresa(empresa);
|
||||
empresaEmail.setEmailDe(textEmailDe.getValue());
|
||||
empresaEmail.setAssunto(textAssunto.getValue());
|
||||
empresaEmail.setAssuntoFiscal(textAssuntoFiscal.getValue());
|
||||
empresaEmail.setTextoCupomEmbarque(messageCupomEmbarque.getValue());
|
||||
empresaEmail.setTextoEmail(messageConteudoEmail.getValue());
|
||||
empresaEmail.setTextoEmailFiscal(messageConteudoEmailFiscal.getValue());
|
||||
preencheInformacoesEmpresaEmail();
|
||||
empresaEmail = empresaEmailService.suscribir(empresaEmail);
|
||||
} else {
|
||||
empresaEmail.setEmailDe(textEmailDe.getValue());
|
||||
empresaEmail.setAssunto(textAssunto.getValue());
|
||||
empresaEmail.setAssuntoFiscal(textAssuntoFiscal.getValue());
|
||||
empresaEmail.setTextoCupomEmbarque(messageCupomEmbarque.getValue());
|
||||
empresaEmail.setTextoEmail(messageConteudoEmail.getValue());
|
||||
empresaEmail.setTextoEmailFiscal(messageConteudoEmailFiscal.getValue());
|
||||
preencheInformacoesEmpresaEmail();
|
||||
empresaEmailService.actualizacion(empresaEmail);
|
||||
}
|
||||
|
||||
if (empresaEmailConfig == null) {
|
||||
empresaEmailConfig = new EmpresaEmailConfig();
|
||||
empresaEmailConfig.setEmpresa(empresa);
|
||||
empresaEmailConfig.setSmtpEmail(textEmail.getValue());
|
||||
empresaEmailConfig.setSenha(textSenhaEmail.getValue());
|
||||
empresaEmailConfig.setSmtp(textSMTPHost.getValue());
|
||||
empresaEmailConfig.setSmtpPorta(textSMTPPorta.getValue());
|
||||
empresaEmailConfig.setIndAutenticacao(chkAutenticacao.isChecked());
|
||||
preencheInformacoesEmpresaConfig();
|
||||
empresaEmailConfig = empresaEmailConfigService.suscribir(empresaEmailConfig);
|
||||
} else {
|
||||
empresaEmailConfig.setSmtpEmail(textEmail.getValue());
|
||||
empresaEmailConfig.setSenha(textSenhaEmail.getValue());
|
||||
empresaEmailConfig.setSmtp(textSMTPHost.getValue());
|
||||
empresaEmailConfig.setSmtpPorta(textSMTPPorta.getValue());
|
||||
empresaEmailConfig.setIndAutenticacao(chkAutenticacao.isChecked());
|
||||
preencheInformacoesEmpresaConfig();
|
||||
empresaEmailConfigService.actualizacion(empresaEmailConfig);
|
||||
}
|
||||
|
||||
|
@ -679,6 +662,24 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
private void preencheInformacoesEmpresaConfig() {
|
||||
empresaEmailConfig.setSmtpEmail(textEmail.getValue());
|
||||
empresaEmailConfig.setSenha(textSenhaEmail.getValue());
|
||||
empresaEmailConfig.setSmtp(textSMTPHost.getValue());
|
||||
empresaEmailConfig.setSmtpPorta(textSMTPPorta.getValue());
|
||||
empresaEmailConfig.setIndAutenticacao(chkAutenticacao.isChecked());
|
||||
}
|
||||
|
||||
private void preencheInformacoesEmpresaEmail() {
|
||||
empresaEmail.setEmailDe(textEmailDe.getValue());
|
||||
empresaEmail.setDestinatario(textDestinatario.getValue());
|
||||
empresaEmail.setAssunto(textAssunto.getValue());
|
||||
empresaEmail.setAssuntoFiscal(textAssuntoFiscal.getValue());
|
||||
empresaEmail.setTextoCupomEmbarque(messageCupomEmbarque.getValue());
|
||||
empresaEmail.setTextoEmail(messageConteudoEmail.getValue());
|
||||
empresaEmail.setTextoEmailFiscal(messageConteudoEmailFiscal.getValue());
|
||||
}
|
||||
|
||||
private boolean validarEmail() {
|
||||
if (txtEmail.getText() == null || txtEmail.getText().isEmpty()) {
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad.contingencia;
|
||||
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Button;
|
||||
import org.zkoss.zul.Checkbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.enums.TypeEventListener;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
@Controller("agreementContigenciaController")
|
||||
@Scope("prototype")
|
||||
public class AgreementContigenciaController extends MyGenericForwardComposer {
|
||||
|
||||
public static final String TITULO_CONTIGENCIA_CONTROLLER = "editarContigencia.window.title";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Checkbox chkAgree;
|
||||
private Button btnAceitar;
|
||||
private EditarContigenciaController contigenciaController;
|
||||
private EventListenerOnClickContingenciaBotaoContingencia eventoPai;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
contigenciaController = (EditarContigenciaController) Executions.getCurrent().getArg().get("controller");
|
||||
eventoPai = (EventListenerOnClickContingenciaBotaoContingencia) Executions.getCurrent().getArg().get("eventoPai");
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
chkAgree.setLabel(String.format("Deseja realmente ativar a contingência para a empresa %s na UF %s?",
|
||||
contigenciaController.getEmpresaSelecionada().getNombempresa(),
|
||||
contigenciaController.getEstadoSelecionado().getCveestado()));
|
||||
chkAgree.addEventListener(TypeEventListener.ON_CHECK.getEvent(), new EventListenerChkAgree());
|
||||
btnAceitar.addEventListener(TypeEventListener.ON_CLICK.getEvent(), new EventListenerBtnAceite());
|
||||
}
|
||||
|
||||
private final class EventListenerBtnAceite implements EventListener {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
eventoPai.gravaLogHistoricoContingencia();
|
||||
}
|
||||
}
|
||||
|
||||
private final class EventListenerChkAgree implements EventListener {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
btnAceitar.setDisabled(!chkAgree.isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad;
|
||||
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad.contingencia;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,8 +9,6 @@ import org.apache.log4j.Logger;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.zkoss.util.resource.Labels;
|
||||
import org.zkoss.zhtml.Messagebox;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -18,12 +16,15 @@ import org.zkoss.zul.Button;
|
|||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Paging;
|
||||
import org.zkoss.zul.Radiogroup;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia;
|
||||
import com.rjconsultores.ventaboletos.service.ContingenciaService;
|
||||
import com.rjconsultores.ventaboletos.enums.EStatusContingencia;
|
||||
import com.rjconsultores.ventaboletos.enums.TypeEventListener;
|
||||
import com.rjconsultores.ventaboletos.rest.ContingenciaClienteRest;
|
||||
import com.rjconsultores.ventaboletos.service.EstadoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
@ -40,14 +41,13 @@ import com.trg.search.Filter;
|
|||
@Controller("editarContigenciaController")
|
||||
@Scope("prototype")
|
||||
public class EditarContigenciaController extends MyGenericForwardComposer {
|
||||
|
||||
|
||||
public static final String TITULO_CONTIGENCIA_CONTROLLER = "editarContigencia.window.title";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Logger log = Logger.getLogger(EditarContigenciaController.class);
|
||||
|
||||
@Autowired
|
||||
private ContingenciaService contigenciaService;
|
||||
|
||||
@Autowired
|
||||
private EstadoService estadoService;
|
||||
|
||||
|
@ -58,9 +58,10 @@ public class EditarContigenciaController extends MyGenericForwardComposer {
|
|||
private List<Empresa> lsEmpresas;
|
||||
private MyListbox historicoList;
|
||||
private Button btnContingencia;
|
||||
private Boolean setarContigencia;
|
||||
private Textbox txtMotivo;
|
||||
private Textbox txtStatus;
|
||||
private EStatusContingencia statusContigencia;
|
||||
private Radiogroup rdbGroup;
|
||||
|
||||
private Paging pagingHistorico;
|
||||
@Autowired
|
||||
|
@ -73,114 +74,38 @@ public class EditarContigenciaController extends MyGenericForwardComposer {
|
|||
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
historicoList.setItemRenderer(new RenderHistoricoContingencia());
|
||||
|
||||
setarContigencia = false;
|
||||
|
||||
txtStatus.setDisabled(true);
|
||||
|
||||
cmbEmpresa.addEventListener("onChange", new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
buscarHistoricoContigencia();
|
||||
}
|
||||
});
|
||||
cmbEmpresa.addEventListener(TypeEventListener.ON_CHANGE.getEvent(), new EventListenerOnChangeContingenciaComboEmpresa());
|
||||
|
||||
cmbEstado.addEventListener("onChange", new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
buscarHistoricoContigencia();
|
||||
}
|
||||
});
|
||||
cmbEstado.addEventListener(TypeEventListener.ON_CHANGE.getEvent(), new EventListenerOnChangeContingenciaComboEstado());
|
||||
|
||||
rdbGroup.addEventListener(TypeEventListener.ON_CHECK.getEvent(), new EventListenerOnClickContingenciaRadioAmbiente());
|
||||
|
||||
btnContingencia.setDisabled(true);
|
||||
|
||||
btnContingencia.addEventListener(TypeEventListener.ON_CLICK.getEvent(), new EventListenerOnClickContingenciaBotaoContingencia(this));
|
||||
}
|
||||
|
||||
public void onClick$btnContingencia(Event ev) {
|
||||
try {
|
||||
|
||||
if (Messagebox.show("Deseja Continuar?", "Continuar?", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.NO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if("".equals(txtMotivo.getValue().trim())) {
|
||||
try {
|
||||
Messagebox.show("É necessário inserir o motivo da operação para continuar.",
|
||||
Labels.getLabel("editarContigencia.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: setar status pelo servico criado pelo alberto de acordo com o boolean 'setarContigencia' definido anteriormente na pesquisa
|
||||
|
||||
// TODO: em caso de sucesso salvar o historico
|
||||
|
||||
LogHistoricoContingencia logHistorico = new LogHistoricoContingencia();
|
||||
|
||||
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
||||
Empresa empresa = (Empresa) itemEmpresa.getValue();
|
||||
|
||||
logHistorico.setEmpresa(empresa);
|
||||
|
||||
Comboitem itemEstado = cmbEstado.getSelectedItem();
|
||||
Estado estado = (Estado) itemEstado.getValue();
|
||||
|
||||
logHistorico.setEstado(estado);
|
||||
|
||||
logHistorico.setMotivo(txtMotivo.getValue().trim());
|
||||
|
||||
contigenciaService.salvarHistoricoContingencia(logHistorico);
|
||||
|
||||
try {
|
||||
Messagebox.show("Status alterado com sucesso.",
|
||||
Labels.getLabel("editarContigencia.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
|
||||
buscarHistoricoContigencia();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Erro ao setar contingencia: " , e);
|
||||
try {
|
||||
Messagebox.show("Ocorreu um erro ao setar a contingencia",
|
||||
Labels.getLabel("editarContigencia.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
private void verificarStatus(String uf, String cnpj) {
|
||||
setStatusContigencia(EStatusContingencia.getStatusContingencia(
|
||||
ContingenciaClienteRest.getInstance().consultar(uf, rdbGroup.getSelectedItem().getValue(), cnpj)));
|
||||
txtStatus.setValue(statusContigencia.getDescricao());
|
||||
|
||||
btnContingencia.setDisabled(false);
|
||||
btnContingencia.setLabel(EStatusContingencia.NORMAL.equals(statusContigencia) ? "SETAR CONTINGENCIA" : "RETIRAR CONTINGENCIA");
|
||||
}
|
||||
|
||||
private void verificarStatus() {
|
||||
//TODO: buscar o status pelo servico e mostrar o status atual e alterar o label do botão de acordo com a acao que pode ser tomada
|
||||
txtStatus.setValue("");
|
||||
|
||||
// TODO: setar o botao para contigencia caso for e mostrar p status
|
||||
setarContigencia = true;
|
||||
|
||||
alterarTextoBotao();
|
||||
|
||||
}
|
||||
|
||||
private void buscarHistoricoContigencia() {
|
||||
|
||||
protected void buscarHistoricoContigencia() {
|
||||
if(cmbEmpresa.getSelectedIndex() < 0 || cmbEstado.getSelectedIndex() < 0) {
|
||||
log.info("Não foi seecionado empresa e/ou estado");
|
||||
log.info("Não foi selecionado empresa e/ou estado");
|
||||
return;
|
||||
}
|
||||
|
||||
txtMotivo.setValue("");
|
||||
|
||||
//Verifica o status do estado e seta os labels do botao e status
|
||||
verificarStatus();
|
||||
|
||||
HibernateSearchObject<LogHistoricoContingencia> sistemaBusqueda = new HibernateSearchObject<LogHistoricoContingencia>
|
||||
(LogHistoricoContingencia.class, pagingHistorico.getPageSize());
|
||||
|
||||
|
@ -194,18 +119,27 @@ public class EditarContigenciaController extends MyGenericForwardComposer {
|
|||
|
||||
sistemaBusqueda.addFilter(Filter.equal("estado", estado));
|
||||
|
||||
sistemaBusqueda.addSortDesc("LogHistoricoContingenciaId");
|
||||
sistemaBusqueda.addSortDesc("logHistoricoContingenciaId");
|
||||
|
||||
plwLogContingencia.init(sistemaBusqueda, historicoList, pagingHistorico);
|
||||
|
||||
//Verifica o status do estado e seta os labels do botao e status
|
||||
verificarStatus(estado.getCveestado(), empresa.getCnpj());
|
||||
}
|
||||
|
||||
private void alterarTextoBotao() {
|
||||
btnContingencia.setDisabled(false);
|
||||
if(setarContigencia) {
|
||||
btnContingencia.setLabel("SETAR CONTINGENCIA");
|
||||
} else {
|
||||
btnContingencia.setLabel("RETIRAR CONTINGENCIA");
|
||||
protected Estado getEstadoSelecionado() {
|
||||
return (Estado) getCmbEstado().getSelectedItem().getValue();
|
||||
}
|
||||
|
||||
protected Empresa getEmpresaSelecionada() {
|
||||
return (Empresa) getCmbEmpresa().getSelectedItem().getValue();
|
||||
}
|
||||
|
||||
protected String getNovoStatus() {
|
||||
if (EStatusContingencia.NORMAL.equals(getStatusContigencia())) {
|
||||
return EStatusContingencia.CONTINGENCIA.getId().toString();
|
||||
}
|
||||
return EStatusContingencia.NORMAL.getId().toString();
|
||||
}
|
||||
|
||||
public List<Estado> getLsEstado() {
|
||||
|
@ -278,6 +212,43 @@ public class EditarContigenciaController extends MyGenericForwardComposer {
|
|||
|
||||
public void setTxtStatus(Textbox txtStatus) {
|
||||
this.txtStatus = txtStatus;
|
||||
}
|
||||
}
|
||||
|
||||
public Radiogroup getRdbGroup() {
|
||||
return rdbGroup;
|
||||
}
|
||||
|
||||
public void setRdbGroup(Radiogroup rdbGroup) {
|
||||
this.rdbGroup = rdbGroup;
|
||||
}
|
||||
|
||||
public EStatusContingencia getStatusContigencia() {
|
||||
return statusContigencia;
|
||||
}
|
||||
|
||||
public void setStatusContigencia(EStatusContingencia statusContigencia) {
|
||||
this.statusContigencia = statusContigencia;
|
||||
}
|
||||
|
||||
private final class EventListenerOnClickContingenciaRadioAmbiente implements EventListener {
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
buscarHistoricoContigencia();
|
||||
}
|
||||
}
|
||||
|
||||
private final class EventListenerOnChangeContingenciaComboEstado implements EventListener {
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
buscarHistoricoContigencia();
|
||||
}
|
||||
}
|
||||
|
||||
private final class EventListenerOnChangeContingenciaComboEmpresa implements EventListener {
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
buscarHistoricoContigencia();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.seguridad.contingencia;
|
||||
|
||||
import static com.rjconsultores.ventaboletos.web.gui.controladores.seguridad.contingencia.EditarContigenciaController.TITULO_CONTIGENCIA_CONTROLLER;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.zkoss.util.resource.Labels;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zkplus.spring.SpringUtil;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia;
|
||||
import com.rjconsultores.ventaboletos.enums.EStatusContingencia;
|
||||
import com.rjconsultores.ventaboletos.service.ContingenciaService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaEmailService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
||||
public class EventListenerOnClickContingenciaBotaoContingencia implements EventListener {
|
||||
|
||||
private static Logger log = Logger.getLogger(EventListenerOnClickContingenciaBotaoContingencia.class);
|
||||
|
||||
private MyGenericForwardComposer controller;
|
||||
|
||||
public EventListenerOnClickContingenciaBotaoContingencia(MyGenericForwardComposer controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void onEvent(Event arg0) throws Exception {
|
||||
if (!isContigenciaValida()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EStatusContingencia.CONTINGENCIA.equals(getStatusContingencia())) {
|
||||
HashMap args = new HashMap();
|
||||
args.put("controller", getController());
|
||||
args.put("eventoPai", this);
|
||||
getController().openWindow("/gui/seguridad/agreementContingencia.zul",
|
||||
Labels.getLabel(TITULO_CONTIGENCIA_CONTROLLER), args, MyGenericForwardComposer.MODAL);
|
||||
} else {
|
||||
gravaLogHistoricoContingencia();
|
||||
}
|
||||
}
|
||||
|
||||
protected void gravaLogHistoricoContingencia() {
|
||||
try {
|
||||
LogHistoricoContingencia logHistoricoContigencia = configuraLogHistoricoContigencia();
|
||||
getContingenciaService().salvarHistoricoContingencia(logHistoricoContigencia);
|
||||
MensagensUtils.showMessageInformation("Status alterado com sucesso.", TITULO_CONTIGENCIA_CONTROLLER);
|
||||
getController().buscarHistoricoContigencia();
|
||||
} catch (Exception e) {
|
||||
log.error("Erro ao setar contingencia: " , e);
|
||||
MensagensUtils.showMessageError("Ocorreu um erro ao setar a contingencia", TITULO_CONTIGENCIA_CONTROLLER);
|
||||
}
|
||||
}
|
||||
|
||||
private LogHistoricoContingencia configuraLogHistoricoContigencia() {
|
||||
LogHistoricoContingencia logHistoricoContingencia = new LogHistoricoContingencia();
|
||||
logHistoricoContingencia.setStatus(getController().getNovoStatus());
|
||||
logHistoricoContingencia.setEmpresa(getController().getEmpresaSelecionada());
|
||||
logHistoricoContingencia.setEstado(getController().getEstadoSelecionado());
|
||||
logHistoricoContingencia.setAmbiente(Integer.valueOf(getController().getRdbGroup().getSelectedItem().getValue()));
|
||||
logHistoricoContingencia.setMotivo(getController().getTxtMotivo().getValue().trim());
|
||||
|
||||
return logHistoricoContingencia;
|
||||
}
|
||||
|
||||
private boolean isContigenciaValida() {
|
||||
if (StringUtils.isBlank(getController().getTxtMotivo().getValue())) {
|
||||
MensagensUtils.showMessageExclamation("É necessário inserir o motivo da operação para continuar.", TITULO_CONTIGENCIA_CONTROLLER);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (destinatarioNuloQuandoEmContingencia()) {
|
||||
MensagensUtils.showMessageExclamation("Favor definir o responsável pelo recebimento do email, em configuração de envio de email.", TITULO_CONTIGENCIA_CONTROLLER);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean destinatarioNuloQuandoEmContingencia() {
|
||||
return StringUtils.isBlank(getEmpresaEmailService().buscarPorEmpresa(getController().getEmpresaSelecionada()).getDestinatario())
|
||||
&& getController().getNovoStatus().equals(EStatusContingencia.CONTINGENCIA.getId().toString());
|
||||
}
|
||||
|
||||
private EStatusContingencia getStatusContingencia() {
|
||||
return EStatusContingencia.getStatusContingencia(Integer.valueOf(getController().getNovoStatus()));
|
||||
}
|
||||
|
||||
private EmpresaEmailService getEmpresaEmailService() {
|
||||
return (EmpresaEmailService) SpringUtil.getBean("empresaEmailService");
|
||||
}
|
||||
|
||||
private ContingenciaService getContingenciaService() {
|
||||
return (ContingenciaService) SpringUtil.getBean("contingenciaService");
|
||||
}
|
||||
|
||||
public EditarContigenciaController getController() {
|
||||
return (EditarContigenciaController)controller;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package com.rjconsultores.ventaboletos.web.utilerias;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
/**
|
||||
* @author vjcor
|
||||
*
|
||||
*/
|
||||
public class ContingenciaUtils {
|
||||
|
||||
private static Logger log = Logger.getLogger(ContingenciaUtils.class);
|
||||
|
||||
private static ContingenciaUtils instance;
|
||||
|
||||
public static ContingenciaUtils getInstance() {
|
||||
if(instance == null) {
|
||||
instance = new ContingenciaUtils();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private String buscarConstanteURL() {
|
||||
//TODO: buscar constante com o valor da URL
|
||||
return "http://10.20.30.157:8130";
|
||||
}
|
||||
|
||||
private void verificarStatus(String uf, String ambiente, String cnpj) {
|
||||
String uri = buscarConstanteURL().concat("/BPeRS/rest/adm/contingencia/tipoEmissaoEmpresa");
|
||||
/*
|
||||
String response = null;
|
||||
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
HttpGet httpGet = new HttpGet(uri+"?uf=".concat(uf).concat("&ambiente=").concat(ambiente).concat("&cnpj=").concat(cnpj));
|
||||
|
||||
String encoding = Base64.getEncoder().encodeToString("rjconsultores:RJ#C0nsul10res@2019".getBytes());
|
||||
|
||||
httpGet.addHeader("Authorization", "Basic " + encoding);
|
||||
httpGet.setHeader("Content-type", MediaType.APPLICATION_JSON);
|
||||
httpGet.setHeader("accept", MediaType.APPLICATION_JSON);
|
||||
|
||||
try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) {
|
||||
response = EntityUtils.toString(httpResponse.getEntity());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Erro: ", e);
|
||||
}
|
||||
|
||||
log.info("[response] " + response);
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -27,9 +27,11 @@ public class MensagensUtils {
|
|||
private static int showMessage(String labelMensagem, String tituloMenssagem,
|
||||
int botoesMensagem, String iconeMensagem) {
|
||||
try {
|
||||
final String label = Labels.getLabel(labelMensagem) == null ? labelMensagem : Labels.getLabel(labelMensagem);
|
||||
final String titulo = Labels.getLabel(tituloMenssagem) == null ? tituloMenssagem : Labels.getLabel(tituloMenssagem);
|
||||
return Messagebox.show(
|
||||
Labels.getLabel(labelMensagem),
|
||||
Labels.getLabel(tituloMenssagem),
|
||||
label,
|
||||
titulo,
|
||||
botoesMensagem, iconeMensagem);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
|
|
@ -5,6 +5,8 @@ import org.zkoss.zul.Listitem;
|
|||
import org.zkoss.zul.ListitemRenderer;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia;
|
||||
import com.rjconsultores.ventaboletos.enums.EAmbienteContingencia;
|
||||
import com.rjconsultores.ventaboletos.enums.EStatusContingencia;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
|
||||
public class RenderHistoricoContingencia implements ListitemRenderer {
|
||||
|
@ -13,22 +15,18 @@ public class RenderHistoricoContingencia implements ListitemRenderer {
|
|||
public void render(Listitem lstm, Object o) throws Exception {
|
||||
LogHistoricoContingencia log = (LogHistoricoContingencia) o;
|
||||
|
||||
Listcell lc = new Listcell(log.getLogHistoricoContingenciaId().toString());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(log.getMotivo());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(log.getUsuario().getUsuarioId() + " - " + log.getUsuario().getName());
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(DateUtil.getStringDateHour(log.getDataHora()));
|
||||
lc.setParent(lstm);
|
||||
|
||||
lc = new Listcell(log.getStatus());
|
||||
lc.setParent(lstm);
|
||||
configuraListCell(lstm, log.getMotivo());
|
||||
configuraListCell(lstm, log.getUsuario().getUsuarioId() + " - " + log.getUsuario().getName());
|
||||
configuraListCell(lstm, DateUtil.getStringDateHour(log.getDataHora()));
|
||||
configuraListCell(lstm, EAmbienteContingencia.getAmbienteContingencia(log.getAmbiente()).getDescricao());
|
||||
configuraListCell(lstm, EStatusContingencia.getStatusContingencia(Integer.valueOf(log.getStatus())).getDescricao());
|
||||
|
||||
lstm.setAttribute("data", log);
|
||||
}
|
||||
|
||||
private void configuraListCell(Listitem listItemParent, String valor) {
|
||||
Listcell lc = new Listcell(valor);
|
||||
lc.setParent(listItemParent);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1406,7 +1406,7 @@ editarEmpresaController.indRemarcacaoTrocaPassagem.label = Utiliza Troca de Pass
|
|||
editarEmpresaController.BloqVdaImpPosterior.label = Bloqueia Venda de Impressão Posterior em empresa diferente da logada
|
||||
editarEmpresaController.usarAliasMapaViagemVenda = Tarjeta de Viagem default Alias de Ubicaciones en la Venta
|
||||
editarEmpresaController.configCallCenter.label = Configuração Email Call Center
|
||||
editarEmpresaController.configCallCenterEnvio.label = Configuração do Envio
|
||||
editarEmpresaController.configEmail.label = Configuração de Envio de Email
|
||||
editarEmpresaController.configCallCenterEmail.label = Configuração Conteúdo Email
|
||||
editarEmpresaController.configCallCenterEmailFiscal.label = Configuração Conteúdo Email Fiscal
|
||||
editarEmpresaController.configCallCenterCupomEmbarque.label = Configuração Conteúdo Cupom Embarque
|
||||
|
@ -8158,6 +8158,9 @@ editarContigencia.btnFechar.tooltiptext= Fechar
|
|||
editarContigencia.estado.label = Estado
|
||||
editarContigencia.empresa.label = Empresa
|
||||
editarContigencia.status.label = Status
|
||||
editarContigencia.lbAmbiente.value = Ambiente
|
||||
editarContigencia.producao.value = Produção
|
||||
editarContigencia.homologacao.value = Homologação
|
||||
editarContigencia.motivo.label = Motivo
|
||||
editarContigencia.btnSetarContingencia.label=Setar Contingência
|
||||
editarContigencia.btnRetirarContingencia.label=Retirar Contingência
|
||||
|
@ -8165,4 +8168,5 @@ editarContigencia.tabela.id=ID
|
|||
editarContigencia.tabela.motivo=MOTIVO
|
||||
editarContigencia.tabela.usuario=USUARIO
|
||||
editarContigencia.tabela.data=DATA
|
||||
editarContigencia.tabela.ambiente=Ambiente
|
||||
editarContigencia.tabela.status=STATUS
|
||||
|
|
|
@ -1529,7 +1529,7 @@ editarEmpresaController.indEmiteCupomFiscalRemarcacao.label = Emite Cupom Fiscal
|
|||
editarEmpresaController.indRemarcacaoTrocaPassagem.label = Utiliza Troca de Passagens para Remarcação
|
||||
editarEmpresaController.BloqVdaImpPosterior.label = Bloqueia Venda de Impressão Posterior em empresa diferente da logada
|
||||
editarEmpresaController.configCallCenter.label = Configuração Email Call Center
|
||||
editarEmpresaController.configCallCenterEnvio.label = Configuração do Envio
|
||||
editarEmpresaController.configEmail.label = Configuração de Envio de Email
|
||||
editarEmpresaController.configCallCenterEmail.label = Configuração Conteúdo Email
|
||||
editarEmpresaController.configCallCenterEmailFiscal.label = Configuração Conteúdo Email Fiscal
|
||||
editarEmpresaController.configCallCenterCupomEmbarque.label = Configuração Conteúdo Cupom Embarque
|
||||
|
@ -8652,6 +8652,9 @@ editarContigencia.btnFechar.tooltiptext= Fechar
|
|||
editarContigencia.estado.label = Estado
|
||||
editarContigencia.empresa.label = Empresa
|
||||
editarContigencia.status.label = Status
|
||||
editarContigencia.lbAmbiente.value = Ambiente
|
||||
editarContigencia.producao.value = Produção
|
||||
editarContigencia.homologacao.value = Homologação
|
||||
editarContigencia.motivo.label = Motivo
|
||||
editarContigencia.btnSetarContingencia.label=Setar Contingência
|
||||
editarContigencia.btnRetirarContingencia.label=Retirar Contingência
|
||||
|
@ -8659,4 +8662,5 @@ editarContigencia.tabela.id=ID
|
|||
editarContigencia.tabela.motivo=MOTIVO
|
||||
editarContigencia.tabela.usuario=USUARIO
|
||||
editarContigencia.tabela.data=DATA
|
||||
editarContigencia.tabela.ambiente=Ambiente
|
||||
editarContigencia.tabela.status=STATUS
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
label="${c:l('editarEmpresaController.comissao.label')}" />
|
||||
<tab
|
||||
label="${c:l('editarEmpresaController.fidelidade.label')}" />
|
||||
|
||||
<tab
|
||||
label="${c:l('editarEmpresaController.configEmail.label')}" />
|
||||
<tab
|
||||
label="${c:l('editarEmpresaController.configCallCenter.label')}" />
|
||||
|
||||
|
@ -726,8 +727,6 @@
|
|||
</listhead>
|
||||
</listbox>
|
||||
</tabpanel>
|
||||
|
||||
|
||||
<tabpanel id="tbInscEstadual" height="80%">
|
||||
<toolbar>
|
||||
<button id="btnAdicionarInscEstadual"
|
||||
|
@ -1271,83 +1270,86 @@
|
|||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="25%" />
|
||||
<column width="75%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label id="lblNaoAutenticaEmail"
|
||||
value="${c:l('editarEmpresaController.indAutenticacao')}" />
|
||||
<checkbox id="chkAutenticacao"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.indAutenticacao}" />
|
||||
</row>
|
||||
<row>
|
||||
<label id="lblTextEmail"
|
||||
value="Email Autenticação SMTP" />
|
||||
<textbox id="textEmail"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtpEmail}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSenhaEmail"
|
||||
value="Senha" />
|
||||
<textbox id="textSenhaEmail"
|
||||
type="password" width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.senha}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSMTPHost"
|
||||
value="SMTP Endereço" />
|
||||
<textbox id="textSMTPHost"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtp}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSMTPPorta"
|
||||
value="SMTP Porta" />
|
||||
<textbox id="textSMTPPorta"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtpPorta}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblEmailDe"
|
||||
value="Email de Envio" />
|
||||
<textbox id="textEmailDe"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmail.emailDe}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblEmailCoppiaOculta"
|
||||
value="Email Cópia Oculta" />
|
||||
<textbox id="textEmailCopiaOculta"
|
||||
width="80%" maxlength="200"
|
||||
value="@{winEditarEmpresa$composer.empresaEmail.emailCopiaOculta}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblDestinatario"
|
||||
value="Destinatário de informações gerais" />
|
||||
<textbox id="textDestinatario"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmail.destinatario}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
<tabpanel>
|
||||
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab label="${c:l('editarEmpresaController.configCallCenterEnvio.label')}" />
|
||||
<tab label="${c:l('editarEmpresaController.configCallCenterEmail.label')}" />
|
||||
<tab label="${c:l('editarEmpresaController.configCallCenterEmailFiscal.label')}" />
|
||||
<tab label="${c:l('editarEmpresaController.configCallCenterCupomEmbarque.label')}" />
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="25%" />
|
||||
<column width="75%" />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label id="lblNaoAutenticaEmail"
|
||||
value="${c:l('editarEmpresaController.indAutenticacao')}" />
|
||||
<checkbox id="chkAutenticacao"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.indAutenticacao}" />
|
||||
</row>
|
||||
<row>
|
||||
<label id="lblTextEmail"
|
||||
value="Email Autenticação SMTP" />
|
||||
<textbox id="textEmail"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtpEmail}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSenhaEmail"
|
||||
value="Senha" />
|
||||
<textbox id="textSenhaEmail"
|
||||
type="password" width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.senha}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSMTPHost"
|
||||
value="SMTP Endereço" />
|
||||
<textbox id="textSMTPHost"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtp}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblSMTPPorta"
|
||||
value="SMTP Porta" />
|
||||
<textbox id="textSMTPPorta"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmailConfig.smtpPorta}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblEmailDe"
|
||||
value="Email de Envio" />
|
||||
<textbox id="textEmailDe"
|
||||
width="80%" maxlength="50"
|
||||
value="@{winEditarEmpresa$composer.empresaEmail.emailDe}" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label id="lblEmailCoppiaOculta"
|
||||
value="Email Cópia Oculta" />
|
||||
<textbox id="textEmailCopiaOculta"
|
||||
width="80%" maxlength="200"
|
||||
value="@{winEditarEmpresa$composer.empresaEmail.emailCopiaOculta}" />
|
||||
</row>
|
||||
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel>
|
||||
<grid>
|
||||
<columns>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?page contentType="text/html;charset=UTF-8"?>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winAgreementContingencia"?>
|
||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||
<window id="winAgreementContingencia" border="normal" apply="${agreementContigenciaController}"
|
||||
width="800px" height="190px" contentStyle="overflow:auto" sizable="true"
|
||||
title="${c:l('editarContigencia.window.title')}">
|
||||
<grid fixedLayout="true">
|
||||
<rows>
|
||||
<row>
|
||||
<label id="textAgreement" style="font-weight:bold"
|
||||
value="Você solicitou utilizar a Contingência Off-line BP-e
|
||||
A decisão pela entrada em contingência, bem como a escolha da alternativa de contingência (dentre as aceitas pela UF) é exclusiva do contribuinte,
|
||||
devendo ser utilizada nas situações em que ocorram problemas técnicos de comunicação ou processamento de informações que impeçam a autorização do BP-e em tempo real.
|
||||
O contribuinte que estiver com problemas técnicos para autorização do BP-e poderá emiti-lo em contingência off-line,
|
||||
imprimir o DABPE e depois de superado o problema técnico, transmitir o arquivo XML do BP-e para autorização. O prazo estabelecido pelo Fisco,
|
||||
atualmente, é o final do primeiro dia útil subsequente contado a partir de sua emissão." />
|
||||
</row>
|
||||
<row>
|
||||
<checkbox id="chkAgree"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<grid fixedLayout="true">
|
||||
<columns>
|
||||
<column width="50%" align="right"/>
|
||||
<column width="50%" align="right"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<button id="btnAceitar" height="20" label="Aceitar" disabled="true"
|
||||
image="/gui/img/ok.png" width="200px"
|
||||
onClick="winAgreementContingencia.detach()"
|
||||
tooltiptext="${c:l('editarContigencia.btnFechar.tooltiptext')}"/>
|
||||
|
||||
<button id="btnRejeitar" height="20" label="Rejeitar"
|
||||
image="/gui/img/cancel.png" width="200px"
|
||||
onClick="winAgreementContingencia.detach()"
|
||||
tooltiptext="${c:l('editarContigencia.btnFechar.tooltiptext')}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
</window>
|
||||
</zk>
|
|
@ -54,6 +54,14 @@
|
|||
value="${c:l('editarContigencia.status.label')}" />
|
||||
<textbox id="txtStatus" width="99%" />
|
||||
</row>
|
||||
<row>
|
||||
<label
|
||||
value="${c:l('editarContigencia.lbAmbiente.value')}" />
|
||||
<radiogroup Id="rdbGroup">
|
||||
<radio id="rdbProducao" value="1" label="${c:l('editarContigencia.producao.value')}" selected="true"/>
|
||||
<radio id="rdbHomologacao" value="2" label="${c:l('editarContigencia.homologacao.value')}" />
|
||||
</radiogroup>
|
||||
</row>
|
||||
|
||||
</rows>
|
||||
</grid>
|
||||
|
@ -80,9 +88,6 @@
|
|||
<listbox id="historicoList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||
multiple="false" width="100%">
|
||||
<listhead sizable="true">
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
label="${c:l('editarContigencia.tabela.id')}"
|
||||
sort="auto(LogHistoricoContingenciaId)" width="8%"/>
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
label="${c:l('editarContigencia.tabela.motivo')}"
|
||||
sort="auto(motivo)" width="45%"/>
|
||||
|
@ -92,6 +97,9 @@
|
|||
<listheader image="/gui/img/create_doc.gif"
|
||||
label="${c:l('editarContigencia.tabela.data')}"
|
||||
sort="auto(dataHora)"/>
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
label="${c:l('editarContigencia.tabela.ambiente')}"
|
||||
sort="auto(ambiente)"/>
|
||||
<listheader image="/gui/img/create_doc.gif"
|
||||
label="${c:l('editarContigencia.tabela.status')}"
|
||||
sort="auto(status)"/>
|
||||
|
|
Loading…
Reference in New Issue