fixes bug #8371
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@65764 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
806592b8bc
commit
ab8c2ffe59
|
@ -277,7 +277,7 @@ public class RelatorioMovimentosAtraso extends Relatorio {
|
|||
|
||||
private void carregarDiasMovimento(MovimentosAtrasoVO movimentosAtrasoBase) throws ParseException {
|
||||
movimentosAtrasoBase.setDiasEmAtraso(new TreeSet<Integer>());
|
||||
Set<Integer> diasCompetencia = DateUtil.carregarDiasCompetencia(movimentosAtrasoBase.getCompetencia());
|
||||
Set<Integer> diasCompetencia = DateUtil.carregarDiasCompetencia(movimentosAtrasoBase.getCompetencia(), null);
|
||||
Date dataAtual = DateUtil.normalizar(new Date());
|
||||
Integer diasEmTransito = movimentosAtrasoBase.getDiasemtransito() != null ? movimentosAtrasoBase.getDiasemtransito() : 0;
|
||||
diasEmTransito += movimentosAtrasoBase.getIntervalofechamento() != null ? movimentosAtrasoBase.getIntervalofechamento() : 0;
|
||||
|
|
|
@ -136,7 +136,7 @@ public class ConferenciaComissaoController extends MyGenericForwardComposer {
|
|||
|
||||
private void carregarDados() {
|
||||
try {
|
||||
lsConferenciaComissao = conferenciaComissaoService.carregarConferenciaComissao(competencia, empresa, puntoVenta);
|
||||
lsConferenciaComissao = conferenciaComissaoService.carregarConferenciaComissao(competencia, empresa, puntoVenta, null);
|
||||
conferenciaList.setData(lsConferenciaComissao);
|
||||
} catch (BusinessException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.job;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService;
|
||||
import com.rjconsultores.ventaboletos.service.CorridaService;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
/**
|
||||
* @author valdevir_rj
|
||||
*
|
||||
*/
|
||||
public class GeneracionConferenciaMovimentoJob implements Job {
|
||||
private static Logger log = Logger.getLogger(GeneracionConferenciaMovimentoJob.class);
|
||||
private CorridaService corridaService;
|
||||
|
||||
private ConferenciaComissaoService conferenciaComissaoService;
|
||||
|
||||
|
||||
public CorridaService getCorridaService() {
|
||||
return corridaService;
|
||||
}
|
||||
|
||||
public void setCorridaService(CorridaService corridaService) {
|
||||
this.corridaService = corridaService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jec) throws JobExecutionException {
|
||||
log.info("Inicio do job de geração de Conferência de Momvimento.");
|
||||
ApplicationContext appContext = AppContext.getApplicationContext();
|
||||
conferenciaComissaoService = (ConferenciaComissaoService) appContext.getBean("conferenciaComissaoService");
|
||||
conferenciaComissaoService.generacionAutomaticaConferencia();
|
||||
log.info("Fim do job de geração de Conferência de Momvimento..");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@ import org.zkoss.zk.ui.WebApp;
|
|||
import com.rjconsultores.ventaboletos.FlyWay;
|
||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionConferenciaMovimentoJob;
|
||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionCorridaJob;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
|
@ -32,6 +33,8 @@ import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
|||
*/
|
||||
public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
||||
|
||||
private static final String HORA_GENERACION_CORRIDA = "HORA_GENERACION_CORRIDA";
|
||||
private static final String HORA_EXEC_CONFERENCIA_MOVIMENTO = "HORA_EXEC_CONFERENCIA_MOVIMENTO";
|
||||
private static Logger log = Logger.getLogger(MyAppInit.class);
|
||||
SchedulerFactory schedFact = new StdSchedulerFactory();
|
||||
Scheduler sched;
|
||||
|
@ -66,6 +69,9 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
|||
|
||||
// Generacion Automatica de Corridas
|
||||
jobGeneracionCorridas();
|
||||
|
||||
//Geração automatíca da conferência de mmovimento.
|
||||
jobGeneracionConferenciaMovimento();
|
||||
}
|
||||
|
||||
executeFlyway();
|
||||
|
@ -118,9 +124,9 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
|||
|
||||
}
|
||||
|
||||
private Integer[] horaExecucion() {
|
||||
private Integer[] horaExecucion(String nombConstante) {
|
||||
|
||||
Constante constante = getConstanteService().buscarPorNomeConstante("HORA_GENERACION_CORRIDA");
|
||||
Constante constante = getConstanteService().buscarPorNomeConstante(nombConstante);
|
||||
|
||||
Integer[] arrayHoraMinuto = new Integer[2];
|
||||
arrayHoraMinuto[0] = 1;
|
||||
|
@ -163,7 +169,7 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
|||
|
||||
JobDetail jobDetail = new JobDetail("GeneracionCorridas", null, GeneracionCorridaJob.class);
|
||||
|
||||
Integer[] hora = horaExecucion();
|
||||
Integer[] hora = horaExecucion(HORA_GENERACION_CORRIDA);
|
||||
|
||||
if (hora == null) {
|
||||
log.info("constante HORA_GENERACION_CORRIDA não habilitada.");
|
||||
|
@ -198,7 +204,32 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
|||
log.error(ex);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Cria job do Quartz para Conferência de Movimento Automática do dia anterior.
|
||||
*/
|
||||
private void jobGeneracionConferenciaMovimento() {
|
||||
try {
|
||||
sched = schedFact.getScheduler();
|
||||
JobDetail jobDetail = new JobDetail("GeneracionConferenciaMovimentoJob", null, GeneracionConferenciaMovimentoJob.class);
|
||||
Integer[] hora = horaExecucion(HORA_EXEC_CONFERENCIA_MOVIMENTO);
|
||||
Trigger trigger = TriggerUtils.makeDailyTrigger("generacionConferenciaMovimentoTrigger", hora[0], hora[1]);
|
||||
// TESTE TRIGGER
|
||||
//Trigger trigger = TriggerUtils.makeImmediateTrigger("generacionConferenciaMovimentoTrigger", 1, 1000);
|
||||
trigger.setName("generacionConferenciaMovimentoTrigger");
|
||||
JobDetail job = sched.getJobDetail(jobDetail.getName(), jobDetail.getGroup());
|
||||
log.info("Job=" + jobDetail.getName() + "." + jobDetail.getGroup());
|
||||
if (job != null) {
|
||||
log.info("Job já existe");
|
||||
boolean deleted = sched.deleteJob(job.getName(), Scheduler.DEFAULT_GROUP);
|
||||
log.info("Deleted=" + deleted);
|
||||
}
|
||||
sched.scheduleJob(jobDetail, trigger);
|
||||
sched.start();
|
||||
|
||||
} catch (SchedulerException ex) {
|
||||
log.error(ex);
|
||||
}
|
||||
}
|
||||
private DataSource getDataSoure() {
|
||||
ApplicationContext appContext = AppContext.getApplicationContext();
|
||||
BeanFactory factory = (BeanFactory) appContext;
|
||||
|
|
Loading…
Reference in New Issue