Advertisement
Guest User

Untitled

a guest
May 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public ClientDTO addAccountToClient(String clientId, AccountDTO accountDto) throws Exception {
  2. Client client = clientRepository.findById(clientId).orElse(null);
  3. if (client == null) {
  4. throw new NotFoundException("Could not find client with that ID.");
  5. }
  6. Date now = new Date();
  7. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
  8. String currentDate = sdf.format(now);
  9. Account acc = new Account(1,accountDto.getAccountType(),currentDate,
  10. accountDto.getBalance());
  11. client.getAccountList().add(acc);
  12. //activityService.addNewActivity("Add account"+accountDto.getAccountId()+" to client id: "+clientId);
  13. clientRepository.save(client);
  14. return ClientConverter.toDto(client);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement