Aggiunta cache di StbEditLimit
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -32,6 +32,7 @@ public class DbmsChangeTrackerComponent {
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
add(WtbGestSetupUser.ENTITY);
|
||||
|
||||
@@ -47,6 +47,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
|
||||
|
||||
@@ -2,8 +2,11 @@ package it.integry.ems.javabeans;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.model.IntegryApplicationEnum;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.user.dto.UserDTO;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
@@ -138,6 +141,16 @@ public class RequestDataDTO {
|
||||
return profileDB;
|
||||
}
|
||||
|
||||
public IntegryCustomerDB getCustomerDB() {
|
||||
if (UtilityString.isNullOrEmpty(profileDB))
|
||||
return null;
|
||||
|
||||
final SettingsModel settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
||||
final String dbName = settingsModel.getDbNameFromProfileDb(profileDB);
|
||||
|
||||
return IntegryCustomerDB.parse(dbName);
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.google.common.base.Joiner;
|
||||
import com.google.firebase.messaging.FirebaseMessagingException;
|
||||
import com.google.firebase.messaging.MessagingErrorCode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.order.dto.UserGroupENUM;
|
||||
@@ -124,6 +125,9 @@ public class PvmService {
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
|
||||
@Autowired
|
||||
private EntityCacheComponent entityCacheComponent;
|
||||
|
||||
public List<OrdChkConsDTO> chkDisponibilitaCons(Date dataCons, String citta) throws Exception {
|
||||
String profileDb = null;
|
||||
UserDTO userData = systemService.login(requestDataDTO.getUsername(), requestDataDTO.getPassword(), "", profileDb);
|
||||
@@ -1891,7 +1895,7 @@ public class PvmService {
|
||||
.stream()
|
||||
.filter(x -> x.get("val_col_rif") != null && ((String) x.get("val_col_rif")).equalsIgnoreCase(codDtip))
|
||||
.findFirst().map(x -> (String) x.get("value")).orElse(null);
|
||||
if (!UtilityString.isNullOrEmpty(ret) ) {
|
||||
if (!UtilityString.isNullOrEmpty(ret)) {
|
||||
try {
|
||||
gg = Integer.parseInt(ret);
|
||||
} catch (NumberFormatException ex) {
|
||||
@@ -2621,44 +2625,29 @@ public class PvmService {
|
||||
public List<PvmAuthorizationDTO> getAuthorizations(String section) throws Exception {
|
||||
String username = requestDataDTO.getUsername();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT dw_name AS module,\n" +
|
||||
" dw_colname AS authorization_name,\n" +
|
||||
" CAST(IIF(enabled IS NULL, 1, IIF(enabled = 'S', 1, 0)) AS BIT) AS enabled,\n" +
|
||||
" CAST(IIF(visible IS NULL, 1, IIF(visible = 'S', 1, 0)) AS BIT) AS visible,\n" +
|
||||
" CAST(IIF(required IS NULL, 0, IIF(required = 'S', 1, 0)) AS BIT) AS required\n" +
|
||||
"FROM stb_edit_limit\n" +
|
||||
"WHERE gest_name = 'PVM'\n" +
|
||||
" AND dw_name = %s\n" +
|
||||
" AND user_name = %s",
|
||||
section,
|
||||
username
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PvmAuthorizationDTO.class);
|
||||
final List<PvmAuthorizationDTO> result = entityCacheComponent.<StbEditLimit>getCachedEntitiesStream(requestDataDTO.getCustomerDB(), StbEditLimit.ENTITY,
|
||||
x -> x.getGestName().equalsIgnoreCase("PVM") &&
|
||||
x.getDwName().equalsIgnoreCase(section) &&
|
||||
x.getUserName().equalsIgnoreCase(username))
|
||||
.map(x -> new PvmAuthorizationDTO() {{
|
||||
setModule(x.getDwName());
|
||||
setAuthorizationName(x.getDwColname());
|
||||
setEnabled(x.getEnabled() == null || x.getEnabled().equalsIgnoreCase("S"));
|
||||
setVisible(x.getVisible() == null || x.getVisible().equalsIgnoreCase("S"));
|
||||
setRequired(x.getRequired() != null && x.getRequired().equalsIgnoreCase("S"));
|
||||
}})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public PvmAuthorizationDTO getAuthorization(String section, String authName) throws Exception {
|
||||
String username = requestDataDTO.getUsername();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT dw_name AS module,\n" +
|
||||
" dw_colname AS authorization_name,\n" +
|
||||
" CAST(IIF(enabled IS NULL, 1, IIF(enabled = 'S', 1, 0)) AS BIT) AS enabled,\n" +
|
||||
" CAST(IIF(visible IS NULL, 1, IIF(visible = 'S', 1, 0)) AS BIT) AS visible,\n" +
|
||||
" CAST(IIF(required IS NULL, 0, IIF(required = 'S', 1, 0)) AS BIT) AS required\n" +
|
||||
"FROM stb_edit_limit\n" +
|
||||
"WHERE gest_name = 'PVM'\n" +
|
||||
" AND dw_name = %s\n" +
|
||||
" AND dw_colname = %s\n" +
|
||||
" AND user_name = %s",
|
||||
section,
|
||||
authName,
|
||||
username
|
||||
);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, PvmAuthorizationDTO.class);
|
||||
final List<PvmAuthorizationDTO> authorizations = getAuthorizations(section);
|
||||
|
||||
return authorizations.stream().filter(x -> x.getAuthorizationName().equalsIgnoreCase(authName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public Map<String, List<PvmAuthorizationDTO>> retrieveSectionUsers(String section) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user