Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 370 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | |||
| 5 | import javax.annotation.PostConstruct; |
||
| 6 | import javax.inject.Inject; |
||
| 7 | import javax.inject.Named; |
||
| 8 | |||
| 9 | import org.springframework.context.annotation.Scope; |
||
| 10 | |||
| 11 | import br.com.ec.core.generic.GenericService; |
||
| 12 | import br.com.ec.core.util.DataUtils; |
||
| 13 | import br.com.ec.domain.dto.DashboardComercialDTO; |
||
| 14 | import br.com.ec.domain.dto.TempoRealDTO; |
||
| 15 | import br.com.ec.domain.model.tipos.TipoPedido; |
||
| 16 | import br.com.ec.domain.model.tipos.TipoPeriodo; |
||
| 17 | import br.com.ec.domain.model.tipos.TipoSituacaoPedido; |
||
| 18 | import br.com.ec.domain.service.PedidoService; |
||
| 19 | import br.com.ec.web.generic.AbstractBean; |
||
| 20 | |||
| 21 | @Named |
||
| 22 | @Scope("view") |
||
| 23 | public class DashboardComercialBean extends AbstractBean<DashboardComercialDTO> implements Serializable { |
||
| 24 | |||
| 25 | private static final long serialVersionUID = 1L; |
||
| 26 | |||
| 27 | private PedidoService pedidoService; |
||
| 28 | |||
| 29 | @Inject |
||
| 30 | public DashboardComercialBean(PedidoService pedidoService) { |
||
| 31 | this.pedidoService = pedidoService; |
||
| 32 | } |
||
| 33 | |||
| 34 | @Override |
||
| 35 | public GenericService<DashboardComercialDTO> getService() { |
||
| 36 | return null; |
||
| 37 | } |
||
| 38 | |||
| 39 | @Override |
||
| 40 | public DashboardComercialDTO getId() { |
||
| 41 | return null; |
||
| 42 | } |
||
| 43 | |||
| 44 | @Override |
||
| 45 | public void limparEntidade() { |
||
| 46 | setEntidade(new DashboardComercialDTO()); |
||
| 47 | } |
||
| 48 | |||
| 49 | @PostConstruct |
||
| 50 | private void iniciarConsolidacoes() { |
||
| 51 | limparEntidade(); |
||
| 52 | getEntidade().setPeriodoInicial(DataUtils.getDataComHorarioMinimo(DataUtils.getPrimeiroDiaDoMesAtual())); |
||
| 53 | getEntidade().setPeriodoFinal(DataUtils.getDataComHorarioMaximo(DataUtils.getUltimoDiaDoMesAtual())); |
||
| 54 | Integer quantidadePedidosAtendidosNoPeriodo = new Integer(0); |
||
| 55 | quantidadePedidosAtendidosNoPeriodo = pedidoService.obterQuantidadePedidosPorSituacaoEePeriodo(TipoPedido.RESERVA.getValor(), TipoSituacaoPedido.FINALIZADO.getValor(), getEntidade().getPeriodoInicial(), getEntidade().getPeriodoFinal()); |
||
| 56 | getEntidade().setQuantidadePedidosAtendidosNoPeriodo(quantidadePedidosAtendidosNoPeriodo); |
||
| 57 | } |
||
| 58 | |||
| 59 | } |