diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java index 8a32cb867..b3da8834b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java @@ -27,4 +27,6 @@ public interface ManageAppService { JSONObject clientDetail(JSONObject device, String clientMoniker); + JSONObject getNewVersion(JSONObject device); + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java index a7e236816..9eefe8d1c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java @@ -13,6 +13,7 @@ import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.device.ManageDeviceSupport; import au.com.royalpay.payment.tools.device.support.DeviceRegister; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; @@ -109,5 +110,35 @@ public class ManageAppServiceImp implements ManageAppService { return manageDeviceTokenMapper.findByDevId(dev_id); } + @Override + public JSONObject getNewVersion(JSONObject device) { + String version = device.getString("version"); + String clientType = device.getString("client_type"); + manageDeviceSupport.findRegister(clientType); + String newAppVersion = PlatformEnvironment.getEnv().getNewVersion(clientType); + Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType); + String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType); + int update_type = 0;// 0:不更新 1:更新 2:强制更新 + String[] oldVersion = version.split("\\."); + String[] newVersion = newAppVersion.split("\\."); + JSONObject res = new JSONObject(); + res.put("update_content", updateContent); + for (int i = 0; i < newVersion.length; i++) { + if (Integer.valueOf(newVersion[i]) > Integer.valueOf(oldVersion[i])) { + update_type = 1; + if (isUpdate) { + update_type = 2; + } + res.put("update_type", update_type); + return res; + } else if (Integer.valueOf(newVersion[i]) < Integer.valueOf(oldVersion[i])) { + res.put("update_type", update_type); + return res; + } + } + res.put("update_type", update_type); + return res; + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java index 350644e4a..b3166184d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java @@ -75,6 +75,11 @@ public class ManageAppController { return manageAppService.clientDetail(device, clientMoniker); } + @RequestMapping(value = "/version", method = RequestMethod.GET) + public JSONObject getAppVersion(@ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device) { + return manageAppService.getNewVersion(device); + } + } diff --git a/src/main/ui/static/config/orgcommission/templates/org_commission_info.html b/src/main/ui/static/config/orgcommission/templates/org_commission_info.html index 166c0790b..2370ed76b 100644 --- a/src/main/ui/static/config/orgcommission/templates/org_commission_info.html +++ b/src/main/ui/static/config/orgcommission/templates/org_commission_info.html @@ -24,7 +24,6 @@

补充说明