Merge pull request 'bug#al-3485' (!313) from AL3485 into master
Reviewed-on: adm/VentaBoletosAdm#313 Reviewed-by: pinheiro <valdevir@rjconsultores.com.br>master 1.32.0
commit
09426da57a
4
pom.xml
4
pom.xml
|
@ -4,11 +4,11 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ventaboletosadm</artifactId>
|
<artifactId>ventaboletosadm</artifactId>
|
||||||
<version>1.31.1</version>
|
<version>1.32.0</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<modelWeb.version>1.22.1</modelWeb.version>
|
<modelWeb.version>1.23.0</modelWeb.version>
|
||||||
<flyway.version>1.19.0</flyway.version>
|
<flyway.version>1.19.0</flyway.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
import com.rjconsultores.ventaboletos.service.HeaderEsquemaCorridaService;
|
import com.rjconsultores.ventaboletos.service.HeaderEsquemaCorridaService;
|
||||||
import com.rjconsultores.ventaboletos.service.MarcaService;
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
@ -103,10 +104,13 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
private Listheader listHeader13;
|
private Listheader listHeader13;
|
||||||
private Listheader listHeader14;
|
private Listheader listHeader14;
|
||||||
private Listheader listHeader15;
|
private Listheader listHeader15;
|
||||||
|
private Listheader listHeader16;
|
||||||
@Autowired
|
@Autowired
|
||||||
private HeaderEsquemaCorridaService headerService;
|
private HeaderEsquemaCorridaService headerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TramoServicioService tramoServicioService;
|
||||||
|
|
||||||
public Listheader getListHeader1() {
|
public Listheader getListHeader1() {
|
||||||
return listHeader1;
|
return listHeader1;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +231,14 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
this.listHeader15 = listHeader15;
|
this.listHeader15 = listHeader15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Listheader getListHeader16() {
|
||||||
|
return listHeader16;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListHeader16(Listheader listHeader16) {
|
||||||
|
this.listHeader16 = listHeader16;
|
||||||
|
}
|
||||||
|
|
||||||
public Combobox getCmbClase() {
|
public Combobox getCmbClase() {
|
||||||
return cmbClase;
|
return cmbClase;
|
||||||
}
|
}
|
||||||
|
@ -392,14 +404,14 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
refreshLista();
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer posicoesColunasTabela[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
Integer posicoesColunasTabela[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
|
||||||
List<String> labelsList = new ArrayList<>();
|
List<String> labelsList = new ArrayList<>();
|
||||||
private void criarListaDinamica() {
|
private void criarListaDinamica() {
|
||||||
|
|
||||||
//Busca do banco as posicoes salvas
|
//Busca do banco as posicoes salvas
|
||||||
posicoesColunasTabela = headerService.buscarHeader();
|
posicoesColunasTabela = headerService.buscarHeader();
|
||||||
|
|
||||||
esquemaCorridaList.setItemRenderer(new RenderConfiguracionCorrida(posicoesColunasTabela));
|
esquemaCorridaList.setItemRenderer(new RenderConfiguracionCorrida(posicoesColunasTabela, tramoServicioService));
|
||||||
|
|
||||||
esquemaCorridaList.addEventListener("onDoubleClick", new EventListener() {
|
esquemaCorridaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@ -425,6 +437,7 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
iniciarListHeader(listHeader13);
|
iniciarListHeader(listHeader13);
|
||||||
iniciarListHeader(listHeader14);
|
iniciarListHeader(listHeader14);
|
||||||
iniciarListHeader(listHeader15);
|
iniciarListHeader(listHeader15);
|
||||||
|
iniciarListHeader(listHeader16);
|
||||||
|
|
||||||
criarListaDeLabels();
|
criarListaDeLabels();
|
||||||
atualizaLabelsTabela();
|
atualizaLabelsTabela();
|
||||||
|
@ -447,6 +460,7 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
labelsList.add(listHeader13.getLabel());
|
labelsList.add(listHeader13.getLabel());
|
||||||
labelsList.add(listHeader14.getLabel());
|
labelsList.add(listHeader14.getLabel());
|
||||||
labelsList.add(listHeader15.getLabel());
|
labelsList.add(listHeader15.getLabel());
|
||||||
|
labelsList.add(listHeader16.getLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void atualizaLabelsTabela() {
|
private void atualizaLabelsTabela() {
|
||||||
|
@ -484,6 +498,8 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
listHeader14.setLabel(labelsList.get(posicao));
|
listHeader14.setLabel(labelsList.get(posicao));
|
||||||
} else if ( i == 15) {
|
} else if ( i == 15) {
|
||||||
listHeader15.setLabel(labelsList.get(posicao));
|
listHeader15.setLabel(labelsList.get(posicao));
|
||||||
|
} else if ( i == 16) {
|
||||||
|
listHeader16.setLabel(labelsList.get(posicao));
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -512,7 +528,7 @@ public class BusquedaCorridaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
headerService.salvarPosicoesHeader(posicoesColunasTabela);
|
headerService.salvarPosicoesHeader(posicoesColunasTabela);
|
||||||
|
|
||||||
esquemaCorridaList.setItemRenderer(new RenderConfiguracionCorrida(posicoesColunasTabela));
|
esquemaCorridaList.setItemRenderer(new RenderConfiguracionCorrida(posicoesColunasTabela, tramoServicioService));
|
||||||
esquemaCorridaList.renderAll();
|
esquemaCorridaList.renderAll();
|
||||||
|
|
||||||
atualizaLabelsTabela();
|
atualizaLabelsTabela();
|
||||||
|
|
|
@ -4,15 +4,28 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.zkoss.util.resource.Labels;
|
import org.zkoss.util.resource.Labels;
|
||||||
import org.zkoss.zul.Listcell;
|
import org.zkoss.zul.Listcell;
|
||||||
import org.zkoss.zul.Listitem;
|
import org.zkoss.zul.Listitem;
|
||||||
import org.zkoss.zul.ListitemRenderer;
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EsquemaTramo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ParadaEsquema;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Rafius
|
* @author Rafius
|
||||||
|
@ -22,9 +35,12 @@ public class RenderConfiguracionCorrida implements ListitemRenderer {
|
||||||
private Integer[] posicoes = null;
|
private Integer[] posicoes = null;
|
||||||
private SimpleDateFormat dt = new SimpleDateFormat("dd/MM/yy");
|
private SimpleDateFormat dt = new SimpleDateFormat("dd/MM/yy");
|
||||||
|
|
||||||
public RenderConfiguracionCorrida(Integer[] posicoes) {
|
private TramoServicioService tramoServicioService;
|
||||||
|
|
||||||
|
public RenderConfiguracionCorrida(Integer[] posicoes, TramoServicioService tramoServicioService) {
|
||||||
super();
|
super();
|
||||||
this.posicoes = posicoes;
|
this.posicoes = posicoes;
|
||||||
|
this.tramoServicioService = tramoServicioService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderConfiguracionCorrida() {
|
public RenderConfiguracionCorrida() {
|
||||||
|
@ -254,10 +270,101 @@ public class RenderConfiguracionCorrida implements ListitemRenderer {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
// hora de chegada
|
||||||
|
Date horaSaida = corrida.getHorasalida();
|
||||||
|
|
||||||
|
if(horaSaida == null) {
|
||||||
|
lc = new Listcell("");
|
||||||
|
} else {
|
||||||
|
List<EsquemaTramo> lsEsquemaTramo = corrida.getEsquemaTramoList();
|
||||||
|
|
||||||
|
//Colocar em ordem de sequencia
|
||||||
|
Collections.sort(lsEsquemaTramo);
|
||||||
|
ClaseServicio clase = corrida.getClaseServicio();
|
||||||
|
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(horaSaida);
|
||||||
|
|
||||||
|
long minutosPartida = c.get(Calendar.MINUTE);
|
||||||
|
int horaPartida = c.get(Calendar.HOUR_OF_DAY);
|
||||||
|
|
||||||
|
Long tempoLocalidade = 0l;
|
||||||
|
for (int i = 0; i < lsEsquemaTramo.size(); i++) {
|
||||||
|
EsquemaTramo rs = lsEsquemaTramo.get(i);
|
||||||
|
|
||||||
|
if(!rs.getActivo()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tramo tramo = rs.getTramo();
|
||||||
|
Date tiempoEstancia = null;
|
||||||
|
if ((i != 0) && (i != (lsEsquemaTramo.size()))) {
|
||||||
|
tiempoEstancia = lsEsquemaTramo.get(i).getTiempoEstancia();
|
||||||
|
}
|
||||||
|
|
||||||
|
Date excepcionRecorrido = null;
|
||||||
|
if (i != (lsEsquemaTramo.size())) {
|
||||||
|
excepcionRecorrido = lsEsquemaTramo.get(i).getExcepcionRecorrido();
|
||||||
|
}
|
||||||
|
|
||||||
|
Date defautRecorrido = null;
|
||||||
|
if (clase != null) {
|
||||||
|
List<TramoServicio> lsTramoServicio = tramoServicioService.buscarPorTramoServico(tramo, clase);
|
||||||
|
|
||||||
|
if (i != (lsEsquemaTramo.size())) {
|
||||||
|
if (!lsTramoServicio.isEmpty()) {
|
||||||
|
// soh eh permitido gravar um por classe, get(0):
|
||||||
|
defautRecorrido = lsTramoServicio.get(0).getTiemporecorrido();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Long tempoPadrao = 0l;
|
||||||
|
Long tempoParada = 0l;
|
||||||
|
|
||||||
|
if (excepcionRecorrido != null) {
|
||||||
|
tempoPadrao = getMinutos(excepcionRecorrido);
|
||||||
|
} else {
|
||||||
|
if (defautRecorrido != null) {
|
||||||
|
tempoPadrao = getMinutos(defautRecorrido);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tiempoEstancia != null) {
|
||||||
|
tempoParada = getMinutos(tiempoEstancia);
|
||||||
|
}
|
||||||
|
tempoLocalidade += (tempoPadrao + tempoParada);
|
||||||
|
}
|
||||||
|
|
||||||
|
int horasLocalidade = (tempoLocalidade.intValue() / 60) + horaPartida;
|
||||||
|
long minutosLocalidade = (tempoLocalidade % 60) + minutosPartida;
|
||||||
|
|
||||||
|
while(minutosLocalidade >= 60){
|
||||||
|
horasLocalidade +=1;
|
||||||
|
minutosLocalidade -= 60;
|
||||||
|
}
|
||||||
|
while(horasLocalidade >= 24){
|
||||||
|
horasLocalidade -= 24;
|
||||||
|
}
|
||||||
|
if(horasLocalidade == 0 && minutosLocalidade == 0l){
|
||||||
|
lc = new Listcell("");
|
||||||
|
}else{
|
||||||
|
String sMinutos = String.valueOf(minutosLocalidade);
|
||||||
|
lc = new Listcell(horasLocalidade + ":" + StringHelper.preencherZeroEsquerda(sMinutos, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Long getMinutos(Date data){
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(data);
|
||||||
|
return DateUtil.getElapsedMinutos(DateUtil.getFecInicio().getTime(), c.getTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3110,6 +3110,7 @@ busquedaConfiguracionCorridaController.lhId.label = ID
|
||||||
busquedaConfiguracionCorridaController.lbNumCorrida.label = Numero de servicio
|
busquedaConfiguracionCorridaController.lbNumCorrida.label = Numero de servicio
|
||||||
busquedaConfiguracionCorridaController.lhDesc.label = Servicio
|
busquedaConfiguracionCorridaController.lhDesc.label = Servicio
|
||||||
busquedaConfiguracionCorridaController.lhHora.label = Horário
|
busquedaConfiguracionCorridaController.lhHora.label = Horário
|
||||||
|
busquedaConfiguracionCorridaController.lhHoraChegada.label= H. Llegada
|
||||||
busquedaConfiguracionCorridaController.lhRuta.label = Linea
|
busquedaConfiguracionCorridaController.lhRuta.label = Linea
|
||||||
busquedaConfiguracionCorridaController.numRuta.label = Numero da Linha
|
busquedaConfiguracionCorridaController.numRuta.label = Numero da Linha
|
||||||
busquedaConfiguracionCorridaController.sentidoRuta.label = Sentido da Linha
|
busquedaConfiguracionCorridaController.sentidoRuta.label = Sentido da Linha
|
||||||
|
|
|
@ -3421,6 +3421,7 @@ busquedaConfiguracionCorridaController.lhId.label = ID
|
||||||
busquedaConfiguracionCorridaController.lbNumCorrida.label = Número de Serviço
|
busquedaConfiguracionCorridaController.lbNumCorrida.label = Número de Serviço
|
||||||
busquedaConfiguracionCorridaController.lhDesc.label = Serviço
|
busquedaConfiguracionCorridaController.lhDesc.label = Serviço
|
||||||
busquedaConfiguracionCorridaController.lhHora.label = Horário
|
busquedaConfiguracionCorridaController.lhHora.label = Horário
|
||||||
|
busquedaConfiguracionCorridaController.lhHoraChegada.label= H. Chegada
|
||||||
busquedaConfiguracionCorridaController.lhRuta.label = Linha
|
busquedaConfiguracionCorridaController.lhRuta.label = Linha
|
||||||
busquedaConfiguracionCorridaController.numRuta.label = Número da Linha
|
busquedaConfiguracionCorridaController.numRuta.label = Número da Linha
|
||||||
busquedaConfiguracionCorridaController.sentidoRuta.label = Sentido da Linha
|
busquedaConfiguracionCorridaController.sentidoRuta.label = Sentido da Linha
|
||||||
|
|
|
@ -170,6 +170,9 @@
|
||||||
<listheader width="110px" image="/gui/img/builder.gif" id="listHeader15"
|
<listheader width="110px" image="/gui/img/builder.gif" id="listHeader15"
|
||||||
label="${c:l('busquedaConfiguracionCorridaController.lhStatus.value')}"
|
label="${c:l('busquedaConfiguracionCorridaController.lhStatus.value')}"
|
||||||
sort="auto(statusCorrida)" />
|
sort="auto(statusCorrida)" />
|
||||||
|
<listheader width="110px" image="/gui/img/builder.gif" id="listHeader16"
|
||||||
|
label="${c:l('busquedaConfiguracionCorridaController.lhHoraChegada.label')}"
|
||||||
|
/>
|
||||||
</listhead>
|
</listhead>
|
||||||
</listbox>
|
</listbox>
|
||||||
</window>
|
</window>
|
||||||
|
|
Loading…
Reference in New Issue