From fedee5f4d9a33cc82e4269c5069910ea7c58811e Mon Sep 17 00:00:00 2001 From: GiuseppeS Date: Tue, 25 Feb 2025 17:28:18 +0100 Subject: [PATCH] Aggiunto supporto a wms beta --- .../Tomcat9__1__DBServer_.xml | 16 ++++++++ build/Jenkinsfile.groovy | 2 + .../controller/WMSGenericController.java | 41 +++++++++++-------- 3 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 .idea/runConfigurations/Tomcat9__1__DBServer_.xml diff --git a/.idea/runConfigurations/Tomcat9__1__DBServer_.xml b/.idea/runConfigurations/Tomcat9__1__DBServer_.xml new file mode 100644 index 0000000000..f6e823975f --- /dev/null +++ b/.idea/runConfigurations/Tomcat9__1__DBServer_.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/build/Jenkinsfile.groovy b/build/Jenkinsfile.groovy index 76d1586a1b..6072c624e5 100644 --- a/build/Jenkinsfile.groovy +++ b/build/Jenkinsfile.groovy @@ -49,6 +49,7 @@ pipeline { echo "Updating Tomcat9 from ${WORKSPACE}" powershell returnStdout: true, script: "build\\update_tomcat.ps1 -serviceName \"Tomcat9Backup\" -httpPort \"8082\" -updatedArtifactPath \"${WORKSPACE}\\ems-engine\\target\\ems-api.war\"" bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp' + bat 'curl -k https://devservices.studioml.it/ems-api/updateWMSApp?suffix=beta' } } } @@ -86,6 +87,7 @@ sudo /usr/bin/systemctl start tomcat9backup sleep 10''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/tomcat9backup/webapps', remoteDirectorySDF: false, removePrefix: 'ems-engine/target/', sourceFiles: 'ems-engine/target/*.war*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)]) bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp' + bat 'curl -k https://services.studioml.it/ems-api/updateWMSApp?suffix=beta' } } } diff --git a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java index f36707dfa0..cedb737fc0 100644 --- a/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java +++ b/ems-engine/src/main/java/it/integry/ems/retail/wms/generic/controller/WMSGenericController.java @@ -102,24 +102,34 @@ public class WMSGenericController { return ServiceRestResponse.createPositiveResponse(wmsGenericService.getPickingListFromBarcodeOrdine(codBarreBancale)); } - @RequestMapping(value = "updateWMSApp", method = RequestMethod.GET) - public ServiceRestResponse updateWMSApp() throws Exception { + @GetMapping(value = "updateWMSApp") + public ServiceRestResponse updateWMSApp(@RequestParam(required = false) String suffix) throws Exception { String baseDownloadUrl = "https://jnxuo98bbuecrmbkciijvpkg.file.core.windows.net/storage-ci/wms/"; String azureToken = "?sv=2022-11-02&ss=bf&srt=sco&sp=r&se=2030-11-04T17:45:57Z&st=2024-11-04T09:45:57Z&spr=https&sig=CGxbbC08xuvAz%2B6k2C6HDq6e9UGitb0lnbbsWeRG%2FiU%3D"; - String androidAppFilePath = Paths.get(UtilityDirs.getWebAppPath(), "wms", "android-release.apk").toString(); - HttpRestWrapper.downloadFile(baseDownloadUrl + "android-release.apk" + azureToken, androidAppFilePath); + if (UtilityString.isNullOrEmpty(suffix)) + suffix = ""; + else + suffix = "-" + suffix; - String androidAppVersionFilePath = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version.txt").toString(); - HttpRestWrapper.downloadFile(baseDownloadUrl + "version.txt" + azureToken, androidAppVersionFilePath); + String androidAppFilePath = Paths.get(UtilityDirs.getWebAppPath(), "wms", "android-release" + suffix + ".apk").toString(); + HttpRestWrapper.downloadFile(baseDownloadUrl + "android-release" + suffix + ".apk" + azureToken, androidAppFilePath); + + String androidAppVersionFilePath = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version" + suffix + ".txt").toString(); + HttpRestWrapper.downloadFile(baseDownloadUrl + "version" + suffix + ".txt" + azureToken, androidAppVersionFilePath); return ServiceRestResponse.createPositiveResponse(); } @GetMapping(value = EmsRestConstants.PATH_CHECK_LATEST_WMS_VERSION_JSON) - public WMSVersionDTO checkWMSLatestVersionJSON(HttpServletResponse response) throws Exception { - String wmsVersionFile = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version.txt").toString(); + public WMSVersionDTO checkWMSLatestVersionJSON(HttpServletResponse response, @RequestParam(required = false) String suffix) throws Exception { + if (UtilityString.isNullOrEmpty(suffix)) + suffix = ""; + else + suffix = "-" + suffix; + + String wmsVersionFile = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version" + suffix + ".txt").toString(); if (new File(wmsVersionFile).exists()) { List lines = UtilityString.splitStringToMultipleLine(IoUtils.readFileAsString(new File(wmsVersionFile))); @@ -138,14 +148,13 @@ public class WMSGenericController { WMSVersionDTO wmsVersionDTO = new WMSVersionDTO() .setLatestVersion(versionString) .setLatestVersionCode(versionCode) - .setUrl("/wms/android-release.apk"); + .setUrl("/wms/android-release" + suffix + ".apk"); - - if(lines.size() > 2) { + if (lines.size() > 2) { String forcedLine = lines.get(2); - if(forcedLine.startsWith("forced=")) { + if (forcedLine.startsWith("forced=")) { String forcedValue = forcedLine.replace("forced=", "").trim(); boolean forced = Boolean.parseBoolean(forcedValue); wmsVersionDTO.setForced(forced); @@ -155,8 +164,8 @@ public class WMSGenericController { return wmsVersionDTO; } else { - logger.warn("File version.txt non trovato"); - response.sendError(404, "File version.txt non trovato"); + logger.warn("File version" + suffix + ".txt non trovato"); + response.sendError(404, "File version" + suffix + ".txt non trovato"); return null; } } @@ -629,7 +638,7 @@ public class WMSGenericController { @RequestMapping(value = "wms/rientroMerce", method = RequestMethod.POST) public @ResponseBody ServiceRestResponse rientroMerce(@RequestParam(CommonConstants.PROFILE_DB) String profileDB, - @RequestBody RientroMerceRequestDTO rientroMerceRequestDTO) throws Exception { + @RequestBody RientroMerceRequestDTO rientroMerceRequestDTO) throws Exception { wmsGenericService.rientroMerce(rientroMerceRequestDTO); return ServiceRestResponse.createPositiveResponse(); @@ -638,7 +647,7 @@ public class WMSGenericController { @RequestMapping(value = "wms/updateTipoUL", method = RequestMethod.POST) public @ResponseBody ServiceRestResponse updateTipoUL(@RequestParam(CommonConstants.PROFILE_DB) String profileDB, - @RequestBody UpdateTipoULRequestDTO updateTipoULRequest) throws Exception { + @RequestBody UpdateTipoULRequestDTO updateTipoULRequest) throws Exception { wmsGenericService.cambiaTipoUL(updateTipoULRequest); return ServiceRestResponse.createPositiveResponse();