commit 登录、设备注册

master
luoyang 6 years ago
parent 99893846b1
commit 4b2416c8ef

@ -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);
}

@ -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);
}
}

@ -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"));
}
}

@ -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.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.DeviceSupport; 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.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.locale.LocaleSupport;
@ -37,6 +38,8 @@ public class RetailValidationController {
@Resource @Resource
private DeviceSupport deviceSupport; private DeviceSupport deviceSupport;
@Resource @Resource
private ManageDeviceSupport manageDeviceSupport;
@Resource
private RetailAppService retailAppService; private RetailAppService retailAppService;
@RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST) @RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST)
@ -46,7 +49,7 @@ public class RetailValidationController {
@RequestMapping(value = "/devices/{devType}/manage/register", method = RequestMethod.POST) @RequestMapping(value = "/devices/{devType}/manage/register", method = RequestMethod.POST)
public JSONObject manageRegister(@RequestBody String registeration, @PathVariable String devType) { 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) @RequestMapping(value = "/sign_in_check", method = RequestMethod.POST)

Loading…
Cancel
Save