This commit is contained in:
Eko Haryadi
2025-08-20 08:56:18 +07:00
parent 4496edd8c8
commit be06f273c5
36 changed files with 3486 additions and 0 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*

45
.gitignore vendored Normal file
View File

@@ -0,0 +1,45 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml
# Eclipse
.project
.classpath
.settings/
bin/
# IntelliJ
.idea
*.ipr
*.iml
*.iws
# NetBeans
nb-configuration.xml
# Visual Studio Code
.vscode
.factorypath
# OSX
.DS_Store
# Vim
*.swp
*.swo
# patch
*.orig
*.rej
# Local environment
.env
# Plugin directory
/.quarkus/cli/plugins/
# TLS Certificates
.certs/

1
.mvn/wrapper/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
maven-wrapper.jar

View File

@@ -0,0 +1,93 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URI;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.concurrent.ThreadLocalRandom;
public final class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "3.3.2";
private static final boolean VERBOSE = Boolean.parseBoolean(System.getenv("MVNW_VERBOSE"));
public static void main(String[] args) {
log("Apache Maven Wrapper Downloader " + WRAPPER_VERSION);
if (args.length != 2) {
System.err.println(" - ERROR wrapperUrl or wrapperJarPath parameter missing");
System.exit(1);
}
try {
log(" - Downloader started");
final URL wrapperUrl = URI.create(args[0]).toURL();
final String jarPath = args[1].replace("..", ""); // Sanitize path
final Path wrapperJarPath = Paths.get(jarPath).toAbsolutePath().normalize();
downloadFileFromURL(wrapperUrl, wrapperJarPath);
log("Done");
} catch (IOException e) {
System.err.println("- Error downloading: " + e.getMessage());
if (VERBOSE) {
e.printStackTrace();
}
System.exit(1);
}
}
private static void downloadFileFromURL(URL wrapperUrl, Path wrapperJarPath)
throws IOException {
log(" - Downloading to: " + wrapperJarPath);
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
final String username = System.getenv("MVNW_USERNAME");
final char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
Path temp = wrapperJarPath
.getParent()
.resolve(wrapperJarPath.getFileName() + "."
+ Long.toUnsignedString(ThreadLocalRandom.current().nextLong()) + ".tmp");
try (InputStream inStream = wrapperUrl.openStream()) {
Files.copy(inStream, temp, StandardCopyOption.REPLACE_EXISTING);
Files.move(temp, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING);
} finally {
Files.deleteIfExists(temp);
}
log(" - Downloader complete");
}
private static void log(String msg) {
if (VERBOSE) {
System.out.println(msg);
}
}
}

20
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=source
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.8/apache-maven-3.9.8-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar

4
build.sh Normal file
View File

@@ -0,0 +1,4 @@
./mvnw package
docker build -f src/main/docker/Dockerfile.jvm -t probdg/ss-backend:v$1 .
docker push probdg/ss-backend:v$1
echo kubectl set image deployment/api-ss-be api-ss-be=probdg/ss-backend:v$1 -n apkt-ss

5
json.json Normal file
View File

@@ -0,0 +1,5 @@
{
"data": "{ \"Row\" : [ { \"THBLLAP\" : \"202401\", \"JENISLAP\" : \"LPB\", \"UNITUPI\" : \"53\", \"UNITAP\" : \"53BDG\", \"UNITUP\" : \"53563\", \"NO_BARIS\" : \"1\", \"GOLTARIF\" : \"S\", \"TARIF\" : \"S1\", \"DAYA_MIN\" : \"0\", \"DAYA_MAX\" : \"220\", \"LABEL\" : \"S.1 / 220 VA\", \"LABEL_ASTERIK\" : \"null\", \"JMLPLG\" : \"0\", \"JMLDAYA\" : \"0\", \"JMLKWH\" : \"0\", \"KWHLWBP\" : \"0\", \"KWHWBP\" : \"0\", \"KELBKVARH\" : \"0\", \"RPBEBAN\" : \"0\", \"RPKWH\" : \"0\", \"RPKVARH\" : \"0\", \"RPPTL\" : \"0\", \"RATA_VA_LANGGANAN\" : \"0\", \"RATA_KWH_LANGGANAN\" : \"0\", \"RATA_RP_KWH\" : \"0\", \"JAM_NYALA\" : \"0\", \"KWH_SD_BLN_INI\" : \"0\", \"KVARH_SD_BLN_INI\" : \"0\", \"B_BEBAN_SD_BLN_INI\" : \"0\", \"B_KWH_SD_BLN_INI\" : \"0\", \"B_KVARH_SD_BLN_INI\" : \"0\", \"JUMLAH_SD_BLN_INI\" : \"0\", \"RP_KWH_SD_BLN_INI\" : \"0\" }, { \"THBLLAP\" : \"202401\", \"JENISLAP\" : \"NORMAL\", \"UNITUPI\" : \"53\", \"UNITAP\" : \"53BDG\", \"UNITUP\" : \"53563\", \"NO_BARIS\" : \"1\", \"GOLTARIF\" : \"S\", \"TARIF\" : \"S1\", \"DAYA_MIN\" : \"0\", \"DAYA_MAX\" : \"220\", \"LABEL\" : \"S.1 / 220 VA\", \"LABEL_ASTERIK\" : \"null\", \"JMLPLG\" : \"0\", \"JMLDAYA\" : \"0\", \"JMLKWH\" : \"0\", \"KWHLWBP\" : \"0\", \"KWHWBP\" : \"0\", \"KELBKVARH\" : \"0\", \"RPBEBAN\" : \"0\", \"RPKWH\" : \"0\", \"RPKVARH\" : \"0\", \"RPPTL\" : \"0\", \"RATA_VA_LANGGANAN\" : \"0\", \"RATA_KWH_LANGGANAN\" : \"0\", \"RATA_RP_KWH\" : \"0\", \"JAM_NYALA\" : \"0\", \"KWH_SD_BLN_INI\" : \"0\", \"KVARH_SD_BLN_INI\" : \"0\", \"B_BEBAN_SD_BLN_INI\" : \"0\", \"B_KWH_SD_BLN_INI\" : \"0\", \"B_KVARH_SD_BLN_INI\" : \"0\", \"JUMLAH_SD_BLN_INI\" : \"0\", \"RP_KWH_SD_BLN_INI\" : \"0\" }]}",
"status": true,
"messsage": "Success"
}

43
json2.json Normal file
View File

@@ -0,0 +1,43 @@
{
"data": {
"Row": [
{
"THBLLAP": "202409",
"JENISLAP": "LPB",
"UNITUPI": "53",
"UNITAP": "53BDG",
"UNITUP": "53563",
"NO_BARIS": "1",
"GOLTARIF": "S",
"TARIF": "S1",
"DAYA_MIN": "0",
"DAYA_MAX": "450",
"LABEL": "S.1 / 450 VA",
"LABEL_ASTERIK": "I",
"JMLPLG": "95",
"JMLDAYA": "42750",
"JMLKWH": "3555.8",
"KWHLWBP": "3555.8",
"KWHWBP": "0",
"KELBKVARH": "0",
"RPBEBAN": "0",
"RPKWH": "1155130",
"RPKVARH": "0",
"RPPTL": "1155130",
"RATA_VA_LANGGANAN": "450",
"RATA_KWH_LANGGANAN": "37.43",
"RATA_RP_KWH": "324.86",
"JAM_NYALA": "83.18",
"KWH_SD_BLN_INI": "31062.48",
"KVARH_SD_BLN_INI": "0",
"B_BEBAN_SD_BLN_INI": "0",
"B_KWH_SD_BLN_INI": "10089197",
"B_KVARH_SD_BLN_INI": "0",
"JUMLAH_SD_BLN_INI": "10089197",
"RP_KWH_SD_BLN_INI": "324.803"
}
]
},
"status": true,
"message": "Success"
}

5
json3.json Normal file

File diff suppressed because one or more lines are too long

39
json4.json Normal file
View File

@@ -0,0 +1,39 @@
{
"Row": [
{
"THBLLAP": "202401",
"JENISLAP": "LPB",
"UNITUPI": "53",
"UNITAP": "53BDG",
"UNITUP": "53563",
"NO_BARIS": "1",
"GOLTARIF": "S",
"TARIF": "S1",
"DAYA_MIN": "0",
"DAYA_MAX": "220",
"LABEL": "S.1 / 220 VA",
"LABEL_ASTERIK": "null",
"JMLPLG": "0",
"JMLDAYA": "0",
"JMLKWH": "0",
"KWHLWBP": "0",
"KWHWBP": "0",
"KELBKVARH": "0",
"RPBEBAN": "0",
"RPKWH": "0",
"RPKVARH": "0",
"RPPTL": "0",
"RATA_VA_LANGGANAN": "0",
"RATA_KWH_LANGGANAN": "0",
"RATA_RP_KWH": "0",
"JAM_NYALA": "0",
"KWH_SD_BLN_INI": "0",
"KVARH_SD_BLN_INI": "0",
"B_BEBAN_SD_BLN_INI": "0",
"B_KWH_SD_BLN_INI": "0",
"B_KVARH_SD_BLN_INI": "0",
"JUMLAH_SD_BLN_INI": "0",
"RP_KWH_SD_BLN_INI": "0"
}
]
}

332
mvnw vendored Executable file
View File

@@ -0,0 +1,332 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Apache Maven Wrapper startup batch script, version 3.3.2
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ]; then
if [ -f /usr/local/etc/mavenrc ]; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ]; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ]; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
darwin=false
mingw=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true ;;
Darwin*)
darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
JAVA_HOME="$(/usr/libexec/java_home)"
export JAVA_HOME
else
JAVA_HOME="/Library/Java/Home"
export JAVA_HOME
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ]; then
if [ -r /etc/gentoo-release ]; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] \
&& JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] \
&& CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw; then
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \
&& JAVA_HOME="$(
cd "$JAVA_HOME" || (
echo "cannot cd into $JAVA_HOME." >&2
exit 1
)
pwd
)"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=$(which readlink)
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
if $darwin; then
javaHome="$(dirname "$javaExecutable")"
javaExecutable="$(cd "$javaHome" && pwd -P)/javac"
else
javaExecutable="$(readlink -f "$javaExecutable")"
fi
javaHome="$(dirname "$javaExecutable")"
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ]; then
if [ -n "$JAVA_HOME" ]; then
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="$(
\unset -f command 2>/dev/null
\command -v java
)"
fi
fi
if [ ! -x "$JAVACMD" ]; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ]; then
echo "Warning: JAVA_HOME environment variable is not set." >&2
fi
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]; then
echo "Path not specified to find_maven_basedir" >&2
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ]; do
if [ -d "$wdir"/.mvn ]; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=$(
cd "$wdir/.." || exit 1
pwd
)
fi
# end of workaround
done
printf '%s' "$(
cd "$basedir" || exit 1
pwd
)"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
# Remove \r in case we run on Windows within Git Bash
# and check out the repository with auto CRLF management
# enabled. Otherwise, we may read lines that are delimited with
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
# splitting rules.
tr -s '\r\n' ' ' <"$1"
fi
}
log() {
if [ "$MVNW_VERBOSE" = true ]; then
printf '%s\n' "$1"
fi
}
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
if [ -z "$BASE_DIR" ]; then
exit 1
fi
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
export MAVEN_PROJECTBASEDIR
log "$MAVEN_PROJECTBASEDIR"
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
if [ -r "$wrapperJarPath" ]; then
log "Found $wrapperJarPath"
else
log "Couldn't find $wrapperJarPath, downloading it ..."
if [ -n "$MVNW_REPOURL" ]; then
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
else
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
fi
while IFS="=" read -r key value; do
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
safeValue=$(echo "$value" | tr -d '\r')
case "$key" in wrapperUrl)
wrapperUrl="$safeValue"
break
;;
esac
done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
log "Downloading from: $wrapperUrl"
if $cygwin; then
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
fi
if command -v wget >/dev/null; then
log "Found wget ... using wget"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl >/dev/null; then
log "Found curl ... using curl"
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
else
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
fi
else
log "Falling back to using Java to download"
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaSource=$(cygpath --path --windows "$javaSource")
javaClass=$(cygpath --path --windows "$javaClass")
fi
if [ -e "$javaSource" ]; then
if [ ! -e "$javaClass" ]; then
log " - Compiling MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/javac" "$javaSource")
fi
if [ -e "$javaClass" ]; then
log " - Running MavenWrapperDownloader.java ..."
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
wrapperSha256Sum=""
while IFS="=" read -r key value; do
case "$key" in wrapperSha256Sum)
wrapperSha256Sum=$value
break
;;
esac
done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
if [ -n "$wrapperSha256Sum" ]; then
wrapperSha256Result=false
if command -v sha256sum >/dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c >/dev/null 2>&1; then
wrapperSha256Result=true
fi
elif command -v shasum >/dev/null; then
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then
wrapperSha256Result=true
fi
else
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2
exit 1
fi
if [ $wrapperSha256Result = false ]; then
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
exit 1
fi
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$JAVA_HOME" ] \
&& JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
[ -n "$CLASSPATH" ] \
&& CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
[ -n "$MAVEN_PROJECTBASEDIR" ] \
&& MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# shellcheck disable=SC2086 # safe args
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

206
mvnw.cmd vendored Executable file
View File

@@ -0,0 +1,206 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Apache Maven Wrapper startup batch script, version 3.3.2
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo. >&2
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo. >&2
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo. >&2
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo. >&2
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %WRAPPER_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
SET WRAPPER_SHA_256_SUM=""
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
)
IF NOT %WRAPPER_SHA_256_SUM%=="" (
powershell -Command "&{"^
"Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
" Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
" Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
" Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
" exit 1;"^
"}"^
"}"
if ERRORLEVEL 1 goto error
)
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

207
pom.xml Normal file
View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>id.co.iconpln.apkt.data309</groupId>
<artifactId>DATA-309-AP2T-INGTEGRATION</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.15.1</quarkus.platform.version>
<skipITs>true</skipITs>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security</artifactId>
</dependency>
<!-- Hibernate ORM specific dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
<version>${quarkus.platform.version}</version>
</dependency>
<!-- JDBC driver dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
<version>3.16.0.CR1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.18.0</version> <!-- Use a stable version -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.loggingjson</groupId>
<artifactId>quarkus-logging-json</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-scheduler</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>3.2.2</version>
<inherited>true</inherited>
<executions>
<execution>
<goals>
<goal>jandex</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<skip>${jandex.skip}</skip>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.native.enabled>true</quarkus.native.enabled>
</properties>
</profile>
</profiles>
</project>

222
sql.sql Normal file
View File

@@ -0,0 +1,222 @@
CREATE TABLE apkt_transactional.gangguan (
id bigserial NOT NULL,
id_pelanggan_no_meter int8 NULL,
id_posko int8 NULL,
id_tipe_permasalahan int8 NULL,
alamat_pelanggan varchar(255) NULL,
nama_pelapor varchar(255) NULL,
telepon_pelapor varchar(255) NULL,
hp_pelapor varchar(255) NULL,
fax_pelapor varchar(255) NULL,
email_pelapor varchar(255) NULL,
alamat_pelapor varchar(4000) NULL,
media varchar(255) NULL,
lokasi public.geometry(point, 4326) NULL,
no_laporan varchar NULL,
keterangan varchar(4000) NULL,
created_date timestamp(6) NULL,
created_by int8 NULL,
updated_date timestamp(6) NULL,
updated_by int8 NULL,
status_akhir varchar(50) NULL,
unit int8 NULL,
eskalasi int8 NULL,
permasalahan varchar NULL,
waktu_lapor timestamp NULL,
id_regu int8 NULL,
waktu_penugasan timestamp NULL,
waktu_perjalanan timestamp NULL,
waktu_pengerjaan timestamp NULL,
waktu_nyala_sementara timestamp NULL,
waktu_nyala timestamp NULL,
waktu_batal timestamp NULL,
waktu_selesai timestamp NULL,
alasan varchar NULL,
patokan varchar NULL,
id_sub_tipe_permasalahan int8 NULL,
tipe_gangguan int8 NULL,
alasan_pembatalan varchar NULL,
jarak int8 NULL,
id_kelompok int8 NULL,
id_sub_fasilitas int8 NULL,
id_equipment int8 NULL,
id_prioritas int8 NULL,
id_penyebab int8 NULL,
jumlah_pelanggan_termarking int8 NULL,
jumlah_lapor int8 NULL,
waktu_konfirmasi timestamp NULL,
id_fasilitas int8 NULL,
id_kelompok_utama int8 NULL,
id_dampak int8 NULL,
id_grup_penyebab_gangguan int8 NULL,
id_kelurahan int8 NULL,
ctt varchar NULL,
id_tindakan int8 NULL,
id_cuaca int8 NULL,
fax varchar NULL,
keterangan_lokasi varchar NULL,
waktu_fax timestamp NULL,
nama_media varchar NULL,
waktu_media timestamp NULL,
merk_meter varchar NULL,
id_tarif_daya int8 NULL,
id_merk_meter int8 NULL,
daya_tarif int8 NULL,
penyebab_sementara varchar NULL,
alasan_nyala_sementara varchar NULL,
tindakan_telah_dilakukan_nyala_sementara varchar NULL,
usulan_tindakan_selanjutnya varchar NULL,
tindakan_telah_dilakukan_nyala varchar NULL,
penyebab_nyala varchar NULL,
jumlah_pelanggan_padam int8 NULL,
is_konfirmasi bool NULL,
pelanggaran bool NULL,
id_feeder_penyebab_tindakan int8 NULL,
komponen_yang_terganggu_feeder varchar NULL,
tindakan_yang_dilakukan_feeder varchar NULL,
ccv bool NULL,
konfirmasi varchar NULL,
no_meter varchar NULL,
deskripsi varchar NULL,
waktu_padam timestamp NULL,
rating int8 NULL,
no_tiket_crm varchar NULL,
no_lapor_pln varchar NULL,
no_kerja varchar NULL,
ulasan_rating varchar NULL,
"tipe_batal" apkt_transactional."tp_batal" NULL,
tipe_wo apkt_transactional."tp_wo" NULL,
id_referensi_marking int8 NULL,
waktu_marking timestamp NULL,
keterangan_marking varchar NULL,
foto_pelanggan varchar NULL,
foto_tindak_lanjut varchar NULL,
flag_padam int8 NULL,
jenis_aduan apkt_transactional."tp_jenis_gangguan" NULL,
waktu_rating timestamp NULL,
status_rating varchar NULL,
keterangan_rating varchar NULL,
feedback_rating varchar NULL,
isfax varchar(1) NULL,
tipe_referensi_marking apkt_transactional."tp_referensi_marking" NULL,
daya int4 NULL,
no_laporan_referensi_marking varchar NULL,
selesai_by int8 NULL,
dispatch_by int8 NULL,
is_automarking apkt_transactional."tp_automarking" NULL,
listriqu apkt_transactional."tp_listriqu" NULL,
CONSTRAINT gangguan_pkey PRIMARY KEY (id)
);
CREATE TABLE apkt_transactional.gangguan (
id bigserial NOT NULL,
id_pelanggan_no_meter int8 NULL,
id_posko int8 NULL,
id_tipe_permasalahan int8 NULL,
alamat_pelanggan varchar(255) NULL,
nama_pelapor varchar(255) NULL,
telepon_pelapor varchar(255) NULL,
hp_pelapor varchar(255) NULL,
fax_pelapor varchar(255) NULL,
email_pelapor varchar(255) NULL,
alamat_pelapor varchar(4000) NULL,
media varchar(255) NULL,
lokasi public.geometry(point, 4326) NULL,
no_laporan varchar NULL,
keterangan varchar(4000) NULL,
created_date timestamp(6) NULL,
created_by int8 NULL,
updated_date timestamp(6) NULL,
updated_by int8 NULL,
status_akhir varchar(50) NULL,
unit int8 NULL,
eskalasi int8 NULL,
permasalahan varchar NULL,
waktu_lapor timestamp NULL,
id_regu int8 NULL,
waktu_penugasan timestamp NULL,
waktu_perjalanan timestamp NULL,
waktu_pengerjaan timestamp NULL,
waktu_nyala_sementara timestamp NULL,
waktu_nyala timestamp NULL,
waktu_batal timestamp NULL,
waktu_selesai timestamp NULL,
alasan varchar NULL,
patokan varchar NULL,
id_sub_tipe_permasalahan int8 NULL,
tipe_gangguan int8 NULL,
alasan_pembatalan varchar NULL,
jarak int8 NULL,
id_kelompok int8 NULL,
id_sub_fasilitas int8 NULL,
id_equipment int8 NULL,
id_prioritas int8 NULL,
id_penyebab int8 NULL,
jumlah_pelanggan_termarking int8 NULL,
jumlah_lapor int8 NULL,
waktu_konfirmasi timestamp NULL,
id_fasilitas int8 NULL,
id_kelompok_utama int8 NULL,
id_dampak int8 NULL,
id_grup_penyebab_gangguan int8 NULL,
id_kelurahan int8 NULL,
ctt varchar NULL,
id_tindakan int8 NULL,
id_cuaca int8 NULL,
fax varchar NULL,
keterangan_lokasi varchar NULL,
waktu_fax timestamp NULL,
nama_media varchar NULL,
waktu_media timestamp NULL,
merk_meter varchar NULL,
id_tarif_daya int8 NULL,
id_merk_meter int8 NULL,
daya_tarif int8 NULL,
penyebab_sementara varchar NULL,
alasan_nyala_sementara varchar NULL,
tindakan_telah_dilakukan_nyala_sementara varchar NULL,
usulan_tindakan_selanjutnya varchar NULL,
tindakan_telah_dilakukan_nyala varchar NULL,
penyebab_nyala varchar NULL,
jumlah_pelanggan_padam int8 NULL,
is_konfirmasi bool NULL,
pelanggaran bool NULL,
id_feeder_penyebab_tindakan int8 NULL,
komponen_yang_terganggu_feeder varchar NULL,
tindakan_yang_dilakukan_feeder varchar NULL,
ccv bool NULL,
konfirmasi varchar NULL,
no_meter varchar NULL,
deskripsi varchar NULL,
waktu_padam timestamp NULL,
rating int8 NULL,
no_tiket_crm varchar NULL,
no_lapor_pln varchar NULL,
no_kerja varchar NULL,
ulasan_rating varchar NULL,
"tipe_batal" apkt_transactional."tp_batal" NULL,
tipe_wo apkt_transactional."tp_wo" NULL,
id_referensi_marking int8 NULL,
waktu_marking timestamp NULL,
keterangan_marking varchar NULL,
foto_pelanggan varchar NULL,
foto_tindak_lanjut varchar NULL,
flag_padam int8 NULL,
jenis_aduan apkt_transactional."tp_jenis_gangguan" NULL,
waktu_rating timestamp NULL,
status_rating varchar NULL,
keterangan_rating varchar NULL,
feedback_rating varchar NULL,
isfax varchar(1) NULL,
tipe_referensi_marking apkt_transactional."tp_referensi_marking" NULL,
daya int4 NULL,
no_laporan_referensi_marking varchar NULL,
selesai_by int8 NULL,
dispatch_by int8 NULL,
is_automarking apkt_transactional."tp_automarking" NULL,
listriqu apkt_transactional."tp_listriqu" NULL,
CONSTRAINT gangguan_pkey PRIMARY KEY (id)
);

View File

@@ -0,0 +1,16 @@
FROM registry.access.redhat.com/ubi8/openjdk-17:1.18
ENV LANGUAGE='en_US:en'
ENV TZ=Asia/Jakarta
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/
COPY --chown=185 target/quarkus-app/*.jar /deployments/
COPY --chown=185 target/quarkus-app/app/ /deployments/app/
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/
EXPOSE 8080
USER 185
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Duser.timezone=Asia/Jakarta"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

View File

@@ -0,0 +1,93 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the container image run:
#
# ./mvnw package -Dquarkus.package.jar.type=legacy-jar
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/code-with-quarkus-legacy-jar .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-legacy-jar
#
# If you want to include the debug port into your docker image
# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005.
# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005
# when running the container
#
# Then run the container using :
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus-legacy-jar
#
# This image uses the `run-java.sh` script to run the application.
# This scripts computes the command line to execute your Java application, and
# includes memory/GC tuning.
# You can configure the behavior using the following environment properties:
# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class")
# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options
# in JAVA_OPTS (example: "-Dsome.property=foo")
# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is
# used to calculate a default maximal heap memory based on a containers restriction.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio
# of the container available memory as set here. The default is `50` which means 50%
# of the available memory is used as an upper boundary. You can skip this mechanism by
# setting this value to `0` in which case no `-Xmx` option is added.
# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This
# is used to calculate a default initial heap memory based on the maximum heap memory.
# If used in a container without any memory constraints for the container then this
# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio
# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx`
# is used as the initial heap size. You can skip this mechanism by setting this value
# to `0` in which case no `-Xms` option is added (example: "25")
# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS.
# This is used to calculate the maximum value of the initial heap memory. If used in
# a container without any memory constraints for the container then this option has
# no effect. If there is a memory constraint then `-Xms` is limited to the value set
# here. The default is 4096MB which means the calculated value of `-Xms` never will
# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096")
# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output
# when things are happening. This option, if set to true, will set
# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true").
# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example:
# true").
# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787").
# - CONTAINER_CORE_LIMIT: A calculated core limit as described in
# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2")
# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024").
# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion.
# (example: "20")
# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking.
# (example: "40")
# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection.
# (example: "4")
# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus
# previous GC times. (example: "90")
# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20")
# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100")
# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should
# contain the necessary JRE command-line options to specify the required GC, which
# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC).
# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080")
# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080")
# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-21:1.20
ENV LANGUAGE='en_US:en'
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/quarkus-run.jar
EXPOSE 8080
USER 185
ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]

View File

@@ -0,0 +1,27 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
#
# Before building the container image run:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/code-with-quarkus .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@@ -0,0 +1,30 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
# It uses a micro base image, tuned for Quarkus native executables.
# It reduces the size of the resulting container image.
# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image.
#
# Before building the container image run:
#
# ./mvnw package -Dnative
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/code-with-quarkus .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/code-with-quarkus
#
###
FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@@ -0,0 +1,49 @@
// package id.co.iconpln.apkt.data309;
// import jakarta.annotation.Priority;
// import org.eclipse.microprofile.config.inject.ConfigProperty;
// import jakarta.ws.rs.container.ContainerRequestContext;
// import jakarta.ws.rs.core.Response;
// import jakarta.ws.rs.ext.Provider;
// import jakarta.ws.rs.container.ContainerRequestFilter;
// import java.util.Base64;
// @Provider
// @Priority(100)
// public class AuthFilter implements ContainerRequestFilter {
// private static final String AUTHORIZATION_PREFIX = "Basic ";
// @ConfigProperty(name = "quarkus.auth.username")
// String authUsername;
// @ConfigProperty(name = "quarkus.auth.password")
// String authPassword;
// @Override
// public void filter(ContainerRequestContext requestContext) {
// String authHeader = requestContext.getHeaderString("Authorization");
// if (authHeader == null || !authHeader.startsWith(AUTHORIZATION_PREFIX)) {
// requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).build());
// return;
// }
// // Decode and validate credentials
// String encodedCredentials = authHeader.substring(AUTHORIZATION_PREFIX.length());
// String decodedCredentials = new String(Base64.getDecoder().decode(encodedCredentials));
// String[] credentials = decodedCredentials.split(":", 2);
// String username = credentials[0];
// String password = credentials.length > 1 ? credentials[1] : "";
// // Implement your user validation logic here
// if (!isValidUser(username, password)) {
// requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).build());
// }
// }
// private boolean isValidUser(String username, String password) {
// // Replace with actual validation logic
// return authUsername.equals(username) && authPassword.equals(password);
// }
// }

View File

@@ -0,0 +1,14 @@
package id.co.iconpln.apkt.data309;
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.annotations.QuarkusMain;
@QuarkusMain
public class Main {
public static void main(String... args) {
Quarkus.run(args);
}
}

View File

@@ -0,0 +1,577 @@
package id.co.iconpln.apkt.data309.boundary;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import id.co.iconpln.apkt.data309.dto.Data309;
import id.co.iconpln.apkt.data309.dto.ReportData;
import id.co.iconpln.apkt.data309.dto.ResponseModel;
import id.co.iconpln.apkt.data309.dto.Row;
import id.co.iconpln.apkt.data309.entity.SS309;
import id.co.iconpln.apkt.data309.entity.Ulp;
import id.co.iconpln.apkt.data309.service.Data309Service;
import id.co.iconpln.apkt.data309.utils.XmlToJsonConverter;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.LocalDate;
// import java.nio.file.Files;
// import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
// import java.util.List;
import java.util.Map;
@ApplicationScoped
@Path("/data309")
public class DataII09Resource {
@Inject
EntityManager em;
@Inject
Data309Service data309Service;
@GET
@Path("/getData")
public ResponseModel<String> getDil(@QueryParam("unit") String unit, @QueryParam("thnbln") String thnbln)
throws IOException {
ResponseModel<String> response = new ResponseModel<>();
try {
// URL of the SOAP service
URL url = new URL("http://10.72.35.15:7076/wsIntegPDPJ/WsIntegSimDisService");
// Open connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml");
connection.setDoOutput(true);
String xmlRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.iconpln.com/\">\n"
+
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <ws:getData309>\n" +
" <unit>" + unit + "</unit>\n" +
" <thblrek>" + thnbln + "</thblrek>\n" +
" </ws:getData309>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream())) {
writer.write(xmlRequest);
writer.flush();
}
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream()))) {
StringBuilder newData = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
newData.append(line);
}
try {
ObjectMapper objectMapper = new ObjectMapper();
String json = XmlToJsonConverter.convertXmlToJson(newData.toString());
JsonNode rootNode = objectMapper.readTree(json);
// Get the 'item' array from JSON
JsonNode itemNode = rootNode.path("Body")
.path("getData309Response")
.path("return")
.path("item");
// Process each item
Map<String, Object> obj = new HashMap<>();
Integer i = 0;
for (JsonNode node : itemNode) {
String itemValue = node.asText();
System.out.println("Item value: " + itemValue);
// Check if the item is XML
if (itemValue.startsWith("<?xml")) {
// Process XML content separately
// You may parse this XML or handle it accordingly
String xmlContent = itemValue;
i++;
obj.put(i.toString(), XmlToJsonConverter
.convertXmlToJson(xmlContent));
}
}
String jsonResult = objectMapper.writeValueAsString(obj);
// Create ObjectMapper instance
ObjectMapper mapperFromObjectNode = new ObjectMapper();
// Parse the JSON string into a JsonNode
JsonNode jsonNode = mapperFromObjectNode.readTree(jsonResult);
// Retrieve the nested JSON string and remove unnecessary backslashes
String cleanedJsonString = jsonNode.get("1").asText();
// Parse the cleaned JSON string back into a JsonNode to ensure it's valid
JsonNode cleanedJsonNode = objectMapper.readTree(cleanedJsonString);
// Pretty print the cleaned JSON
String prettyCleanedJsonString = objectMapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(cleanedJsonNode);
response.setData(prettyCleanedJsonString.replace("\n", ""));
response.setMessage("Success");
response.setStatus(true);
} catch (Exception e) {
e.printStackTrace();
response.setMessage("Failed : " + e.getMessage());
response.setStatus(false);
}
} catch (IOException e) {
// Handle IOException
e.printStackTrace();
response.setMessage("Failed : " + e.getMessage());
response.setStatus(false);
}
} catch (Exception e) {
e.printStackTrace();
response.setMessage("Failed : " + e.getMessage());
response.setStatus(false);
}
return response;
}
@GET
@Path("/pojo")
@Transactional
public Data309 getPojo(@QueryParam("unit") String unit, @QueryParam("thnbln") String thnbln)
throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://10.14.212.9:32184/data309/getData?unit=" + unit +
"&thnbln=" + thnbln))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
// get data from root path json.json
// String jsonString = new String(Files.readAllBytes(Paths.get("json3.json")));
// replace "null" with null
String jsonString = response.body();
try {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY, true);
ReportData reportData = objectMapper.readValue(jsonString, ReportData.class);
String data = reportData.getData();
Data309 data309 = objectMapper.readValue(data, Data309.class);
if (data309.getRow() != null) {
for (Row newData : data309.getRow()) {
Ulp ulp = Ulp.find("unit_ap2t = ?1", newData.getUnitup()).firstResult();
SS309 ss309 = SS309
.find("id_ulp = ?1 and thbllap = ?2 and no_baris = ?3",
ulp.getId(),
newData.getThbllap(), newData.getNoBaris())
.firstResult();
if (ss309 == null) {
ss309 = new SS309();
}
ss309.setThbllap(!newData.getThbllap().equals("null") ? newData.getThbllap()
: null);
ss309.setJenislap(!newData.getJenislap().equals("null") ? newData.getJenislap()
: null);
ss309.setId_ulp(ulp == null ? null : ulp.getId());
ss309.setNo_baris(
!newData.getNoBaris().equals("null")
? Integer.valueOf(newData.getNoBaris())
: null);
ss309.setGoltarif(!newData.getGoltarif().equals("null") ? newData.getGoltarif()
: null);
ss309.setTarif(!newData.getTarif().equals("null") ? newData.getTarif() : null);
ss309.setDaya_min(
!newData.getDayaMin().equals("null")
? Integer.valueOf(newData.getDayaMin())
: null);
ss309.setDaya_max(
!newData.getDayaMax().equals("null")
? Integer.valueOf(newData.getDayaMax())
: null);
ss309.setLabel(!newData.getLabel().equals("null") ? newData.getLabel() : null);
ss309.setLabel_asterik(
!newData.getLabelAsterik().equals("null")
? newData.getLabelAsterik()
: null);
ss309.setJmldaya(
!newData.getJmldaya().equals("null")
? new BigDecimal(newData.getJmldaya())
: null);
ss309.setJmlplg(
!newData.getJmlplg().equals("null")
? new BigDecimal(newData.getJmlplg())
: null);
ss309.setJmlkwh(!newData.getJmlkwh().equals("null")
? new BigDecimal(newData.getJmlkwh())
: null);
ss309.setJmlplg(
!newData.getJmlplg().equals("null")
? new BigDecimal(newData.getJmlplg())
: null);
ss309.setKwhlwbp(
!newData.getKwhlwbp().equals("null")
? new BigDecimal(newData.getKwhlwbp())
: null);
ss309.setKwhwbp(!newData.getKwhwbp().equals("null")
? new BigDecimal(newData.getKwhwbp())
: null);
ss309.setKelbkvarh(
!newData.getKelbkvarh().equals("null")
? new BigDecimal(newData.getKelbkvarh())
: null);
ss309.setRpbeban(
!newData.getRpbeban().equals("null")
? new BigDecimal(newData.getRpbeban())
: null);
ss309.setRpkwh(!newData.getRpkwh().equals("null")
? new BigDecimal(newData.getRpkwh())
: null);
ss309.setRpkvarh(
!newData.getRpkvarh().equals("null")
? new BigDecimal(newData.getRpkvarh())
: null);
ss309.setRpptl(!newData.getRpptl().equals("null")
? new BigDecimal(newData.getRpptl())
: null);
ss309.setRata_va_langganan(
!newData.getRataVaLangganan().equals("null")
? new BigDecimal(newData.getRataVaLangganan())
: null);
ss309.setRata_kwh_langganan(
!newData.getRataKwhLangganan().equals("null")
? new BigDecimal(newData.getRataKwhLangganan())
: null);
ss309.setRata_rp_kwh(
!newData.getRataRpKwh().equals("null")
? new BigDecimal(newData.getRataRpKwh())
: null);
ss309.setJam_nyala(
!newData.getJamNyala().equals("null")
? new BigDecimal(newData.getJamNyala())
: null);
ss309.setKwh_sd_bln_ini(
!newData.getKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getKwhSdBlnIni())
: null);
ss309.setKvarh_sd_bln_ini(
!newData.getKvarhSdBlnIni().equals("null")
? new BigDecimal(newData.getKvarhSdBlnIni())
: null);
ss309.setR_beban_sd_bln_ini(
!newData.getBBebanSdBlnIni().equals("null")
? new BigDecimal(newData.getBBebanSdBlnIni())
: null);
ss309.setB_kwh_sd_bln_ini(
!newData.getBKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getBKwhSdBlnIni())
: null);
ss309.setB_kvarh_sd_bln_ini(
!newData.getBKvarhSdBlnIni().equals("null")
? new BigDecimal(newData.getBKvarhSdBlnIni())
: null);
ss309.setJumlah_sd_bln_ini(
!newData.getJumlahSdBlnIni().equals("null")
? new BigDecimal(newData.getJumlahSdBlnIni())
: null);
ss309.setRp_kwh_sd_bln_ini(
!newData.getRpKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getRpKwhSdBlnIni())
: null);
ss309.persist();
}
}
return data309;
} catch (IOException e) {
e.printStackTrace();
return null; // Or handle as needed
}
}
@GET
@Path("/sinkron")
@Transactional
public void sinkron() throws IOException, InterruptedException {
System.out.println("SINKRON DATA 309");
String thnbln = String.valueOf(LocalDate.now().getYear())
+ String.format("%02d", LocalDate.now().getMonthValue() - 1);
// string pad left 0
if (LocalDate.now().getMonthValue() == 1) {
thnbln = String.valueOf(LocalDate.now().getYear() - 1) + "12";
}
List<Ulp> ulps = Ulp.find("unit_ap2t NOT IN ('PLN.PST') OR unit_ap2t is not null").list();
for (Ulp getUlp : ulps) {
String unit = getUlp.getUnit_ap2t();
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://10.14.212.9:32184/data309/pojo?unit=" + unit +
"&thnbln=" + thnbln))
.GET()
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
// data309Service.syncronize(unit, thnbln);
}
}
@GET
@Path("/manual")
@Transactional
public void manual(@QueryParam("thnbln") String thnbln) throws IOException, InterruptedException {
List<Ulp> ulps = Ulp.find("unit_ap2t NOT IN ('PLN.PST') OR unit_ap2t is not null").list();
for (Ulp getUlp : ulps) {
String unit = getUlp.getUnit_ap2t();
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://10.14.212.9:32184/data309/pojo?unit=" + unit +
"&thnbln=" + thnbln))
.GET()
.build();
client.send(request,
HttpResponse.BodyHandlers.ofString());
// data309Service.syncronize(unit, thnbln);
}
}
@GET
@Path("/getAll")
@Transactional
public void getAll() {
String thnbln = getThnbln();
List<Ulp> ulps = Ulp.find("unit_ap2t is not null OR unit_ap2t NOT IN ('PLN.PST')").list();
for (Ulp getUlp : ulps) {
String unit = getUlp.getUnit_ap2t();
try {
String jsonString = fetchJsonData(unit, thnbln);
if (jsonString != null) {
processJsonData(jsonString);
}
} catch (IOException | InterruptedException e) {
// Log exception
}
}
}
private void processJsonData(String jsonString) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ReportData reportData = objectMapper.readValue(jsonString, ReportData.class);
if (reportData != null) {
Data309 data309 = objectMapper.readValue(reportData.getData(), Data309.class);
if (data309.getRow() != null) {
for (Row newData : data309.getRow()) {
persistSS309(newData);
}
}
}
}
private void persistSS309(Row newData) {
Ulp ulp = Ulp.find("unit_ap2t = ?1", newData.getUnitup()).firstResult();
// Create or update SS309 based on newData
SS309 ss309 = SS309.find("id_ulp = ?1 and thbllap = ?2 and no_baris = ?3",
ulp.getId(), newData.getThbllap(), newData.getNoBaris()).firstResult();
if (ss309 == null) {
ss309 = new SS309();
}
// Set properties
setSS309Properties(ss309, ulp, newData);
ss309.persist();
}
private void setSS309Properties(SS309 ss309, Ulp ulp, Row newData) {
ss309.setThbllap(!newData.getThbllap().equals("null")
? newData.getThbllap()
: null);
ss309.setJenislap(!newData.getJenislap().equals("null")
? newData.getJenislap()
: null);
ss309.setId_ulp(ulp == null ? null : ulp.getId());
ss309.setNo_baris(
!newData.getNoBaris().equals("null")
? Integer.valueOf(newData.getNoBaris())
: null);
ss309.setGoltarif(!newData.getGoltarif().equals("null")
? newData.getGoltarif()
: null);
ss309.setTarif(!newData.getTarif().equals("null") ? newData.getTarif()
: null);
ss309.setDaya_min(
!newData.getDayaMin().equals("null")
? Integer.valueOf(newData.getDayaMin())
: null);
ss309.setDaya_max(
!newData.getDayaMax().equals("null")
? Integer.valueOf(newData.getDayaMax())
: null);
ss309.setLabel(!newData.getLabel().equals("null") ? newData.getLabel()
: null);
ss309.setLabel_asterik(
!newData.getLabelAsterik().equals("null")
? newData.getLabelAsterik()
: null);
ss309.setJmldaya(
!newData.getJmldaya().equals("null")
? new BigDecimal(newData.getJmldaya())
: null);
ss309.setJmlplg(
!newData.getJmlplg().equals("null")
? new BigDecimal(newData.getJmlplg())
: null);
ss309.setJmlkwh(!newData.getJmlkwh().equals("null")
? new BigDecimal(newData.getJmlkwh())
: null);
ss309.setKwhlwbp(
!newData.getKwhlwbp().equals("null")
? new BigDecimal(newData.getKwhlwbp())
: null);
ss309.setKwhwbp(!newData.getKwhwbp().equals("null")
? new BigDecimal(newData.getKwhwbp())
: null);
ss309.setKelbkvarh(
!newData.getKelbkvarh().equals("null")
? new BigDecimal(newData.getKelbkvarh())
: null);
ss309.setRpbeban(
!newData.getRpbeban().equals("null")
? new BigDecimal(newData.getRpbeban())
: null);
ss309.setRpkwh(!newData.getRpkwh().equals("null")
? new BigDecimal(newData.getRpkwh())
: null);
ss309.setRpkvarh(
!newData.getRpkvarh().equals("null")
? new BigDecimal(newData.getRpkvarh())
: null);
ss309.setRpptl(!newData.getRpptl().equals("null")
? new BigDecimal(newData.getRpptl())
: null);
ss309.setRata_va_langganan(
!newData.getRataVaLangganan().equals("null")
? new BigDecimal(newData
.getRataVaLangganan())
: null);
ss309.setRata_kwh_langganan(
!newData.getRataKwhLangganan().equals("null")
? new BigDecimal(newData
.getRataKwhLangganan())
: null);
ss309.setRata_rp_kwh(
!newData.getRataRpKwh().equals("null")
? new BigDecimal(newData.getRataRpKwh())
: null);
ss309.setJam_nyala(
!newData.getJamNyala().equals("null")
? new BigDecimal(newData.getJamNyala())
: null);
ss309.setKwh_sd_bln_ini(
!newData.getKwhSdBlnIni().equals("null")
? new BigDecimal(newData
.getKwhSdBlnIni())
: null);
ss309.setKvarh_sd_bln_ini(
!newData.getKvarhSdBlnIni().equals("null")
? new BigDecimal(newData
.getKvarhSdBlnIni())
: null);
ss309.setR_beban_sd_bln_ini(
!newData.getBBebanSdBlnIni().equals("null")
? new BigDecimal(newData
.getBBebanSdBlnIni())
: null);
ss309.setB_kwh_sd_bln_ini(
!newData.getBKwhSdBlnIni().equals("null")
? new BigDecimal(newData
.getBKwhSdBlnIni())
: null);
ss309.setB_kvarh_sd_bln_ini(
!newData.getBKvarhSdBlnIni().equals("null")
? new BigDecimal(newData
.getBKvarhSdBlnIni())
: null);
ss309.setJumlah_sd_bln_ini(
!newData.getJumlahSdBlnIni().equals("null")
? new BigDecimal(newData
.getJumlahSdBlnIni())
: null);
ss309.setRp_kwh_sd_bln_ini(
!newData.getRpKwhSdBlnIni().equals("null")
? new BigDecimal(newData
.getRpKwhSdBlnIni())
: null);
}
private String getThnbln() {
String thnbln = String.valueOf(LocalDate.now().getYear())
+ String.format("%02d", LocalDate.now().getMonthValue() - 1);
// string pad left 0
if (LocalDate.now().getMonthValue() == 1) {
thnbln = String.valueOf(LocalDate.now().getYear() - 1) + "12";
}
return thnbln;
}
private String fetchJsonData(String unit, String thnbln) throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://10.14.212.9:32184/data309/getData?unit=" + unit + "&thnbln="
+ thnbln))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
return response.body();
}
public static String convertEntitiesToUnicode(String xmlString) {
// Replace HTML entities with their corresponding characters
String convertedXml = xmlString.replace("&", "&amp;")
.replace("<", "&lt;")
.replace(">", "&gt;")
.replace("\"", "&quot;")
.replace("'", "&apos;");
return convertedXml;
}
}

View File

@@ -0,0 +1,44 @@
package id.co.iconpln.apkt.data309.dto;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"Row"
})
public class Data309 {
@JsonProperty("Row")
private List<Row> row;
@JsonIgnore
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
@JsonProperty("Row")
public List<Row> getRow() {
return row;
}
@JsonProperty("Row")
public void setRow(List<Row> row) {
this.row = row;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}

View File

@@ -0,0 +1,18 @@
package id.co.iconpln.apkt.data309.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ReportData {
@JsonProperty("data")
private String data; // This will hold the string representation of the Row object
@JsonProperty("message")
public static String message;
@JsonProperty("status")
public static Boolean status;
}

View File

@@ -0,0 +1,14 @@
package id.co.iconpln.apkt.data309.dto;
import java.util.List;
import lombok.Data;
@Data
public class ResponseModel<T> {
private T data;
private String message;
private Boolean status;
private List<String> errors;
}

View File

@@ -0,0 +1,459 @@
package id.co.iconpln.apkt.data309.dto;
import java.util.LinkedHashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"THBLLAP",
"JENISLAP",
"UNITUPI",
"UNITAP",
"UNITUP",
"NO_BARIS",
"GOLTARIF",
"TARIF",
"DAYA_MIN",
"DAYA_MAX",
"LABEL",
"LABEL_ASTERIK",
"JMLPLG",
"JMLDAYA",
"JMLKWH",
"KWHLWBP",
"KWHWBP",
"KELBKVARH",
"RPBEBAN",
"RPKWH",
"RPKVARH",
"RPPTL",
"RATA_VA_LANGGANAN",
"RATA_KWH_LANGGANAN",
"RATA_RP_KWH",
"JAM_NYALA",
"KWH_SD_BLN_INI",
"KVARH_SD_BLN_INI",
"B_BEBAN_SD_BLN_INI",
"B_KWH_SD_BLN_INI",
"B_KVARH_SD_BLN_INI",
"JUMLAH_SD_BLN_INI",
"RP_KWH_SD_BLN_INI"
})
public class Row {
@JsonProperty("THBLLAP")
private String thbllap;
@JsonProperty("JENISLAP")
private String jenislap;
@JsonProperty("UNITUPI")
private String unitupi;
@JsonProperty("UNITAP")
private String unitap;
@JsonProperty("UNITUP")
private String unitup;
@JsonProperty("NO_BARIS")
private String noBaris;
@JsonProperty("GOLTARIF")
private String goltarif;
@JsonProperty("TARIF")
private String tarif;
@JsonProperty("DAYA_MIN")
private String dayaMin;
@JsonProperty("DAYA_MAX")
private String dayaMax;
@JsonProperty("LABEL")
private String label;
@JsonProperty("LABEL_ASTERIK")
private String labelAsterik;
@JsonProperty("JMLPLG")
private String jmlplg;
@JsonProperty("JMLDAYA")
private String jmldaya;
@JsonProperty("JMLKWH")
private String jmlkwh;
@JsonProperty("KWHLWBP")
private String kwhlwbp;
@JsonProperty("KWHWBP")
private String kwhwbp;
@JsonProperty("KELBKVARH")
private String kelbkvarh;
@JsonProperty("RPBEBAN")
private String rpbeban;
@JsonProperty("RPKWH")
private String rpkwh;
@JsonProperty("RPKVARH")
private String rpkvarh;
@JsonProperty("RPPTL")
private String rpptl;
@JsonProperty("RATA_VA_LANGGANAN")
private String rataVaLangganan;
@JsonProperty("RATA_KWH_LANGGANAN")
private String rataKwhLangganan;
@JsonProperty("RATA_RP_KWH")
private String rataRpKwh;
@JsonProperty("JAM_NYALA")
private String jamNyala;
@JsonProperty("KWH_SD_BLN_INI")
private String kwhSdBlnIni;
@JsonProperty("KVARH_SD_BLN_INI")
private String kvarhSdBlnIni;
@JsonProperty("B_BEBAN_SD_BLN_INI")
private String bBebanSdBlnIni;
@JsonProperty("B_KWH_SD_BLN_INI")
private String bKwhSdBlnIni;
@JsonProperty("B_KVARH_SD_BLN_INI")
private String bKvarhSdBlnIni;
@JsonProperty("JUMLAH_SD_BLN_INI")
private String jumlahSdBlnIni;
@JsonProperty("RP_KWH_SD_BLN_INI")
private String rpKwhSdBlnIni;
@JsonIgnore
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
@JsonProperty("THBLLAP")
public String getThbllap() {
return thbllap;
}
@JsonProperty("THBLLAP")
public void setThbllap(String thbllap) {
this.thbllap = thbllap;
}
@JsonProperty("JENISLAP")
public String getJenislap() {
return jenislap;
}
@JsonProperty("JENISLAP")
public void setJenislap(String jenislap) {
this.jenislap = jenislap;
}
@JsonProperty("UNITUPI")
public String getUnitupi() {
return unitupi;
}
@JsonProperty("UNITUPI")
public void setUnitupi(String unitupi) {
this.unitupi = unitupi;
}
@JsonProperty("UNITAP")
public String getUnitap() {
return unitap;
}
@JsonProperty("UNITAP")
public void setUnitap(String unitap) {
this.unitap = unitap;
}
@JsonProperty("UNITUP")
public String getUnitup() {
return unitup;
}
@JsonProperty("UNITUP")
public void setUnitup(String unitup) {
this.unitup = unitup;
}
@JsonProperty("NO_BARIS")
public String getNoBaris() {
return noBaris;
}
@JsonProperty("NO_BARIS")
public void setNoBaris(String noBaris) {
this.noBaris = noBaris;
}
@JsonProperty("GOLTARIF")
public String getGoltarif() {
return goltarif;
}
@JsonProperty("GOLTARIF")
public void setGoltarif(String goltarif) {
this.goltarif = goltarif;
}
@JsonProperty("TARIF")
public String getTarif() {
return tarif;
}
@JsonProperty("TARIF")
public void setTarif(String tarif) {
this.tarif = tarif;
}
@JsonProperty("DAYA_MIN")
public String getDayaMin() {
return dayaMin;
}
@JsonProperty("DAYA_MIN")
public void setDayaMin(String dayaMin) {
this.dayaMin = dayaMin;
}
@JsonProperty("DAYA_MAX")
public String getDayaMax() {
return dayaMax;
}
@JsonProperty("DAYA_MAX")
public void setDayaMax(String dayaMax) {
this.dayaMax = dayaMax;
}
@JsonProperty("LABEL")
public String getLabel() {
return label;
}
@JsonProperty("LABEL")
public void setLabel(String label) {
this.label = label;
}
@JsonProperty("LABEL_ASTERIK")
public String getLabelAsterik() {
return labelAsterik;
}
@JsonProperty("LABEL_ASTERIK")
public void setLabelAsterik(String labelAsterik) {
this.labelAsterik = labelAsterik;
}
@JsonProperty("JMLPLG")
public String getJmlplg() {
return jmlplg;
}
@JsonProperty("JMLPLG")
public void setJmlplg(String jmlplg) {
this.jmlplg = jmlplg;
}
@JsonProperty("JMLDAYA")
public String getJmldaya() {
return jmldaya;
}
@JsonProperty("JMLDAYA")
public void setJmldaya(String jmldaya) {
this.jmldaya = jmldaya;
}
@JsonProperty("JMLKWH")
public String getJmlkwh() {
return jmlkwh;
}
@JsonProperty("JMLKWH")
public void setJmlkwh(String jmlkwh) {
this.jmlkwh = jmlkwh;
}
@JsonProperty("KWHLWBP")
public String getKwhlwbp() {
return kwhlwbp;
}
@JsonProperty("KWHLWBP")
public void setKwhlwbp(String kwhlwbp) {
this.kwhlwbp = kwhlwbp;
}
@JsonProperty("KWHWBP")
public String getKwhwbp() {
return kwhwbp;
}
@JsonProperty("KWHWBP")
public void setKwhwbp(String kwhwbp) {
this.kwhwbp = kwhwbp;
}
@JsonProperty("KELBKVARH")
public String getKelbkvarh() {
return kelbkvarh;
}
@JsonProperty("KELBKVARH")
public void setKelbkvarh(String kelbkvarh) {
this.kelbkvarh = kelbkvarh;
}
@JsonProperty("RPBEBAN")
public String getRpbeban() {
return rpbeban;
}
@JsonProperty("RPBEBAN")
public void setRpbeban(String rpbeban) {
this.rpbeban = rpbeban;
}
@JsonProperty("RPKWH")
public String getRpkwh() {
return rpkwh;
}
@JsonProperty("RPKWH")
public void setRpkwh(String rpkwh) {
this.rpkwh = rpkwh;
}
@JsonProperty("RPKVARH")
public String getRpkvarh() {
return rpkvarh;
}
@JsonProperty("RPKVARH")
public void setRpkvarh(String rpkvarh) {
this.rpkvarh = rpkvarh;
}
@JsonProperty("RPPTL")
public String getRpptl() {
return rpptl;
}
@JsonProperty("RPPTL")
public void setRpptl(String rpptl) {
this.rpptl = rpptl;
}
@JsonProperty("RATA_VA_LANGGANAN")
public String getRataVaLangganan() {
return rataVaLangganan;
}
@JsonProperty("RATA_VA_LANGGANAN")
public void setRataVaLangganan(String rataVaLangganan) {
this.rataVaLangganan = rataVaLangganan;
}
@JsonProperty("RATA_KWH_LANGGANAN")
public String getRataKwhLangganan() {
return rataKwhLangganan;
}
@JsonProperty("RATA_KWH_LANGGANAN")
public void setRataKwhLangganan(String rataKwhLangganan) {
this.rataKwhLangganan = rataKwhLangganan;
}
@JsonProperty("RATA_RP_KWH")
public String getRataRpKwh() {
return rataRpKwh;
}
@JsonProperty("RATA_RP_KWH")
public void setRataRpKwh(String rataRpKwh) {
this.rataRpKwh = rataRpKwh;
}
@JsonProperty("JAM_NYALA")
public String getJamNyala() {
return jamNyala;
}
@JsonProperty("JAM_NYALA")
public void setJamNyala(String jamNyala) {
this.jamNyala = jamNyala;
}
@JsonProperty("KWH_SD_BLN_INI")
public String getKwhSdBlnIni() {
return kwhSdBlnIni;
}
@JsonProperty("KWH_SD_BLN_INI")
public void setKwhSdBlnIni(String kwhSdBlnIni) {
this.kwhSdBlnIni = kwhSdBlnIni;
}
@JsonProperty("KVARH_SD_BLN_INI")
public String getKvarhSdBlnIni() {
return kvarhSdBlnIni;
}
@JsonProperty("KVARH_SD_BLN_INI")
public void setKvarhSdBlnIni(String kvarhSdBlnIni) {
this.kvarhSdBlnIni = kvarhSdBlnIni;
}
@JsonProperty("B_BEBAN_SD_BLN_INI")
public String getBBebanSdBlnIni() {
return bBebanSdBlnIni;
}
@JsonProperty("B_BEBAN_SD_BLN_INI")
public void setBBebanSdBlnIni(String bBebanSdBlnIni) {
this.bBebanSdBlnIni = bBebanSdBlnIni;
}
@JsonProperty("B_KWH_SD_BLN_INI")
public String getBKwhSdBlnIni() {
return bKwhSdBlnIni;
}
@JsonProperty("B_KWH_SD_BLN_INI")
public void setBKwhSdBlnIni(String bKwhSdBlnIni) {
this.bKwhSdBlnIni = bKwhSdBlnIni;
}
@JsonProperty("B_KVARH_SD_BLN_INI")
public String getBKvarhSdBlnIni() {
return bKvarhSdBlnIni;
}
@JsonProperty("B_KVARH_SD_BLN_INI")
public void setBKvarhSdBlnIni(String bKvarhSdBlnIni) {
this.bKvarhSdBlnIni = bKvarhSdBlnIni;
}
@JsonProperty("JUMLAH_SD_BLN_INI")
public String getJumlahSdBlnIni() {
return jumlahSdBlnIni;
}
@JsonProperty("JUMLAH_SD_BLN_INI")
public void setJumlahSdBlnIni(String jumlahSdBlnIni) {
this.jumlahSdBlnIni = jumlahSdBlnIni;
}
@JsonProperty("RP_KWH_SD_BLN_INI")
public String getRpKwhSdBlnIni() {
return rpKwhSdBlnIni;
}
@JsonProperty("RP_KWH_SD_BLN_INI")
public void setRpKwhSdBlnIni(String rpKwhSdBlnIni) {
this.rpKwhSdBlnIni = rpKwhSdBlnIni;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}

View File

@@ -0,0 +1,77 @@
package id.co.iconpln.apkt.data309.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RowNew {
@JsonProperty("THBLLAP")
public String thbllap;
@JsonProperty("JENISLAP")
public String jenislap;
@JsonProperty("UNITUPI")
public String unitupi;
@JsonProperty("UNITAP")
public String unitap;
@JsonProperty("UNITUP")
public String unitup;
@JsonProperty("NO_BARIS")
public String no_baris;
@JsonProperty("GOLTARIF")
public String goltarif;
@JsonProperty("TARIF")
public String tarif;
@JsonProperty("DAYA_MIN")
public String daya_min;
@JsonProperty("DAYA_MAX")
public String daya_max;
@JsonProperty("LABEL")
public String label;
@JsonProperty("LABEL_ASTERIK")
public String label_asterik;
@JsonProperty("JMLPLG")
public String jmlplg;
@JsonProperty("JMLDAYA")
public String jmldaya;
@JsonProperty("JMLKWH")
public String jmlkwh;
@JsonProperty("KWHLWBP")
public String kwhlwbp;
@JsonProperty("KWHWBP")
public String kwhwbp;
@JsonProperty("KELBKVARH")
public String kelbkvarh;
@JsonProperty("RPBEBAN")
public String rpbeban;
@JsonProperty("RPKWH")
public String rpkwh;
@JsonProperty("RPKVARH")
public String rpkvarh;
@JsonProperty("RPPTL")
public String rpptl;
@JsonProperty("RATA_VA_LANGGANAN")
public String rata_va_langganan;
@JsonProperty("RATA_KWH_LANGGANAN")
public String rata_kwh_langganan;
@JsonProperty("RATA_RP_KWH")
public String rata_rp_kwh;
@JsonProperty("JAM_NYALA")
public String jam_nyala;
@JsonProperty("KWH_SD_BLN_INI")
public String kwh_sd_bln_ini;
@JsonProperty("KVARH_SD_BLN_INI")
public String kvarh_sd_bln_ini;
@JsonProperty("B_BEBAN_SD_BLN_INI")
public String b_beban_sd_bln_ini;
@JsonProperty("B_KWH_SD_BLN_INI")
public String b_kwh_sd_bln_ini;
@JsonProperty("B_KVARH_SD_BLN_INI")
public String b_kvarh_sd_bln_ini;
@JsonProperty("JUMLAH_SD_BLN_INI")
public String jumlah_sd_bln_ini;
@JsonProperty("RP_KWH_SD_BLN_INI")
public String rp_kwh_sd_bln_ini;
}

View File

@@ -0,0 +1,50 @@
package id.co.iconpln.apkt.data309.entity;
import java.math.BigDecimal;
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.*;
@Entity
@Setter
@Getter
@RequiredArgsConstructor
@Table(name = "ss_309", schema = "apkt_transactional")
public class SS309 extends PanacheEntityBase {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String thbllap;
private String jenislap;
private Integer id_ulp;
private Integer no_baris;
private String goltarif;
private String tarif;
private Integer daya_min;
private Integer daya_max;
private String label;
private String label_asterik;
private BigDecimal jmlplg;
private BigDecimal jmldaya;
private BigDecimal jmlkwh;
private BigDecimal kwhlwbp;
private BigDecimal kwhwbp;
private BigDecimal kelbkvarh;
private BigDecimal rpbeban;
private BigDecimal rpkwh;
private BigDecimal rpkvarh;
private BigDecimal rpptl;
private BigDecimal rata_va_langganan;
private BigDecimal rata_kwh_langganan;
private BigDecimal rata_rp_kwh;
private BigDecimal jam_nyala;
private BigDecimal kwh_sd_bln_ini;
private BigDecimal kvarh_sd_bln_ini;
private BigDecimal r_beban_sd_bln_ini;
private BigDecimal b_kwh_sd_bln_ini;
private BigDecimal b_kvarh_sd_bln_ini;
private BigDecimal jumlah_sd_bln_ini;
private BigDecimal rp_kwh_sd_bln_ini;
}

View File

@@ -0,0 +1,24 @@
package id.co.iconpln.apkt.data309.entity;
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.*;
@Entity
@Setter
@Getter
@RequiredArgsConstructor
@Table(name = "master_ulp", schema = "apkt_transactional")
public class Ulp extends PanacheEntityBase {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "nama")
private String nama;
@Column(name = "unit_ap2t")
private String unit_ap2t;
}

View File

@@ -0,0 +1,38 @@
package id.co.iconpln.apkt.data309.schedule;
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;
@ApplicationScoped
public class MyScheduledBean {
// every month at day 7 on 23.59
@Scheduled(cron = "0 59 23 7 * ?")
void scheduleCron() throws Exception {
HttpClient client = HttpClient.newHttpClient();
// Username and password for basic authentication
// String username = "apkt";
// String password = "apkt@54321";
// Combine username and password for basic authentication
// String auth = username + ":" + password;
// Encode the combined string with Base64
// String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
// Add the Authorization header with Basic auth to the request
HttpRequest request = HttpRequest.newBuilder()
// .header("Authorization", "Basic " + encodedAuth)
.uri(URI.create("http://10.14.212.9:32184/data309/sinkron"))
.GET()
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Scheduled task executed successfully");
}
}

View File

@@ -0,0 +1,252 @@
package id.co.iconpln.apkt.data309.service;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import id.co.iconpln.apkt.data309.dto.Data309;
import id.co.iconpln.apkt.data309.dto.Row;
import id.co.iconpln.apkt.data309.entity.SS309;
import id.co.iconpln.apkt.data309.entity.Ulp;
import id.co.iconpln.apkt.data309.utils.XmlToJsonConverter;
import jakarta.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class Data309Service {
public void syncronize(String unit, String thnbln) throws IOException, InterruptedException {
// URL of the SOAP service
URL url = new URL("http://10.72.35.15:7076/wsIntegPDPJ/WsIntegSimDisService");
// Open connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "text/xml");
connection.setDoOutput(true);
String xmlRequest = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.iconpln.com/\">\n"
+
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <ws:getData309>\n" +
" <unit>" + unit + "</unit>\n" +
" <thblrek>" + thnbln + "</thblrek>\n" +
" </ws:getData309>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try (OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream())) {
writer.write(xmlRequest);
writer.flush();
}
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream()))) {
StringBuilder buildNewData = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
buildNewData.append(line);
}
ObjectMapper objectMapper = new ObjectMapper();
String json = XmlToJsonConverter.convertXmlToJson(buildNewData.toString());
JsonNode rootNode = objectMapper.readTree(json);
// Get the 'item' array from JSON
JsonNode itemNode = rootNode.path("Body")
.path("getData309Response")
.path("return")
.path("item");
// Process each item
Map<String, Object> obj = new HashMap<>();
Integer i = 0;
for (JsonNode node : itemNode) {
String itemValue = node.asText();
// Check if the item is XML
if (itemValue.startsWith("<?xml")) {
// Process XML content separately
// You may parse this XML or handle it accordingly
String xmlContent = itemValue;
i++;
obj.put(i.toString(), XmlToJsonConverter
.convertXmlToJson(xmlContent));
}
}
String jsonResult = objectMapper.writeValueAsString(obj);
// Create ObjectMapper instance
ObjectMapper mapperFromObjectNode = new ObjectMapper();
// Parse the JSON string into a JsonNode
JsonNode jsonNode = mapperFromObjectNode.readTree(jsonResult);
// Retrieve the nested JSON string and remove unnecessary backslashes
String cleanedJsonString = jsonNode.get("1").asText();
// Parse the cleaned JSON string back into a JsonNode to ensure it's valid
JsonNode cleanedJsonNode = objectMapper.readTree(cleanedJsonString);
// Pretty print the cleaned JSON
String prettyCleanedJsonString = objectMapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(cleanedJsonNode);
ObjectMapper mapperToDatabase = new ObjectMapper();
mapperToDatabase.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapperToDatabase.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
mapperToDatabase.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
mapperToDatabase.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
mapperToDatabase.configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true);
mapperToDatabase.configure(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY,
true);
Data309 data309 = mapperToDatabase.readValue(prettyCleanedJsonString.replace("\n", ""),
Data309.class);
if (data309.getRow() != null) {
Integer u = 1;
Integer in = 1;
for (Row newData : data309.getRow()) {
Ulp ulp = Ulp.find("unit_ap2t = ?1", newData.getUnitup()).firstResult();
SS309 ss309 = SS309
.find("id_ulp = ?1 and thbllap = ?2 and no_baris = ?3",
ulp.getId(),
newData.getThbllap(), newData.getNoBaris())
.firstResult();
String upsert;
if (ss309 == null) {
ss309 = new SS309();
upsert = in++ + " di tambahkan";
} else {
upsert = u++ + " di update";
}
ss309.setThbllap(!newData.getThbllap().equals("null") ? newData.getThbllap()
: null);
ss309.setJenislap(!newData.getJenislap().equals("null") ? newData.getJenislap()
: null);
ss309.setId_ulp(ulp == null ? null : ulp.getId());
ss309.setNo_baris(
!newData.getNoBaris().equals("null")
? Integer.valueOf(newData.getNoBaris())
: null);
ss309.setGoltarif(!newData.getGoltarif().equals("null") ? newData.getGoltarif()
: null);
ss309.setTarif(!newData.getTarif().equals("null") ? newData.getTarif() : null);
ss309.setDaya_min(
!newData.getDayaMin().equals("null")
? Integer.valueOf(newData.getDayaMin())
: null);
ss309.setDaya_max(
!newData.getDayaMax().equals("null")
? Integer.valueOf(newData.getDayaMax())
: null);
ss309.setLabel(!newData.getLabel().equals("null") ? newData.getLabel() : null);
ss309.setLabel_asterik(
!newData.getLabelAsterik().equals("null")
? newData.getLabelAsterik()
: null);
ss309.setJmldaya(
!newData.getJmldaya().equals("null")
? new BigDecimal(newData.getJmldaya())
: null);
ss309.setJmlplg(
!newData.getJmlplg().equals("null")
? new BigDecimal(newData.getJmlplg())
: BigDecimal.ZERO);
ss309.setJmlkwh(!newData.getJmlkwh().equals("null")
? new BigDecimal(newData.getJmlkwh())
: null);
ss309.setKwhlwbp(
!newData.getKwhlwbp().equals("null")
? new BigDecimal(newData.getKwhlwbp())
: null);
ss309.setKwhwbp(!newData.getKwhwbp().equals("null")
? new BigDecimal(newData.getKwhwbp())
: null);
ss309.setKelbkvarh(
!newData.getKelbkvarh().equals("null")
? new BigDecimal(newData.getKelbkvarh())
: null);
ss309.setRpbeban(
!newData.getRpbeban().equals("null")
? new BigDecimal(newData.getRpbeban())
: null);
ss309.setRpkwh(!newData.getRpkwh().equals("null")
? new BigDecimal(newData.getRpkwh())
: null);
ss309.setRpkvarh(
!newData.getRpkvarh().equals("null")
? new BigDecimal(newData.getRpkvarh())
: null);
ss309.setRpptl(!newData.getRpptl().equals("null")
? new BigDecimal(newData.getRpptl())
: null);
ss309.setRata_va_langganan(
!newData.getRataVaLangganan().equals("null")
? new BigDecimal(newData.getRataVaLangganan())
: null);
ss309.setRata_kwh_langganan(
!newData.getRataKwhLangganan().equals("null")
? new BigDecimal(newData.getRataKwhLangganan())
: null);
ss309.setRata_rp_kwh(
!newData.getRataRpKwh().equals("null")
? new BigDecimal(newData.getRataRpKwh())
: null);
ss309.setJam_nyala(
!newData.getJamNyala().equals("null")
? new BigDecimal(newData.getJamNyala())
: null);
ss309.setKwh_sd_bln_ini(
!newData.getKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getKwhSdBlnIni())
: null);
ss309.setKvarh_sd_bln_ini(
!newData.getKvarhSdBlnIni().equals("null")
? new BigDecimal(newData.getKvarhSdBlnIni())
: null);
ss309.setR_beban_sd_bln_ini(
!newData.getBBebanSdBlnIni().equals("null")
? new BigDecimal(newData.getBBebanSdBlnIni())
: null);
ss309.setB_kwh_sd_bln_ini(
!newData.getBKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getBKwhSdBlnIni())
: null);
ss309.setB_kvarh_sd_bln_ini(
!newData.getBKvarhSdBlnIni().equals("null")
? new BigDecimal(newData.getBKvarhSdBlnIni())
: null);
ss309.setJumlah_sd_bln_ini(
!newData.getJumlahSdBlnIni().equals("null")
? new BigDecimal(newData.getJumlahSdBlnIni())
: null);
ss309.setRp_kwh_sd_bln_ini(
!newData.getRpKwhSdBlnIni().equals("null")
? new BigDecimal(newData.getRpKwhSdBlnIni())
: null);
ss309.persist();
System.out.println(upsert);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,21 @@
package id.co.iconpln.apkt.data309.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
public class XmlToJsonConverter {
public static String convertXmlToJson(String xmlString) throws Exception {
// Create an XML mapper
XmlMapper xmlMapper = new XmlMapper();
// Read XML string into JSON
JsonNode jsonNode = xmlMapper.readTree(xmlString.getBytes());
// Create an Object Mapper
ObjectMapper objectMapper = new ObjectMapper();
// Convert JSON node to JSON string
return objectMapper.writeValueAsString(jsonNode);
}
}

View File

@@ -0,0 +1,2 @@
Manifest-Version: 1.0
Main-Class: id.co.iconpln.apkt.data309

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,48 @@
# HTTP Configuration
# quarkus.http.cors.origins=http://10.68.35.112:8001,http://10.1.15.215:32167
quarkus.http.cors.origins=*
quarkus.http.cors=true
# quarkus.http.cors.access-control-allow-credentials=false
quarkus.http.host=0.0.0.0
quarkus.http.port=32184
quarkus.dev-ui.cors.enabled=true
quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQLDialect
quarkus.hibernate-orm.statistics=true
# quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/ap2t?stringtype=unspecified
# quarkus.datasource.db-kind=postgresql
# quarkus.datasource.username=postgres
# quarkus.datasource.password=postgres
quarkus.scheduler.enabled=true
quarkus.scheduler.concurrent-execution=true
quarkus.datasource.jdbc.url=jdbc:postgresql://10.14.212.9:32109/apkt?stringtype=unspecified
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=clusterapkt
quarkus.datasource.password=@/<i<UBg>BHDd,ex/Ando<?1
# log info
# quarkus.security.basic.enabled=false
quarkus.auth.password =apkt@54321
quarkus.auth.username=apkt
# quarkus.smallrye-openapi.path=/swagger
# Enable basic authentication
# quarkus.security.auth.basic.enabled=false
# In-memory identity provider configuration
# quarkus.security.identity-provider.in-memory.enabled=false
# quarkus.security.identity-provider.in-memory.users.user1.password=password1
# quarkus.security.identity-provider.in-memory.users.user1.roles=USER
# Enable OpenAPI
# quarkus.smallrye-openapi.path=/openapi
# Configure info
# quarkus.smallrye-openapi.info.title=My API
# quarkus.smallrye-openapi.info.version=1.0.0
# quarkus.smallrye-openapi.info.description=API documentation for my application.
# Define security scheme
# quarkus.smallrye-openapi.security.basic.enabled=true

46
ss309.sql Normal file
View File

@@ -0,0 +1,46 @@
-- apkt_transactional.ss_309 definition
-- Drop table
-- DROP TABLE apkt_transactional.ss_309;
CREATE TABLE apkt_transactional.ss_309 (
id bigserial NOT NULL,
thbllap varchar NULL,
jenislap varchar NULL,
id_ulp bigint NULL,
no_baris bigint NULL,
goltarif varchar NULL,
tarif varchar NULL,
daya_min bigint NULL,
daya_max bigint NULL,
"label" varchar NULL,
label_asterik varchar NULL,
jmlplg bigint NULL,
jmldaya bigint NULL,
jmlkwh bigint NULL,
kwhlwbp bigint NULL,
kwhwbp bigint NULL,
kelbkvarh bigint NULL,
rpbeban bigint NULL,
rpkwh bigint NULL,
rpkvarh bigint NULL,
rpptl bigint NULL,
rata_va_langganan bigint NULL,
rata_kwh_langganan bigint NULL,
rata_rp_kwh bigint NULL,
jam_nyala bigint NULL,
kwh_sd_bln_ini bigint NULL,
kvarh_sd_bln_ini bigint NULL,
r_beban_sd_bln_ini bigint NULL,
b_kwh_sd_bln_ini bigint NULL,
b_kvarh_sd_bln_ini bigint NULL,
jumlah_sd_bln_ini bigint NULL,
rp_kwh_sd_bln_ini bigint NULL,
CONSTRAINT ss_309_pkey PRIMARY KEY (id)
);
-- apkt_transactional.ss_309 foreign keys
ALTER TABLE apkt_transactional.ss_309 ADD CONSTRAINT ulp FOREIGN KEY (id_ulp) REFERENCES apkt_transactional.master_ulp(id);