Finish Hotfix-61
This commit is contained in:
@@ -373,7 +373,7 @@ public class EmsServices {
|
|||||||
if (tmpResult != null) {
|
if (tmpResult != null) {
|
||||||
finalResult.addAll(tmpResult);
|
finalResult.addAll(tmpResult);
|
||||||
anyError = Stream.of(tmpResult)
|
anyError = Stream.of(tmpResult)
|
||||||
.filter(x-> x !=null)
|
.filter(x -> x != null)
|
||||||
.anyMatch(x -> x.getException() != null);
|
.anyMatch(x -> x.getException() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,14 +479,8 @@ public class EmsServices {
|
|||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (headless) {
|
if (headless) {
|
||||||
List<EntityBase> entityBases = new ArrayList<EntityBase>();
|
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, "EXPORT_" + type, format,
|
||||||
EntityBase entityBase = new EntityBase() {
|
"Esportazione entity", null, null, null, Collections.singletonList(ex));
|
||||||
};
|
|
||||||
EntityException newEx = new EntityException(ex.getMessage());
|
|
||||||
newEx.setStackTrace(ex.getStackTrace());
|
|
||||||
entityBase.setException(newEx);
|
|
||||||
entityBases.add(entityBase);
|
|
||||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, "EXPORT_" + type, format, "Esportazione entity", entityBases, null, null, null);
|
|
||||||
throw ex;
|
throw ex;
|
||||||
} else {
|
} else {
|
||||||
throw ex;
|
throw ex;
|
||||||
|
|||||||
@@ -275,12 +275,11 @@ public class MailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendErrorMailByGestNameSection(MultiDBTransactionManager multiDBTransactionManager, String emailDestination, String gestName, String section,
|
public void sendErrorMailByGestNameSection(MultiDBTransactionManager multiDBTransactionManager, String gestName, String section,
|
||||||
String mailTitle, List<EntityBase> entitiesList, byte[] fileInput, String fileName, List<AnomalieDTO> anomalie) throws Exception {
|
String mailTitle, List<EntityBase> entitiesList, List<EmailFileAttachment> attachments, List<AnomalieDTO> anomalie, List<Exception> customExceptions) throws Exception {
|
||||||
|
|
||||||
|
// GET DESTINATION
|
||||||
List<EmailFileAttachment> attachments = new ArrayList<>();
|
String emailDestination = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), gestName, section, "EMAIL_FOR_LOG");
|
||||||
attachments.add(new EmailFileAttachment(fileName, fileInput));
|
|
||||||
|
|
||||||
sendErrorMail(multiDBTransactionManager, emailDestination,
|
sendErrorMail(multiDBTransactionManager, emailDestination,
|
||||||
mailTitle,
|
mailTitle,
|
||||||
@@ -288,7 +287,7 @@ public class MailService {
|
|||||||
entitiesList,
|
entitiesList,
|
||||||
attachments,
|
attachments,
|
||||||
anomalie,
|
anomalie,
|
||||||
null);
|
customExceptions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ public class EntityException extends Exception {
|
|||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityException(Exception innerException) {
|
||||||
|
super(innerException.getMessage());
|
||||||
|
|
||||||
|
this.mInnerException = innerException;
|
||||||
|
}
|
||||||
|
|
||||||
public EntityException(Exception e, EntityBase entity, String query) {
|
public EntityException(Exception e, EntityBase entity, String query) {
|
||||||
super("Impossibile salvare la entity " + entity.getTableName() + ".\n " +
|
super("Impossibile salvare la entity " + entity.getTableName() + ".\n " +
|
||||||
e.getMessage() + "\n" +
|
e.getMessage() + "\n" +
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class TrasformaPrevServices {
|
|||||||
if (headless) {
|
if (headless) {
|
||||||
logger.error("Trasformazione preventivi: ", firstError.get().getException());
|
logger.error("Trasformazione preventivi: ", firstError.get().getException());
|
||||||
try {
|
try {
|
||||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, to, gestName, section, "Trasformazione preventivi",
|
mailService.sendErrorMail(multiDBTransactionManager, to, "Trasformazione preventivi", String.format("%s %s", gestName, section),
|
||||||
Collections.singletonList(firstError.get()), null, null, null);
|
Collections.singletonList(firstError.get()), null, null, null);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ public class Slim2kLogisticService {
|
|||||||
respList.add(new ServiceRestResponse(EsitoType.KO, entity.getException().getMessage()));
|
respList.add(new ServiceRestResponse(EsitoType.KO, entity.getException().getMessage()));
|
||||||
|
|
||||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
||||||
Collections.singletonList(entity), null, null, null);
|
Collections.singletonList(entity), (byte[]) null, null, null);
|
||||||
} else {
|
} else {
|
||||||
respList.add(new ServiceRestResponse(EsitoType.OK, entity, multiDBTransactionManager.getPrimaryDatasource().getProfile()));
|
respList.add(new ServiceRestResponse(EsitoType.OK, entity, multiDBTransactionManager.getPrimaryDatasource().getProfile()));
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ public class Slim2kLogisticService {
|
|||||||
|
|
||||||
if (!entitiesWithErrors.isEmpty()) {
|
if (!entitiesWithErrors.isEmpty()) {
|
||||||
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
mailService.sendErrorMailByGestNameSection(multiDBTransactionManager, type, format, null,
|
||||||
entitiesWithErrors, null, null, null);
|
entitiesWithErrors, (byte[]) null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (EntityBase entity : colli) {
|
for (EntityBase entity : colli) {
|
||||||
|
|||||||
Reference in New Issue
Block a user