Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ClientDTO addAccountToClient(String clientId, AccountDTO accountDto) throws Exception {
- Client client = clientRepository.findById(clientId).orElse(null);
- if (client == null) {
- throw new NotFoundException("Could not find client with that ID.");
- }
- Date now = new Date();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
- String currentDate = sdf.format(now);
- Account acc = new Account(1,accountDto.getAccountType(),currentDate,
- accountDto.getBalance());
- client.getAccountList().add(acc);
- //activityService.addNewActivity("Add account"+accountDto.getAccountId()+" to client id: "+clientId);
- clientRepository.save(client);
- return ClientConverter.toDto(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement