Subversion Repositories Integrator Subversion

Rev

Rev 568 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

package br.com.ec.controller;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.context.annotation.Scope;

import br.com.ec.core.generic.GenericService;
import br.com.ec.core.util.DataUtils;
import br.com.ec.domain.dto.AlertasGeralDTO;
import br.com.ec.domain.dto.AlertasLogisticaComprasDTO;
import br.com.ec.domain.dto.RankingComprasTransferenciasDTO;
import br.com.ec.domain.dto.RankingModeloDTO;
import br.com.ec.domain.dto.consulta.ParametrosConsultaModelosMaisVendidosDTO;
import br.com.ec.domain.service.AlertasService;
import br.com.ec.domain.service.VendaService;
import br.com.ec.web.generic.AbstractBean;

@Named
@Scope("view")
public class AlertasLogisticaBean extends AbstractBean<AlertasGeralDTO> implements Serializable {

        private static final long serialVersionUID = 1L;
       
        private Boolean adicionarModelosFavoritosSemVendas;
        private Integer quantidadeDiasVendas = 0;
        private Integer quantidadeDiasParaAlerta = 0;
       
        private AlertasService alertasService;

        @Inject
        public AlertasLogisticaBean(AlertasService alertasService) {
                this.alertasService = alertasService;
        }

        @Override
        public GenericService<AlertasGeralDTO> getService() {
                return null;
        }

        @Override
        public AlertasGeralDTO getId() {
                return null;
        }
       
        @Override
        public void limparEntidade() {
                setEntidade(new AlertasGeralDTO());
                setQuantidadeDiasVendas(30);
                setQuantidadeDiasParaAlerta(10);
                setAdicionarModelosFavoritosSemVendas(false);
        }
       
        @PostConstruct
        private void iniciarConsolidacoes() {
                limparEntidade();
        }
       
        public Boolean getAdicionarModelosFavoritosSemVendas() {
                return adicionarModelosFavoritosSemVendas;
        }
        public void setAdicionarModelosFavoritosSemVendas(Boolean adicionarModelosFavoritosSemVendas) {
                this.adicionarModelosFavoritosSemVendas = adicionarModelosFavoritosSemVendas;
        }
       
        public Integer getQuantidadeDiasVendas() {
                return quantidadeDiasVendas;
        }
        public void setQuantidadeDiasVendas(Integer quantidadeDiasVendas) {
                this.quantidadeDiasVendas = quantidadeDiasVendas;
        }
       
        public Integer getQuantidadeDiasParaAlerta() {
                return quantidadeDiasParaAlerta;
        }
        public void setQuantidadeDiasParaAlerta(Integer quantidadeDiasParaAlerta) {
                this.quantidadeDiasParaAlerta = quantidadeDiasParaAlerta;
        }
       
        public void verificarAlertas() {
                limparEntidade();
                getEntidade().setAlertasLogisticaCapasDTO(alertasService.consultarAlertasLogistica(getQuantidadeDiasVendas(), getQuantidadeDiasParaAlerta(), getAdicionarModelosFavoritosSemVendas()));
        }
       
}