From 4b2416c8ef44da23908aef63926cc850b6a5fe3f Mon Sep 17 00:00:00 2001 From: luoyang Date: Fri, 8 Mar 2019 11:49:36 +0800 Subject: [PATCH] =?UTF-8?q?commit=20=E7=99=BB=E5=BD=95=E3=80=81=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appclient/core/ManageAppService.java | 9 +++++++ .../core/impls/ManageAppServiceImp.java | 21 +++++++++++++++ .../appclient/web/ManageAppController.java | 26 +++++++++++++++++++ .../web/RetailValidationController.java | 5 +++- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java 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 new file mode 100644 index 000000000..05e8b1477 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/ManageAppService.java @@ -0,0 +1,9 @@ +package au.com.royalpay.payment.manage.appclient.core; + +import com.alibaba.fastjson.JSONObject; + +public interface ManageAppService { + + void updateDevToken(JSONObject device, String devToken); + +} 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 new file mode 100644 index 000000000..b3d1372c1 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/ManageAppServiceImp.java @@ -0,0 +1,21 @@ +package au.com.royalpay.payment.manage.appclient.core.impls; + +import au.com.royalpay.payment.manage.appclient.core.ManageAppService; +import au.com.royalpay.payment.tools.device.DeviceSupport; +import au.com.royalpay.payment.tools.device.ManageDeviceSupport; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class ManageAppServiceImp implements ManageAppService { + + @Resource + private ManageDeviceSupport manageDeviceSupport; + + @Override + public void updateDevToken(JSONObject device, String devToken) { + manageDeviceSupport.updateDeviceMessageToken(device, devToken); + } +} 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 new file mode 100644 index 000000000..bd895de5b --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/ManageAppController.java @@ -0,0 +1,26 @@ +package au.com.royalpay.payment.manage.appclient.web; + +import au.com.royalpay.payment.manage.appclient.core.ManageAppService; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.device.ManageDeviceSupport; +import com.alibaba.fastjson.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +@RestController +@RequestMapping("/api/v1.0/manage/app") +public class ManageAppController { + Logger logger = LoggerFactory.getLogger(getClass()); + + @Resource + private ManageAppService manageAppService; + + @RequestMapping(value = "/token", method = RequestMethod.PUT) + public void updateDevToken(@ModelAttribute(CommonConsts.MANAGER_DEVICE) JSONObject device, @RequestBody JSONObject token) { + manageAppService.updateDevToken(device, token.getString("devToken")); + + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java index b7bda0c8c..b4f4bf3e5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.device.DeviceSupport; +import au.com.royalpay.payment.tools.device.ManageDeviceSupport; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.locale.LocaleSupport; @@ -37,6 +38,8 @@ public class RetailValidationController { @Resource private DeviceSupport deviceSupport; @Resource + private ManageDeviceSupport manageDeviceSupport; + @Resource private RetailAppService retailAppService; @RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST) @@ -46,7 +49,7 @@ public class RetailValidationController { @RequestMapping(value = "/devices/{devType}/manage/register", method = RequestMethod.POST) public JSONObject manageRegister(@RequestBody String registeration, @PathVariable String devType) { - return deviceSupport.register(devType, registeration); + return manageDeviceSupport.register(devType, registeration); } @RequestMapping(value = "/sign_in_check", method = RequestMethod.POST)