Fissato il problema di sync quando un gruppo non ha un id esterno

This commit is contained in:
Giancarlo Panichi 2023-06-08 14:12:33 +02:00
parent 52619ae831
commit 3c9fc8fa6a
4 changed files with 43 additions and 17 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "epasmed", "name": "epasmed",
"version": "0.0.1-SNAPSHOT", "version": "1.0.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -6,7 +6,7 @@
<groupId>it.cnr.isti.epasmed</groupId> <groupId>it.cnr.isti.epasmed</groupId>
<artifactId>epasmed</artifactId> <artifactId>epasmed</artifactId>
<version>1.0.5</version> <version>1.0.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>epasmed</name> <name>epasmed</name>

View File

@ -558,11 +558,19 @@ public class SyncService {
if (epasGroups != null) { if (epasGroups != null) {
EPASGroups groupPresent = null; EPASGroups groupPresent = null;
for (EPASGroups g : epasGroups) { for (EPASGroups g : epasGroups) {
if (Integer.valueOf(g.getExternalId()).compareTo(sig.getId()) == 0) { if (g.getExternalId() != null && !g.getExternalId().isEmpty()) {
Integer gExternalId=null;
try {
gExternalId=Integer.valueOf(g.getExternalId());
} catch (NumberFormatException e) {
logger.error("EPAS Group has invalid External Id: {}", g);
}
if (gExternalId!=null&&gExternalId.compareTo(sig.getId()) == 0) {
groupPresent = g; groupPresent = g;
break; break;
} }
} }
}
if (groupPresent == null) { if (groupPresent == null) {
EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null, EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null,

View File

@ -1,5 +1,8 @@
package it.cnr.isti.epasmed.web.rest.sync; package it.cnr.isti.epasmed.web.rest.sync;
//import java.security.SecureRandom;
//import java.util.concurrent.TimeUnit;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -131,7 +134,7 @@ public class SyncResource {
public ResponseEntity<Void> syncTest(@RequestParam("year") String year, @RequestParam("month") String month) public ResponseEntity<Void> syncTest(@RequestParam("year") String year, @RequestParam("month") String month)
throws Exception { throws Exception {
logger.info("REST request syncTest"); logger.info("REST request syncTest");
//delayTest();
ResponseEntity<Void> res; ResponseEntity<Void> res;
logger.info("Selezionato {} - {} ", year, month); logger.info("Selezionato {} - {} ", year, month);
String msg = "Test eseguito correttamente."; String msg = "Test eseguito correttamente.";
@ -148,6 +151,21 @@ public class SyncResource {
return res; return res;
} }
/* private void delayTest() {
SecureRandom rand = new SecureRandom();
int upperbound = 1000;
// Generating random values from 0 - 999
// using nextInt()
int random1 = rand.nextInt(upperbound);
logger.debug("Test: "+random1);
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
*/
/** /**
* {@code GET /sync/writesOrario} : Report Orario from ePAS and update * {@code GET /sync/writesOrario} : Report Orario from ePAS and update
* SistemaInformativo. * SistemaInformativo.