Rev 630 | Rev 636 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 630 | Rev 631 | ||
|---|---|---|---|
| Line 16... | Line 16... | ||
| 16 | import br.com.ec.domain.dto.PosVendaDTO; |
16 | import br.com.ec.domain.dto.PosVendaDTO; |
| 17 | import br.com.ec.domain.model.PosVenda; |
17 | import br.com.ec.domain.model.PosVenda; |
| 18 | import br.com.ec.domain.model.tipos.TipoNpsPosVenda; |
18 | import br.com.ec.domain.model.tipos.TipoNpsPosVenda; |
| 19 | import br.com.ec.domain.service.NpsPosVendaService; |
19 | import br.com.ec.domain.service.NpsPosVendaService; |
| 20 | import br.com.ec.domain.service.PosVendaService; |
20 | import br.com.ec.domain.service.PosVendaService; |
| - | 21 | import br.com.ec.domain.service.VendaService; |
|
| 21 | import br.com.ec.repository.PosVendaRepository; |
22 | import br.com.ec.repository.PosVendaRepository; |
| 22 | 23 | ||
| 23 | @Service |
24 | @Service |
| 24 | public class PosVendaServiceImpl extends AbstractService<PosVenda> implements PosVendaService { |
25 | public class PosVendaServiceImpl extends AbstractService<PosVenda> implements PosVendaService { |
| 25 | 26 | ||
| 26 | private PosVendaRepository posVendaRepository; |
27 | private PosVendaRepository posVendaRepository; |
| 27 | private NpsPosVendaService npsPosVendaService; |
28 | private NpsPosVendaService npsPosVendaService; |
| - | 29 | private VendaService vendaService; |
|
| 28 | 30 | ||
| 29 | @Autowired |
31 | @Autowired |
| 30 | public PosVendaServiceImpl(Validador validador, PosVendaRepository posVendaRepository, NpsPosVendaService npsPosVendaService) { |
- | |
| - | 32 | public PosVendaServiceImpl(Validador validador, PosVendaRepository posVendaRepository, NpsPosVendaService npsPosVendaService, |
|
| - | 33 | VendaService vendaService) { |
|
| 31 | super(validador); |
34 | super(validador); |
| 32 | this.posVendaRepository = posVendaRepository; |
35 | this.posVendaRepository = posVendaRepository; |
| 33 | this.npsPosVendaService = npsPosVendaService; |
36 | this.npsPosVendaService = npsPosVendaService; |
| - | 37 | this.vendaService = vendaService; |
|
| 34 | }
|
38 | }
|
| 35 | 39 | ||
| 36 | @Override |
40 | @Override |
| 37 | protected GenericRepository<PosVenda> getRepository() { |
41 | protected GenericRepository<PosVenda> getRepository() { |
| 38 | return posVendaRepository; |
42 | return posVendaRepository; |
| Line 41... | Line 45... | ||
| 41 | @Override |
45 | @Override |
| 42 | public ComercialPosVendaDTO consultarPosVendaEmAndamento() { |
46 | public ComercialPosVendaDTO consultarPosVendaEmAndamento() { |
| 43 | ComercialPosVendaDTO comercialPosVendaDTO = new ComercialPosVendaDTO(); |
47 | ComercialPosVendaDTO comercialPosVendaDTO = new ComercialPosVendaDTO(); |
| 44 | List<PosVendaDTO> listaPosVendaNaoFinalizadas = posVendaRepository.consultarNaoFinalizadas(); |
48 | List<PosVendaDTO> listaPosVendaNaoFinalizadas = posVendaRepository.consultarNaoFinalizadas(); |
| 45 | for (PosVendaDTO posVendaNaoFinalizada : listaPosVendaNaoFinalizadas) { |
49 | for (PosVendaDTO posVendaNaoFinalizada : listaPosVendaNaoFinalizadas) { |
| - | 50 | if (VerificadorUtil.naoEstaNulo(posVendaNaoFinalizada.getSequencialDaVenda())) { |
|
| - | 51 | posVendaNaoFinalizada.setVendaDTO(vendaService.detalharPorSequencial(posVendaNaoFinalizada.getSequencialDaVenda())); |
|
| - | 52 | }
|
|
| 46 | NpsPosVendaDTO npsPosVendaAgradecimento = npsPosVendaService.consultarPorPosVendaEeTipo(posVendaNaoFinalizada.getSequencial(), TipoNpsPosVenda.ATENDIMENTO_A.getValor()); |
53 | NpsPosVendaDTO npsPosVendaAgradecimento = npsPosVendaService.consultarPorPosVendaEeTipo(posVendaNaoFinalizada.getSequencial(), TipoNpsPosVenda.ATENDIMENTO_A.getValor()); |
| 47 | if (VerificadorUtil.naoEstaNulo(npsPosVendaAgradecimento)) { |
54 | if (VerificadorUtil.naoEstaNulo(npsPosVendaAgradecimento)) { |
| 48 | if (VerificadorUtil.estaNulo(npsPosVendaAgradecimento.getDataFinalizacao())) { |
55 | if (VerificadorUtil.estaNulo(npsPosVendaAgradecimento.getDataFinalizacao())) { |
| 49 | posVendaNaoFinalizada.setNpsPosVendaAgradecimento(npsPosVendaAgradecimento); |
56 | posVendaNaoFinalizada.setNpsPosVendaAgradecimento(npsPosVendaAgradecimento); |
| 50 | comercialPosVendaDTO.getListaPosVendaAgradecimento().add(posVendaNaoFinalizada); |
57 | comercialPosVendaDTO.getListaPosVendaAgradecimento().add(posVendaNaoFinalizada); |
| 51 | }
|
58 | }
|
| - | 59 | } else { |
|
| - | 60 | comercialPosVendaDTO.getListaPosVendaAgradecimento().add(posVendaNaoFinalizada); |
|
| 52 | }
|
61 | }
|
| 53 | posVendaNaoFinalizada.setNpsPosVendaAgradecimento(npsPosVendaService.consultarPorPosVendaEeTipo(posVendaNaoFinalizada.getSequencial(), TipoNpsPosVenda.ATENDIMENTO_A.getValor())); |
62 | posVendaNaoFinalizada.setNpsPosVendaAgradecimento(npsPosVendaService.consultarPorPosVendaEeTipo(posVendaNaoFinalizada.getSequencial(), TipoNpsPosVenda.ATENDIMENTO_A.getValor())); |
| 54 | }
|
63 | }
|
| 55 | comercialPosVendaDTO.setListaEmAndamento(listaPosVendaNaoFinalizadas); |
64 | comercialPosVendaDTO.setListaEmAndamento(listaPosVendaNaoFinalizadas); |
| 56 | return comercialPosVendaDTO; |
65 | return comercialPosVendaDTO; |