fixes bug#11535
dev:gleimar qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@83234 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
e0510ea5c0
commit
111e360811
|
@ -1,22 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.job;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.CalculoComissaoService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
public class GeneracionRetencaoDiariaComissaoJob implements Job {
|
||||
|
@ -24,8 +14,6 @@ public class GeneracionRetencaoDiariaComissaoJob implements Job {
|
|||
private static Logger log = Logger.getLogger(GeneracionRetencaoDiariaComissaoJob.class);
|
||||
|
||||
private CalculoComissaoService calculoComissaoService;
|
||||
private EmpresaService empresaService;
|
||||
private PuntoVentaService puntoVentaService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext arg0) throws JobExecutionException {
|
||||
|
@ -33,37 +21,7 @@ public class GeneracionRetencaoDiariaComissaoJob implements Job {
|
|||
log.info("Inicio Job retencao diaria da comissao");
|
||||
ApplicationContext appContext = AppContext.getApplicationContext();
|
||||
calculoComissaoService = (CalculoComissaoService) appContext.getBean("calculoComissaoService");
|
||||
empresaService = (EmpresaService) appContext.getBean("empresaService");
|
||||
puntoVentaService = (PuntoVentaService) appContext.getBean("puntoVentaService");
|
||||
|
||||
Integer usuarioId = 1;
|
||||
if (UsuarioLogado.getUsuarioLogado() != null && UsuarioLogado.getUsuarioLogado().getUsuarioId() != null) {
|
||||
usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId();
|
||||
}
|
||||
|
||||
List<Empresa> empresas = empresaService.buscarEmpresaPtoVtaComissao();
|
||||
List<PuntoVenta> puntoVentas = puntoVentaService.buscarPuntoVentaPtoVtaComissao(empresas);
|
||||
|
||||
Calendar cDataRetencao = Calendar.getInstance();
|
||||
cDataRetencao.add(Calendar.DAY_OF_MONTH, -2);
|
||||
|
||||
Date dataRetencao = DateUtil.normalizarToFecha(cDataRetencao.getTime());
|
||||
String sDataRetencao = DateUtil.getStringDate(dataRetencao, "dd/MM/yyyy");
|
||||
|
||||
for (Empresa empresa : empresas) {
|
||||
for (PuntoVenta puntoVenta : puntoVentas) {
|
||||
String descretencao = "Empresa: "+ empresa.getNombempresa() + " - Agencia: " + puntoVenta.getNombpuntoventa() +" data: " + sDataRetencao;
|
||||
log.info("Inicio Retencao " + descretencao);
|
||||
try {
|
||||
calculoComissaoService.registrarCalculoComissao(puntoVenta, empresa, dataRetencao, dataRetencao, usuarioId);
|
||||
log.info("Fim Retencao " + descretencao);
|
||||
} catch (Exception e) {
|
||||
log.info("Erro retencao " + descretencao);
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calculoComissaoService.retencaoAutomaticaComissao();
|
||||
log.info("Fim Job retencao diaria da comissao");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue