Rev 106 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.domain.service.conta.impl; |
| 2 | |||
| 3 | import java.util.Date; |
||
| 4 | import java.util.List; |
||
| 5 | |||
| 6 | import org.springframework.beans.factory.annotation.Autowired; |
||
| 7 | import org.springframework.stereotype.Service; |
||
| 8 | |||
| 195 | espaco | 9 | import br.com.ec.core.generic.AbstractService; |
| 10 | import br.com.ec.core.generic.GenericRepository; |
||
| 11 | import br.com.ec.core.util.VerificadorUtil; |
||
| 12 | import br.com.ec.core.validador.Validador; |
||
| 106 | espaco | 13 | import br.com.ec.domain.model.Conta; |
| 14 | import br.com.ec.domain.model.Venda; |
||
| 15 | import br.com.ec.domain.model.VendaFormaPagamento; |
||
| 16 | import br.com.ec.domain.model.tipos.TipoFrequencia; |
||
| 17 | import br.com.ec.domain.service.conta.ContaService; |
||
| 18 | import br.com.ec.infrastructure.repository.ContaRepository; |
||
| 19 | |||
| 20 | @Service |
||
| 21 | public class ContaServiceImpl extends AbstractService<Conta> implements ContaService { |
||
| 22 | |||
| 23 | private ContaRepository contaRepository; |
||
| 24 | |||
| 25 | @Autowired |
||
| 26 | public ContaServiceImpl(Validador validador, ContaRepository contaRepository) { |
||
| 27 | super(validador); |
||
| 28 | this.contaRepository = contaRepository; |
||
| 29 | } |
||
| 30 | |||
| 31 | @Override |
||
| 32 | protected GenericRepository<Conta> getRepository() { |
||
| 33 | return contaRepository; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Override |
||
| 37 | protected void regrasNegocioCadastrar(Conta conta) { |
||
| 38 | if (VerificadorUtil.estaNulo(conta.getTipoFrequencia())) { |
||
| 39 | conta.setTipoFrequencia(TipoFrequencia.UNICA.getValor()); |
||
| 40 | } |
||
| 41 | conta.setIndicadorAtivo(true); |
||
| 42 | } |
||
| 43 | |||
| 44 | @Override |
||
| 45 | protected void regrasNegocioAlterar(Conta conta) { |
||
| 46 | if (VerificadorUtil.estaNulo(conta.getTipoFrequencia())) { |
||
| 47 | conta.setTipoFrequencia(TipoFrequencia.UNICA.getValor()); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public Conta consultarContaAReceber(VendaFormaPagamento vendaFormaPagamento) { |
||
| 53 | return contaRepository.consultarContaAReceber(vendaFormaPagamento); |
||
| 54 | } |
||
| 55 | |||
| 56 | @Override |
||
| 57 | @Deprecated |
||
| 58 | public List<Conta> consultarContasAReceber(Venda venda) { |
||
| 59 | return contaRepository.consultarContasAReceber(venda); |
||
| 60 | } |
||
| 61 | |||
| 62 | @Override |
||
| 63 | public List<Conta> consultarContasAReceberPorPeriodo(Date dataInicial, Date dataFinal) { |
||
| 64 | return contaRepository.consultarContasAReceberPorPeriodo(dataInicial, dataFinal); |
||
| 65 | } |
||
| 66 | |||
| 67 | } |