fixes bug#23499
dev: Valdevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@109594 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
c87db3f5b1
commit
b6d179ca88
|
@ -0,0 +1,35 @@
|
||||||
|
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.SapService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
public class IntegracaoSapJob implements Job {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(IntegracaoSapJob.class);
|
||||||
|
private SapService sapService;
|
||||||
|
|
||||||
|
public SapService getSapService() {
|
||||||
|
return sapService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext jec) throws JobExecutionException {
|
||||||
|
log.info("Inicio do job de integração de boletos com o SAP.");
|
||||||
|
|
||||||
|
ApplicationContext appContext = AppContext.getApplicationContext();
|
||||||
|
SapService iss = (SapService) appContext.getBean("sapService");
|
||||||
|
try {
|
||||||
|
iss.integracaoSapAutomatica();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Fim do job de integração de boletos com o SAP.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionConferenciaMovimentoJob;
|
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionConferenciaMovimentoJob;
|
||||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionCorridaJob;
|
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionCorridaJob;
|
||||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionRetencaoDiariaComissaoJob;
|
import com.rjconsultores.ventaboletos.web.gui.controladores.job.GeneracionRetencaoDiariaComissaoJob;
|
||||||
|
import com.rjconsultores.ventaboletos.web.gui.controladores.job.IntegracaoSapJob;
|
||||||
import com.rjconsultores.ventaboletos.web.gui.controladores.job.MonitoramentoCCFCRZJob;
|
import com.rjconsultores.ventaboletos.web.gui.controladores.job.MonitoramentoCCFCRZJob;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ 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_GENERACION_CORRIDA = "HORA_GENERACION_CORRIDA";
|
||||||
private static final String HORA_EXEC_CONFERENCIA_MOVIMENTO = "HORA_EXEC_CONFERENCIA_MOVIMENTO";
|
private static final String HORA_EXEC_CONFERENCIA_MOVIMENTO = "HORA_EXEC_CONFERENCIA_MOVIMENTO";
|
||||||
private static final String HORA_EXEC_MONITORAMENTO_REDUCAOZ = "HORA_EXEC_MONITORAMENTO_REDUCAOZ";
|
private static final String HORA_EXEC_MONITORAMENTO_REDUCAOZ = "HORA_EXEC_MONITORAMENTO_REDUCAOZ";
|
||||||
|
private static final String HORA_INTEGRACAO_SAP = "HORA_INTEGRACAO_SAP";
|
||||||
private static Logger log = Logger.getLogger(MyAppInit.class);
|
private static Logger log = Logger.getLogger(MyAppInit.class);
|
||||||
SchedulerFactory schedFact = new StdSchedulerFactory();
|
SchedulerFactory schedFact = new StdSchedulerFactory();
|
||||||
Scheduler sched;
|
Scheduler sched;
|
||||||
|
@ -91,6 +93,8 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
||||||
|
|
||||||
//Retencao diara comissao
|
//Retencao diara comissao
|
||||||
jobGeneracionRetencaoDiariaComissao();
|
jobGeneracionRetencaoDiariaComissao();
|
||||||
|
|
||||||
|
jobIntegracaoSap();
|
||||||
}
|
}
|
||||||
|
|
||||||
executeFlyway();
|
executeFlyway();
|
||||||
|
@ -285,6 +289,48 @@ public class MyAppInit implements org.zkoss.zk.ui.util.WebAppInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void jobIntegracaoSap() {
|
||||||
|
try {
|
||||||
|
sched = schedFact.getScheduler();
|
||||||
|
|
||||||
|
JobDetail jobDetail = new JobDetail("IntegracaoSap", null, IntegracaoSapJob.class);
|
||||||
|
|
||||||
|
Integer[] hora = horaExecucion(HORA_INTEGRACAO_SAP);
|
||||||
|
|
||||||
|
if (hora == null) {
|
||||||
|
log.info("constante HORA_INTEGRACAO_SAP não habilitada.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Horario de integraçao com sap : " + hora[0] + ":" + hora[1]);
|
||||||
|
|
||||||
|
Trigger trigger = TriggerUtils.makeDailyTrigger("integracaoSapTrigger", hora[0], hora[1]);
|
||||||
|
|
||||||
|
// TESTE TRIGGER
|
||||||
|
// Trigger trigger = TriggerUtils.makeImmediateTrigger("integracaoSapTrigger", 1, 1000);
|
||||||
|
|
||||||
|
trigger.setName("integracaoSapTrigger");
|
||||||
|
|
||||||
|
JobDetail job = sched.getJobDetail(jobDetail.getName(), jobDetail.getGroup());
|
||||||
|
|
||||||
|
log.info("Job=" + jobDetail.getName() + "." + jobDetail.getGroup());
|
||||||
|
|
||||||
|
if (job != null) {
|
||||||
|
log.info("Job ya existia");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cria job do Quartz para Conferência de Movimento Automática do dia anterior.
|
* Cria job do Quartz para Conferência de Movimento Automática do dia anterior.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue