diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java index 113072ffa..8ca50c67a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java @@ -52,8 +52,6 @@ public class ClientPreApplyBean { @NotEmpty(message = "agree can't be null") private boolean agree; - private String codeKey; - public JSONObject insertObject() { JSONObject res = (JSONObject) JSON.toJSON(this); return res; diff --git a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java index 0cd80e262..7f0a14008 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/web/SimpleClientApplyController.java @@ -9,9 +9,14 @@ import au.com.royalpay.payment.tools.http.HttpUtils; import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; import org.springframework.validation.Errors; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; @@ -59,9 +64,13 @@ public class SimpleClientApplyController { @RequestMapping(value = "/info/update/{username}/step1", method = RequestMethod.POST) @ResponseBody - public void registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) { + public JSONObject registerCompanyInfoStep1(@PathVariable String username, @RequestBody @Valid ClientPreApplyStep1Bean account) { + JSONObject result = new JSONObject(); simpleClientApplyService.verifyRegisterSMSCode(account.getPhoneCodeKey(), account.getContact_phone()); + String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, null); simpleClientApplyService.saveOrUpdateApplyInfo(account.insertObject(), username); + result.put("codeKey",codeKey); + return result; } @RequestMapping(value = "/info/phone/{phone_number}/verify", method = RequestMethod.POST) @@ -75,8 +84,7 @@ public class SimpleClientApplyController { @RequestMapping(value = "/info/update/{username}", method = RequestMethod.POST) public JSONObject registerCompanyInfo(@PathVariable String username, @RequestBody @Valid ClientPreApplyBean applyBean) { JSONObject result = new JSONObject(); - String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username, - StringUtils.isEmpty(applyBean.getCodeKey()) ? null : applyBean.getCodeKey()); + String codeKey = simpleClientApplyService.checkOrGenerateRegisterProcessKey(username,applyBean.getCodeKey()); simpleClientApplyService.saveOrUpdateApplyInfo(applyBean.insertObject(), username); result.put("codeKey", codeKey); return result;