SUPPORT-9296: fix unblocking
This commit is contained in:
parent
992e2c9a8a
commit
ddc5f40362
6 changed files with 434 additions and 11 deletions
|
|
@ -83,11 +83,12 @@ public class AccountGridLoadService extends Behavior implements GridService {
|
|||
for (Account account : accounts) {
|
||||
GridRow gridRow = new GridRow();
|
||||
gridRow.put("row_uid", account.getId() != null ? account.getId() : "");
|
||||
gridRow.put("enabled", !account.isBlocked());
|
||||
gridRow.put("accountEnabled", !account.isBlocked());
|
||||
Person person = account.getPerson();
|
||||
if (person != null) {
|
||||
gridRow.put("login", person.getLogin());
|
||||
gridRow.put("snils", person.getSnils());
|
||||
gridRow.put("personEnabled", !person.isBlocked());
|
||||
|
||||
String fullName = person.getFullName();
|
||||
if (fullName != null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.micord.ervu.account_applications.enums;
|
||||
|
||||
import ru.cg.webbpm.modules.webkit.annotations.Model;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
@Model
|
||||
public enum BlockedRegion {
|
||||
ACCOUNT,
|
||||
PERSON,
|
||||
BOTH
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ import ru.micord.ervu.account_applications.service.constant.PathConstant;
|
|||
|
||||
import ru.cg.webbpm.modules.standard_annotations.editor.ObjectRef;
|
||||
|
||||
import static ru.micord.ervu.account_applications.enums.BlockedRegion.*;
|
||||
|
||||
/**
|
||||
* @author Adel Kalimullin
|
||||
*/
|
||||
|
|
@ -42,6 +44,9 @@ public class AccountFetchService implements EntityFetchService<Account> {
|
|||
private static final String FIELD_IP_ADDRESSES = "ipAddresses";
|
||||
private static final String FIELD_SNILS = "snils";
|
||||
private static final String FIELD_ROLES = "roles";
|
||||
private static final String FIELD_ACCOUNT_BLOCKED = "blocked";
|
||||
private static final String FIELD_PERSON_BLOCKED = "person.blocked";
|
||||
private static final String FIELD_BLOCKED_REGION = "blockedRegion";
|
||||
private final RestTemplate restTemplate;
|
||||
private final ObjectMapper mapper;
|
||||
private final SecurityContext securityContext;
|
||||
|
|
@ -140,7 +145,9 @@ public class AccountFetchService implements EntityFetchService<Account> {
|
|||
}
|
||||
|
||||
private Map<String, Object> objectToFlatMap(Object obj) {
|
||||
return objectToFlatMapInternal(obj, "");
|
||||
Map<String, Object> result = objectToFlatMapInternal(obj, "");
|
||||
putBlockedValue(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> objectToFlatMapInternal(Object obj, String prefix) {
|
||||
|
|
@ -224,4 +231,14 @@ public class AccountFetchService implements EntityFetchService<Account> {
|
|||
private boolean isSimple(Class<?> type) {
|
||||
return ClassUtils.isPrimitiveOrWrapper(type) || type == String.class;
|
||||
}
|
||||
|
||||
private void putBlockedValue(Map<String, Object> result) {
|
||||
boolean accountBlocked = Boolean.parseBoolean(String.valueOf(result.get(FIELD_ACCOUNT_BLOCKED)));
|
||||
boolean personBlocked = Boolean.parseBoolean(String.valueOf(result.get(FIELD_PERSON_BLOCKED)));
|
||||
String value = accountBlocked && personBlocked
|
||||
? BOTH.toString() : accountBlocked
|
||||
? ACCOUNT.toString() : personBlocked
|
||||
? PERSON.toString() : null;
|
||||
result.put(FIELD_BLOCKED_REGION, value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue