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

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