保誠-保戶業務員媒合平台
wayne
2021-11-18 150378e109b73451be531e2b7170d42f88bb60f0
pamapi/src/main/java/com/pollex/pam/web/rest/LoginResource.java
@@ -33,26 +33,26 @@
        this.applicationProperty = applicationProperty;
    }
    @PostMapping("/bySMS")
    public ResponseEntity<OtpResponseDTO> sendOtpBySMS(@RequestBody OtpSMSLoginVM login) throws ServiceException, RemoteException {
    @GetMapping("/bySMS")
    public ResponseEntity<OtpResponseDTO> sendOtpBySMS(@RequestParam("phone") String phone) throws ServiceException, RemoteException {
        OtpWebServiceLocator locator = new OtpWebServiceLocator();
        locator.setOtpWebServicePortEndpointAddress(applicationProperty.getOtpWebServiceUrl());
        OtpWebServicePortBindingStub otpWebServicePort = (OtpWebServicePortBindingStub) locator.getOtpWebServicePort();
        String[] result =
            otpWebServicePort.sendOtpBySMS(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), login.getPhone());
            otpWebServicePort.sendOtpBySMS(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), phone);
        return new ResponseEntity<>(new OtpResponseDTO(result), HttpStatus.OK);
    }
    @PostMapping("/byEmail")
    public ResponseEntity<OtpResponseDTO> sendOtpByEmail(@RequestBody OtpEmailLoginVM login) throws RemoteException, ServiceException {
    @GetMapping("/byEmail")
    public ResponseEntity<OtpResponseDTO> sendOtpByEmail(@RequestParam("email") String email) throws RemoteException, ServiceException {
        OtpWebServiceLocator locator = new OtpWebServiceLocator();
        locator.setOtpWebServicePortEndpointAddress(applicationProperty.getOtpWebServiceUrl());
        OtpWebServicePortBindingStub otpWebServicePort = (OtpWebServicePortBindingStub) locator.getOtpWebServicePort();
        String[] result =
            otpWebServicePort.sendOtpByEmail(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), login.getEmail());
            otpWebServicePort.sendOtpByEmail(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), email);
        return new ResponseEntity<>(new OtpResponseDTO(result), HttpStatus.OK);
    }
@@ -64,8 +64,8 @@
    }
    // todo: 這裡移動到認證授權的provider
    @PostMapping("/byEService")
    public ResponseEntity<EServiceResponse> loginByEService(@RequestBody EServiceRequestVM param) throws Exception {
        return loginService.loginByEService(param);
    @GetMapping("/byEService")
    public ResponseEntity<EServiceResponse> loginByEService(@RequestParam("account") String account, @RequestParam("password") String password) throws Exception {
        return loginService.loginByEService(account, password);
    }
}