first commit

This commit is contained in:
2025-12-05 06:21:42 +07:00
commit a3c945a60a
119 changed files with 21757 additions and 0 deletions

59
services/bastmergedocx.sh Normal file
View File

@ -0,0 +1,59 @@
#res=$(curl -i -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord82/authentification/sync.sh 2>/dev/null)
cd /home/nodejs/wsproc/services/
p=/home/nodejs/wsproc/services/processbast.txt
if [ -f $p ];
then
echo "another process detected, Exiting.."
exit 1;
fi
echo "Starting Time : "`date` > $p
# printf "\n" >> $p
# ==== GET TOken
rm -rf r.json
curl -s -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord82/authentification/sync.sh > r.json
token=$(cat r.json | jq -r '.response.token') >> $p
# echo $token
# ==== Merge Docx
# curl -s -X POST -H "Content-Type: application/" -H 'x-token:'$token -d '{"idxjustification":"0"}' http://localhost:8083/PoiWord82/main/sync.sh/mergedoc > m.json
# idxjustification=$(echo "SELECT _idx FROM dbproc.tbl_justification where ismergedoc=0 order by _idx asc limit 1" | mysql -h172.17.12.71 -ussotcel -pssotcel#20i7)
idxbast=`mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -s -N -e "SELECT _idx FROM dbproc.vw_bast where ismergedoc=0 order by _idx asc limit 1"`
if [ -z "$idxbast" ]
then
echo "\$idxbast is empty"
else
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/mergedocbast" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "idx="""$idxbast > mbast.json
# cat mbast.json
filedocmerge=$(cat mbast.json | jq -r '.response.filedocmerge[0]')
# echo $filedocmerge
statuscode=$(cat mbast.json | jq -r '.metadata.code')
if [ "$statuscode" == 200 ]
then
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_bast set ismergedoc=1,mergedate=now(),filedoc='$filedocmerge' where _idx='$idxbast'"
fi
# # === Create Docx to PDF
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/docxtopdfbast" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "docxfilename=$filedocmerge" > mbast.json
# cat mbast.json
filedocxpdf=$(cat mbast.json | jq -r '.response.filepdf[0]')
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_bast set filepdf='$filedocxpdf' where _idx='$idxbast'"
cat mbast.json >> $p
printf "\n" >> $p
echo "End Time : "`date` >> $p
cat $p > lastprocessbast.txt
fi
rm -rf $p
rm -rf mbast.json

12
services/docxtopdf.sh Normal file
View File

@ -0,0 +1,12 @@
# ==== GET TOken
rm -rf r.json
curl -s -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord/authentification/sync.sh > r.json
token=$(cat r.json | jq -r '.response.token')
# === Create Docx to PDF
curl -s --location --request POST "http://localhost:8083/PoiWord/main/sync.sh/docxtopdf" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "docxfilename=justifikasi_999999_131248.docx" > m.json
cat m.json

3
services/lastprocess.txt Normal file
View File

@ -0,0 +1,3 @@
Starting Time : Thu Dec 4 11:19:31 JST 2025
{"metadata":{"code":200,"message":"OK"},"response":{"filepdf":["justifikasi_00001_1764814771305.pdf"]}}
End Time : Thu Dec 4 11:19:44 JST 2025

View File

@ -0,0 +1,3 @@
Starting Time : Tue Jan 23 13:48:11 JST 2024
{"metadata":{"code":200,"message":"OK"},"response":{"filepdf":["bast_999999_1705985291504.pdf"]}}
End Time : Tue Jan 23 13:48:13 JST 2024

View File

@ -0,0 +1,3 @@
Starting Time : Wed Jul 3 13:39:21 JST 2024
{"metadata":{"code":200,"message":"OK"},"response":{"filepdf":["procjustifikasi_999999_1719981561245.pdf"]}}
End Time : Wed Jul 3 13:39:23 JST 2024

58
services/mergedocx.sh Normal file
View File

@ -0,0 +1,58 @@
#res=$(curl -i -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord/authentification/sync.sh 2>/dev/null)
cd /home/nodejs/wsproc/services/
p=/home/nodejs/wsproc/services/process.txt
if [ -f $p ];
then
echo "another process detected, Exiting.."
exit 1;
fi
echo "Starting Time : "`date` > $p
# printf "\n" >> $p
# ==== GET TOken
rm -rf r.json
curl -s -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord82/authentification/sync.sh > r.json
token=$(cat r.json | jq -r '.response.token')
# echo $token
# ==== Merge Docx
# curl -s -X POST -H "Content-Type: application/" -H 'x-token:'$token -d '{"idxjustification":"0"}' http://localhost:8083/PoiWord/main/sync.sh/mergedoc > m.json
# idxjustification=$(echo "SELECT _idx FROM dbproc.tbl_justification where ismergedoc=0 order by _idx asc limit 1" | mysql -h172.17.12.71 -ussotcel -pssotcel#20i7)
idxjustification=`mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -s -N -e "SELECT _idx FROM dbproc.tbl_justification where ismergedoc=0 and status=2 order by _idx asc limit 1"`
if [ -z "$idxjustification" ]
then
echo "\$idxjustification is empty"
else
# == Merge Doc Original to dbproc
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/mergedoc" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "idxjustification=$idxjustification" > m.json
# cat m.json
filedocmerge=$(cat m.json | jq -r '.response.filedocmerge[0]')
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_justification set ismergedoc=1,filedocmerge='$filedocmerge' where _idx=$idxjustification"
# === Create Docx to PDF
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/docxtopdf" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "docxfilename=$filedocmerge" > m.json
filedocxpdf=$(cat m.json | jq -r '.response.filepdf[0]')
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_justification set filepdf='$filedocxpdf' where _idx=$idxjustification"
cat m.json >> $p
printf "\n" >> $p
echo "End Time : "`date` >> $p
cat $p > lastprocess.txt
fi
rm -rf $p
rm -rf *.json
# === check proc justification
sh procmergedocx.sh
# === check Bast
sh bastmergedocx.sh

71
services/procmergedocx.sh Normal file
View File

@ -0,0 +1,71 @@
#res=$(curl -i -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord82/authentification/sync.sh 2>/dev/null)
cd /home/nodejs/wsproc/services/
p=/home/nodejs/wsproc/services/processproc.txt
if [ -f $p ];
then
echo "another process detected, Exiting.."
exit 1;
fi
echo "Starting Time : "`date` > $p
# printf "\n" >> $p
# ==== GET TOken
rm -rf r.json
curl -s -X POST -H "Content-Type: application/json" -H 'x-username:proc' -H 'x-password:pr0c2022#tc3l' http://localhost:8083/PoiWord82/authentification/sync.sh > r.json
token=$(cat r.json | jq -r '.response.token') >> $p
# echo $token
# ==== Merge Docx
# curl -s -X POST -H "Content-Type: application/" -H 'x-token:'$token -d '{"idxjustification":"0"}' http://localhost:8083/PoiWord82/main/sync.sh/mergedoc > m.json
# idxjustification=$(echo "SELECT _idx FROM dbproc.tbl_justification where ismergedoc=0 order by _idx asc limit 1" | mysql -h172.17.12.71 -ussotcel -pssotcel#20i7)
idxsplit=`mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -s -N -e "SELECT concat(id,'|',idxfiledoc) idxcolumn FROM dbproc.vw_procjustificationdocmerge where status=2 and ismergedoc=0 order by id asc limit 1"`
# idxjustification=`mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -s -N -e "SELECT idxjustification FROM dbproc.vw_procjustificationdocmerge where ismergedoc=0 and status=2 order by _idx asc limit 1"`
# $idx=$(printf %s "$idxsplit" | awk -F '|' '/1/ {print $1}')
# $idxfiledoc=`echo $idxsplit | awk -F '|' '/1/ {print $2}'`
IFS='|' read -r -a array <<< $idxsplit
# echo ${array[0]} == id
# echo ${array[1]} == idfiledoc
# echo $idx
if [ -z "${array[0]}" ]
then
echo "\$idx is empty"
else
# == Merge Doc Original to dbproc
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/mergedocproc" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "idx="""${array[0]} > mproc.json
# cat mproc.json
filedocmerge=$(cat mproc.json | jq -r '.response.filedocmerge[0]')
# echo $filedocmerge
statuscode=$(cat mproc.json | jq -r '.metadata.code')
if [ "$statuscode" == 200 ]
then
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_procjustificationdoc set ismergedoc=1,filedocmerge='$filedocmerge' where _idx=${array[1]}"
fi
# # === Create Docx to PDF
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/docxtopdfproc" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "docxfilename=$filedocmerge" > mproc.json
# cat mproc.json
filedocxpdf=$(cat mproc.json | jq -r '.response.filepdf[0]')
mysql -h172.17.12.71 -ussotcel -pssotcel#20i7 -e "update dbproc.tbl_procjustificationdoc set isconvertpdf=1,pdffile='$filedocxpdf' where _idx=${array[1]}"
cat mproc.json >> $p
printf "\n" >> $p
echo "End Time : "`date` >> $p
cat $p > lastprocessproc.txt
fi
rm -rf $p
rm -rf mproc.json

1
services/r.json Normal file
View File

@ -0,0 +1 @@
{"metadata":{"code":200,"message":""},"response":{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJpdG5zcjA5QGdtYWlsLmNvbSIsImF1ZCI6WyJwcm9jIiwicHIwYzIwMjIjdGMzbCJdLCJpc3MiOiJ0ZWxrb21jZWwudGwiLCJleHAiOjE3NjQ4NTk4NjEsImlhdCI6MTc2NDg1NjI2MSwianRpIjoiYjBmMGEyYzUtMTc0NS00OTAyLWE0YTQtMzYxYTI2OGY4N2E3In0.ROj8NlWd4-2VuNQvfTdK9v1ct597mxoWLAP-QU_8KTM"}}

4
services/testdocx.sh Normal file
View File

@ -0,0 +1,4 @@
curl -s --location --request POST "http://localhost:8083/PoiWord82/main/sync.sh/mergedoc" \
--header "x-token: "$token \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "idxjustification=20"