commit 30/09/2025
This commit is contained in:
@@ -27,10 +27,9 @@ public class ErhaAPI {
|
|||||||
private @Getter String API_USERNAME = "erha-pb-001";
|
private @Getter String API_USERNAME = "erha-pb-001";
|
||||||
private @Getter String API_PASSWORD = "bM0tH!s";
|
private @Getter String API_PASSWORD = "bM0tH!s";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String auth;
|
private String auth;
|
||||||
private String API_URL="";
|
private String API_URL="";
|
||||||
|
private boolean DermiesMode = false;
|
||||||
|
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
@@ -42,6 +41,16 @@ public class ErhaAPI {
|
|||||||
setProduction(isProduction);
|
setProduction(isProduction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Erha API object
|
||||||
|
* @param isProduction if true will use Production URL, if false will use Staging URL
|
||||||
|
* @param dermiesMode if true will use Dermies Mode (for Dermies Clinic)
|
||||||
|
*/
|
||||||
|
public ErhaAPI(boolean isProduction, boolean dermiesMode){
|
||||||
|
setProduction(isProduction);
|
||||||
|
this.DermiesMode = dermiesMode;
|
||||||
|
}
|
||||||
|
|
||||||
public void setProduction(boolean isProduction){
|
public void setProduction(boolean isProduction){
|
||||||
final String API_URL_PROD = "https://connect-api.aryanoble.co.id/api";
|
final String API_URL_PROD = "https://connect-api.aryanoble.co.id/api";
|
||||||
final String API_URL_STAGING = "https://connect-api-staging.aryanoble.web.id/api";
|
final String API_URL_STAGING = "https://connect-api-staging.aryanoble.web.id/api";
|
||||||
@@ -99,7 +108,7 @@ public class ErhaAPI {
|
|||||||
try (HttpClient client = HttpClient.newHttpClient()) {
|
try (HttpClient client = HttpClient.newHttpClient()) {
|
||||||
int medical_record_detail_id = toInt(Barcode);
|
int medical_record_detail_id = toInt(Barcode);
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
.uri(java.net.URI.create(API_URL+"/photobooth/photobooth/" + medical_record_detail_id))
|
.uri(java.net.URI.create(API_URL+ (DermiesMode ? "/photobooth/dermies/":"/photobooth/photobooth/") + medical_record_detail_id))
|
||||||
.header("Authorization", "Basic " + auth)
|
.header("Authorization", "Basic " + auth)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
@@ -193,7 +202,7 @@ public class ErhaAPI {
|
|||||||
|
|
||||||
System.out.println("Uploading file : " + filename + " to " + (config.isProduction()?"Production":"Staging")+" API ");
|
System.out.println("Uploading file : " + filename + " to " + (config.isProduction()?"Production":"Staging")+" API ");
|
||||||
HttpRequest request = HttpRequest.newBuilder()
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
.uri(new URI(API_URL + "/photobooth/photobooth"))
|
.uri(new URI(API_URL + (DermiesMode ?"/photobooth/dermies":"/photobooth/photobooth")))
|
||||||
.header("Authorization", "Basic " + auth)
|
.header("Authorization", "Basic " + auth)
|
||||||
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
|
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
|
||||||
.POST(HttpRequest.BodyPublishers.ofByteArray(multipartData))
|
.POST(HttpRequest.BodyPublishers.ofByteArray(multipartData))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import javafx.application.Platform;
|
|||||||
|
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ public class CaptureView {
|
|||||||
|
|
||||||
private final AtomicBoolean isTakingPhoto = new AtomicBoolean(false);
|
private final AtomicBoolean isTakingPhoto = new AtomicBoolean(false);
|
||||||
|
|
||||||
private final ErhaAPI erhaAPI = new ErhaAPI(config.isProduction());
|
// dermiesMode = true means for Dermies Clinic, false means for Erha Clinic
|
||||||
|
private final ErhaAPI erhaAPI = new ErhaAPI(config.isProduction(), true);
|
||||||
|
|
||||||
// for timeout 180 detik
|
// for timeout 180 detik
|
||||||
private final int timeout = 180;
|
private final int timeout = 180;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class MainApplication extends Application {
|
|||||||
Screen screen = Screen.getPrimary();
|
Screen screen = Screen.getPrimary();
|
||||||
Rectangle2D screenbound = screen.getBounds();
|
Rectangle2D screenbound = screen.getBounds();
|
||||||
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
|
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
|
||||||
stage.setTitle("MultiCam Capture App for ERHA "+version);
|
stage.setTitle("MultiCam Capture App for Dermies "+version);
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(true);
|
stage.setResizable(true);
|
||||||
stage.setMaximized(true);
|
stage.setMaximized(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user