commit 3e97011f66a22f749c99a3b2d0b7c71eadaa19d9 Author: tias Date: Sat Jun 15 16:59:12 2024 +0700 inisialisasi diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..94810d0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* +!target/quarkus-app/* \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8c7863e --- /dev/null +++ b/.gitignore @@ -0,0 +1,43 @@ +#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/ diff --git a/.mvn/wrapper/.gitignore b/.mvn/wrapper/.gitignore new file mode 100644 index 0000000..e72f5e8 --- /dev/null +++ b/.mvn/wrapper/.gitignore @@ -0,0 +1 @@ +maven-wrapper.jar diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..84d1e60 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,98 @@ +/* + * 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.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +public final class MavenWrapperDownloader +{ + private static final String WRAPPER_VERSION = "3.2.0"; + + 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 = new URL( args[0] ); + 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 ); + } + } ); + } + try ( InputStream inStream = wrapperUrl.openStream() ) + { + Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING ); + } + log( " - Downloader complete" ); + } + + private static void log( String msg ) + { + if ( VERBOSE ) + { + System.out.println( msg ); + } + } + +} diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..346d645 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# 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. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1fde56 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# api-keluhan-mobile + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: +```shell script +./mvnw compile quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. + +## Packaging and running the application + +The application can be packaged using: +```shell script +./mvnw package +``` +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: +```shell script +./mvnw package -Dquarkus.package.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: +```shell script +./mvnw package -Dnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: +```shell script +./mvnw package -Dnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/api-keluhan-mobile-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling. + +## Related Guides + +- RESTEasy Reactive ([guide](https://quarkus.io/guides/resteasy-reactive)): A Jakarta REST implementation utilizing build time processing and Vert.x. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it. +- Reactive PostgreSQL client ([guide](https://quarkus.io/guides/reactive-sql-clients)): Connect to the PostgreSQL database using the reactive pattern + +## Provided Code + +### RESTEasy Reactive + +Easily start your Reactive RESTful Web Services + +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..cde9183 --- /dev/null +++ b/build.sh @@ -0,0 +1,6 @@ +echo "-----------------------------------" +echo "Build and deploy api chempion version : $1" +echo "-----------------------------------" +./mvnw package +docker build -f src/main/docker/Dockerfile.jvm -t tias333/api-chempion:v.0.0.$1 . +docker push tias333/api-chempion:v.0.0.$1 \ No newline at end of file diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..8d937f4 --- /dev/null +++ b/mvnw @@ -0,0 +1,308 @@ +#!/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.2.0 +# +# 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."; 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." +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" + 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.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.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." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + 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 "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..c4586b5 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,205 @@ +@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.2.0 +@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. +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. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +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. +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.2.0/maven-wrapper-3.2.0.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.2.0/maven-wrapper-3.2.0.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 "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output '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% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..5673de8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,181 @@ + + + 4.0.0 + org.sadigit + api-keluhan-mobile + 1.0.0-SNAPSHOT + + + 3.12.1 + 21 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.8.4 + true + 3.2.5 + 2.17.0 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-hibernate-orm-panache + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + org.projectlombok + lombok + 1.18.32 + provided + + + io.quarkus + quarkus-hibernate-validator + + + org.projectlombok + lombok + 1.18.30 + provided + + + org.apache.commons + commons-lang3 + + + org.hibernate + hibernate-spatial + 6.4.2.Final + + + io.quarkus + quarkus-resteasy-jsonb + + + com.fasterxml.jackson.core + * + + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + native + + + + false + native + + + + diff --git a/src/main/docker/Dockerfile.jvm b/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000..3d65e85 --- /dev/null +++ b/src/main/docker/Dockerfile.jvm @@ -0,0 +1,97 @@ +#### +# 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 +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/api-keluhan-mobile-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/api-keluhan-mobile-jvm +# +# 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/api-keluhan-mobile-jvm +# +# 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.18 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +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" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/src/main/docker/Dockerfile.legacy-jar b/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000..2a1ab76 --- /dev/null +++ b/src/main/docker/Dockerfile.legacy-jar @@ -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.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/api-keluhan-mobile-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/api-keluhan-mobile-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/api-keluhan-mobile-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.18 + +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" ] diff --git a/src/main/docker/Dockerfile.native b/src/main/docker/Dockerfile.native new file mode 100644 index 0000000..313351c --- /dev/null +++ b/src/main/docker/Dockerfile.native @@ -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/api-keluhan-mobile . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/api-keluhan-mobile +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 +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"] diff --git a/src/main/docker/Dockerfile.native-micro b/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000..52e41fb --- /dev/null +++ b/src/main/docker/Dockerfile.native-micro @@ -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/api-keluhan-mobile . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/api-keluhan-mobile +# +### +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"] diff --git a/src/main/java/org/sadigit/Interceptor/AuthenticationInterceptor.java b/src/main/java/org/sadigit/Interceptor/AuthenticationInterceptor.java new file mode 100644 index 0000000..8f6cf6d --- /dev/null +++ b/src/main/java/org/sadigit/Interceptor/AuthenticationInterceptor.java @@ -0,0 +1,53 @@ +// package org.sadigit.Interceptor; +// import lombok.NonNull; +// import lombok.extern.slf4j.Slf4j; +// import org.apache.commons.codec.binary.Base64; +// import org.springframework.http.HttpHeaders; +// import org.springframework.http.HttpRequest; +// import org.springframework.http.client.ClientHttpRequestExecution; +// import org.springframework.http.client.ClientHttpRequestInterceptor; +// import org.springframework.http.client.ClientHttpResponse; + +// import java.io.IOException; +// import java.nio.charset.Charset; + +// @Slf4j +// public class AuthenticationInterceptor implements +// ClientHttpRequestInterceptor { + +// private String auth; +// // private String content; + +// public AuthenticationInterceptor(String auth) { +// super(); +// this.auth = auth; +// // this.content = content; +// } + +// public ClientHttpResponse intercept(@NonNull HttpRequest request, +// @NonNull byte[] body, +// @NonNull ClientHttpRequestExecution execution) throws IOException { +// HttpHeaders headers = request.getHeaders(); +// String authorize = auth; +// String urlEncoded = +// Base64.encodeBase64String(authorize.getBytes(Charset.forName("utf-8"))); +// String authHeader = authorize; +// if (auth != null) { +// headers.add("MAXAUTH", authHeader); +// } + +// // headers.setContentType(MediaType.APPLICATION_JSON); +// headers.add("Content-Type", "application/x-www-form-urlencoded"); +// headers.add("Cache-Control", "no-cache"); + +// log.debug("HEADER >> {}", headers.toString()); +// log.debug("BODY >> {}", new String(body)); +// log.info("request method: {}, request URI: {}, request headers: {}, request +// body: {}", +// request.getMethod(), request.getURI(), request.getHeaders(), new +// String(body)); + +// return execution.execute(request, body); +// } + +// } diff --git a/src/main/java/org/sadigit/adapter/GeometryAdapter.java b/src/main/java/org/sadigit/adapter/GeometryAdapter.java new file mode 100644 index 0000000..10478ff --- /dev/null +++ b/src/main/java/org/sadigit/adapter/GeometryAdapter.java @@ -0,0 +1,35 @@ +package org.sadigit.adapter; + +import jakarta.json.bind.adapter.JsonbAdapter; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKTReader; +import org.locationtech.jts.io.WKTWriter; + +@SuppressWarnings("unused") +public class GeometryAdapter implements JsonbAdapter { + + private static final int DEFAULT_SRID = 4326; // Default SRID + + @Override + public String adaptToJson(Geometry geometry) throws Exception { + if (geometry == null) { + return null; + } + WKTWriter writer = new WKTWriter(); + return writer.write(geometry); + } + + @Override + public Geometry adaptFromJson(String json) throws Exception { + if (json == null || json.isEmpty()) { + return null; + } + WKTReader reader = new WKTReader(); + try { + return reader.read(json); + } catch (ParseException e) { + throw new IllegalArgumentException("Invalid WKT string: " + json, e); + } + } +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/boundary/v1/endpoint/IntegKeluhanMobileResource.java b/src/main/java/org/sadigit/boundary/v1/endpoint/IntegKeluhanMobileResource.java new file mode 100644 index 0000000..c2e863d --- /dev/null +++ b/src/main/java/org/sadigit/boundary/v1/endpoint/IntegKeluhanMobileResource.java @@ -0,0 +1,669 @@ +package org.sadigit.boundary.v1.endpoint; + +import io.smallrye.mutiny.Uni; +import jakarta.inject.Inject; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.io.UnsupportedEncodingException; +import org.sadigit.model.ResponseModelIntegKeluhanMobile; +import org.sadigit.model.ResponseModelIntegKeluhanMobileTanpaOutData; +import org.sadigit.service.api.v1.GetDataPerUnitService; +import org.sadigit.service.api.v1.IssueTypeService; +import org.sadigit.service.api.v1.LoginService; +import org.sadigit.service.api.v1.PenggunaService; +import org.sadigit.service.api.v1.UnitService; +import org.sadigit.util.AppException; + +@Path("api/apkt/integkeluhanmobile") +@Produces(MediaType.APPLICATION_JSON) +@Slf4j + +@RequiredArgsConstructor + +public class IntegKeluhanMobileResource { + + @Inject + private final LoginService loginService; + private final PenggunaService penggunaService; + private final UnitService unitService; + private final IssueTypeService issueTypeService; + private final GetDataPerUnitService getDataPerUnitService; + + @POST + @Path("/p00_login") + public Response p00_login( + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_PASSWORD") String IN_PASSWORD) throws UnsupportedEncodingException { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + + // replace space with + + IN_USER = IN_USER.replace(" ", "+"); + IN_PASSWORD = IN_PASSWORD.replace(" ", "+"); + + try { + mapResponse.setData(loginService.auth(IN_USER, IN_PASSWORD)); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("0"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P00_GET_USER") + public Response P00_GET_USER( + @QueryParam(value = "IN_UNITID") Long IN_UNITID, + @QueryParam(value = "IN_POSITIONID") Long IN_POSITIONID) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + + try { + mapResponse.setData(penggunaService.findDataPengguna(IN_UNITID, IN_POSITIONID)); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("0"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/p01_getdataperunit") + public Response p01_getdataperunit( + @QueryParam(value = "IN_UNIT") Long IN_UNIT, + @QueryParam(value = "IN_TGLAWAL") String IN_TGLAWAL, + @QueryParam(value = "IN_TGLAKHIR") String IN_TGLAKHIR) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + try { + mapResponse.setData(getDataPerUnitService.getDataPerUnit(IN_UNIT, IN_TGLAWAL, IN_TGLAKHIR)); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("0"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/p02_getdataperpetugas") + public Response p02_getdataperpetugas( + @QueryParam(value = "IN_UNIT") String IN_UNIT, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_TGLAWAL") String IN_TGLAWAL, + @QueryParam(value = "IN_TGLAKHIR") String IN_TGLAKHIR) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_UNIT", IN_UNIT); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_TGLAWAL", IN_TGLAWAL); + mapParam.put("IN_TGLAKHIR", IN_TGLAKHIR); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p02_getdataperpetugas(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/p03_getpenjelasanbidang") + public Response p03_getpenjelasanbidang( + @QueryParam(value = "IN_LAPORAN") String IN_LAPORAN) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_LAPORAN", IN_LAPORAN); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p03_getpenjelasanbidang(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/p04_setpetugasbidang") + public Response p04_setpetugasbidang( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_FUNGSI") String IN_FUNGSI) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_FUNGSI", IN_FUNGSI); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p04_setpetugasbidang(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST // + @Path("/p05_setalihunit") + public Response p05_setalihunit( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USERID") String IN_USERID, + @QueryParam(value = "IN_UNITID") String IN_UNITID) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USERID", IN_USERID); + mapParam.put("IN_UNITID", IN_UNITID); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p05_setalihunit(mapParam); + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/p06_setalihbidang") + public Response p06_setalihbidang( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USERID") String IN_USERID, + @QueryParam(value = "IN_FUNGSI") String IN_FUNGSI) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USERID", IN_USERID); + mapParam.put("IN_FUNGSI", IN_FUNGSI); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p06_setalihbidang(mapParam); + // mapResponse = + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST // + @Path("/p07_setpenjelasanbidang") + public Response p07_setpenjelasanbidang( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_CUSTOMERRESPONSE") String IN_CUSTOMERRESPONSE, + @QueryParam(value = "IN_REMARK") String IN_REMARK, + @QueryParam(value = "IN_IMPLEMENTOR") String IN_IMPLEMENTOR) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_CUSTOMERRESPONSE", IN_CUSTOMERRESPONSE); + mapParam.put("IN_REMARK", IN_REMARK); + mapParam.put("IN_IMPLEMENTOR", IN_IMPLEMENTOR); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p07_setpenjelasanbidang(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST // + @Path("/p08_setkonfirmasi") + public Response p08_setkonfirmasi( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.p08_setkonfirmasi(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST // + @Path("/p09_setselesai") + public Response p09_setselesai( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + + // mapResult = IntegKeluhanMobileService.p09_setselesai(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST // + @Path("/p10_setbatal") + public Response p10_setbatal( + @QueryParam(value = "IN_LAPORAN") String IN_LAPORAN, + @QueryParam(value = "IN_USER") String IN_USER) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_LAPORAN", IN_LAPORAN); + mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + + // mapResult = IntegKeluhanMobileService.p10_setbatal(mapParam); + // mapResponse = + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P11_GETHISTRUNTASK") + public Response P11_GETHISTRUNTASK( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P11_GETHISTRUNTASK(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P12_GETFUNGSI") + public Response P12_GETFUNGSI( + @QueryParam(value = "IN_UNIT") String IN_UNIT, + @QueryParam(value = "IN_USER") String IN_USER) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_UNIT", IN_UNIT); + mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P12_GETFUNGSI(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P13_GETMASTER_ISSUETYPE") + public Response P13_GETMASTER_ISSUETYPE() { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + + try { + mapResponse.setData(issueTypeService.findAll()); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("00"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P14_GETUNIT") + public Response P14_GETUNIT( + @QueryParam(value = "IN_UNITTYPEID") Long IN_UNITTYPEID) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + + try { + mapResponse.setData(unitService.findByUnitTypeId(IN_UNITTYPEID)); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("00"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P15_GETJMLKELUHAN") + public Response P15_GETJMLKELUHAN( + @QueryParam(value = "IN_DISTRIBUTION") String IN_DISTRIBUTION, + @QueryParam(value = "IN_CREATEDATE") String IN_CREATEDATE, + @QueryParam(value = "IN_ESCALATIONID") String IN_ESCALATIONID) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_DISTRIBUTION", IN_DISTRIBUTION); + mapParam.put("IN_CREATEDATE", IN_CREATEDATE); + mapParam.put("IN_ESCALATIONID", IN_ESCALATIONID); + // mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P15_GETJMLKELUHAN(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P16_GETBIDANGMEMBER") + public Response P16_GETBIDANGMEMBER( + @QueryParam(value = "IN_BIDANGUNITID") Long IN_BIDANGUNITID) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_BIDANGUNITID", IN_BIDANGUNITID); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P16_GETBIDANGMEMBER(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P17_VALIDASIEMAIL") + public Response P17_VALIDASIEMAIL( + @QueryParam(value = "IN_EMAIL") String IN_EMAIL) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_EMAIL", IN_EMAIL); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P17_VALIDASIEMAIL(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P18_ISSUETYPE") + public Response P18_ISSUETYPE( + // @QueryParam(value = "IN_UNIT") String IN_UNIT, + // @QueryParam(value = "IN_USER") String IN_USE + ) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + + try { + mapResponse.setData(issueTypeService.findActive()); + mapResponse.setMessage("SUKSES"); + mapResponse.setRc("00"); + + } catch (AppException e) { + mapResponse.setMessage(e.getMessage()); + mapResponse.setRc(e.getRc()); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P19_SUBISSUETYPE") + public Response P19_SUBISSUETYPE( + // @QueryParam(value = "IN_UNIT") String IN_UNIT, + // @QueryParam(value = "IN_USER") String IN_USE + ) { + + ResponseModelIntegKeluhanMobile mapResponse = new ResponseModelIntegKeluhanMobile(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + // mapParam.put("IN_UNIT", IN_UNIT); + // mapParam.put("IN_USER", IN_USER); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P19_SUBISSUETYPE(mapParam); + // mapResponse = AppServerIntegKeluhanMobile.setResultMessage(mapResult); + // log.info("log : {}",mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } +} diff --git a/src/main/java/org/sadigit/boundary/v2/endpoint/IntegKeluhanMobileResourceV2.java b/src/main/java/org/sadigit/boundary/v2/endpoint/IntegKeluhanMobileResourceV2.java new file mode 100644 index 0000000..480453b --- /dev/null +++ b/src/main/java/org/sadigit/boundary/v2/endpoint/IntegKeluhanMobileResourceV2.java @@ -0,0 +1,137 @@ +package org.sadigit.boundary.v2.endpoint; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.sadigit.model.ResponseModelIntegKeluhanMobile; +import org.sadigit.model.ResponseModelIntegKeluhanMobileTanpaOutData; + +import io.smallrye.mutiny.Uni; +import jakarta.inject.Inject; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Response; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Path("/api/apkt/integkeluhanmobile") +@Produces("application/json") +public class IntegKeluhanMobileResourceV2 { + + @POST + @Path("/P018_SETPENJELASANBIDANGV2") + public Response P018_SETPENJELASANBIDANGV2( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_CUSTOMERRESPONSE") String IN_CUSTOMERRESPONSE, + @QueryParam(value = "IN_REMARK") String IN_REMARK, + @QueryParam(value = "IN_IMPLEMENTOR") String IN_IMPLEMENTOR, + @QueryParam(value = "IN_ISSUETYPE") String IN_ISSUETYPE, + @QueryParam(value = "IN_SUBISSUETYPE") String IN_SUBISSUETYPE) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_CUSTOMERRESPONSE", IN_CUSTOMERRESPONSE); + mapParam.put("IN_REMARK", IN_REMARK); + mapParam.put("IN_IMPLEMENTOR", IN_IMPLEMENTOR); + mapParam.put("IN_ISSUETYPE", IN_ISSUETYPE); + mapParam.put("IN_SUBISSUETYPE", IN_SUBISSUETYPE); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P20_SETPENJELASANBIDANG(mapParam); + // mapResponse = + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // System.out.println(" log = " + mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P21_MUTASI_KG") + public Response P21_MUTASI_KG( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_ALASAN") String IN_ALASAN) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_ALASAN", IN_ALASAN); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + // mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P21_MUTASI_KG(mapParam); + // mapResponse = + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // System.out.println(" log = " + mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + + @POST + @Path("/P22_SEND_LISTRIQU") + public Response P22_SEND_LISTRIQU( + @QueryParam(value = "IN_REPORTNUMBER") String IN_REPORTNUMBER, + @QueryParam(value = "IN_USER") String IN_USER, + @QueryParam(value = "IN_ALASAN") String IN_ALASAN) { + + ResponseModelIntegKeluhanMobileTanpaOutData mapResponse = new ResponseModelIntegKeluhanMobileTanpaOutData(); + Map mapResult; + Map mapParam = new HashMap<>(); + + try { + mapParam.put("IN_REPORTNUMBER", IN_REPORTNUMBER); + mapParam.put("IN_USER", IN_USER); + mapParam.put("IN_ALASAN", IN_ALASAN); + + mapParam.put("OUT_RC", "VARCHAR"); + mapParam.put("OUT_MESSAGE", "VARCHAR"); + // mapParam.put("OUT_DATA", "CURSOR"); + + // mapResult = IntegKeluhanMobileService.P21_MUTASI_KG(mapParam); + // mapResponse = + // AppServerIntegKeluhanMobileLoginTanpaOutData.setResultMessage(mapResult); + // System.out.println(" log = " + mapResponse); + + } catch (Exception e) { + // log.error(e.getMessage(), e); + mapResponse.setMessage(e.getMessage()); + // mapResponse.setRc("06"); + } + + return Response.ok(mapResponse).build(); + + } + +} diff --git a/src/main/java/org/sadigit/control/errorhandler/BadRequestBodyErrorHandler.java b/src/main/java/org/sadigit/control/errorhandler/BadRequestBodyErrorHandler.java new file mode 100644 index 0000000..49faf30 --- /dev/null +++ b/src/main/java/org/sadigit/control/errorhandler/BadRequestBodyErrorHandler.java @@ -0,0 +1,25 @@ +package org.sadigit.control.errorhandler; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.sadigit.control.exception.BadRequestBodyException; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; + +@Provider +public class BadRequestBodyErrorHandler implements ExceptionMapper { + + @Override + public Response toResponse(BadRequestBodyException exception) { + Map response = new LinkedHashMap<>(); + response.put("status", false); + response.put("title", "Bad Request"); + response.put("message", exception.getMessage()); + + return Response.status(403).entity(response).build(); + } + +} diff --git a/src/main/java/org/sadigit/control/errorhandler/FileProcessingErrorHandler.java b/src/main/java/org/sadigit/control/errorhandler/FileProcessingErrorHandler.java new file mode 100644 index 0000000..939d9b0 --- /dev/null +++ b/src/main/java/org/sadigit/control/errorhandler/FileProcessingErrorHandler.java @@ -0,0 +1,26 @@ +package org.sadigit.control.errorhandler; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.sadigit.control.exception.FileProcessingException; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; + +@Provider +public class FileProcessingErrorHandler implements ExceptionMapper { + + @Override + public Response toResponse(FileProcessingException exception) { + + Map response = new LinkedHashMap<>(); + response.put("status", false); + response.put("title", "Bad Request"); + response.put("message", exception.getMessage()); + + return Response.status(403).entity(response).build(); + } + +} diff --git a/src/main/java/org/sadigit/control/errorhandler/ValidationExceptionErrorHandler.java b/src/main/java/org/sadigit/control/errorhandler/ValidationExceptionErrorHandler.java new file mode 100644 index 0000000..1850f12 --- /dev/null +++ b/src/main/java/org/sadigit/control/errorhandler/ValidationExceptionErrorHandler.java @@ -0,0 +1,31 @@ +package org.sadigit.control.errorhandler; + +import java.util.Map; +import java.util.stream.Collectors; + +import jakarta.validation.ConstraintViolationException; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.ext.ExceptionMapper; +import jakarta.ws.rs.ext.Provider; +import lombok.extern.slf4j.Slf4j; + +@Provider +@Slf4j +public class ValidationExceptionErrorHandler implements ExceptionMapper{ + + @Override + public Response toResponse(ConstraintViolationException exception) { + + var errorStructure = exception.getConstraintViolations() + .stream() + .map(violation -> Map.of( + "path", violation.getPropertyPath().toString(), + "message", violation.getMessage() + )) + .collect(Collectors.toList()); + + log.error("Validation error: {}", errorStructure); + return Response.status(Response.Status.OK).entity(errorStructure).build(); + } + +} diff --git a/src/main/java/org/sadigit/control/exception/AppFlowException.java b/src/main/java/org/sadigit/control/exception/AppFlowException.java new file mode 100644 index 0000000..c262bd8 --- /dev/null +++ b/src/main/java/org/sadigit/control/exception/AppFlowException.java @@ -0,0 +1,5 @@ +package org.sadigit.control.exception; + +public class AppFlowException extends RuntimeException{ + +} diff --git a/src/main/java/org/sadigit/control/exception/BadRequestBodyException.java b/src/main/java/org/sadigit/control/exception/BadRequestBodyException.java new file mode 100644 index 0000000..810e846 --- /dev/null +++ b/src/main/java/org/sadigit/control/exception/BadRequestBodyException.java @@ -0,0 +1,17 @@ +package org.sadigit.control.exception; + +public class BadRequestBodyException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public BadRequestBodyException() { + super(); + } + + public BadRequestBodyException(String msg) { + super(msg); + } + + public BadRequestBodyException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/src/main/java/org/sadigit/control/exception/FileProcessingException.java b/src/main/java/org/sadigit/control/exception/FileProcessingException.java new file mode 100644 index 0000000..0df5422 --- /dev/null +++ b/src/main/java/org/sadigit/control/exception/FileProcessingException.java @@ -0,0 +1,17 @@ +package org.sadigit.control.exception; + +public class FileProcessingException extends RuntimeException { + private static final long serialVersionUID = 1L; + + public FileProcessingException() { + super(); + } + + public FileProcessingException(String msg) { + super(msg); + } + + public FileProcessingException(String msg, Exception e) { + super(msg, e); + } +} diff --git a/src/main/java/org/sadigit/control/security/User.java b/src/main/java/org/sadigit/control/security/User.java new file mode 100644 index 0000000..75790eb --- /dev/null +++ b/src/main/java/org/sadigit/control/security/User.java @@ -0,0 +1,24 @@ +// package org.sadigit.control.security; + +// import io.quarkus.elytron.security.common.BcryptUtil; +// import io.quarkus.security.jpa.Password; +// import io.quarkus.security.jpa.Roles; +// import io.quarkus.security.jpa.UserDefinition; +// import io.quarkus.security.jpa.Username; + +// @UserDefinition +// public class User { + +// @Username +// public String username; +// @Password +// public String password; +// @Roles +// public String role; + +// public User(String username, String password, String role) { +// this.username = username; +// this.password = BcryptUtil.bcryptHash(password); +// this.role = role; +// } +// } diff --git a/src/main/java/org/sadigit/entity/AppUser.java b/src/main/java/org/sadigit/entity/AppUser.java new file mode 100644 index 0000000..4b5d793 --- /dev/null +++ b/src/main/java/org/sadigit/entity/AppUser.java @@ -0,0 +1,104 @@ +package org.sadigit.entity; + +import lombok.Getter; +import lombok.Setter; + +import java.sql.Timestamp; +import java.util.List; + +import org.hibernate.annotations.Immutable; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + +@Entity +@Getter +@Setter +@Immutable +@Table(name = "appuser", schema = "apkt_transactional") +public class AppUser extends PanacheEntityBase { + + @Id + @Column(name = "userid", nullable = false) + private Long userId; + + @Column(name = "username", length = 200) + private String username; + + @Column(name = "employeename", length = 200) + private String employeeName; + + @Column(name = "nip", length = 200) + private String nip; + + @Column(name = "password", length = 200) + private String password; + + @Column(name = "address", length = 4000) + private String address; + + @Column(name = "phone", length = 20) + private String phone; + + @Column(name = "mobile", length = 20) + private String mobile; + + @Column(name = "email", length = 200) + private String email; + + @Column(name = "positionid") + private Long positionId; + + @Column(name = "unitid") + private Long unitId; + + @Column(name = "isactive", length = 255) + private String isActive; + + @Column(name = "islogin", length = 255) + private String isLogin; + + @Column(name = "passwordchangedate") + private Timestamp passwordChangeDate; + + @Column(name = "createdate") + private Timestamp createDate; + + @Column(name = "createby") + private Long createBy; + + @Column(name = "updatedate") + private Timestamp updateDate; + + @Column(name = "updateby") + private Long updateBy; + + @Column(name = "pukid") + private Long pukId; + + @Column(name = "pukanswer", length = 200) + private String pukAnswer; + + @Column(name = "defaulttab") + private Long defaultTab; + + @Column(name = "no_imei", length = 50) + private String noImei; + + @Column(name = "domain", length = 50) + private String domain; + + @Column(name = "picture") + private String picture; + + @OneToMany(mappedBy = "idUser") + private List userRole; + +} diff --git a/src/main/java/org/sadigit/entity/Issuetype.java b/src/main/java/org/sadigit/entity/Issuetype.java new file mode 100644 index 0000000..5284cfd --- /dev/null +++ b/src/main/java/org/sadigit/entity/Issuetype.java @@ -0,0 +1,36 @@ +package org.sadigit.entity; + +import java.math.BigDecimal; +import java.security.Timestamp; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "issuetype", schema = "apkt_transactional") +public class Issuetype { + @Id + @Column(name = "issuetypeid", nullable = false) + private Long issueTypeId; + + @Column(name = "issuetypecode", length = 10) + private String issueTypeCode; + + @Column(name = "issuetypename", length = 200) + private String issueTypeName; + + @Column(name = "projectid") + private Long projectId; + + @Column(name = "isactive", length = 1) + private String isActive; + + @Column(name = "description", length = 4000) + private String description; +} diff --git a/src/main/java/org/sadigit/entity/Keluhan.java b/src/main/java/org/sadigit/entity/Keluhan.java new file mode 100644 index 0000000..9c9078a --- /dev/null +++ b/src/main/java/org/sadigit/entity/Keluhan.java @@ -0,0 +1,206 @@ +package org.sadigit.entity; + +import java.security.Timestamp; +import java.time.LocalDateTime; + +import org.locationtech.jts.geom.Geometry; +import org.sadigit.adapter.GeometryAdapter; + +import jakarta.json.bind.annotation.JsonbTypeAdapter; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "keluhan", schema = "apkt_transactional") +public class Keluhan { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "id_pelanggan_no_meter") + private Long idPelangganNoMeter; + + @Column(name = "id_ulp") + private Long idUlp; + + @Column(name = "id_tipe_permasalahan") + private Long idTipePermasalahan; + + @Column(name = "alamat_pelanggan", length = 255) + private String alamatPelanggan; + + @Column(name = "nama_pelapor", length = 255) + private String namaPelapor; + + @Column(name = "telepon_pelapor", length = 255) + private String teleponPelapor; + + @Column(name = "hp_pelapor", length = 255) + private String hpPelapor; + + @Column(name = "fax_pelapor", length = 255) + private String faxPelapor; + + @Column(name = "email_pelapor", length = 255) + private String emailPelapor; + + @Column(name = "alamat_pelapor", length = 4000) + private String alamatPelapor; + + @Column(length = 255) + private String media; + + @Column(name = "waktu_padam", length = 255) + private LocalDateTime waktuPadam; + + @Column(length = 255) + private String konfirmasi; + + @JsonbTypeAdapter(GeometryAdapter.class) + @Column(name = "lokasi", columnDefinition = "geometry(Point,4326)") + private Geometry lokasi; + + @Column(name = "no_laporan") + private String noLaporan; + + @Column(length = 4000) + private String keterangan; + + @Column(name = "created_date") + private LocalDateTime createdDate; + + @Column(name = "created_by") + private Long createdBy; + + @Column(name = "updated_date") + private LocalDateTime updatedDate; + + @Column(name = "updated_by") + private Long updatedBy; + + @Column(name = "status_akhir", length = 50) + private String statusAkhir; + + @Column(name = "tipe_wo") + private Long tipeWo; + + private Long unit; + + private Long eskalasi; + + private String permasalahan; + + @Column(name = "waktu_lapor") + private LocalDateTime waktuLapor; + + @Column(name = "id_regu") + private Long idRegu; + + @Column(name = "waktu_penugasan") + private LocalDateTime waktuPenugasan; + + @Column(name = "waktu_perjalanan") + private LocalDateTime waktuPerjalanan; + + @Column(name = "waktu_pengerjaan") + private LocalDateTime waktuPengerjaan; + + @Column(name = "waktu_nyala_sementara") + private LocalDateTime waktuNyalaSementara; + + @Column(name = "waktu_nyala") + private LocalDateTime waktuNyala; + + @Column(name = "waktu_batal") + private LocalDateTime waktuBatal; + + @Column(name = "waktu_selesai") + private LocalDateTime waktuSelesai; + + @Column(name = "tipe_keluhan") + private Long tipeKeluhan; + + @Column(name = "tipe_sub_keluhan") + private Long tipeSubKeluhan; + + private String alasan; + + private String patokan; + + private Long jarak; + + @Column(name = "id_kelurahan") + private Long idKelurahan; + + private String fax; + + @Column(name = "keterangan_lokasi") + private String keteranganLokasi; + + @Column(name = "waktu_fax") + private LocalDateTime waktuFax; + + @Column(name = "nama_media") + private String namaMedia; + + @Column(name = "waktu_media") + private LocalDateTime waktuMedia; + + @Column(name = "id_posko") + private Long idPosko; + + @Column(name = "respon_pelanggan") + private String responPelanggan; + + private String uraian; + + private String pelaksana; + + @Column(name = "id_tarif_daya") + private Long idTarifDaya; + + private String summary; + + @Column(name = "jumlah_lapor") + private Long jumlahLapor; + + private String deskripsi; + + @Column(name = "waktu_konfirmasi") + private LocalDateTime waktuKonfirmasi; + + @Column(name = "waktu_menunggu_tanggapan_supervisor") + private LocalDateTime waktuMenungguTanggapanSupervisor; + + @Column(name = "tindak_lanjut_penyelesaian") + private String tindakLanjutPenyelesaian; + + @Column(name = "no_lapor_pln") + private String noLaporPln; + + @Column(name = "no_tiket_crm") + private String noTiketCrm; + + @ManyToOne() + @JoinColumn(name = "id_kelurahan", referencedColumnName = "id_kelurahan", insertable = false, updatable = false) + private MasterKelurahan kelurahan; + + @ManyToOne() + @JoinColumn(name = "tipe_keluhan", referencedColumnName = "issuetypeid", insertable = false, updatable = false) + private Issuetype issueType; + + @ManyToOne() + @JoinColumn(name = "tipe_sub_keluhan", referencedColumnName = "subissuetypeid", insertable = false, updatable = false) + private SubIssueType subIssueType; + +} diff --git a/src/main/java/org/sadigit/entity/MasterKelurahan.java b/src/main/java/org/sadigit/entity/MasterKelurahan.java new file mode 100644 index 0000000..2e6f702 --- /dev/null +++ b/src/main/java/org/sadigit/entity/MasterKelurahan.java @@ -0,0 +1,59 @@ +package org.sadigit.entity; + +import java.security.Timestamp; +import java.time.LocalDateTime; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "master_kelurahan", schema = "apkt_transactional") +public class MasterKelurahan { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id_kelurahan") + private Long idKelurahan; + + @Column(name = "nama_kelurahan", nullable = false) + private String namaKelurahan; + + @Column(name = "created_date") + private LocalDateTime createdDate; + + @Column(name = "created_by") + private Long createdBy; + + @Column(name = "updated_date") + private LocalDateTime updatedDate; + + @Column(name = "updated_by") + private Long updatedBy; + + @Column(name = "id_kecamatan") + private Long idKecamatan; + + @Column(name = "nama_kecamatan") + private String namaKecamatan; + + @Column(name = "id_kota") + private Long idKota; + + @Column(name = "nama_kota") + private String namaKota; + + @Column(name = "id_provinsi") + private Long idProvinsi; + + @Column(name = "nama_provinsi") + private String namaProvinsi; + + private String status; +} diff --git a/src/main/java/org/sadigit/entity/SubIssueType.java b/src/main/java/org/sadigit/entity/SubIssueType.java new file mode 100644 index 0000000..c82c0ad --- /dev/null +++ b/src/main/java/org/sadigit/entity/SubIssueType.java @@ -0,0 +1,38 @@ +package org.sadigit.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "subissuetype", schema = "apkt_transactional") + +public class SubIssueType { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "subissuetypeid", nullable = false) + private Long subissuetypeid; + + @Column(name = "issuetypeid", nullable = true) + private Long issuetypeid; + + @Column(name = "subissuetypename", length = 200, nullable = true) + private String subissuetypename; + + @Column(name = "projectid", nullable = true) + private Long projectid; + + @Column(name = "isactive", length = 1, nullable = true) + private String isactive; + + @Column(name = "description", length = 4000, nullable = true) + private String description; + +} diff --git a/src/main/java/org/sadigit/entity/Unit.java b/src/main/java/org/sadigit/entity/Unit.java new file mode 100644 index 0000000..c66c141 --- /dev/null +++ b/src/main/java/org/sadigit/entity/Unit.java @@ -0,0 +1,87 @@ +package org.sadigit.entity; + +import java.math.BigDecimal; +import java.security.Timestamp; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "unit", schema = "apkt_transactional") +public class Unit { + @Id + @Column(name = "unitid", nullable = false) + private Long unitId; + + @Column(name = "unitcode", length = 10) + private String unitCode; + + @Column(name = "unitname", length = 100) + private String unitName; + + @Column(name = "unittypeid") + private Long unitTypeId; + + @Column(name = "unitparent") + private Long unitParent; + + @Column(name = "address", length = 250) + private String address; + + @Column(name = "city", length = 50) + private String city; + + @Column(name = "zip", length = 5) + private String zip; + + @Column(name = "phone", length = 20) + private String phone; + + @Column(name = "mobile", length = 20) + private String mobile; + + @Column(name = "fax", length = 20) + private String fax; + + @Column(name = "email", length = 100) + private String email; + + @Column(name = "ipaddress", length = 15) + private String ipAddress; + + @Column(name = "createdate") + private Timestamp createDate; + + @Column(name = "createby") + private BigDecimal createBy; + + @Column(name = "updatedate") + private Timestamp updateDate; + + @Column(name = "updateby") + private BigDecimal updateBy; + + @Column(name = "isactive", length = 1) + private String isActive; + + @Column(name = "coordinator") + private BigDecimal coordinator; + + @Column(name = "supervisor") + private BigDecimal supervisor; + + @Column(name = "assistantmanager") + private BigDecimal assistantManager; + + @Column(name = "assmanphone", length = 20) + private String assManPhone; + + @Column(name = "vehiclecolor", length = 10) + private String vehicleColor; +} diff --git a/src/main/java/org/sadigit/entity/UserRole.java b/src/main/java/org/sadigit/entity/UserRole.java new file mode 100644 index 0000000..c40e687 --- /dev/null +++ b/src/main/java/org/sadigit/entity/UserRole.java @@ -0,0 +1,54 @@ +package org.sadigit.entity; + +import java.time.LocalDateTime; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.Getter; +import lombok.Setter; + +@Entity +@Getter +@Setter +@Table(name = "user_role", schema = "apkt_transactional") +public class UserRole extends PanacheEntityBase { + @Id + private Long id; + + @Column(name = "id_user", nullable = false) + private Long idUser; + + @Column(name = "id_role", nullable = false) + private Long idRole; + + @Column(name = "start_date", nullable = false) + private LocalDateTime startDate; + + @Column(name = "end_date", nullable = false) + private LocalDateTime endDate; + + @Column(name = "created_date") + private LocalDateTime createdDate; + + @Column(name = "created_by") + private Long createdBy; + + @Column(name = "updated_date") + private LocalDateTime updatedDate; + + @Column(name = "updated_by") + private Long updatedBy; + + @ManyToOne() + @JoinColumn(name = "id_user", referencedColumnName = "userid", insertable = false, updatable = false) + AppUser appUser; + +} diff --git a/src/main/java/org/sadigit/mapper/AppUserMapper.java b/src/main/java/org/sadigit/mapper/AppUserMapper.java new file mode 100644 index 0000000..ce364b1 --- /dev/null +++ b/src/main/java/org/sadigit/mapper/AppUserMapper.java @@ -0,0 +1,27 @@ +package org.sadigit.mapper; + +import org.sadigit.entity.AppUser; +import org.sadigit.model.dto.AppUserDto; + +public class AppUserMapper { + public AppUserMapper() { + } + + public static AppUserDto entityToDTO(AppUser entity) { + + return AppUserDto.builder() + .address(entity.getAddress()) + .nip(entity.getNip()) + .phone(entity.getPhone()) + .positionid(entity.getPositionId().intValue()) + .isactive(entity.getIsActive()) + .mobile(entity.getMobile()) + .unitid(entity.getUnitId().intValue()) + .userid(entity.getUserId().intValue()) + .employeename(entity.getEmployeeName()) + .email(entity.getEmail()) + .username(entity.getUsername()) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/mapper/IssueTypeMapper.java b/src/main/java/org/sadigit/mapper/IssueTypeMapper.java new file mode 100644 index 0000000..2dde01a --- /dev/null +++ b/src/main/java/org/sadigit/mapper/IssueTypeMapper.java @@ -0,0 +1,22 @@ +package org.sadigit.mapper; + +import org.sadigit.entity.Issuetype; +import org.sadigit.model.dto.IssueTypeDto; + +import io.quarkus.logging.Log; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class IssueTypeMapper { + public IssueTypeMapper() { + } + + public static IssueTypeDto entityToDTO(Issuetype entity) { + + return IssueTypeDto.builder() + .issuetypeid(entity.getIssueTypeId()) + .issuetypename(entity.getIssueTypeName()) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/mapper/KeluhanMapper.java b/src/main/java/org/sadigit/mapper/KeluhanMapper.java new file mode 100644 index 0000000..76f5049 --- /dev/null +++ b/src/main/java/org/sadigit/mapper/KeluhanMapper.java @@ -0,0 +1,63 @@ +package org.sadigit.mapper; + +import org.sadigit.entity.Keluhan; +import org.sadigit.model.dto.KeluhantDto; + +public class KeluhanMapper { + public KeluhanMapper() { + } + + public static KeluhantDto entityToDTO(Keluhan entity) { + + return KeluhantDto.builder() + .provinsi(entity.getKelurahan() != null ? entity.getKelurahan().getNamaProvinsi() : null) + .keterangan(entity.getKeterangan()) + .latitude(0) + .referencelocation(entity.getLokasi() != null ? entity.getLokasi().toString() : null) + .createdate(entity.getCreatedDate()) + .description(entity.getDeskripsi()) + .idnomormeter(entity.getIdPelangganNoMeter() != null ? entity.getIdPelangganNoMeter().toString() : null) + .distribution(null) + .flaghisto(0) + .issuetypename(entity.getIssueType().getIssueTypeName()) + .kabupaten(entity.getKelurahan() != null ? entity.getKelurahan().getNamaKota() : null) + .serviceunitid(0) + .createby(entity.getCreatedBy()) + .updatedate(entity.getUpdatedDate()) + .isgerai(false) + .unitname(null) + .subissuetypename(entity.getSubIssueType().getSubissuetypename()) + .customername(null) + .plnreportnumber(null) + .longitude(0) + .summary("1") + .escalationid(entity.getEskalasi()) + .lapor(0) + .customernumber(1) + .reportnumber(entity.getNoLaporan()) + .reporteremail(null) + .kelurahan(entity.getKelurahan() != null ? entity.getKelurahan().getNamaKelurahan() : null) + .priorityid(0) + .neareststreet(null) + .nometer(null) + .priorityname("NORMAL") + .subissuetypeid(entity.getTipeKeluhan()) + .updateby(entity + .getUpdatedBy() != null ? entity.getUpdatedBy() : 0) + .runworkflowid(0) + .reportermobile(null) + .customerid(null) + .reporteraddress(null) + .kecamatan(entity.getKelurahan() != null ? entity.getKelurahan().getNamaKecamatan() + : null) + .laststatus(entity.getStatusAkhir()) + .issuetypeid(entity.getTipeKeluhan()) + .location(null) + .reportername(entity.getNamaPelapor()) + .reporterphone(entity.getHpPelapor()) + .reporterfax(entity.getFaxPelapor()) + .unitparent(null) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/mapper/MasterIssueTypeMapper.java b/src/main/java/org/sadigit/mapper/MasterIssueTypeMapper.java new file mode 100644 index 0000000..2ce2128 --- /dev/null +++ b/src/main/java/org/sadigit/mapper/MasterIssueTypeMapper.java @@ -0,0 +1,24 @@ +package org.sadigit.mapper; + +import org.sadigit.entity.Issuetype; +import org.sadigit.model.dto.MasterIssueTypeDto; + +import io.quarkus.logging.Log; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class MasterIssueTypeMapper { + public MasterIssueTypeMapper() { + } + + public static MasterIssueTypeDto entityToDTO(Issuetype entity) { + + return MasterIssueTypeDto.builder() + .jenis_pengaduan("KELUHAN") + .issuetypeid(entity.getIssueTypeId()) + .issuetypename(entity.getIssueTypeName()) + .projectid(entity.getProjectId()) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/mapper/PenggunaMapper.java b/src/main/java/org/sadigit/mapper/PenggunaMapper.java new file mode 100644 index 0000000..807f9c0 --- /dev/null +++ b/src/main/java/org/sadigit/mapper/PenggunaMapper.java @@ -0,0 +1,35 @@ +package org.sadigit.mapper; + +import org.sadigit.entity.AppUser; +import org.sadigit.model.dto.PenggunaDto; +import org.sadigit.util.Checks; + +import io.quarkus.logging.Log; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class PenggunaMapper { + public PenggunaMapper() { + } + + public static PenggunaDto entityToDTO(AppUser entity) { + + return PenggunaDto.builder() + .nip(entity.getNip()) + .positionid(entity.getPositionId().intValue()) + .roleid(getFirstRoleId(entity)) + .unitid(entity.getUnitId().intValue()) + .userid(entity.getUserId().intValue()) + .employeename(entity.getEmployeeName()) + .username(entity.getUsername()) + .build(); + } + + private static Integer getFirstRoleId(AppUser entity) { + if (entity.getUserRole() != null && !entity.getUserRole().isEmpty()) { + return entity.getUserRole().get(0).getIdRole().intValue(); + } + return null; + } + +} \ No newline at end of file diff --git a/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobile.java b/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobile.java new file mode 100644 index 0000000..84b5693 --- /dev/null +++ b/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobile.java @@ -0,0 +1,42 @@ +package org.sadigit.model; + +import java.io.Serializable; + +import io.quarkus.runtime.annotations.RegisterForReflection; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ToString +@RegisterForReflection +public class ResponseModelIntegKeluhanMobile implements Serializable { + private String Rc; + private String Message; + private T Data; + + public String getRc() { return Rc; } + + public void setRc(String rc) { this.Rc = rc; } + + public String getMessage() { + return Message; + } + + public void setMessage(String message) { + this.Message = message; + } + + public T getData() { + return Data; + } + + public void setData(T data) { + Data = data; + } +} diff --git a/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobileTanpaOutData.java b/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobileTanpaOutData.java new file mode 100644 index 0000000..27aafe7 --- /dev/null +++ b/src/main/java/org/sadigit/model/ResponseModelIntegKeluhanMobileTanpaOutData.java @@ -0,0 +1,33 @@ +package org.sadigit.model; + +import java.io.Serializable; + +import io.quarkus.runtime.annotations.RegisterForReflection; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ToString +@RegisterForReflection +public class ResponseModelIntegKeluhanMobileTanpaOutData implements Serializable{ + private String Rc; + private String Message; + + public String getRc() { return Rc; } + + public void setRc(String rc) { this.Rc = rc; } + + public String getMessage() { + return Message; + } + + public void setMessage(String message) { + this.Message = message; + } +} diff --git a/src/main/java/org/sadigit/model/dto/AppUserDto.java b/src/main/java/org/sadigit/model/dto/AppUserDto.java new file mode 100644 index 0000000..693bfb5 --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/AppUserDto.java @@ -0,0 +1,22 @@ +package org.sadigit.model.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter +public class AppUserDto { + private String address; + private String nip; + private String phone; + private int positionid; + private String isactive; + private String mobile; + private int unitid; + private int userid; + private String employeename; + private String email; + private String username; +} diff --git a/src/main/java/org/sadigit/model/dto/IssueTypeDto.java b/src/main/java/org/sadigit/model/dto/IssueTypeDto.java new file mode 100644 index 0000000..23fc8b1 --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/IssueTypeDto.java @@ -0,0 +1,13 @@ +package org.sadigit.model.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter +public class IssueTypeDto { + private Long issuetypeid; + private String issuetypename; +} diff --git a/src/main/java/org/sadigit/model/dto/KeluhantDto.java b/src/main/java/org/sadigit/model/dto/KeluhantDto.java new file mode 100644 index 0000000..7342656 --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/KeluhantDto.java @@ -0,0 +1,61 @@ +package org.sadigit.model.dto; + +import java.sql.Date; +import java.time.LocalDate; +import java.time.LocalDateTime; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter + +public class KeluhantDto { + private String provinsi; + private String keterangan; + private double latitude; + private String referencelocation; + private LocalDateTime createdate; + private String description; + private String idnomormeter; + private String distribution; + private int flaghisto; + private String issuetypename; + private String kabupaten; + private int serviceunitid; + private long createby; + private LocalDateTime updatedate; + private Boolean isgerai; + private String unitname; + private String subissuetypename; + private String customername; + private String plnreportnumber; + private double longitude; + private String summary; + private Long escalationid; + private int lapor; + private int customernumber; + private String reportnumber; + private String reporteremail; + private String kelurahan; + private int priorityid; + private String neareststreet; + private String nometer; + private String priorityname; + private Long subissuetypeid; + private long updateby; + private long runworkflowid; + private String reportermobile; + private String customerid; + private String reporteraddress; + private String kecamatan; + private String laststatus; + private Long issuetypeid; + private String location; + private String reportername; + private String reporterphone; + private String reporterfax; + private String unitparent; +} diff --git a/src/main/java/org/sadigit/model/dto/MasterIssueTypeDto.java b/src/main/java/org/sadigit/model/dto/MasterIssueTypeDto.java new file mode 100644 index 0000000..d7544c0 --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/MasterIssueTypeDto.java @@ -0,0 +1,16 @@ +package org.sadigit.model.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter + +public class MasterIssueTypeDto { + private String jenis_pengaduan; + private Long issuetypeid; + private String issuetypename; + private Long projectid; +} diff --git a/src/main/java/org/sadigit/model/dto/PenggunaDto.java b/src/main/java/org/sadigit/model/dto/PenggunaDto.java new file mode 100644 index 0000000..4156fe9 --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/PenggunaDto.java @@ -0,0 +1,18 @@ +package org.sadigit.model.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter +public class PenggunaDto { + private String nip; + private int positionid; + private Integer roleid; + private int unitid; + private int userid; + private String employeename; + private String username; +} diff --git a/src/main/java/org/sadigit/model/dto/UnitDto.java b/src/main/java/org/sadigit/model/dto/UnitDto.java new file mode 100644 index 0000000..6619efa --- /dev/null +++ b/src/main/java/org/sadigit/model/dto/UnitDto.java @@ -0,0 +1,17 @@ +package org.sadigit.model.dto; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +@Builder(toBuilder = true) +@Setter +@Getter + +public class UnitDto { + private String unit_jaringan; + private String unitname; + private Long unitid; + private Long unittypeid; + private Long unitparent; +} diff --git a/src/main/java/org/sadigit/repository/AppUserRepository.java b/src/main/java/org/sadigit/repository/AppUserRepository.java new file mode 100644 index 0000000..be7f085 --- /dev/null +++ b/src/main/java/org/sadigit/repository/AppUserRepository.java @@ -0,0 +1,23 @@ +package org.sadigit.repository; + +import java.util.List; + +import org.sadigit.entity.AppUser; + +import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class AppUserRepository implements PanacheRepositoryBase { + public AppUser findByUsername(String username) { + return find("username", username).count() > 0 ? find("username", username).firstResult() : null; + } + + public AppUser findByUsernameAndPassword(String username, String password) { + return find("username = ?1 and password = ?2", username, password).firstResult(); + } + + public List findByUnitIdAndPositionId(Long unitId, Long positionId) { + return find("unitId = ?1 and positionId = ?2 and isActive='1'", unitId, positionId).list(); + } +} diff --git a/src/main/java/org/sadigit/repository/IssueTypeRepository.java b/src/main/java/org/sadigit/repository/IssueTypeRepository.java new file mode 100644 index 0000000..978bad7 --- /dev/null +++ b/src/main/java/org/sadigit/repository/IssueTypeRepository.java @@ -0,0 +1,19 @@ +package org.sadigit.repository; + +import java.util.List; + +import org.sadigit.entity.Issuetype; + +import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class IssueTypeRepository implements PanacheRepositoryBase { + public List findIssueTypeKeluhan() { + return find("projectId = ?1", 2).list(); + } + + public List findIssueTypeActiveKeluhan() { + return find("projectId = ?1 AND isActive = ?2", 2, "1").list(); + } +} diff --git a/src/main/java/org/sadigit/repository/KeluhanRepository.java b/src/main/java/org/sadigit/repository/KeluhanRepository.java new file mode 100644 index 0000000..60de8cc --- /dev/null +++ b/src/main/java/org/sadigit/repository/KeluhanRepository.java @@ -0,0 +1,27 @@ +package org.sadigit.repository; + +import java.sql.Date; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +import org.sadigit.entity.Keluhan; + +import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; +import jakarta.enterprise.context.ApplicationScoped; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@ApplicationScoped +public class KeluhanRepository implements PanacheRepositoryBase { + public List findKeluhanByUnitId(Long unitId, String startDate, String endDate) { + + Date start = Date.valueOf(startDate); + Date end = Date.valueOf(endDate); + + log.info("start: {}", start); + + return find("unit = ?1 and date(createdDate) >= ?2 and date(createdDate)<= ?3", unitId, start, end) + .list(); + } +} diff --git a/src/main/java/org/sadigit/repository/UnitRepository.java b/src/main/java/org/sadigit/repository/UnitRepository.java new file mode 100644 index 0000000..359e673 --- /dev/null +++ b/src/main/java/org/sadigit/repository/UnitRepository.java @@ -0,0 +1,27 @@ +package org.sadigit.repository; + +import java.util.List; + +import org.hibernate.Session; +import org.hibernate.query.Query; +import org.sadigit.model.dto.UnitDto; + +import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class UnitRepository implements PanacheRepositoryBase { + @Inject + Session session; + + public List findByUnitTypeId(Long unitTypeId) { + Query query = session.createQuery( + "SELECT (SELECT B.unitName FROM Unit B WHERE B.unitId = A.unitParent) AS unitJaringan, A.unitName, A.unitId, A.unitTypeId, A.unitParent " + + "FROM Unit A WHERE unitTypeId = ?1", + UnitDto.class); + query.setParameter(1, unitTypeId); + return query.list(); + } +} diff --git a/src/main/java/org/sadigit/scheduling/Ago/JobGetAgoApkt.java b/src/main/java/org/sadigit/scheduling/Ago/JobGetAgoApkt.java new file mode 100644 index 0000000..caca132 --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/Ago/JobGetAgoApkt.java @@ -0,0 +1,304 @@ +// package org.sadigit.scheduling.Ago; + +// import com.iconpln.schedulerintegapktago.dao.AgoApktDao; +// import java.io.IOException; +// import java.util.ArrayList; +// import java.util.HashMap; +// import java.util.Iterator; +// import java.util.List; +// import java.util.Map; +// import org.slf4j.Logger; +// import org.slf4j.LoggerFactory; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.stereotype.Component; + +// @Component("jobGetAgoApkt") +// public class JobGetAgoApkt { + +// private static final Logger log = +// LoggerFactory.getLogger(JobGetAgoApkt.class); + +// @Autowired +// private AgoApktDao agoApktDao; + +// public JobGetAgoApkt() { +// } + +// public void executeGetAgoApkt() throws IOException { +// log.info("--- JOB GET AGO APKT ---"); +// List> lstMap = this.getAmbilDataAgoSync(); +// if (!lstMap.isEmpty()) { +// Iterator var2 = lstMap.iterator(); + +// while(var2.hasNext()) { +// Map mapsync = (Map)var2.next(); +// List lstMapMasterKooBon; +// Map SimpanDataMasterKooBon; +// if (((String)mapsync.get("id_master")).toString().equals("1")) { +// lstMapMasterKooBon = this.getAmbilDataMaterialPihak3(); +// if (!lstMapMasterKooBon.isEmpty()) { +// log.info("BERHASIL GET AGO JML DATA MATERIAL PIHAK 3 : {}", +// lstMapMasterKooBon.size()); +// log.info("BERHASIL GET AGO RESPONSE MATERIAL PIHAK 3 : {}", +// lstMapMasterKooBon); +// SimpanDataMasterKooBon = this.SimpanDataMaterialPihak3(lstMapMasterKooBon); +// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN AGO SIMPAN DATA MATERIAL PIHAK 3: {}", +// SimpanDataMasterKooBon); +// } +// } else { +// log.info("GAGAL GET AGO RESPONSE MATERIAL : DATA KOSONG {}", +// lstMapMasterKooBon); +// } +// } + +// if (((String)mapsync.get("id_master")).toString().equals("2")) { +// lstMapMasterKooBon = this.getAmbilDataMasterKoo(); +// if (!lstMapMasterKooBon.isEmpty()) { +// log.info("BERHASIL GET AGO JML DATA KOO : {}", lstMapMasterKooBon.size()); +// log.info("BERHASIL GET AGO RESPONSE KOO: {}", lstMapMasterKooBon); +// SimpanDataMasterKooBon = this.SimpanDataMasterKoo(lstMapMasterKooBon); +// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN AGO SIMPAN DATA KOO : {}", SimpanDataMasterKooBon); +// } +// } else { +// log.info("GAGAL GET AGO RESPONSE MASTER KOO : DATA KOSONG {}", +// lstMapMasterKooBon); +// } +// } + +// if (((String)mapsync.get("id_master")).toString().equals("3")) { +// lstMapMasterKooBon = this.getAmbilDataMasterKooRegu(); +// if (!lstMapMasterKooBon.isEmpty()) { +// log.info("BERHASIL GET AGO JML DATA REGU : {}", lstMapMasterKooBon.size()); +// log.info("BERHASIL GET AGO RESPONSE REGU : {}", lstMapMasterKooBon); +// SimpanDataMasterKooBon = this.SimpanDataMasterKooRegu(lstMapMasterKooBon); +// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN AGO SIMPAN DATA REGU : {}", +// SimpanDataMasterKooBon); +// } +// } else { +// log.info("GAGAL GET AGO RESPONSE MASTER REGU : DATA KOSONG {}", +// lstMapMasterKooBon); +// } +// } + +// if (((String)mapsync.get("id_master")).toString().equals("4")) { +// lstMapMasterKooBon = this.getAmbilDataKooBon(); +// if (!lstMapMasterKooBon.isEmpty()) { +// log.info("BERHASIL GET AGO JML DATA KOO BON : {}", +// lstMapMasterKooBon.size()); +// log.info("BERHASIL GET AGO RESPONSE KOO BON : {}", lstMapMasterKooBon); +// SimpanDataMasterKooBon = this.SimpanDataMasterKooBon(lstMapMasterKooBon); +// if (((String)SimpanDataMasterKooBon.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN AGO SIMPAN DATA KOO BON : {}", +// SimpanDataMasterKooBon); +// } +// } else { +// log.info("GAGAL GET AGO RESPONSE MASTER KOO BON : DATA KOSONG {}", +// lstMapMasterKooBon); +// } +// } +// } +// } else { +// log.info("GAGAL GET AGO RESPONSE SYNC : DATA KOSONG {}", lstMap); +// } + +// log.info("--- JOB GET APKT AGO---"); +// List> lstMapMasterKooBon = +// this.getAmbilDataMasterKooBon(); +// List> lstMapPemakaian = this.getAmbilDataPemakaian(); +// List> lstMapKembali = this.getAmbilDataKembali(); +// List> lstMapPemakaianSync = new ArrayList(); +// Iterator var5; +// Map mapsyncpemakaian; +// if (!lstMapMasterKooBon.isEmpty()) { +// var5 = lstMapMasterKooBon.iterator(); + +// while(var5.hasNext()) { +// mapsyncpemakaian = (Map)var5.next(); +// log.info("BERHASIL GET APKT JML DATA MASTER KOO BON: {}", +// lstMapMasterKooBon.size()); +// log.info("BERHASIL GET APKT ID_KOO : {}", +// ((String)mapsyncpemakaian.get("id_koo")).toString()); +// log.info("BERHASIL GET APKT NOMOR_BON : {}", +// ((String)mapsyncpemakaian.get("nomor_bon")).toString()); +// List> mapGetDataMaterialBon = +// this.getAmbilDataMaterialBon(((String)mapsyncpemakaian.get("id_koo")).toString(), +// ((String)mapsyncpemakaian.get("nomor_bon")).toString()); +// if (!mapGetDataMaterialBon.isEmpty()) { +// log.info("BERHASIL GET APKT JML DATA MATERIAL BON : {}", +// mapGetDataMaterialBon.size()); +// log.info("BERHASIL GET APKT RESPONSE MATERIAL BON : {}", +// mapGetDataMaterialBon); +// Map mapSimpanDataBonMaterial = +// this.SimpanDataBonMaterial(mapGetDataMaterialBon); +// if (((String)mapSimpanDataBonMaterial.get("return")).equals("1")) { +// log.info("BERHASIL APKT SIMPAN DATA MATERIAL BON : {}", +// mapSimpanDataBonMaterial); +// } +// } else { +// log.info("GAGAL GET APKT RESPONSE MATERIAL BON : DATA KOSONG {}", +// mapGetDataMaterialBon); +// } +// } +// } else { +// log.info("GAGAL GET APKT RESPONSE MASTER KOO BON : DATA KOSONG {}", +// lstMapMasterKooBon); +// } + +// Map mapSimpanKembali; +// if (!lstMapPemakaian.isEmpty()) { +// log.info("BERHASIL GET APKT JML DATA PEMAKAIAN : {}", +// lstMapPemakaian.size()); +// log.info("BERHASIL GET APKT RESPONSE PEMAKAIAN : {}", lstMapPemakaian); +// log.info("LSTMAPPEMAKAIAN : {}", lstMapPemakaian); +// var5 = lstMapPemakaian.iterator(); + +// while(var5.hasNext()) { +// mapsyncpemakaian = (Map)var5.next(); +// log.info("MAPSYNCPEMAKAIAAN : {}", mapsyncpemakaian); +// if (!((String)mapsyncpemakaian.get("nomor_bon")).toString().isEmpty()) { +// lstMapPemakaianSync.add(mapsyncpemakaian); +// log.info("LSTMAPPEMAKAIANSYNC : {}", lstMapPemakaianSync); +// log.info("LSTMAPPEMAKAIANSYNC : {}", lstMapPemakaianSync.size()); +// } else { +// log.info("GAGAL INSERT APKT PEMAKAIAN NO WO : {} TIDAK ADA NOMOR BON ", +// ((String)mapsyncpemakaian.get("no_wo")).toString()); +// } +// } + +// mapSimpanKembali = this.SimpanDataTmpReservasiApkt(lstMapPemakaianSync); +// if (((String)mapSimpanKembali.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN APKT SIMPAN DATA PEMAKAIAN : {}", +// mapSimpanKembali); +// } +// } else { +// log.info("GAGAL GET APKT RESPONSE PEMAKAIAN : DATA KOSONG {}", +// lstMapPemakaian); +// } + +// if (!lstMapKembali.isEmpty()) { +// log.info("BERHASIL GET APKT JML DATA PENGEMBALIAN : {}", +// lstMapKembali.size()); +// log.info("BERHASIL GET APKT RESPONSE PENGEMBALIAN : {}", lstMapKembali); +// mapSimpanKembali = this.SimpanDataTmpPengembalianApkt(lstMapKembali); +// if (((String)mapSimpanKembali.get("return")).equals("1")) { +// log.info("BERHASIL SIMPAN APKT SIMPAN DATA PENGEMBALIAN : {}", +// mapSimpanKembali); +// } +// } else { +// log.info("GAGAL GET APKT RESPONSE PENGEMBALIAN : DATA KOSONG {}", +// lstMapKembali); +// } +// } + +// //AGO APKT +// private List> getAmbilDataAgoSync() { +// List> lstMap = this.agoApktDao.getAmbilDataAgoSync(); +// return lstMap; +// } + +// private List> getAmbilDataMaterialPihak3() { +// List> lstMap = +// this.agoApktDao.getAmbilDataMaterialPihak3(); +// return lstMap; +// } + +// private Map SimpanDataMaterialPihak3(List> lstMapMaterial) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataMaterialPihak3(lstMapMaterial); +// return mapResult; +// } + +// private List> getAmbilDataMasterKoo() { +// List> lstMap = this.agoApktDao.getAmbilDataMasterKoo(); +// return lstMap; +// } + +// private Map SimpanDataMasterKoo(List> +// lstMapMaster) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataMasterKoo(lstMapMaster); +// return mapResult; +// } + +// private List> getAmbilDataMasterKooRegu() { +// List> lstMap = +// this.agoApktDao.getAmbilDataMasterKooRegu(); +// return lstMap; +// } + +// private Map SimpanDataMasterKooRegu(List> +// lstMapMasterRegu) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataMasterKooRegu(lstMapMasterRegu); +// return mapResult; +// } + +// private List> getAmbilDataKooBon() { +// List> lstMap = this.agoApktDao.getAmbilDataKooBon(); +// return lstMap; +// } + +// private Map SimpanDataMasterKooBon(List> +// lstMapMasterKooBon) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataMasterKooBon(lstMapMasterKooBon); +// return mapResult; +// } + +// //APKT AGO +// private List> getAmbilDataMasterKooBon() { +// List> lstMap = +// this.agoApktDao.getAmbilDataMasterKooBon(); +// return lstMap; +// } + +// private List> getAmbilDataMaterialBon(String id_koo, +// String nomor_bon) { +// List> lstMap = +// this.agoApktDao.getAmbilDataMaterialBon(id_koo, nomor_bon); +// return lstMap; +// } + +// private Map SimpanDataBonMaterial(List> +// lstMapBonMaterial) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataBonMaterial(lstMapBonMaterial); +// return mapResult; +// } + +// private List> getAmbilDataPemakaian() { +// List> lstMap = this.agoApktDao.getAmbilDataPemakaian(); +// return lstMap; +// } + +// private Map SimpanDataTmpReservasiApkt(List> lstMapTmpReservasiApkt) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataTmpReservasiApkt(lstMapTmpReservasiApkt); +// return mapResult; +// } + +// private List> getAmbilDataKembali() { +// List> lstMap = this.agoApktDao.getAmbilDataKembali(); +// return lstMap; +// } + +// private Map SimpanDataTmpPengembalianApkt(List> lstMapTmpPengembalianApkt) { +// new HashMap(); +// Map mapResult = +// this.agoApktDao.SimpanDataTmpPengembalianApkt(lstMapTmpPengembalianApkt); +// return mapResult; +// } + +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/scheduling/AnotherBean.java b/src/main/java/org/sadigit/scheduling/AnotherBean.java new file mode 100644 index 0000000..8115296 --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/AnotherBean.java @@ -0,0 +1,13 @@ +// package org.sadigit.scheduling; + +// import org.springframework.stereotype.Component; + +// @Component("anotherBean") +// public class AnotherBean { + +// public void printAnotherMessage(){ +// System.out.println("I am called by Quartz jobBean using +// CronTriggerFactoryBean"); +// } + +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/scheduling/Maximo/JobGetAsset.java b/src/main/java/org/sadigit/scheduling/Maximo/JobGetAsset.java new file mode 100644 index 0000000..e8aa4b4 --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/Maximo/JobGetAsset.java @@ -0,0 +1,294 @@ +// package org.sadigit.scheduling.Maximo; + +// import com.google.gson.Gson; +// import com.google.gson.GsonBuilder; +// import +// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor; +// import com.iconpln.schedulerintegmaximoupdate.dao.AssetDao; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataGardu; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataPenyulang; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataTrafo; +// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseGardu; +// import +// com.iconpln.schedulerintegmaximoupdate.model.payload.ResponsePenyulang; +// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseTrafo; +// import lombok.extern.slf4j.Slf4j; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.beans.factory.annotation.Value; +// import org.springframework.http.HttpEntity; +// import org.springframework.http.HttpMethod; +// import org.springframework.http.ResponseEntity; +// import org.springframework.http.client.ClientHttpRequestInterceptor; +// import org.springframework.http.converter.StringHttpMessageConverter; +// import +// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +// import org.springframework.stereotype.Component; +// import org.springframework.web.client.RestTemplate; + +// import java.io.IOException; +// import java.text.SimpleDateFormat; +// import java.util.*; + +// @Slf4j +// @Component("jobGetAsset") +// public class JobGetAsset { + +// @Value("${url.api.maximo1}") +// private String URL; + +// @Value("${auth.api.maximo}") +// private String AUTH; + +// // @Value("${content.api.maximo}") +// // private String CONTENT; + +// @Autowired +// private AssetDao assetDao; + +// public void executeGetAsset() throws IOException { +// log.info("--- JOB GET ASSET ---"); +// List> lstMap = getDataSiapAmbil(); +// log.info("JML DATA CXUNIT : {}", lstMap.size()); +// if (!lstMap.isEmpty()) { +// for (Map map : lstMap) { +// if (map.get("tipe").toString().equals("GARDU") ) { +// ResponseGardu response = getGarduUpdateEndPoint(map); +// log.info("JML DATA GARDU : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataGarduKolektif = +// SimpanDataGarduKolektif(map.get("unitid").toString(), response.getMember()); +// if (mapSimpanDataGarduKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA GARDU : {}", mapSimpanDataGarduKolektif); +// } +// } +// } +// if (map.get("tipe").toString().equals("FEEDER") ) { +// ResponsePenyulang response = getPenyulangUpdateEndPoint(map); +// log.info("JML DATA PENYULANG : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataPenyulangKolektif = +// SimpanDataPenyulangKolektif(map.get("unitid").toString(), +// response.getMember()); +// if (mapSimpanDataPenyulangKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA PENYULANG : {}", mapSimpanDataPenyulangKolektif); +// } +// } +// } +// if (map.get("tipe").toString().equals("TRAFO") ) { +// ResponseTrafo response = getTrafoUpdateEndPoint(map); +// log.info("JML DATA TRAFO : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataTrafoKolektif = +// SimpanDataTrafoKolektif(map.get("unitid").toString(), response.getMember()); +// if (mapSimpanDataTrafoKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA TRAFO : {}", mapSimpanDataTrafoKolektif); +// } +// } +// } +// } +// } +// } + +// private List> getDataSiapAmbil() { +// List> lstMap = assetDao.getAmbilDataGardu(); +// return lstMap; +// } + +// private ResponseGardu getGarduUpdateEndPoint (Map map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponseGardu response = new ResponseGardu(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and +// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// // String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = "{longitudex,latitudey,formattedaddress}"; +// mapParams.put("longitudex,latitudey,formattedaddress", mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseGardu.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponseGardu.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET GARDU : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private ResponsePenyulang getPenyulangUpdateEndPoint (Map +// map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponsePenyulang response = new ResponsePenyulang(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description, +// location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec{assetattrid,alnvalue,numvalue,measureunitid},location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy{parent}&oslc.where=status="OPERATING" +// and cxclassificationdesc="MVCable 20 kV" and +// apkt_number!="NULL"&ignorecollectionref=1&oslc.pageSize=10&lean=1&collectioncount=1"; +// String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = +// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}"; +// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit", +// mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponsePenyulang.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET PENYULANG : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private ResponseTrafo getTrafoUpdateEndPoint (Map map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponseTrafo response = new ResponseTrafo(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and +// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = +// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}"; +// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit", +// mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponseTrafo.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET TRAFO : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private Map SimpanDataGarduKolektif(String unitid, +// List lstGardu){ +// Map mapResult = new HashMap<>(); +// mapResult = assetDao.SimpanDataGarduKolektif(unitid, lstGardu); +// return mapResult; +// } + +// private Map SimpanDataPenyulangKolektif(String unitid, +// List lstPenyulang){ +// Map mapResult = new HashMap<>(); +// mapResult = assetDao.SimpanDataPenyulangKolektif(unitid, lstPenyulang); +// return mapResult; +// } + +// private Map SimpanDataTrafoKolektif(String unitid, +// List lstTrafo){ +// Map mapResult = new HashMap<>(); +// mapResult = assetDao.SimpanDataTrafoKolektif(unitid, lstTrafo); +// return mapResult; +// } +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/scheduling/Maximo/JobGetGarduUpdate.java b/src/main/java/org/sadigit/scheduling/Maximo/JobGetGarduUpdate.java new file mode 100644 index 0000000..6904885 --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/Maximo/JobGetGarduUpdate.java @@ -0,0 +1,133 @@ +// package org.sadigit.scheduling.Maximo; + +// import com.google.gson.Gson; +// import com.google.gson.GsonBuilder; +// import +// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor; +// import com.iconpln.schedulerintegmaximoupdate.dao.GarduDao; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataGardu; +// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseGardu; +// import lombok.extern.slf4j.Slf4j; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.beans.factory.annotation.Value; +// import org.springframework.http.HttpEntity; +// import org.springframework.http.HttpMethod; +// import org.springframework.http.ResponseEntity; +// import org.springframework.http.client.ClientHttpRequestInterceptor; +// import org.springframework.http.converter.StringHttpMessageConverter; +// import +// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +// import org.springframework.stereotype.Component; +// import org.springframework.web.client.RestTemplate; + +// import java.io.IOException; +// import java.text.SimpleDateFormat; +// import java.util.*; + +// @Slf4j +// @Component("jobGetGarduUpdate") +// public class JobGetGarduUpdate { + +// @Value("${url.api.maximo1}") +// private String URL; + +// @Value("${auth.api.maximo}") +// private String AUTH; + +// // @Value("${content.api.maximo}") +// // private String CONTENT; + +// @Autowired +// private GarduDao garduDao; + +// public void executeGetGarduUpdate() throws IOException { +// log.info("--- JOB GET GARDU ---"); +// List> lstMap = getDataSiapAmbil(); +// // log.info("JML DATA CXUNIT : {}", lstMap.size()); +// if (!lstMap.isEmpty()) { +// for (Map map : lstMap) { +// if (map.get("tipe").toString().equals("GARDU") ) { +// ResponseGardu response = getGarduUpdateEndPoint(map); +// log.info("JML DATA GARDU : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataGarduKolektif = +// SimpanDataGarduKolektif(map.get("unitid").toString(), response.getMember()); +// if (mapSimpanDataGarduKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA GARDU : {}", mapSimpanDataGarduKolektif); +// } +// } +// } +// } +// } +// } + +// private List> getDataSiapAmbil() { +// List> lstMap = garduDao.getAmbilDataGardu(); +// return lstMap; +// } + +// private ResponseGardu getGarduUpdateEndPoint (Map map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponseGardu response = new ResponseGardu(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and +// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// // String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// String url = URL + +// "os/MXLOCATION_TEST?oslc.select=location,description,tujdnumber,cxunit,apkt_numbers,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,locationspec,serviceaddress{longitudex,latitudey,formattedaddress}&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Bangunan Sipil Gardu\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = "{longitudex,latitudey,formattedaddress}"; +// mapParams.put("longitudex,latitudey,formattedaddress", mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseGardu.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponseGardu.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET GARDU : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private Map SimpanDataGarduKolektif(String unitid, +// List lstGardu){ +// Map mapResult = new HashMap<>(); +// mapResult = garduDao.SimpanDataGarduKolektif(unitid, lstGardu); +// return mapResult; +// } + +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/scheduling/Maximo/JobGetPenyulangUpdate.java b/src/main/java/org/sadigit/scheduling/Maximo/JobGetPenyulangUpdate.java new file mode 100644 index 0000000..8da748d --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/Maximo/JobGetPenyulangUpdate.java @@ -0,0 +1,139 @@ +// package org.sadigit.scheduling.Maximo; + +// import com.google.gson.Gson; +// import com.google.gson.GsonBuilder; +// import +// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor; +// import com.iconpln.schedulerintegmaximoupdate.dao.PenyulangDao; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataPenyulang; +// import +// com.iconpln.schedulerintegmaximoupdate.model.payload.ResponsePenyulang; +// import lombok.extern.slf4j.Slf4j; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.beans.factory.annotation.Value; +// import org.springframework.http.HttpEntity; +// import org.springframework.http.HttpMethod; +// import org.springframework.http.ResponseEntity; +// import org.springframework.http.client.ClientHttpRequestInterceptor; +// import org.springframework.http.converter.StringHttpMessageConverter; +// import +// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +// import org.springframework.stereotype.Component; +// import org.springframework.web.client.RestTemplate; + +// import java.io.IOException; +// import java.text.SimpleDateFormat; +// import java.util.*; + +// @Slf4j +// @Component("jobGetPenyulangUpdate") +// public class JobGetPenyulangUpdate { + +// @Value("${url.api.maximo1}") +// private String URL; + +// @Value("${auth.api.maximo}") +// private String AUTH; + +// // @Value("${content.api.maximo}") +// // private String CONTENT; + +// @Autowired +// private PenyulangDao penyulangDao; + +// public void executeGetPenyulangUpdate() throws IOException { +// log.info("--- JOB GET PENYULANG ---"); +// List> lstMap = getDataSiapAmbil(); +// // log.info("JML DATA CXUNIT : {}", lstMap.size()); +// if (!lstMap.isEmpty()) { +// for (Map map : lstMap) { +// if (map.get("tipe").toString().equals("FEEDER") ) { +// ResponsePenyulang response = getPenyulangUpdateEndPoint(map); +// log.info("JML DATA PENYULANG : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataPenyulangKolektif = +// SimpanDataPenyulangKolektif(map.get("unitid").toString(), +// response.getMember()); +// if (mapSimpanDataPenyulangKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA PENYULANG : {}", mapSimpanDataPenyulangKolektif); +// } +// } +// } +// } +// } +// } + +// private List> getDataSiapAmbil() { +// List> lstMap = penyulangDao.getAmbilDataPenyulang(); +// return lstMap; +// } + +// private ResponsePenyulang getPenyulangUpdateEndPoint (Map +// map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponsePenyulang response = new ResponsePenyulang(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description, +// location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec{assetattrid,alnvalue,numvalue,measureunitid},location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy{parent}&oslc.where=status="OPERATING" +// and cxclassificationdesc="MVCable 20 kV" and +// apkt_number!="NULL"&ignorecollectionref=1&oslc.pageSize=10&lean=1&collectioncount=1"; +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,endmeasure&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"MVCable 20 kV\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = +// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}"; +// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit", +// mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponsePenyulang.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET PENYULANG : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private Map SimpanDataPenyulangKolektif(String unitid, +// List lstPenyulang){ +// Map mapResult = new HashMap<>(); +// mapResult = penyulangDao.SimpanDataPenyulangKolektif(unitid, lstPenyulang); +// return mapResult; +// } + +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/scheduling/Maximo/JobGetTrafoUpdate.java b/src/main/java/org/sadigit/scheduling/Maximo/JobGetTrafoUpdate.java new file mode 100644 index 0000000..160f27d --- /dev/null +++ b/src/main/java/org/sadigit/scheduling/Maximo/JobGetTrafoUpdate.java @@ -0,0 +1,135 @@ +// package org.sadigit.scheduling.Maximo; + +// import com.google.gson.Gson; +// import com.google.gson.GsonBuilder; +// import +// com.iconpln.schedulerintegmaximoupdate.Interceptor.AuthenticationInterceptor; +// import com.iconpln.schedulerintegmaximoupdate.dao.TrafoDao; +// import com.iconpln.schedulerintegmaximoupdate.model.dto.DataTrafo; +// import com.iconpln.schedulerintegmaximoupdate.model.payload.ResponseTrafo; +// import lombok.extern.slf4j.Slf4j; +// import org.springframework.beans.factory.annotation.Autowired; +// import org.springframework.beans.factory.annotation.Value; +// import org.springframework.http.HttpEntity; +// import org.springframework.http.HttpMethod; +// import org.springframework.http.ResponseEntity; +// import org.springframework.http.client.ClientHttpRequestInterceptor; +// import org.springframework.http.converter.StringHttpMessageConverter; +// import +// org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +// import org.springframework.stereotype.Component; +// import org.springframework.web.client.RestTemplate; + +// import java.io.IOException; +// import java.text.SimpleDateFormat; +// import java.util.*; + +// @Slf4j +// @Component("jobGetTrafoUpdate") +// public class JobGetTrafoUpdate { + +// @Value("${url.api.maximo1}") +// private String URL; + +// @Value("${auth.api.maximo}") +// private String AUTH; + +// // @Value("${content.api.maximo}") +// // private String CONTENT; + +// @Autowired +// private TrafoDao trafoDao; + +// public void executeGetTrafoUpdate() throws IOException { +// log.info("--- JOB GET TRAFO ---"); +// List> lstMap = getDataSiapAmbil(); +// // log.info("JML DATA CXUNIT : {}", lstMap.size()); +// if (!lstMap.isEmpty()) { +// for (Map map : lstMap) { +// if (map.get("tipe").toString().equals("TRAFO") ) { +// ResponseTrafo response = getTrafoUpdateEndPoint(map); +// log.info("JML DATA TRAFO : {}", response.getMember().size()); +// log.info("CXUNIT : {}", map.get("unitid").toString()); +// log.info("TIPE : {}", map.get("tipe").toString()); + +// if (response.getMember() != null) { +// Map mapSimpanDataTrafoKolektif = +// SimpanDataTrafoKolektif(map.get("unitid").toString(), response.getMember()); +// if (mapSimpanDataTrafoKolektif.get("return").equals("1")) { +// log.info("SIMPAN DATA TRAFO : {}", mapSimpanDataTrafoKolektif); +// } +// } +// } +// } +// } +// } + +// private List> getDataSiapAmbil() { +// List> lstMap = trafoDao.getAmbilDataTrafo(); +// return lstMap; +// } + +// private ResponseTrafo getTrafoUpdateEndPoint (Map map) { +// RestTemplate restTemplate = new RestTemplate(); +// Map mapParams = new HashMap<>(); +// ResponseTrafo response = new ResponseTrafo(); +// ResponseEntity res = null; +// try { +// ClientHttpRequestInterceptor authenticationInterceptor = new +// AuthenticationInterceptor(AUTH); +// restTemplate.setInterceptors(Collections.singletonList(authenticationInterceptor)); +// restTemplate.getMessageConverters().add(new +// MappingJackson2HttpMessageConverter()); +// restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); + +// Date date = new Date(); +// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and +// cxunit=\"{unitid}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// // String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and +// changedate>\"{currentdate}\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// String url = URL + +// "os/mxasset_test?oslc.select=assetnum,apkt_numbers,description,location--assetlocation,tujdnumber,cxunit,cxclassificationdesc,installvendor,installdate,actualoprdate,changedate,assetspec,location.saddresscode,locations{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit},lochierarchy,manufacturer&oslc.where=status=\"OPERATING\" +// and cxclassificationdesc=\"Trafo\" and cxunit=\"{unitid}\" and +// changedate>\"2021-08-05\"&ignorecollectionref=1&lean=1&collectioncount=1"; +// Object mapValue = +// "{serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit}"; +// mapParams.put("serviceaddress.longitudex,serviceaddress.latitudey,serviceaddress.FORMATTEDADDRESS,cxunit", +// mapValue); +// mapParams.put("unitid", map.get("unitid").toString()); +// mapParams.put("currentdate", formatter.format(date)); +// // Map mapParam = new HashMap(); +// // res = restTemplate.getForEntity(url, null, ResponseTrafo.class, mapParam); +// res = restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, +// ResponseTrafo.class, mapParams); +// // log.info("res : {}", res); + +// Gson gson = new GsonBuilder().setPrettyPrinting().create(); +// String jsonifyresponse = gson.toJson(res.getBody()); +// log.info("RESPONSE : {}", jsonifyresponse); + +// } catch (Exception ex) { +// ex.printStackTrace(); +// log.error("ERROR GET TRAFO : {}", ex); +// // response.setRc("01"); +// response.setMessage("Error, "+ex.getMessage()); +// response.setMember(null); +// return response; +// } + +// return res.getBody(); +// } + +// private Map SimpanDataTrafoKolektif(String unitid, +// List lstTrafo){ +// Map mapResult = new HashMap<>(); +// mapResult = trafoDao.SimpanDataTrafoKolektif(unitid, lstTrafo); +// return mapResult; +// } + +// } \ No newline at end of file diff --git a/src/main/java/org/sadigit/service/api/v1/GetDataPerUnitService.java b/src/main/java/org/sadigit/service/api/v1/GetDataPerUnitService.java new file mode 100644 index 0000000..61d1731 --- /dev/null +++ b/src/main/java/org/sadigit/service/api/v1/GetDataPerUnitService.java @@ -0,0 +1,25 @@ +package org.sadigit.service.api.v1; + +import java.util.List; +import java.util.stream.Collectors; + +import org.sadigit.entity.Keluhan; +import org.sadigit.mapper.KeluhanMapper; +import org.sadigit.mapper.PenggunaMapper; +import org.sadigit.model.dto.KeluhantDto; +import org.sadigit.repository.KeluhanRepository; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.RequiredArgsConstructor; + +@ApplicationScoped +@RequiredArgsConstructor +public class GetDataPerUnitService { + private final KeluhanRepository keluhanRepository; + + public List getDataPerUnit(Long unitId, String startDate, String endDate) { + return keluhanRepository.findKeluhanByUnitId(unitId, startDate, endDate).stream() + .map(KeluhanMapper::entityToDTO) + .collect(Collectors.toList()); + } +} diff --git a/src/main/java/org/sadigit/service/api/v1/IssueTypeService.java b/src/main/java/org/sadigit/service/api/v1/IssueTypeService.java new file mode 100644 index 0000000..126e919 --- /dev/null +++ b/src/main/java/org/sadigit/service/api/v1/IssueTypeService.java @@ -0,0 +1,31 @@ +package org.sadigit.service.api.v1; + +import java.util.List; +import java.util.stream.Collectors; + +import org.sadigit.mapper.IssueTypeMapper; +import org.sadigit.mapper.MasterIssueTypeMapper; +import org.sadigit.model.dto.IssueTypeDto; +import org.sadigit.model.dto.MasterIssueTypeDto; +import org.sadigit.repository.IssueTypeRepository; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@ApplicationScoped +@RequiredArgsConstructor +@Slf4j +public class IssueTypeService { + private final IssueTypeRepository issueTypeRepository; + + public List findAll() { + return issueTypeRepository.findIssueTypeKeluhan().stream().map(MasterIssueTypeMapper::entityToDTO) + .collect(Collectors.toList()); + } + + public List findActive() { + return issueTypeRepository.findIssueTypeActiveKeluhan().stream().map(IssueTypeMapper::entityToDTO) + .collect(Collectors.toList()); + } +} diff --git a/src/main/java/org/sadigit/service/api/v1/LoginService.java b/src/main/java/org/sadigit/service/api/v1/LoginService.java new file mode 100644 index 0000000..e6039ce --- /dev/null +++ b/src/main/java/org/sadigit/service/api/v1/LoginService.java @@ -0,0 +1,37 @@ +package org.sadigit.service.api.v1; + +import java.util.List; + +import org.sadigit.entity.AppUser; +import org.sadigit.mapper.AppUserMapper; +import org.sadigit.model.dto.AppUserDto; +import org.sadigit.repository.AppUserRepository; +import org.sadigit.util.Checks; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@ApplicationScoped +@RequiredArgsConstructor +@Slf4j +public class LoginService { + private final AppUserRepository appUserRepository; + + AppUserDto appUser; + + public List auth(String username, String password) { + log.info("auth password : {}", password); + // find appuser by username + Checks.isTrues(appUserRepository.findByUsername(username) != null, + "DATA TIDAK DITEMUKAN / USER SUDAH TIDAK ACTIVE", "1"); + + // find user by username and password + appUser = AppUserMapper.entityToDTO(appUserRepository.findByUsernameAndPassword(username, password)); + + Checks.isTrues(appUser != null, "PASSWORD TIDAK SESUAI", "99"); + + return List.of(appUser); + + } +} diff --git a/src/main/java/org/sadigit/service/api/v1/PenggunaService.java b/src/main/java/org/sadigit/service/api/v1/PenggunaService.java new file mode 100644 index 0000000..39d879f --- /dev/null +++ b/src/main/java/org/sadigit/service/api/v1/PenggunaService.java @@ -0,0 +1,34 @@ +package org.sadigit.service.api.v1; + +import java.util.List; +import java.util.stream.Collectors; + +import org.sadigit.entity.AppUser; +import org.sadigit.mapper.AppUserMapper; +import org.sadigit.mapper.PenggunaMapper; +import org.sadigit.model.dto.AppUserDto; +import org.sadigit.model.dto.PenggunaDto; +import org.sadigit.repository.AppUserRepository; +import org.sadigit.util.Checks; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@ApplicationScoped +@RequiredArgsConstructor +@Slf4j +public class PenggunaService { + private final AppUserRepository appUserRepository; + + PenggunaDto pengguna; + + public List findDataPengguna(Long unitId, Long positionId) { + Checks.isTrues(appUserRepository.findByUnitIdAndPositionId(unitId, positionId) != null, + "DATA TIDAK DITEMUKAN", "1"); + + return appUserRepository.findByUnitIdAndPositionId(unitId, positionId).stream().map(PenggunaMapper::entityToDTO) + .collect(Collectors.toList()); + + } +} diff --git a/src/main/java/org/sadigit/service/api/v1/UnitService.java b/src/main/java/org/sadigit/service/api/v1/UnitService.java new file mode 100644 index 0000000..f0ec9aa --- /dev/null +++ b/src/main/java/org/sadigit/service/api/v1/UnitService.java @@ -0,0 +1,24 @@ +package org.sadigit.service.api.v1; + +import java.util.List; +import java.util.stream.Collectors; + +import org.sadigit.entity.Unit; +import org.sadigit.mapper.PenggunaMapper; +import org.sadigit.model.dto.UnitDto; +import org.sadigit.repository.UnitRepository; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@ApplicationScoped +@RequiredArgsConstructor +@Slf4j +public class UnitService { + private final UnitRepository unitRepository; + + public List findByUnitTypeId(Long unitTypeId) { + return unitRepository.findByUnitTypeId(unitTypeId); + } +} diff --git a/src/main/java/org/sadigit/util/AppException.java b/src/main/java/org/sadigit/util/AppException.java new file mode 100644 index 0000000..c026500 --- /dev/null +++ b/src/main/java/org/sadigit/util/AppException.java @@ -0,0 +1,68 @@ +package org.sadigit.util; + +public class AppException extends RuntimeException { + private int status = 400; + private String rc = "99"; + private Object data; + + public AppException() { + super("Something bad happen on app server please try again later, contact support for this error"); + } + + public AppException(String message) { + super(message); + } + + public AppException(String message, Object data) { + super(message); + this.data = data; + } + + public AppException(String message, int status) { + super(message); + this.status = status; + } + + public AppException(String message, String rc) { + super(message); + this.rc = rc; + } + + public AppException(String message, int status, Object data) { + super(message); + this.status = status; + this.data = data; + } + + public static AppException create(String message) { + return new AppException(message); + } + + public static AppException create(String message, int status) { + return new AppException(message, status); + } + + public static AppException create(String message, Object data) { + return new AppException(message, data); + } + + public static AppException create(String message, int status, Object data) { + return new AppException(message, status, data); + } + + public void setStatus(int status) { + this.status = status; + } + + public void setData(Object data) { + this.data = data; + } + + public void setRc(String rc) { + this.rc = rc; + } + + public String getRc() { + return rc; + } +} diff --git a/src/main/java/org/sadigit/util/AppUtil.java b/src/main/java/org/sadigit/util/AppUtil.java new file mode 100644 index 0000000..6a588e5 --- /dev/null +++ b/src/main/java/org/sadigit/util/AppUtil.java @@ -0,0 +1,57 @@ +package org.sadigit.util; + +import lombok.extern.slf4j.Slf4j; + +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.*; + + +@Slf4j +public class AppUtil { + + public static List> convertResultsetToListStr(ResultSet rs) { + List> lst = new ArrayList>(); + try { + ResultSetMetaData rsmd = rs.getMetaData(); + int colCount = rsmd.getColumnCount(); + String value = ""; + + while (rs.next()) { + HashMap map = new HashMap(); + for (int i = 1; i <= colCount; i++) { + try { + if (rs.getObject(i).toString().equals("") || rs.getObject(i).toString().equals("null")) { + value = ""; + } else { + value = rs.getObject(i).toString(); + } + } catch (Exception e) { + value = ""; + } + map.put(rsmd.getColumnName(i).toLowerCase(), value); + } + lst.add(map); + } + + } catch (Exception ex) { + log.info("AppUtil :" + ex.getMessage()); + } + + return lst; + } + + public static Double doubleNVL(Double value) { + return Optional.ofNullable(value).orElse(Double.NaN); + } + + public static BigDecimal BigDecimalNVL(BigDecimal value) { + return Optional.ofNullable(value).orElse(null); + } + + public static int intNVL(int value) { + return Optional.ofNullable(value).orElse(Integer.BYTES); + } + +} diff --git a/src/main/java/org/sadigit/util/Checks.java b/src/main/java/org/sadigit/util/Checks.java new file mode 100644 index 0000000..44df44a --- /dev/null +++ b/src/main/java/org/sadigit/util/Checks.java @@ -0,0 +1,70 @@ +package org.sadigit.util; + +import org.apache.commons.lang3.StringUtils; + +public class Checks { + public static void isTrues(boolean param, String message, String rc) { + if (!param) + throw newE(message, rc); + } + + public static void isTrue(boolean param, String message, int status) { + if (!param) + throw newE(message, status); + } + + public static void isTrue(boolean param, U exception) { + if (!param) + throw exception; + } + + public static void nonNull(Object param, String message) { + if (param == null) + throw newE(message); + } + + public static void nonNull(Object param, String message, int status) { + if (param == null) + throw newE(message, status); + } + + public static void nonNull(Object param, U exception) { + if (param == null) + throw exception; + } + + public static void hasText(CharSequence param, String message) { + if (StringUtils.isBlank(param)) + throw newE(message); + } + + public static void hasText(CharSequence param, String message, int status) { + if (StringUtils.isBlank(param)) + throw newE(message, status); + } + + public static void hasText(CharSequence param, U exception) { + if (StringUtils.isBlank(param)) + throw exception; + } + + public static void throwE(String message) { + throw newE(message); + } + + public static AppException newE(String message) { + return new AppException(message); + } + + public static AppException newE(String message, int status) { + return new AppException(message, status); + } + + public static AppException newE(String message, String rc) { + return new AppException(message, rc); + } + + public static AppException newE(String message, int status, Object data) { + return new AppException(message, status, data); + } +} diff --git a/src/main/java/org/sadigit/util/validator/ValidDateFormat.java b/src/main/java/org/sadigit/util/validator/ValidDateFormat.java new file mode 100644 index 0000000..f5abe1f --- /dev/null +++ b/src/main/java/org/sadigit/util/validator/ValidDateFormat.java @@ -0,0 +1,29 @@ +package org.sadigit.util.validator; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.sadigit.util.validator.impl.ValidDateFormatValidator; + +import jakarta.validation.Constraint; +import jakarta.validation.Payload; + +/** + * Annotation for checking if String is in correct date format (yyyy-MM-dd HH:mm:ss) + * + * @author Tias Mardiansyah + * + */ +@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +@Target({ + ElementType.FIELD, +}) +@Constraint(validatedBy = ValidDateFormatValidator.class) +public @interface ValidDateFormat { + String message() default "Format tanggal harus mengikuti format berikut (yyyy-MM-dd HH:mm:ss)"; + + Class[] payload() default {}; + + Class[] groups() default {}; +} diff --git a/src/main/java/org/sadigit/util/validator/impl/ValidDateFormatValidator.java b/src/main/java/org/sadigit/util/validator/impl/ValidDateFormatValidator.java new file mode 100644 index 0000000..451920a --- /dev/null +++ b/src/main/java/org/sadigit/util/validator/impl/ValidDateFormatValidator.java @@ -0,0 +1,32 @@ +package org.sadigit.util.validator.impl; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +import org.sadigit.util.validator.ValidDateFormat; + +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ValidDateFormatValidator implements ConstraintValidator { + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + + try { + DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime.parse(value, inputFormatter); + } catch (Exception e) { + log.error("error parsing, reason : {}", e.getMessage()); + context.buildConstraintViolationWithTemplate("Terjadi kesalahan dalam format tanggal, pastikan format tanggal sesuai (yyyy-MM-dd HH:mm:ss)") + .addConstraintViolation(); + return false; + } + + return true; + + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..73a6799 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,7 @@ +quarkus.native.resources.includes=mock-data/** + +# Database configuration +quarkus.datasource.username=adminapkt +quarkus.datasource.password=adm-apkt@2024! +quarkus.datasource.jdbc.url=jdbc:postgresql://10.1.50.173:30257/apkt?sslmode=require +quarkus.hibernate-orm.log.sql=true \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p00-get-user.json b/src/main/resources/mock-data/endpoint-v1/p00-get-user.json new file mode 100644 index 0000000..6f3f40b --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p00-get-user.json @@ -0,0 +1,231 @@ +{ + "message": "SUKSES", + "data": [ + { + "nip": "08734", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 170, + "employeename": "Iskandar", + "username": "iskandar" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 1377, + "employeename": "DEDI HERYANTO", + "username": "dell" + }, + { + "nip": "123456", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 2534, + "employeename": "Fadjar Permana", + "username": "utha" + }, + { + "nip": "0", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 2805, + "employeename": "Bayu Fajar Nugraha", + "username": "bayu" + }, + { + "nip": "0", + "positionid": 1, + "roleid": 99, + "unitid": 2, + "userid": 2805, + "employeename": "Bayu Fajar Nugraha", + "username": "bayu" + }, + { + "nip": "12345", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 2584, + "employeename": "Danang Wira", + "username": "danang.wira" + }, + { + "nip": "123456", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 5824, + "employeename": "ADMIN - APKT", + "username": "eka.priya" + }, + { + "nip": "123456", + "positionid": 1, + "roleid": 21, + "unitid": 2, + "userid": 5824, + "employeename": "ADMIN - APKT", + "username": "eka.priya" + }, + { + "nip": "43456", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 11124, + "employeename": "zainul OM Lapangan", + "username": "zainul" + }, + { + "nip": "123456", + "positionid": 1, + "roleid": 21, + "unitid": 2, + "userid": 10794, + "employeename": "M Zen Falahuddin", + "username": "zen" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 10324, + "employeename": "Misno", + "username": "misno" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 10324, + "employeename": "Misno", + "username": "misno" + }, + { + "nip": "0", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 18430, + "employeename": "taufik arifani", + "username": "taufik" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 99, + "unitid": 2, + "userid": 24697, + "employeename": "SINGGIH CP", + "username": "singgih" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 24697, + "employeename": "SINGGIH CP", + "username": "singgih" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 26174, + "employeename": "YUKE RIFAYANI", + "username": "YUKE" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 25700, + "employeename": "ARIP.FAOZI", + "username": "ARIP.FAOZI" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 99, + "unitid": 2, + "userid": 25700, + "employeename": "ARIP.FAOZI", + "username": "ARIP.FAOZI" + }, + { + "nip": "123321", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 26054, + "employeename": "FTQA ADMIN", + "username": "SSQA.ADMIN" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 26173, + "employeename": "RATIH NOVIKA SARI", + "username": "RATIH.SARI" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 25533, + "employeename": "RANGGA WIJAYA", + "username": "RANGGA.WIJAYA" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 99, + "unitid": 2, + "userid": 85811, + "employeename": "AMARUDIN", + "username": "AMARUDIN" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 85811, + "employeename": "AMARUDIN", + "username": "AMARUDIN" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 99, + "unitid": 2, + "userid": 89486, + "employeename": "Aprianto Sudibyo", + "username": "aprianto.s" + }, + { + "nip": "123", + "positionid": 1, + "roleid": 1, + "unitid": 2, + "userid": 89486, + "employeename": "Aprianto Sudibyo", + "username": "aprianto.s" + } + ], + "rc": "0" + } \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p00-login.json b/src/main/resources/mock-data/endpoint-v1/p00-login.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p01-get-data-per-unit.json b/src/main/resources/mock-data/endpoint-v1/p01-get-data-per-unit.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p02-get-data-per-petugas.json b/src/main/resources/mock-data/endpoint-v1/p02-get-data-per-petugas.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p03-get-penjelasan-bidang.json b/src/main/resources/mock-data/endpoint-v1/p03-get-penjelasan-bidang.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p04-set-petugas-bidang.json b/src/main/resources/mock-data/endpoint-v1/p04-set-petugas-bidang.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p05-set-alih-unit.json b/src/main/resources/mock-data/endpoint-v1/p05-set-alih-unit.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p06-set-alih-bidang.json b/src/main/resources/mock-data/endpoint-v1/p06-set-alih-bidang.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p07-set-penjelasan-bidang.json b/src/main/resources/mock-data/endpoint-v1/p07-set-penjelasan-bidang.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p08-set-konfirmasi.json b/src/main/resources/mock-data/endpoint-v1/p08-set-konfirmasi.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p09-set-selesai.json b/src/main/resources/mock-data/endpoint-v1/p09-set-selesai.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p10-set-batal.json b/src/main/resources/mock-data/endpoint-v1/p10-set-batal.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p11-get-histruntask.json b/src/main/resources/mock-data/endpoint-v1/p11-get-histruntask.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p12-get-fungsi.json b/src/main/resources/mock-data/endpoint-v1/p12-get-fungsi.json new file mode 100644 index 0000000..c158f65 --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p12-get-fungsi.json @@ -0,0 +1,16 @@ +{ + "message": "SUKSES", + "data": [ + { + "bidangunitcode": "SPV.CC", + "bidangunitid": 127122, + "bidangunitname": "Fungsi SPV CC" + }, + { + "bidangunitcode": "SPV.CC", + "bidangunitid": 127122, + "bidangunitname": "Fungsi SPV CC" + } + ], + "rc": "00" + } \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p13-get-master-issue-type.json b/src/main/resources/mock-data/endpoint-v1/p13-get-master-issue-type.json new file mode 100644 index 0000000..a7fe7ba --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p13-get-master-issue-type.json @@ -0,0 +1,156 @@ +{ + "message": "SUKSES", + "data": [ + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 334, + "issuetypename": "URGENT", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 41, + "issuetypename": "Pasang Baru (PB)", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 42, + "issuetypename": "Perubahan Daya (PD)", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 43, + "issuetypename": "Penyambungan Sementara (PS)", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 44, + "issuetypename": "Cater", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 45, + "issuetypename": "Tagihan Listrik dan Token ", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 46, + "issuetypename": "Pemutusan Penyambungan (Tusbung)", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 47, + "issuetypename": "APP", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 48, + "issuetypename": "Informasi", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 49, + "issuetypename": "Perubahan Data", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 50, + "issuetypename": "Integritas", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 51, + "issuetypename": "Program Konversi Kompor Induksi", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 52, + "issuetypename": "EV Home Charging", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 4, + "issuetypename": "PDPB", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 5, + "issuetypename": "Tusbung", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 6, + "issuetypename": "Lain-Lain", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 23, + "issuetypename": "Cater", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 24, + "issuetypename": "Pemakaian PTL Tidak Syah", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 25, + "issuetypename": "Instalasi Listrik", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 26, + "issuetypename": "Rekening", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 27, + "issuetypename": "Mutu dan Keandalan", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 28, + "issuetypename": "Invoice", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 29, + "issuetypename": "Non Transaksi", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 30, + "issuetypename": "Prabayar", + "projectid": 2 + }, + { + "jenis_pengaduan": "KELUHAN", + "issuetypeid": 32, + "issuetypename": "Calo atau Suap", + "projectid": 2 + } + ], + "rc": "00" +} \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p14-get-unit.json b/src/main/resources/mock-data/endpoint-v1/p14-get-unit.json new file mode 100644 index 0000000..b00a807 --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p14-get-unit.json @@ -0,0 +1,20 @@ +{ + "message": "SUKSES", + "data": [ + { + "unit_jaringan": null, + "unitname": "PT. PLN (Persero) Kantor Pusat", + "unitid": -1, + "unittypeid": 1, + "unitparent": null + }, + { + "unit_jaringan": null, + "unitname": "PT. PLN (Persero)", + "unitid": 1, + "unittypeid": 1, + "unitparent": null + } + ], + "rc": "00" +} \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p15-get-jml-keluhan.json b/src/main/resources/mock-data/endpoint-v1/p15-get-jml-keluhan.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p16-get-bidang-member.json b/src/main/resources/mock-data/endpoint-v1/p16-get-bidang-member.json new file mode 100644 index 0000000..6310651 --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p16-get-bidang-member.json @@ -0,0 +1,20 @@ +{ + "message": "SUKSES", + "data": [ + { + "appuserid": 90275, + "daftar_user": "12712.JOHANES", + "bidangunitcode": "SPV.CC", + "bidangunitid": 127122, + "bidangunitname": "Fungsi SPV CC" + }, + { + "appuserid": 90574, + "daftar_user": "12712.WANDRA", + "bidangunitcode": "SPV.CC", + "bidangunitid": 127122, + "bidangunitname": "Fungsi SPV CC" + } + ], + "rc": "00" +} \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p17-validasi-email.json b/src/main/resources/mock-data/endpoint-v1/p17-validasi-email.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v1/p18-issue-type.json b/src/main/resources/mock-data/endpoint-v1/p18-issue-type.json new file mode 100644 index 0000000..aae3a15 --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p18-issue-type.json @@ -0,0 +1,54 @@ +{ + "message": "SUKSES", + "data": [ + { + "issuetypeid": 41, + "issuetypename": "Pasang Baru (PB)" + }, + { + "issuetypeid": 42, + "issuetypename": "Perubahan Daya (PD)" + }, + { + "issuetypeid": 43, + "issuetypename": "Penyambungan Sementara (PS)" + }, + { + "issuetypeid": 44, + "issuetypename": "Cater" + }, + { + "issuetypeid": 45, + "issuetypename": "Tagihan Listrik dan Token " + }, + { + "issuetypeid": 46, + "issuetypename": "Pemutusan Penyambungan (Tusbung)" + }, + { + "issuetypeid": 47, + "issuetypename": "APP" + }, + { + "issuetypeid": 48, + "issuetypename": "Informasi" + }, + { + "issuetypeid": 49, + "issuetypename": "Perubahan Data" + }, + { + "issuetypeid": 50, + "issuetypename": "Integritas" + }, + { + "issuetypeid": 51, + "issuetypename": "Program Konversi Kompor Induksi" + }, + { + "issuetypeid": 52, + "issuetypename": "EV Home Charging" + } + ], + "rc": "00" +} \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v1/p19-sub-issue-type.json b/src/main/resources/mock-data/endpoint-v1/p19-sub-issue-type.json new file mode 100644 index 0000000..3fb8928 --- /dev/null +++ b/src/main/resources/mock-data/endpoint-v1/p19-sub-issue-type.json @@ -0,0 +1,406 @@ +{ + "message": "SUKSES", + "data": [ + { + "subissuetypeid": 363, + "subissuetypename": "Belum bisa mengoperasikan", + "issuetypeid": 51 + }, + { + "subissuetypeid": 364, + "subissuetypename": "Geser Instalasi", + "issuetypeid": 51 + }, + { + "subissuetypeid": 365, + "subissuetypename": "Instalasi Bermasalah", + "issuetypeid": 51 + }, + { + "subissuetypeid": 366, + "subissuetypename": "MCB Turun / belum diganti", + "issuetypeid": 51 + }, + { + "subissuetypeid": 367, + "subissuetypename": "Bluetooth / LCD Mati / Blank", + "issuetypeid": 51 + }, + { + "subissuetypeid": 368, + "subissuetypename": "Gagal baca / QR Code Error", + "issuetypeid": 51 + }, + { + "subissuetypeid": 369, + "subissuetypename": "Kompor belum diterima", + "issuetypeid": 51 + }, + { + "subissuetypeid": 370, + "subissuetypename": "Utensil Rusak / Belum Diterima", + "issuetypeid": 51 + }, + { + "subissuetypeid": 371, + "subissuetypename": "Tagihan Listrik Naik", + "issuetypeid": 51 + }, + { + "subissuetypeid": 372, + "subissuetypename": "Kompor Rusak / Mati", + "issuetypeid": 51 + }, + { + "subissuetypeid": 373, + "subissuetypename": "Diskon Tambah Daya Bundling HCS", + "issuetypeid": 52 + }, + { + "subissuetypeid": 374, + "subissuetypename": "Proses Integrasi Charge.in", + "issuetypeid": 52 + }, + { + "subissuetypeid": 375, + "subissuetypename": "PB/PD Layanan Bundling HCS", + "issuetypeid": 52 + }, + { + "subissuetypeid": 376, + "subissuetypename": "Charger Tidak Berfungsi", + "issuetypeid": 52 + }, + { + "subissuetypeid": 377, + "subissuetypename": "Kendala Instalasi Home Charger", + "issuetypeid": 52 + }, + { + "subissuetypeid": 378, + "subissuetypename": "Reschedule Jadwal Pemasangan", + "issuetypeid": 52 + }, + { + "subissuetypeid": 379, + "subissuetypename": "Tidak Mendapatkan Diskon Tarif", + "issuetypeid": 52 + }, + { + "subissuetypeid": 380, + "subissuetypename": "Umum", + "issuetypeid": 52 + }, + { + "subissuetypeid": 361, + "subissuetypename": "Layanan Kompor Induksi", + "issuetypeid": 99048 + }, + { + "subissuetypeid": 301, + "subissuetypename": "Proses PB, belum ada realisasinya", + "issuetypeid": 41 + }, + { + "subissuetypeid": 302, + "subissuetypename": "Restitusi", + "issuetypeid": 41 + }, + { + "subissuetypeid": 303, + "subissuetypename": "Proses PD/TD, belum ada realisasinya ", + "issuetypeid": 42 + }, + { + "subissuetypeid": 304, + "subissuetypename": "Daya Terpasang Tidak Sesuai Daya Kontrak", + "issuetypeid": 42 + }, + { + "subissuetypeid": 305, + "subissuetypename": "Restitusi", + "issuetypeid": 42 + }, + { + "subissuetypeid": 306, + "subissuetypename": "Proses PS, belum ada realisasinya ", + "issuetypeid": 43 + }, + { + "subissuetypeid": 307, + "subissuetypename": "Restitusi", + "issuetypeid": 43 + }, + { + "subissuetypeid": 308, + "subissuetypename": "Keakuratan hasil catat meter ", + "issuetypeid": 44 + }, + { + "subissuetypeid": 309, + "subissuetypename": "Lebih Tagih", + "issuetypeid": 44 + }, + { + "subissuetypeid": 310, + "subissuetypename": "Petugas Cater Jarang Datang", + "issuetypeid": 44 + }, + { + "subissuetypeid": 311, + "subissuetypename": "Kurang Tagih", + "issuetypeid": 44 + }, + { + "subissuetypeid": 312, + "subissuetypename": "Koreksi Rekening", + "issuetypeid": 45 + }, + { + "subissuetypeid": 313, + "subissuetypename": "Rekening belum terbit ", + "issuetypeid": 45 + }, + { + "subissuetypeid": 314, + "subissuetypename": "Gagal Bayar", + "issuetypeid": 45 + }, + { + "subissuetypeid": 315, + "subissuetypename": "Salah membayar Rekening", + "issuetypeid": 45 + }, + { + "subissuetypeid": 316, + "subissuetypename": "Mengajukan Berlanganan Invoice ", + "issuetypeid": 45 + }, + { + "subissuetypeid": 317, + "subissuetypename": "Restitusi", + "issuetypeid": 45 + }, + { + "subissuetypeid": 318, + "subissuetypename": "Token tidak terbit", + "issuetypeid": 45 + }, + { + "subissuetypeid": 319, + "subissuetypename": "Konversi sisa token ", + "issuetypeid": 45 + }, + { + "subissuetypeid": 320, + "subissuetypename": "Token Expired", + "issuetypeid": 45 + }, + { + "subissuetypeid": 321, + "subissuetypename": "Gagal Input Token", + "issuetypeid": 45 + }, + { + "subissuetypeid": 322, + "subissuetypename": "Tidak bisa beli Token ", + "issuetypeid": 45 + }, + { + "subissuetypeid": 323, + "subissuetypename": "Token sudah dimasukan, namun Kwh tidak bertambah", + "issuetypeid": 45 + }, + { + "subissuetypeid": 324, + "subissuetypename": "Salah Putus ", + "issuetypeid": 46 + }, + { + "subissuetypeid": 325, + "subissuetypename": "Sudah Bayar Belum Disambung", + "issuetypeid": 46 + }, + { + "subissuetypeid": 326, + "subissuetypename": "Alat Ukur Paskabayar tidak berfungsi ", + "issuetypeid": 47 + }, + { + "subissuetypeid": 327, + "subissuetypename": "Alat Ukur Prabayar tidak berfungsi ", + "issuetypeid": 47 + }, + { + "subissuetypeid": 328, + "subissuetypename": "Alat Pembatas tidak berfungsi ", + "issuetypeid": 47 + }, + { + "subissuetypeid": 329, + "subissuetypename": "Instalasi / Wiring tidak berfungsi", + "issuetypeid": 47 + }, + { + "subissuetypeid": 330, + "subissuetypename": "Keypad/lampu indikator pada APP tidak berfungsi", + "issuetypeid": 47 + }, + { + "subissuetypeid": 331, + "subissuetypename": "Pelanggan berkeberatan dialihkan ke APP Prabayar", + "issuetypeid": 47 + }, + { + "subissuetypeid": 332, + "subissuetypename": "Proses Migrasi, belum ada realisasinya ", + "issuetypeid": 47 + }, + { + "subissuetypeid": 333, + "subissuetypename": "PB ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 334, + "subissuetypename": "PD", + "issuetypeid": 48 + }, + { + "subissuetypeid": 335, + "subissuetypename": "PS", + "issuetypeid": 48 + }, + { + "subissuetypeid": 336, + "subissuetypename": "Tagihan Susulan", + "issuetypeid": 48 + }, + { + "subissuetypeid": 337, + "subissuetypename": "Tusbung", + "issuetypeid": 48 + }, + { + "subissuetypeid": 338, + "subissuetypename": "P2TL ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 339, + "subissuetypename": "Kondisi Jaringan Listrik ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 340, + "subissuetypename": "Cater ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 341, + "subissuetypename": "APP", + "issuetypeid": 48 + }, + { + "subissuetypeid": 342, + "subissuetypename": "Tagihan Listrik dan Token", + "issuetypeid": 48 + }, + { + "subissuetypeid": 343, + "subissuetypename": "Drop Tegangan ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 344, + "subissuetypename": "PTL Sering Padam ", + "issuetypeid": 48 + }, + { + "subissuetypeid": 345, + "subissuetypename": "Penanganan Gangguan dengan cara sambung langsung", + "issuetypeid": 48 + }, + { + "subissuetypeid": 346, + "subissuetypename": "Penanganan gangguan namun belum disertai penyegelan kembali", + "issuetypeid": 48 + }, + { + "subissuetypeid": 347, + "subissuetypename": "Stimulus / Subsidi Listrik", + "issuetypeid": 48 + }, + { + "subissuetypeid": 348, + "subissuetypename": "PJU", + "issuetypeid": 48 + }, + { + "subissuetypeid": 349, + "subissuetypename": "Umum", + "issuetypeid": 48 + }, + { + "subissuetypeid": 350, + "subissuetypename": "Ubah Nama", + "issuetypeid": 49 + }, + { + "subissuetypeid": 351, + "subissuetypename": "Ubah Alamat ", + "issuetypeid": 49 + }, + { + "subissuetypeid": 352, + "subissuetypename": "Ubah No Telp/NIK/NPWP ", + "issuetypeid": 49 + }, + { + "subissuetypeid": 353, + "subissuetypename": "Berhenti Berlangganan", + "issuetypeid": 49 + }, + { + "subissuetypeid": 354, + "subissuetypename": "Penggantian alamat email Invoice ", + "issuetypeid": 49 + }, + { + "subissuetypeid": 355, + "subissuetypename": "Proses Migrasi Data, belum ada realisasinya ", + "issuetypeid": 49 + }, + { + "subissuetypeid": 356, + "subissuetypename": "Penyesuaian UJL", + "issuetypeid": 49 + }, + { + "subissuetypeid": 357, + "subissuetypename": "Petugas kurang Sopan ", + "issuetypeid": 50 + }, + { + "subissuetypeid": 358, + "subissuetypename": "Petugas menawarkan Jasa (Calo )", + "issuetypeid": 50 + }, + { + "subissuetypeid": 359, + "subissuetypename": "Petugas Mengancam/Mengintimidasi", + "issuetypeid": 50 + }, + { + "subissuetypeid": 360, + "subissuetypename": "Petugas Meminta uang tambahan /Tip", + "issuetypeid": 50 + }, + { + "subissuetypeid": 362, + "subissuetypename": "Bantuan Pasang Baru Listrik / CSR", + "issuetypeid": 41 + } + ], + "rc": "00" + } \ No newline at end of file diff --git a/src/main/resources/mock-data/endpoint-v2/p018-set-penjelasan-bidang-v2.json b/src/main/resources/mock-data/endpoint-v2/p018-set-penjelasan-bidang-v2.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v2/p21-mutasi-kg.json b/src/main/resources/mock-data/endpoint-v2/p21-mutasi-kg.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mock-data/endpoint-v2/p22-send-listriqu.json b/src/main/resources/mock-data/endpoint-v2/p22-send-listriqu.json new file mode 100644 index 0000000..e69de29