Guest User

Untitled

a guest
Jan 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. public List<MovementDTO> getAgruped(Long startDate, Long endDate) {
  2.  
  3. List<MovementDTO> movementDTOs = new ArrayList<>();
  4.  
  5. // Block
  6. List<Movement> unBlockedCash = this.movementRepository.getUnBlockedCash(new DateTime().withMillis(startDate),
  7. new DateTime().withMillis(endDate));
  8.  
  9. for (Movement movement : unBlockedCash) {
  10. movementDTOs.add(new MovementDTO(movement));
  11. }
  12.  
  13. // Caixa
  14. movementDTOs.addAll(this.getByMovementGrouping());
  15.  
  16. // Saque
  17. List<Movement> saques = this.movementRepository.getSaque(new DateTime().withMillis(startDate),
  18. new DateTime().withMillis(endDate));
  19. for (Movement movement : saques) {
  20. movementDTOs.add(new MovementDTO(movement));
  21. }
  22.  
  23. return movementDTOs;
  24. }
  25.  
  26. public List<MovementDTO> getByMovementGrouping() {
  27.  
  28. DecimalFormat df = new DecimalFormat("###,###,###.00");
  29.  
  30. List<MovementDTO> movementDTOList = new ArrayList<MovementDTO>();
  31. List<BigInteger> payboxListLong = this.movementRepository.getByPayBoxId();
  32.  
  33. //Método que retorna o primeiro registro da tabela
  34. Movement firstMovement = this.getFirstMovement();
  35.  
  36. for (BigInteger payboxId : payboxListLong) {
  37.  
  38. BigDecimal sumTotalPayBox = this.movementRepository.getBySumTotalPayBox(payboxId);
  39.  
  40. MovementDTO movementDTO = new MovementDTO();
  41. movementDTO.setValue(df.format(sumTotalPayBox));
  42. movementDTO.setDescription("Agrupado por caixa");
  43. movementDTO.setCreationDate(DateTime.now().getMillis());
  44. movementDTO
  45. .setCreationDateStr(new SimpleDateFormat("dd/MM HH:mm").format(DateTime.now().getMillis()) + "h");
  46.  
  47. movementDTOList.add(movementDTO);
  48. }
  49. return movementDTOList;
  50. }
Add Comment
Please, Sign In to add comment