Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-02-17 12:40:21 +01:00

View File

@@ -85,8 +85,8 @@ public class SteUPService {
private HashMap<String, Object> authUser() throws Exception { private HashMap<String, Object> authUser(String md5User) throws Exception {
HashMap<String, Object> loggedUser = authUserFromRequest(); HashMap<String, Object> loggedUser = authUserFromRequest(md5User);
if (loggedUser != null) { if (loggedUser != null) {
int keyGroup = Integer.parseInt(loggedUser.get("key_group").toString()); int keyGroup = Integer.parseInt(loggedUser.get("key_group").toString());
if (!(this.isGroupRilevatore(keyGroup) || this.isGroupTecnico(keyGroup))) { if (!(this.isGroupRilevatore(keyGroup) || this.isGroupTecnico(keyGroup))) {
@@ -96,11 +96,11 @@ public class SteUPService {
return loggedUser; return loggedUser;
} }
private HashMap<String, Object> authUserFromRequest() throws Exception { private HashMap<String, Object> authUserFromRequest(String md5User) throws Exception {
String userName = requestDataDTO.getUsername(); String userName = requestDataDTO.getUsername();
String password = requestDataDTO.getPassword(); String password = requestDataDTO.getPassword();
String profileDB = multiDBTransactionManager.getPrimaryDatasource().getProfile(); String profileDB = multiDBTransactionManager.getPrimaryDatasource().getProfile();
return systemService.login(userName, password, "", profileDB); return systemService.login(userName, password, md5User, profileDB);
} }
private String getUserNamePv(String codMdep) throws Exception { private String getUserNamePv(String codMdep) throws Exception {
@@ -127,7 +127,7 @@ public class SteUPService {
public HashMap<String, Object> login(String profileDb, String md5User) throws Exception { public HashMap<String, Object> login(String profileDb, String md5User) throws Exception {
HashMap<String, Object> toReturn = new HashMap<>(); HashMap<String, Object> toReturn = new HashMap<>();
HashMap<String, Object> loggedUser = this.authUser(); HashMap<String, Object> loggedUser = this.authUser(md5User);
String userName = loggedUser.get("user_name").toString(); String userName = loggedUser.get("user_name").toString();
Integer keyGroup = Integer.valueOf(loggedUser.get("key_group").toString()); Integer keyGroup = Integer.valueOf(loggedUser.get("key_group").toString());
@@ -284,7 +284,7 @@ public class SteUPService {
public void setIndiceGradimento(String activityId, String codJfas, Integer indiceGradimento) throws Exception { public void setIndiceGradimento(String activityId, String codJfas, Integer indiceGradimento) throws Exception {
Integer maxValue = 10; Integer maxValue = 10;
HashMap<String, Object> loggedUser = this.authUserFromRequest(); HashMap<String, Object> loggedUser = this.authUserFromRequest(null);
String userName = loggedUser.get("user_name").toString(); String userName = loggedUser.get("user_name").toString();
int keyGroup = Integer.parseInt(loggedUser.get("key_group").toString()); int keyGroup = Integer.parseInt(loggedUser.get("key_group").toString());
@@ -334,10 +334,10 @@ public class SteUPService {
HashMap<String, Object> loggedUser; HashMap<String, Object> loggedUser;
if (UtilityString.nullIfBlank(md5User) != null) { // RICHIESTA DA APP if (UtilityString.nullIfBlank(md5User) != null) { // RICHIESTA DA APP
loggedUser = this.authUser(); loggedUser = this.authUser(md5User);
} else { // RICHIESTA DA PORTALE (non manda md5user) } else { // RICHIESTA DA PORTALE (non manda md5user)
loggedUser = this.authUserFromRequest(); loggedUser = this.authUserFromRequest(null);
} }
String userName = loggedUser.get("user_name").toString(); String userName = loggedUser.get("user_name").toString();
@@ -459,12 +459,13 @@ public class SteUPService {
String activityTypeId = entry.getActivityTypeId(); String activityTypeId = entry.getActivityTypeId();
String codJfas = entry.getCodJfas(); String codJfas = entry.getCodJfas();
String codCmac = entry.getCodCmac(); String codCmac = entry.getCodCmac();
String md5User = entry.getMd5User();
Date dataCreation = UtilityDate.StringToDate(entry.getDataCreation(), CommonConstants.DATETIME_FORMAT_YMD); Date dataCreation = UtilityDate.StringToDate(entry.getDataCreation(), CommonConstants.DATETIME_FORMAT_YMD);
if (UtilityString.isNullOrEmpty(activityTypeId)) if (UtilityString.isNullOrEmpty(activityTypeId))
throw new Exception("Motivazione attività non presente"); throw new Exception("Motivazione attività non presente");
HashMap<String, Object> loggedUser = this.authUser(); HashMap<String, Object> loggedUser = this.authUser(md5User);
String userNameCreator = loggedUser.get("user_name").toString(); String userNameCreator = loggedUser.get("user_name").toString();
String userNamePv = this.getUserNamePv(codMdep); String userNamePv = this.getUserNamePv(codMdep);
boolean flag_isNewIspezione = false; boolean flag_isNewIspezione = false;
@@ -710,10 +711,9 @@ public class SteUPService {
boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode")))); boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode"))));
if (!containBarcode) { if (!containBarcode) {
List<HashMap<String, Object>> barcode = hashMapList.stream().filter(x -> x.get("barcode") != null).collect(Collectors.toList()); List<HashMap<String, Object>> barcode = hashMapList.stream().filter(x -> x.get("barcode") != null).collect(Collectors.toList());
if (!barcode.isEmpty()) if (!barcode.isEmpty())
barcodes.add(barcode.stream().findFirst().map(x -> x.get("barcode").toString()).get()); barcodes.add(barcode.get(0).get("barcode").toString());
} }
} }
} else { } else {
@@ -914,7 +914,7 @@ public class SteUPService {
} }
public StbActivity uploadAttachment(MultipartFile f, String activityId, String md5User) throws Exception { public StbActivity uploadAttachment(MultipartFile f, String activityId, String md5User) throws Exception {
authUserFromRequest(); authUserFromRequest(md5User);
logger.info("Uploading attachment activity ID: " + activityId); logger.info("Uploading attachment activity ID: " + activityId);
String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".zip"; String fileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".zip";
String pathFile = UtilityDirs.getEmsApiTempDirectoryPath() + File.separator + activityId + File.separator; String pathFile = UtilityDirs.getEmsApiTempDirectoryPath() + File.separator + activityId + File.separator;