Rev 337 | Rev 422 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 337 | Rev 356 | ||
|---|---|---|---|
| Line 33... | Line 33... | ||
| 33 | import br.com.ec.domain.dto.RankingProdutoDTO; |
33 | import br.com.ec.domain.dto.RankingProdutoDTO; |
| 34 | import br.com.ec.domain.dto.RankingVendedorDTO; |
34 | import br.com.ec.domain.dto.RankingVendedorDTO; |
| 35 | import br.com.ec.domain.dto.VendasDTO; |
35 | import br.com.ec.domain.dto.VendasDTO; |
| 36 | import br.com.ec.domain.model.Avaliacao; |
36 | import br.com.ec.domain.model.Avaliacao; |
| 37 | import br.com.ec.domain.model.AvaliacaoFuncionario; |
37 | import br.com.ec.domain.model.AvaliacaoFuncionario; |
| - | 38 | import br.com.ec.domain.model.AvaliacaoProduto; |
|
| 38 | import br.com.ec.domain.model.Categoria; |
39 | import br.com.ec.domain.model.Categoria; |
| 39 | import br.com.ec.domain.model.Cupom; |
40 | import br.com.ec.domain.model.Cupom; |
| 40 | import br.com.ec.domain.model.EstoqueAuditoria; |
41 | import br.com.ec.domain.model.EstoqueAuditoria; |
| 41 | import br.com.ec.domain.model.FormaPagamento; |
42 | import br.com.ec.domain.model.FormaPagamento; |
| 42 | import br.com.ec.domain.model.Lancamento; |
43 | import br.com.ec.domain.model.Lancamento; |
| Line 76... | Line 77... | ||
| 76 | import br.com.ec.domain.service.produtodaloja.ProdutoLojaService; |
77 | import br.com.ec.domain.service.produtodaloja.ProdutoLojaService; |
| 77 | import br.com.ec.domain.service.venda.VendaService; |
78 | import br.com.ec.domain.service.venda.VendaService; |
| 78 | import br.com.ec.domain.service.vendaformapagamento.VendaFormaPagamentoService; |
79 | import br.com.ec.domain.service.vendaformapagamento.VendaFormaPagamentoService; |
| 79 | import br.com.ec.domain.service.vendavivo.VendaVivoService; |
80 | import br.com.ec.domain.service.vendavivo.VendaVivoService; |
| 80 | import br.com.ec.domain.service.vendedor.VendedorService; |
81 | import br.com.ec.domain.service.vendedor.VendedorService; |
| - | 82 | import br.com.ec.domain.service.vigencia.VigenciaService; |
|
| 81 | import br.com.ec.domain.shared.ConstantesSEC; |
83 | import br.com.ec.domain.shared.ConstantesSEC; |
| 82 | import br.com.ec.domain.shared.Ordenador; |
84 | import br.com.ec.domain.shared.Ordenador; |
| 83 | import br.com.ec.domain.shared.OrdenadorImpl; |
85 | import br.com.ec.domain.shared.OrdenadorImpl; |
| 84 | import br.com.ec.infrastructure.repository.NotaFiscalRepository; |
86 | import br.com.ec.infrastructure.repository.NotaFiscalRepository; |
| 85 | import br.com.ec.infrastructure.repository.VendaRepository; |
87 | import br.com.ec.infrastructure.repository.VendaRepository; |
| Line 104... | Line 106... | ||
| 104 | private VendaVivoService vendaVivoService; |
106 | private VendaVivoService vendaVivoService; |
| 105 | private ModeloService modeloService; |
107 | private ModeloService modeloService; |
| 106 | private CupomService cupomService; |
108 | private CupomService cupomService; |
| 107 | private BancoHorasService bancoHorasService; |
109 | private BancoHorasService bancoHorasService; |
| 108 | private EstoqueAuditoriaService estoqueAuditoriaService; |
110 | private EstoqueAuditoriaService estoqueAuditoriaService; |
| - | 111 | private VigenciaService vigenciaService; |
|
| 109 | 112 | ||
| 110 | private Ordenador ordenador; |
113 | private Ordenador ordenador; |
| 111 | private NotaFiscalRepository notaFiscalRepository; |
114 | private NotaFiscalRepository notaFiscalRepository; |
| 112 | 115 | ||
| 113 | @Autowired |
116 | @Autowired |
| 114 | public VendaServiceImpl(Validador validador, VendaRepository vendaRepository, LancamentoService lancamentoService, |
117 | public VendaServiceImpl(Validador validador, VendaRepository vendaRepository, LancamentoService lancamentoService, |
| 115 | VendaFormaPagamentoService vendaFormaPagamentoService, ProdutoService produtoService, ProdutoLojaService produtoLojaService, |
118 | VendaFormaPagamentoService vendaFormaPagamentoService, ProdutoService produtoService, ProdutoLojaService produtoLojaService, |
| 116 | VendedorService vendedorService, FuncionarioService funcionarioService, LojaService lojaService, PedidoService pedidoService, |
119 | VendedorService vendedorService, FuncionarioService funcionarioService, LojaService lojaService, PedidoService pedidoService, |
| 117 | ParcelaService parcelaService, AvaliacaoService avaliacaoService, AvaliacaoFuncionarioService avaliacaoFuncionarioService, |
120 | ParcelaService parcelaService, AvaliacaoService avaliacaoService, AvaliacaoFuncionarioService avaliacaoFuncionarioService, |
| 118 | AvaliacaoLojaService avaliacaoLojaService, VendaVivoService vendaVivoService, ModeloService modeloService, CupomService cupomService, |
121 | AvaliacaoLojaService avaliacaoLojaService, VendaVivoService vendaVivoService, ModeloService modeloService, CupomService cupomService, |
| 119 | BancoHorasService bancoHorasService, EstoqueAuditoriaService estoqueAuditoriaService, NotaFiscalRepository notaFiscalRepository) { |
- | |
| - | 122 | BancoHorasService bancoHorasService, EstoqueAuditoriaService estoqueAuditoriaService, VigenciaService vigenciaService, |
|
| - | 123 | NotaFiscalRepository notaFiscalRepository) { |
|
| 120 | super(validador); |
124 | super(validador); |
| 121 | this.vendaRepository = vendaRepository; |
125 | this.vendaRepository = vendaRepository; |
| 122 | this.funcionarioService = funcionarioService; |
126 | this.funcionarioService = funcionarioService; |
| 123 | this.lancamentoService = lancamentoService; |
127 | this.lancamentoService = lancamentoService; |
| 124 | this.vendaFormaPagamentoService = vendaFormaPagamentoService; |
128 | this.vendaFormaPagamentoService = vendaFormaPagamentoService; |
| Line 134... | Line 138... | ||
| 134 | this.vendaVivoService = vendaVivoService; |
138 | this.vendaVivoService = vendaVivoService; |
| 135 | this.modeloService = modeloService; |
139 | this.modeloService = modeloService; |
| 136 | this.cupomService = cupomService; |
140 | this.cupomService = cupomService; |
| 137 | this.bancoHorasService = bancoHorasService; |
141 | this.bancoHorasService = bancoHorasService; |
| 138 | this.estoqueAuditoriaService = estoqueAuditoriaService; |
142 | this.estoqueAuditoriaService = estoqueAuditoriaService; |
| 139 | this.ordenador = new OrdenadorImpl(); |
- | |
| - | 143 | this.vigenciaService = vigenciaService; |
|
| 140 | this.notaFiscalRepository = notaFiscalRepository; |
144 | this.notaFiscalRepository = notaFiscalRepository; |
| - | 145 | this.ordenador = new OrdenadorImpl(); |
|
| 141 | }
|
146 | }
|
| 142 | 147 | ||
| 143 | @Override |
148 | @Override |
| 144 | protected GenericRepository<Venda> getRepository() { |
149 | protected GenericRepository<Venda> getRepository() { |
| 145 | return vendaRepository; |
150 | return vendaRepository; |
| Line 1352... | Line 1357... | ||
| 1352 | }
|
1357 | }
|
| 1353 | return estilos; |
1358 | return estilos; |
| 1354 | }
|
1359 | }
|
| 1355 | 1360 | ||
| 1356 | @Override |
1361 | @Override |
| 1357 | public List<RankingVendedorDTO> consultarRankingPromocaoInterna(Date dataInicial, Date dataFinal, String produtosPromocaoInterna) { |
- | |
| - | 1362 | public List<RankingVendedorDTO> consultarRankingPromocaoInterna(Date dataInicial, Date dataFinal) { |
|
| 1358 | List<RankingVendedorDTO> rankingVendedores = new ArrayList<RankingVendedorDTO>(); |
1363 | List<RankingVendedorDTO> rankingVendedores = new ArrayList<RankingVendedorDTO>(); |
| 1359 | List<Vendedor> vendedores = vendedorService.consultarVendedoresColaboradoresAtivos(null); |
- | |
| 1360 | for (Vendedor vendedor : vendedores) { |
- | |
| 1361 | RankingVendedorDTO ranking = consultarRankingPromocaoInternaDoVendedor(vendedor, dataInicial, dataFinal, produtosPromocaoInterna); |
- | |
| 1362 | if (ranking.getValorTotalVendido() > new Double(0.0)) { |
- | |
| 1363 | rankingVendedores.add(ranking); |
- | |
| - | 1364 | Vigencia vigencia = vigenciaService.consultarVigenciaDoPeriodo(dataInicial); |
|
| - | 1365 | if (VerificadorUtil.naoEstaNulo(vigencia)) { |
|
| - | 1366 | Avaliacao avaliacao = avaliacaoService.consultarAvaliacaoDaVigencia(vigencia); |
|
| - | 1367 | if (VerificadorUtil.naoEstaNulo(avaliacao)) { |
|
| - | 1368 | List<AvaliacaoProduto> produtosAvaliacaoPromocaoInterna = avaliacaoService.consultarProdutosPromocaoInterna(avaliacao.getSequencial()); |
|
| - | 1369 | List<Produto> produtosPromocaoInterna = new ArrayList<Produto>(); |
|
| - | 1370 | for (AvaliacaoProduto produtoAvaliacaoPromocaoInterna : produtosAvaliacaoPromocaoInterna) { |
|
| - | 1371 | produtosPromocaoInterna.add(produtoAvaliacaoPromocaoInterna.getProduto()); |
|
| - | 1372 | }
|
|
| - | 1373 | ||
| - | 1374 | List<Vendedor> vendedores = vendedorService.consultarVendedoresColaboradoresAtivos(null); |
|
| - | 1375 | for (Vendedor vendedor : vendedores) { |
|
| - | 1376 | RankingVendedorDTO ranking = consultarRankingPromocaoInternaDoVendedor(vendedor, dataInicial, dataFinal, produtosPromocaoInterna); |
|
| - | 1377 | if (ranking.getValorTotalVendido() > new Double(0.0)) { |
|
| - | 1378 | rankingVendedores.add(ranking); |
|
| - | 1379 | }
|
|
| - | 1380 | }
|
|
| 1364 | }
|
1381 | }
|
| 1365 | }
|
1382 | }
|
| 1366 | return (List<RankingVendedorDTO>) ordenador.ordenar(rankingVendedores); |
1383 | return (List<RankingVendedorDTO>) ordenador.ordenar(rankingVendedores); |
| 1367 | }
|
1384 | }
|
| 1368 | 1385 | ||
| 1369 | @Override |
1386 | @Override |
| 1370 | public RankingVendedorDTO consultarRankingPromocaoInternaDoVendedor(Vendedor vendedor, Date dataInicial, Date dataFinal, |
1387 | public RankingVendedorDTO consultarRankingPromocaoInternaDoVendedor(Vendedor vendedor, Date dataInicial, Date dataFinal, |
| 1371 | String produtosPromocaoInterna) { |
- | |
| - | 1388 | List<Produto> produtosPromocaoInterna) { |
|
| 1372 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
1389 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
| 1373 | parametrosConsultaVendas.setDataInicial(DataUtils.getDataComHorarioMinimo(dataInicial)); |
1390 | parametrosConsultaVendas.setDataInicial(DataUtils.getDataComHorarioMinimo(dataInicial)); |
| 1374 | parametrosConsultaVendas.setDataFinal(DataUtils.getDataComHorarioMaximo(dataFinal)); |
1391 | parametrosConsultaVendas.setDataFinal(DataUtils.getDataComHorarioMaximo(dataFinal)); |
| 1375 | parametrosConsultaVendas.setVendedor(vendedor); |
1392 | parametrosConsultaVendas.setVendedor(vendedor); |
| 1376 | RankingVendedorDTO rankingVendedor = new RankingVendedorDTO(); |
1393 | RankingVendedorDTO rankingVendedor = new RankingVendedorDTO(); |