Changes between Version 12 and Version 13 of AdvancedApplicationDevelopment


Ignore:
Timestamp:
06/25/24 19:43:41 (8 days ago)
Author:
211012
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedApplicationDevelopment

    v12 v13  
    2222|| 18 || **Одлучува по приговорот** ||
    2323|| 19 || **Пријавува учество на кандидатски листи** ||
     24|| 20 || **Назначува граѓанин за член на комисија** ||
     25
    2426
    2527== Назначува членови на комисија
     
    534536$$;
    535537}}}
     538== Назначува граѓанин за член на комисија
     539Како дополнение на сценариото од прототипот, во оваа верзија имплементиравме креирање на кориснички профил за секој граѓанин кој е назначен за член на комисија. Истото се извршува во една трансакција при неговотo внесување во табелата членови на комисија, па методот е соодветно анотиран со @Transactional.
     540{{{#!java
     541    @Override
     542    @Transactional
     543    public CommitteeMember update(Long id) {
     544        committeeMemberRepository.insertCommitteeMember(id);
     545        Citizen c = citizenService.findById(id);
     546        String userName = utilService.cyrillicToLatinTransliteration(c.getName()) + '.' + utilService.cyrillicToLatinTransliteration(c.getSurname());
     547        UserProfile userProfile = userProfileRepository.findByUserName(userName);
     548        if(userProfile == null) {
     549            userProfile = new UserProfile();
     550            userProfile.setUserName(userName);
     551            userProfile.setPassword(passwordEncoder.encode(c.getIdNum()));
     552            userProfile.setIsCommittee(true);
     553            userProfile.setCitizen(c);
     554        }
     555        else {
     556            userProfile.setIsCommittee(false);
     557        }
     558        return findById(id);
     559    }
     560}}}