Merge branch 'backend/michael' into backend/max
This commit is contained in:
commit
090e43e7d7
@ -279,16 +279,19 @@ public class Controller {
|
|||||||
if (cache.getStationen().get(i - 1).equals(aktuelleStation)) {
|
if (cache.getStationen().get(i - 1).equals(aktuelleStation)) {
|
||||||
bearbeitet.setAktuelleStation(station);
|
bearbeitet.setAktuelleStation(station);
|
||||||
if (i == cache.getStationen().size() - 1) { // letze Station erreicht
|
if (i == cache.getStationen().size() - 1) { // letze Station erreicht
|
||||||
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional =
|
//----------------------
|
||||||
cacheAccesDefinitionRepository.findById(1); // abgeschlossen
|
//Get CacheAccesDefinition
|
||||||
if (cacheAccesDefinitionOptional.isPresent()) {
|
ResponseEntity getCacheAccesDefinition = FinderUtil.findCacheAccesDefinitionById("1");
|
||||||
CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get();
|
|
||||||
|
if (getCacheAccesDefinition.getStatusCodeValue() != 200) {
|
||||||
|
return getCacheAccesDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheAccesDefinition cacheAccesDefinition = (CacheAccesDefinition) getCacheAccesDefinition.getBody();
|
||||||
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
|
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
|
||||||
} else {
|
//----------------------
|
||||||
return ResponseEntity.status(404).body("There is no cacheAccesDefinition with the ID " + 1);
|
|
||||||
}
|
}
|
||||||
}
|
return ResponseEntity.status(200).body(new Gson().toJson(bearbeitet));
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(station));
|
|
||||||
} else {
|
} else {
|
||||||
return ResponseEntity.status(400).body("The scanned station isn´t the correct following station");
|
return ResponseEntity.status(400).body("The scanned station isn´t the correct following station");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package hhn.labsw.bugageocaching.util;
|
package hhn.labsw.bugageocaching.util;
|
||||||
|
|
||||||
import hhn.labsw.bugageocaching.entities.Bearbeitet;
|
import hhn.labsw.bugageocaching.entities.*;
|
||||||
import hhn.labsw.bugageocaching.entities.Cache;
|
|
||||||
import hhn.labsw.bugageocaching.entities.Station;
|
|
||||||
import hhn.labsw.bugageocaching.entities.User;
|
|
||||||
import hhn.labsw.bugageocaching.repositories.*;
|
import hhn.labsw.bugageocaching.repositories.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -74,4 +71,12 @@ public class FinderUtil {
|
|||||||
return ResponseEntity.status(404).body("Couldnt find user with username " + username);
|
return ResponseEntity.status(404).body("Couldnt find user with username " + username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResponseEntity findCacheAccesDefinitionById(String cacheAccesDefinitionID) {
|
||||||
|
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional = cacheAccesDefinitionRepository.findById(Integer.valueOf(cacheAccesDefinitionID));
|
||||||
|
if (cacheAccesDefinitionOptional.isPresent()) {
|
||||||
|
return ResponseEntity.status(200).body(cacheAccesDefinitionOptional.get());
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.status(404).body("Couldnt find CacheAccesDefinition " + cacheAccesDefinitionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user