Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -86,13 +86,12 @@ public class JWTFilter extends GenericFilterBean {
|
||||
ServiceRestResponse errorObject = null;
|
||||
GlobalExceptionHandler globalExceptionHandler = ContextLoader.getCurrentWebApplicationContext().getBean(GlobalExceptionHandler.class);
|
||||
|
||||
if (ex instanceof ExpiredJwtException) {
|
||||
ExpiredJwtException expiredJwtException = (ExpiredJwtException) ex;
|
||||
if (ex instanceof ExpiredJwtException || ex instanceof InvalidTokenException) {
|
||||
|
||||
errorObject = globalExceptionHandler.handleException(
|
||||
httpServletRequest,
|
||||
httpServletResponse,
|
||||
new AccessDeniedException("Session expired", expiredJwtException.getCause()));
|
||||
new AccessDeniedException("Session expired", ex.getCause()));
|
||||
} else {
|
||||
errorObject = globalExceptionHandler.handleException(
|
||||
httpServletRequest,
|
||||
|
||||
@@ -1015,10 +1015,11 @@ public class DocumentiAcquistoImportService {
|
||||
anomalie.add(
|
||||
AnomalieDTO.error(String.format("Nessun deposito agganciato all'intercode %s", rifOrdApulia.getCodicePv() ))
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
String codMdep = result.get("cod_mdep").toString();
|
||||
String codForn = result.get("cod_forn").toString();
|
||||
String codMdep = (String) result.get("cod_mdep");
|
||||
String codForn = (String) result.get("cod_forn");
|
||||
|
||||
sql = "select dtb_ordt.data_ord, dtb_ordt.num_ord, dtb_ordr.riga_ord, dtb_ordr.cod_mart, dtb_ordr.cod_art_for\n" +
|
||||
"from dtb_ordt \n" +
|
||||
@@ -1068,13 +1069,9 @@ public class DocumentiAcquistoImportService {
|
||||
", Codice deposito: " + codMdep
|
||||
)
|
||||
);
|
||||
} else if (!listDocumentDtb.isEmpty() && listDocumentWdtb.isEmpty()) {
|
||||
entityReturn.addAll(processRifOrdApuliaList(listDocumentDtb, selectOrdine, anomalie, tipiDoc, ds, pIva, false));
|
||||
} else if (listDocumentDtb.isEmpty()) {
|
||||
entityReturn.addAll(processRifOrdApuliaList(listDocumentWdtb, selectOrdine, anomalie, tipiDoc, ds, pIva, true));
|
||||
} else {
|
||||
entityReturn.addAll(processRifOrdApuliaList(listDocumentDtb, selectOrdine, anomalie, tipiDoc, ds, pIva, false));
|
||||
entityReturn.addAll(processRifOrdApuliaList(listDocumentWdtb, selectOrdine, anomalie, tipiDoc, ds, pIva, true));
|
||||
if( !listDocumentDtb.isEmpty()) entityReturn.add(processRifOrdApuliaList(listDocumentDtb, selectOrdine, anomalie, tipiDoc, ds, pIva, false));
|
||||
if( !listDocumentWdtb.isEmpty()) entityReturn.add(processRifOrdApuliaList(listDocumentWdtb, selectOrdine, anomalie, tipiDoc, ds, pIva, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1097,8 +1094,7 @@ public class DocumentiAcquistoImportService {
|
||||
storedProcedure.close();
|
||||
}
|
||||
|
||||
private List<EntityBase> processRifOrdApuliaList(List<HashMap<String, Object>> listDocument, List<HashMap<String, Object>> selectOrdine, List<AnomalieDTO> anomalie, String tipiDoc, AdvancedDataSource ds, String pIva, boolean isWdtb) throws Exception {
|
||||
List<EntityBase> entityList = new ArrayList<>();
|
||||
private DtbBaseDocT processRifOrdApuliaList(List<HashMap<String, Object>> listDocument, List<HashMap<String, Object>> selectOrdine, List<AnomalieDTO> anomalie, String tipiDoc, AdvancedDataSource ds, String pIva, boolean isWdtb) throws Exception {
|
||||
DtbBaseDocT dtbBaseDoct;
|
||||
|
||||
if (isWdtb) {
|
||||
@@ -1114,6 +1110,11 @@ public class DocumentiAcquistoImportService {
|
||||
.setSerDoc(listDocument.get(0).get("ser_doc").toString())
|
||||
.setCodAnag(listDocument.get(0).get("cod_anag").toString());
|
||||
|
||||
if (isWdtb)
|
||||
((WdtbDoct) dtbBaseDoct).setWdtbDocr(new ArrayList<>());
|
||||
else
|
||||
((DtbDoct) dtbBaseDoct).setDtbDocr(new ArrayList<>());
|
||||
|
||||
List<DtbBaseDocR> baseDtbDocrList = new ArrayList<>();
|
||||
|
||||
for (HashMap<String, Object> document : listDocument) {
|
||||
@@ -1162,56 +1163,37 @@ public class DocumentiAcquistoImportService {
|
||||
existingObject.getSerDoc().equals(dtbBaseDocr.getSerDoc()));
|
||||
|
||||
if (!existsInList) {
|
||||
if (isWdtb)
|
||||
((WdtbDoct) dtbBaseDoct).getWdtbDocr().add((WdtbDocr) dtbBaseDocr);
|
||||
else
|
||||
((DtbDoct) dtbBaseDoct).getDtbDocr().add((DtbDocr) dtbBaseDocr);
|
||||
baseDtbDocrList.add(dtbBaseDocr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isWdtb) {
|
||||
WdtbDoct wdtbDoct = (WdtbDoct) dtbBaseDoct;
|
||||
List<WdtbDocr> wdtbDocrList = new ArrayList<>();
|
||||
for (DtbBaseDocR dtbBaseDocr : baseDtbDocrList) {
|
||||
wdtbDocrList.add((WdtbDocr) dtbBaseDocr);
|
||||
}
|
||||
|
||||
wdtbDoct.setWdtbDocr(wdtbDocrList);
|
||||
entityList.add(wdtbDoct);
|
||||
} else {
|
||||
DtbDoct dtbDoct = (DtbDoct) dtbBaseDoct;
|
||||
List<DtbDocr> dtbDocrList = new ArrayList<>();
|
||||
for (DtbBaseDocR dtbBaseDocr : baseDtbDocrList) {
|
||||
dtbDocrList.add((DtbDocr) dtbBaseDocr);
|
||||
}
|
||||
|
||||
dtbDoct.setDtbDocr(dtbDocrList);
|
||||
entityList.add(dtbDoct);
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityBase> entityReturn = new ArrayList<>();
|
||||
MultiDBTransactionManager m = new MultiDBTransactionManager();
|
||||
try {
|
||||
m.addConnection(ds.getProfileName(), ds.getDataSource());
|
||||
m.setPrimaryDs(ds.getProfileName());
|
||||
|
||||
for (EntityBase e : entityList) {
|
||||
if (!isWdtb) {
|
||||
UpdProgOrdini(m, (DtbDoct) e, -1);
|
||||
}
|
||||
if (!isWdtb) {
|
||||
UpdProgOrdini(m, (DtbDoct) dtbBaseDoct, -1);
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(e, true, false, requestData.getUsername(), m, false);
|
||||
entityReturn.add(e);
|
||||
entityProcessor.processEntity(dtbBaseDoct, true, false, requestData.getUsername(), m, false);
|
||||
|
||||
if (!isWdtb) {
|
||||
UpdProgOrdini(m, (DtbDoct) e, 1);
|
||||
}
|
||||
|
||||
if (!isWdtb) {
|
||||
UpdProgOrdini(m, (DtbDoct) dtbBaseDoct, 1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
m.rollbackAll();
|
||||
}
|
||||
m.closeAll();
|
||||
|
||||
return entityReturn;
|
||||
return dtbBaseDoct;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user