parent
3eaae2336c
commit
e234355e24
2 changed files with 38 additions and 7 deletions
|
|
@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -245,12 +244,11 @@ public class ErvuDirectoriesService {
|
||||||
roleRecord.setCreated(createdAt);
|
roleRecord.setCreated(createdAt);
|
||||||
roleRecord.setUpdated(updatedAt);
|
roleRecord.setUpdated(updatedAt);
|
||||||
roleRecord.setFinished(finishAt);
|
roleRecord.setFinished(finishAt);
|
||||||
Optional<String> adminRole = Arrays.stream(adminRoles)
|
Arrays.stream(adminRoles).forEach(role -> {
|
||||||
.filter(role -> role.trim().equals(data.getName()))
|
if (role.trim().equals(data.getName())) {
|
||||||
.findAny();
|
roleRecord.setAdminRole(true);
|
||||||
if (adminRole.isPresent()) {
|
}
|
||||||
roleRecord.setAdminRole(true);
|
});
|
||||||
}
|
|
||||||
if (ids.contains(data.getId())) {
|
if (ids.contains(data.getId())) {
|
||||||
roleRecords.add(roleRecord);
|
roleRecords.add(roleRecord);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package ru.micord.ervu.account_applications.service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.DependsOn;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eduard Tihomirov
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@DependsOn("kafkaConsumerInitializer")
|
||||||
|
public class ErvuDirectoriesUpdateService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ErvuDirectoriesService ervuDirectoriesService;
|
||||||
|
|
||||||
|
@Value("${load.directories:true}")
|
||||||
|
private Boolean loadDirectories;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
if (loadDirectories) {
|
||||||
|
new Thread(this::run).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void run() {
|
||||||
|
ervuDirectoriesService.updateDirectories();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue