package br.com.ec.domain.dto;
import java.util.ArrayList;
import java.util.List;
import br.com.ec.core.util.VerificadorUtil;
import br.com.ec.domain.model.SubtipoProduto;
public class AlertasComprasGeralSubTipoDTO
{
private SubtipoProduto subtipoProduto
;
private List<RankingProdutoDTO
> rankingProdutosDTO
;
private Integer quantidadeAlertasPossiveis
;
public AlertasComprasGeralSubTipoDTO
() {
setRankingProdutosDTO
(new ArrayList<RankingProdutoDTO
>());
setQuantidadeAlertasPossiveis
(0);
}
public SubtipoProduto getSubtipoProduto
() {
return subtipoProduto
;
}
public void setSubtipoProduto
(SubtipoProduto subtipoProduto
) {
this.
subtipoProduto = subtipoProduto
;
}
public List<RankingProdutoDTO
> getRankingProdutosDTO
() {
return rankingProdutosDTO
;
}
public void setRankingProdutosDTO
(List<RankingProdutoDTO
> rankingProdutosDTO
) {
this.
rankingProdutosDTO = rankingProdutosDTO
;
}
public Integer getQuantidadeAlertasPossiveis
() {
return quantidadeAlertasPossiveis
;
}
public void setQuantidadeAlertasPossiveis
(Integer quantidadeAlertasPossiveis
) {
this.
quantidadeAlertasPossiveis = quantidadeAlertasPossiveis
;
}
/******************************************************/
public Integer getQuantidadeTotalTempoEstoque
() {
Integer quantidadeTotal =
0;
if (!getRankingProdutosDTO
().
isEmpty()) {
for (RankingProdutoDTO ranking : getRankingProdutosDTO
()) {
quantidadeTotal += ranking.
getTempoEstoque();
}
quantidadeTotal = quantidadeTotal/getRankingProdutosDTO
().
size();
}
return quantidadeTotal
;
}
public Integer getQuantidadeTotalVendas
() {
Long quantidadeTotal =
new Long(0);
if (!getRankingProdutosDTO
().
isEmpty()) {
for (RankingProdutoDTO ranking : getRankingProdutosDTO
()) {
quantidadeTotal += ranking.
getQuantidadeVendas();
}
}
return quantidadeTotal.
intValue();
}
public Integer getQuantidadeTotalEstoque
() {
Long quantidadeTotal =
new Long(0);
if (!getRankingProdutosDTO
().
isEmpty()) {
for (RankingProdutoDTO ranking : getRankingProdutosDTO
()) {
quantidadeTotal += ranking.
getQuantidadeEstoque();
}
}
return quantidadeTotal.
intValue();
}
public Integer getQuantidadeTotalParaComprarPedidoCompra
() {
Long quantidadeTotal =
new Long(0);
if (!getRankingProdutosDTO
().
isEmpty()) {
for (RankingProdutoDTO ranking : getRankingProdutosDTO
()) {
if (VerificadorUtil.
naoEstaNulo(ranking.
getQuantidadeParaComprarPedidoCompra())) {
quantidadeTotal += ranking.
getQuantidadeParaComprarPedidoCompra();
}
}
}
return quantidadeTotal.
intValue();
}
public Integer getQuantidadeComprar
() {
return getQuantidadeTotalVendas
() - getQuantidadeTotalEstoque
();
}
/*
public Integer getQuantidadeTotalAlertas() {
Integer quantidadeTotalAlertas = 0;
if (!getAlertasComprasGeralDTO().isEmpty()) {
for (AlertasComprasGeralSubTipoDTO ranking : getAlertasComprasGeralDTO()) {
quantidadeTotalAlertas += ranking.getAlertas().size();
}
}
return quantidadeTotalAlertas;
}
public Integer getQuantidadeTotalAlertasPossiveis() {
Integer quantidadeTotalAlertasPossiveis = 0;
if (!getAlertasComprasGeralDTO().isEmpty()) {
for (AlertasComprasGeralSubTipoDTO ranking : getAlertasComprasGeralDTO()) {
quantidadeTotalAlertasPossiveis += ranking.getQuantidadeAlertasPossiveis();
}
}
return quantidadeTotalAlertasPossiveis + getQuantidadeTotalAlertas();
}
public Double percentualAlertas() {
Double percentual = new Double(getQuantidadeTotalAlertas())/new Double(getQuantidadeTotalAlertasPossiveis());
return 100 - (percentual * 100.0);
}
public String corPercentualAlerta() {
Double percentual = percentualAlertas();
if (percentual > 90.0) {
return "green-haze";
}
if (percentual > 50.0) {
return "orange";
}
return "red";
}
*/
}