feat: Implement RekapGarduDistribusi resource and related DTOs
- Added RekapGarduDistribusiResource for handling data retrieval and synchronization. - Created RekapGarduDistribusiDTO to represent the data structure for distribution records. - Developed RekapGarduDistribusiResponse to encapsulate the response from the external API. - Introduced RekapGarduDistribusi entity to map to the database table. - Implemented GarduService for synchronizing data with external API. - Enhanced error handling and logging during data synchronization.
This commit is contained in:
@@ -4,7 +4,6 @@ import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.Base64;
|
||||
import io.quarkus.scheduler.Scheduled;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
@@ -35,4 +34,16 @@ public class MyScheduledBean {
|
||||
client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
System.out.println("Scheduled task executed successfully");
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 59 23 1 * ?")
|
||||
void scheduleCronGardu() throws Exception {
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create("http://10.14.212.9:32184/rekapGarduDistribusi/sinkron"))
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
System.out.println("Scheduled Rekap Gardu task executed successfully");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user